|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.rubato.math.matrix.Matrix
org.rubato.math.matrix.RMatrix
public class RMatrix
Matrixes over real numbers.
Constructor Summary | |
---|---|
RMatrix(double[] v)
Creates a nx1 real matrix from the vector v ,
where n is the length of v . |
|
RMatrix(double[][] c)
Creates a m⨉n real matrix from the 2-dimensional array c of doubles. |
|
RMatrix(int rows,
int cols)
Creates a real rows x cols matrix
with all coefficients set to 0. |
|
RMatrix(int rows,
int cols,
double value)
Creates a real rows x cols matrix
with all coefficients set to value . |
|
RMatrix(RMatrix m)
Creates a copy of the real matrix m . |
|
RMatrix(ZMatrix m)
Creates a real matrix copy of the integer matrix m . |
|
RMatrix(ZnMatrix m)
Creates a real matrix copy of the modular integer matrix m . |
Method Summary | |
---|---|
RMatrix |
adjoint()
Returns the adjoint of this matrix. |
RMatrix |
affineDifference()
|
int |
compareTo(Matrix object)
Compares this matrix to object . |
void |
computeRREF()
Compute the reducted row echelon form of this matrix. |
double |
determinant()
Returns the determinant of this matrix. |
RMatrix |
difference(RMatrix m)
Returns the difference of this matrix and m . |
double |
dotProduct(RMatrix m)
Returns the dot product of this matrix and m . |
boolean |
equals(java.lang.Object object)
|
double |
euclidean()
Returns the Euclidean norm of this matrix. |
double |
get(int row,
int col)
Returns the value at index row ,col . |
RMatrix |
getMinorMatrix(int row,
int col)
Returns the matrix containing all rows and all columns of this matrix except row and col . |
RMatrix |
getSubMatrix(int fromRow,
int toRow,
int fromCol,
int toCol)
Returns the submatrix containing all rows from fromRow
to toRow inclusive, and from fromCol to
toCol inclusive. |
static RMatrix |
getUnitMatrix(int size)
Returns the unit real matrix of the given size . |
RMatrix |
inverse()
Returns the inverse of this matrix, if it exists. |
boolean |
isConstant()
Returns true iff the coefficients of this matrix are equal to a constant value. |
boolean |
isOne(int row,
int col)
Returns true iff the coefficient at row ,col is one. |
boolean |
isRegular()
Returns true iff this matrix is regular. |
boolean |
isUnit()
Returns true iff this is a unit matrix. |
boolean |
isZero()
Returns true iff this is a zero matrix. |
boolean |
isZero(int row,
int col)
Returns true iff the coefficient at row ,col is zero. |
double |
minor(int row,
int col)
Returns the minor at row |
RMatrix |
normalized()
Returns this matrix normalized, in case of a column matrix. |
RMatrix |
power(int exponent)
Returns this matrix raised to exponent . |
double[] |
product(double[] vector)
Returns the product of this matrix with vector . |
RMatrix |
product(RMatrix m)
Returns the product of this matrix and m . |
RMatrix |
quadraticForm()
Returns the quadratic form of this matrix. |
int |
rank()
Returns the rank of this matrix. |
RMatrix |
scaled(double scalar)
Returns this matrix scaled by scalar . |
void |
set(int row,
int col,
double value)
Sets index row ,col to value . |
void |
setColumnCount(int cols)
Resizes this matrix by changing the number of columns. |
void |
setRowCount(int rows)
Resizes this matrix by changing the number of rows. |
void |
setSubMatrix(int row,
int col,
RMatrix m)
Sets the submatrix starting at row ,col
to the matrix m . |
void |
setToElementaryMatrix(double value)
Sets all values of this matrix to value . |
void |
setToOne(int row,
int col)
Sets the coefficient at row ,col to one. |
void |
setToUnitMatrix()
Makes this matrix unit square. |
void |
setToZero(int row,
int col)
Sets the coefficient at row ,col to zero. |
void |
setToZeroMatrix()
Sets all coefficients to zero. |
double |
sum()
Returns the 1-norm of this matrix. |
RMatrix |
sum(RMatrix m)
Returns the sum of this matrix and m . |
RMatrix |
taylor(int exponent)
|
java.lang.String |
toString()
Returns a string representation of this matrix. |
RMatrix |
transposed()
Returns the transpose of this matrix. |
Methods inherited from class org.rubato.math.matrix.Matrix |
---|
getColumnCount, getRowCount, isSquare, isZeroColumn, isZeroRow, productPossible, productPossible, sameSize, sameSize |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RMatrix(int rows, int cols)
rows
x cols
matrix
with all coefficients set to 0.
public RMatrix(int rows, int cols, double value)
rows
x cols
matrix
with all coefficients set to value
.
public RMatrix(RMatrix m)
m
.
public RMatrix(ZMatrix m)
m
.
public RMatrix(ZnMatrix m)
m
.
public RMatrix(double[] v)
v
,
where n is the length of v
.
public RMatrix(double[][] c)
c
of doubles.
Method Detail |
---|
public static RMatrix getUnitMatrix(int size)
size
.
public double get(int row, int col)
row
,col
.
public void set(int row, int col, double value)
row
,col
to value
.
public void setRowCount(int rows)
Matrix
setRowCount
in class Matrix
public void setColumnCount(int cols)
Matrix
setColumnCount
in class Matrix
public void setToZeroMatrix()
Matrix
setToZeroMatrix
in class Matrix
public void setToUnitMatrix()
Matrix
setToUnitMatrix
in class Matrix
public void setToZero(int row, int col)
Matrix
row
,col
to zero.
setToZero
in class Matrix
public void setToOne(int row, int col)
Matrix
row
,col
to one.
setToOne
in class Matrix
public void setToElementaryMatrix(double value)
value
.
public RMatrix getSubMatrix(int fromRow, int toRow, int fromCol, int toCol)
fromRow
to toRow
inclusive, and from fromCol
to
toCol
inclusive.
public RMatrix getMinorMatrix(int row, int col)
row
and col
.
public RMatrix transposed()
public RMatrix inverse()
java.lang.ArithmeticException
- if inverse does not existpublic RMatrix adjoint()
public RMatrix affineDifference()
public RMatrix quadraticForm()
public RMatrix scaled(double scalar)
scalar
.
public RMatrix power(int exponent)
exponent
.
java.lang.ArithmeticException
- if the matrix is not squarepublic RMatrix taylor(int exponent)
public int rank()
Matrix
rank
in class Matrix
public boolean isConstant()
Matrix
isConstant
in class Matrix
public boolean isZero()
Matrix
isZero
in class Matrix
public boolean isUnit()
Matrix
isUnit
in class Matrix
public boolean isRegular()
Matrix
isRegular
in class Matrix
public boolean isZero(int row, int col)
Matrix
row
,col
is zero.
isZero
in class Matrix
public boolean isOne(int row, int col)
Matrix
row
,col
is one.
isOne
in class Matrix
public RMatrix normalized()
java.lang.ArithmeticException
- if this matrix is not a column matrix.public double dotProduct(RMatrix m)
m
.
Both matrixes must be column matrixes of the same size.
public boolean equals(java.lang.Object object)
equals
in class Matrix
public int compareTo(Matrix object)
Matrix
object
.
If object
is a matrix, but not of the same
type, then the strings representation are compared.
compareTo
in interface java.lang.Comparable<Matrix>
compareTo
in class Matrix
public void setSubMatrix(int row, int col, RMatrix m)
row
,col
to the matrix m
.
public void computeRREF()
public RMatrix sum(RMatrix m)
m
.
public RMatrix difference(RMatrix m)
m
.
public RMatrix product(RMatrix m)
m
.
public double[] product(double[] vector)
vector
.
public double determinant()
java.lang.ArithmeticException
- if this matrix is not squarepublic double minor(int row, int col)
row,col
.
public double euclidean()
public double sum()
public java.lang.String toString()
Matrix
toString
in class Matrix
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |