All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class openstar.util.Matrix

java.lang.Object
   |
   +----openstar.util.Matrix

public class Matrix
extends Object
implements Cloneable
A simple general purpose matrix class operating on double values.

Version:
09 Apr 1997
Author:
Nils Schwabe

Constructor Index

 o Matrix(double, double, double, double, double, double, double, double, double)
Constructs and initializes a 3x3 matrix.
 o Matrix(int, int)
Constructs a matrix with a given number of rows and columns.

Method Index

 o clone()
Makes a deep copy of this matrix object.
 o copyInto(Matrix)
Makes a deep copy of this matrix object and stores the values in another given matrix.
 o equals(Object)
Returns true if both matrices have the same number of rows and columns and all elements have equal values.
 o get(int, int)
Returns the specified element of the matrix.
 o getColumns()
Returns the number of columns of the matrix.
 o getRows()
Returns the number of rows of the matrix.
 o invert()
Inverts the matrix.
 o multiply(Matrix, Matrix)
Multiplies this matrix with another matrix and stores the result in yet another matrix.
 o multiply(Point, Point)
Multiplies this matrix with a vector and stores the result in another vector.
 o resize(int, int)
Resizes the matrix.
 o set(int, int, double)
Sets the specified element of the matrix.
 o toString()

Constructors

 o Matrix
  public Matrix(int cntRows,
                int cntColumns)
Constructs a matrix with a given number of rows and columns. All elements are initialized with zero.

Parameters:
cntRows - the number of rows
cntColumns - number of columns
 o Matrix
  public Matrix(double a1,
                double a2,
                double a3,
                double b1,
                double b2,
                double b3,
                double c1,
                double c2,
                double c3)
Constructs and initializes a 3x3 matrix.

Parameters:
a - first row
b - second row
c - third row

Methods

 o clone
  public Object clone()
Makes a deep copy of this matrix object.

Overrides:
clone in class Object
 o copyInto
  public void copyInto(Matrix res)
Makes a deep copy of this matrix object and stores the values in another given matrix.

 o equals
  public boolean equals(Object obj)
Returns true if both matrices have the same number of rows and columns and all elements have equal values.

Overrides:
equals in class Object
 o toString
  public String toString()
Overrides:
toString in class Object
 o get
  public double get(int row,
                    int column)
Returns the specified element of the matrix.

Parameters:
row - zero-based row index
column - zero-based column index
 o set
  public void set(int row,
                  int column,
                  double value)
Sets the specified element of the matrix.

Parameters:
row - zero-based row index
column - zero-based column index
value - new value of the matrix element
 o getRows
  public int getRows()
Returns the number of rows of the matrix.

 o getColumns
  public int getColumns()
Returns the number of columns of the matrix.

 o resize
  public boolean resize(int cntRows,
                        int cntColumns)
Resizes the matrix.
Resizing is only possible if the matrix has been created with a sufficient size.

Parameters:
cntRows - new number of rows
cntColumns - new number of colums
Returns:
true - successful operation
false - initial size of matrix not sufficient
 o multiply
  public void multiply(Matrix v,
                       Matrix result)
Multiplies this matrix with another matrix and stores the result in yet another matrix.

Parameters:
v - matrix with which this matrix should be multiplied
result - resulting matrix (must have correct size)
 o multiply
  public void multiply(Point p,
                       Point result)
Multiplies this matrix with a vector and stores the result in another vector.

Parameters:
p - vector with which this matrix should be multiplied
result - resulting vector (must have correct size)
 o invert
  public boolean invert()
Inverts the matrix.

Returns:
success indicator.

All Packages  Class Hierarchy  This Package  Previous  Next  Index