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
-
Matrix(double, double, double, double, double, double, double, double, double)
- Constructs and initializes a 3x3 matrix.
-
Matrix(int, int)
- Constructs a matrix with a given number of rows and columns.
-
clone()
- Makes a deep copy of this matrix object.
-
copyInto(Matrix)
- Makes a deep copy of this matrix object and stores the
values in another given matrix.
-
equals(Object)
- Returns true if both matrices have the same number of
rows and columns and all elements have equal values.
-
get(int, int)
- Returns the specified element of the matrix.
-
getColumns()
- Returns the number of columns of the matrix.
-
getRows()
- Returns the number of rows of the matrix.
-
invert()
- Inverts the matrix.
-
multiply(Matrix, Matrix)
- Multiplies this matrix with another matrix and stores
the result in yet another matrix.
-
multiply(Point, Point)
- Multiplies this matrix with a vector and stores
the result in another vector.
-
resize(int, int)
- Resizes the matrix.
-
set(int, int, double)
- Sets the specified element of the matrix.
-
toString()
-
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
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
clone
public Object clone()
- Makes a deep copy of this matrix object.
- Overrides:
- clone in class Object
copyInto
public void copyInto(Matrix res)
- Makes a deep copy of this matrix object and stores the
values in another given matrix.
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
toString
public String toString()
- Overrides:
- toString in class Object
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
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
getRows
public int getRows()
- Returns the number of rows of the matrix.
getColumns
public int getColumns()
- Returns the number of columns of the matrix.
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
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)
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)
invert
public boolean invert()
- Inverts the matrix.
- Returns:
- success indicator.
All Packages Class Hierarchy This Package Previous Next Index