|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.matrix.doubles.matrixtype.MatrixMathImpl<T>
public abstract class MatrixMathImpl<T extends Matrix>
This is one implementation of Matrix.
It provides default implementation for common methods used in the double based Matrix.
It assumes no knowledge of how a Matrix subclass is implemented and the data structure.
Subclasses can (and should) override these methods for performance whenever possible.
| Constructor Summary | |
|---|---|
MatrixMathImpl(int nRows,
int nCols)
Construct a MatrixImpl using SimpleMatrixMathOperation. |
|
MatrixMathImpl(int nRows,
int nCols,
MatrixMathOperation math)
Construct a MatrixImpl, allowing overriding the default implementation. |
|
| Method Summary | |
|---|---|
Matrix |
add(Matrix that)
this + that |
T |
call(java.lang.String op,
Matrix that)
|
Vector |
getColumn(int col)
Get a specified column as a vector. |
Vector |
getRow(int row)
Get a specified row as a vector. |
protected T |
getSample()
|
Matrix |
minus(Matrix that)
this - that |
Matrix |
multiply(Matrix that)
this %*% that |
Vector |
multiply(Vector v)
Right multiply this matrix, A by a vector. |
int |
nCols()
Get the number of columns. |
int |
nRows()
Get the number of rows. |
Matrix |
opposite()
Get the opposite of this matrix. |
Matrix |
scaled(double scalar)
scalar * this |
void |
setColumn(int col,
double... values)
Set the column entries in the matrix, i.e., [*, column]. |
void |
setColumn(int col,
Vector v)
Set the column entries in the matrix, i.e., [*, column]. |
void |
setRow(int row,
double... values)
Set the row entries in the matrix, i.e., [row, *]. |
void |
setRow(int row,
Vector v)
Set the row entries in the matrix, i.e., [row, *]. |
Matrix |
t()
t(this)
Compute the transpose of this matrix. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.numericalmethod.suanshu.matrix.doubles.Matrix |
|---|
deepCopy |
| Methods inherited from interface com.numericalmethod.suanshu.matrix.doubles.MatrixAccessor |
|---|
get, set |
| Methods inherited from interface com.numericalmethod.suanshu.matrix.doubles.MatrixRing |
|---|
ONE, ZERO |
| Constructor Detail |
|---|
public MatrixMathImpl(int nRows,
int nCols,
MatrixMathOperation math)
nRows - number of rowsnCols - number of columnsmath - an implementation of matrix math operations
public MatrixMathImpl(int nRows,
int nCols)
SimpleMatrixMathOperation.
nRows - number of rowsnCols - number of columns| Method Detail |
|---|
public int nRows()
MatrixDimension
nRows in interface MatrixDimensionpublic int nCols()
MatrixDimension
nCols in interface MatrixDimensionprotected T getSample()
public void setRow(int row,
double... values)
[row, *].
row - the row index, counting from 1values - the values to change the row entries to
MatrixAccessException - if the number of values does not match the column size
public void setRow(int row,
Vector v)
[row, *].
row - the row index, counting from 1v - the vector to change the row entries to
MatrixAccessException - if the number of values does not match the column size
public Vector getRow(int row)
throws MatrixAccessException
MatrixAccessor
getRow in interface MatrixAccessorrow - the row index
A[row, ]
MatrixAccessException - when row < 1, or when row > number of rows
public void setColumn(int col,
double... values)
[*, column].
col - the column index, counting from 1values - the values to change the column entries to
MatrixAccessException - if the number of values does not match the row size
public void setColumn(int col,
Vector v)
[*, column].
col - the column index, counting from 1v - the vector to change the column entries to
MatrixAccessException - if the number of values does not match the row size
public Vector getColumn(int col)
throws MatrixAccessException
MatrixAccessor
getColumn in interface MatrixAccessorcol - the column index
A[, col]
MatrixAccessException - when col < 1, or when col > number of columns
public T call(java.lang.String op,
Matrix that)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException
java.lang.NoSuchMethodException
java.lang.IllegalAccessExceptionpublic Matrix add(Matrix that)
MatrixRingthis + that
add in interface AbelianGroup<Matrix>add in interface MatrixRingthat - another matrix
this and thatpublic Matrix minus(Matrix that)
MatrixRingthis - that
minus in interface AbelianGroup<Matrix>minus in interface MatrixRingthat - another matrix
this and thatpublic Matrix multiply(Matrix that)
MatrixRingthis %*% that
multiply in interface Monoid<Matrix>multiply in interface MatrixRingthat - another matrix
this and thatpublic Vector multiply(Vector v)
MatrixA by a vector.
multiply in interface Matrixv - a vector
A %*% vpublic Matrix scaled(double scalar)
Matrixscalar * this
scaled in interface Matrixscalar - a double
scalar * thispublic Matrix t()
MatrixRingt(this)
Compute the transpose of this matrix. The original matrix does not change. The returned value is independent and can be modified anyhow.
This is the involution on the matrix ring.
t in interface MatrixRingpublic Matrix opposite()
MatrixRing
opposite in interface AbelianGroup<Matrix>opposite in interface MatrixRing-thispublic java.lang.String toString()
toString in class java.lang.Object
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||