|
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.generic.matrixtype.RealMatrix
public class RealMatrix
This class represents a matrix of Real numbers.
Comparing to the double-based DenseMatrix,
this class allows arbitrary precision arithmetic at the cost of (much) slower performance.
For some high precision mathematics, we often do the calculation using more number of decimal points. We then cast back the results to double for higher accuracy.
| Constructor Summary | |
|---|---|
RealMatrix(double[][] data)
Construct a RealMatrix from a 2D array of doubles. |
|
RealMatrix(int nRows,
int nCols)
Construct a nRows x nCols matrix of Real numbers. |
|
RealMatrix(Real[][] data)
Construct a matrix from a 2D array of Real numbers. |
|
| Method Summary | |
|---|---|
RealMatrix |
add(RealMatrix that)
+ : G × G → G |
DenseMatrix |
doubleValue()
Create a DenseMatrix of double values from this real matrix. |
boolean |
equals(java.lang.Object obj)
|
Real |
get(int row,
int col)
Get the matrix element at [row, col]. |
int |
hashCode()
|
RealMatrix |
minus(RealMatrix that)
- : G × G → G
- is not in the definition of of an additive group but can be deduced. |
RealMatrix |
multiply(RealMatrix that)
· : G × G → G |
int |
nCols()
Get the number of columns. |
int |
nRows()
Get the number of rows. |
RealMatrix |
ONE()
The multiplicative element 1 in the group such that for any elements a in the group,
the equation
1 × a = a × 1 = a
holds. |
RealMatrix |
opposite()
For each a in G, there exists an element b in G such that a + b = b + a = 0
That is, it is the object such as
this.add(this.opposite()) == this.ZERO |
RealMatrix |
scaled(Real scalar)
* : F × V → V
The result of applying this function to scalar, c, in F and v in V is denoted cv. |
void |
set(int row,
int col,
Real value)
Set the matrix element at [row, col] to value. |
java.lang.String |
toString()
|
RealMatrix |
ZERO()
The additive element 0 in the group, such that for all elements a in the group,
the equation 0 + a = a + 0 = a holds. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RealMatrix(int nRows,
int nCols)
nRows x nCols matrix of Real numbers.
nRows - number of rowsnCols - number of columnspublic RealMatrix(Real[][] data)
Real numbers.
data - a matrix arrangement of Real numbers in a 2D arraypublic RealMatrix(double[][] data)
data - a matrix arrangement of doubles in a 2D array| Method Detail |
|---|
public int nRows()
MatrixDimension
nRows in interface MatrixDimensionpublic int nCols()
MatrixDimension
nCols in interface MatrixDimension
public void set(int row,
int col,
Real value)
MatrixAccessor[row, col] to value.
This is the only function that may change the entries of a matrix.
set in interface MatrixAccessor<Real>row - the row indexcol - the column indexvalue - the value to set A[row, col] to
public Real get(int row,
int col)
MatrixAccessor[row, col].
get in interface MatrixAccessor<Real>row - the row indexcol - the column index
A[row, col]public RealMatrix add(RealMatrix that)
AbelianGroup+ : G × G → G
add in interface AbelianGroup<RealMatrix>that - the object to be added
this + thatpublic RealMatrix minus(RealMatrix that)
AbelianGroup- : G × G → G
- is not in the definition of of an additive group but can be deduced.
This function is provided for convenience purpose.
It is equivalent to
this.add(that.opposite())
minus in interface AbelianGroup<RealMatrix>that - the object to be subtracted (subtrahend)
this - thatpublic RealMatrix multiply(RealMatrix that)
Monoid· : G × G → G
multiply in interface Monoid<RealMatrix>that - the multiplicand
this × thatpublic RealMatrix scaled(Real scalar)
VectorSpace* : F × V → V
The result of applying this function to scalar, c, in F and v in V is denoted cv.
scaled in interface VectorSpace<RealMatrix,Real>scalar - a multiplier
scalar * thispublic RealMatrix opposite()
AbelianGroupa + b = b + a = 0
That is, it is the object such as
this.add(this.opposite()) == this.ZERO
opposite in interface AbelianGroup<RealMatrix>-thispublic RealMatrix ZERO()
AbelianGroupa in the group,
the equation 0 + a = a + 0 = a holds.
ZERO in interface AbelianGroup<RealMatrix>0public RealMatrix ONE()
Monoida in the group,
the equation
1 × a = a × 1 = a
holds.
ONE in interface Monoid<RealMatrix>1public DenseMatrix doubleValue()
DenseMatrixpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic 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 | |||||||