|
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.operation.ElementaryOperation
public class ElementaryOperation
There are three elementary row operations which are equivalent to left multiplying an elementary matrix. They are row switching, row multiplication, and row addition.
By applying these operations to an identity matrix, I,
the resultant matrix, T, is a transformation matrix, such that
left multiplying T to a matrix A, i.e., T %*% A,
is equivalent to applying the same sequence of operations to A.
Similiarly, the three elementary column operations are: column switching, column multiplication, and column addition. Column operations correspond to right multiplying a transformation matrix.
| Constructor Summary | |
|---|---|
ElementaryOperation(int dim)
Construct an instance of ElementaryOperation of dimension dim. |
|
ElementaryOperation(int nRows,
int nCols)
Construct an instance of ElementaryOperation of dimension nRows x nCols. |
|
ElementaryOperation(Matrix T)
Get a copy of a transformation matrix. |
|
| Method Summary | |
|---|---|
void |
addColumn(int col1,
int col2,
double scale)
Column addition: A[col1, ] = A[col1, ] + scale * A[col2, ]
|
void |
addRow(int row1,
int row2,
double scale)
Row addition: A[row1, ] = A[row1, ] + scale * A[row2, ]
|
double |
get(int row,
int col)
Get the matrix element at [row, col]. |
void |
scaleColumn(int col,
double scale)
Scale a column: A[col, ] = scale * A[col, ]
|
void |
scaleRow(int row,
double scale)
Scale a row: A[row, ] = scale * A[row, ]
|
void |
swapColumn(int col1,
int col2)
Swap columns: A[col1, ] = A[col2, ]
A[col2, ] = A[col1, ]
|
void |
swapRow(int row1,
int row2)
Swap rows: A[row1, ] = A[row2, ]
A[row2, ] = A[row1, ]
|
Matrix |
T()
Get a copy of the transformation matrix T. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ElementaryOperation(int nRows,
int nCols)
nRows x nCols.
The initial transformation matrix T is an identity matrix, if it is square.
Otherwise, the rightmost columns are padded with zeros.
nRows - number of rows of TnCols - number of columns of Tpublic ElementaryOperation(int dim)
dim.
The initial transformation matrix T is an identity matrix.
dim - dimension of Tpublic ElementaryOperation(Matrix T)
T - a copy of the transformation matrix| Method Detail |
|---|
public double get(int row,
int col)
[row, col].
row - row indexcol - column index
T[row, col]public Matrix T()
T.
T
public void swapRow(int row1,
int row2)
A[row1, ] = A[row2, ]A[row2, ] = A[row1, ]
- Parameters:
row1- the row to becomerow2row2- the row to becomerow1
public void scaleRow(int row,
double scale)
A[row, ] = scale * A[row, ]
row - the row to be scaledscale - the scaling factor
public void addRow(int row1,
int row2,
double scale)
A[row1, ] = A[row1, ] + scale * A[row2, ]
row1 - addend; the row to add to; the row changes afterwardrow2 - the row to add withscale - the scaling factor for row2
public void swapColumn(int col1,
int col2)
A[col1, ] = A[col2, ]A[col2, ] = A[col1, ]
- Parameters:
col1- becomingcol2col2- becomingcol1
public void scaleColumn(int col,
double scale)
A[col, ] = scale * A[col, ]
col - the column to be scaledscale - the scaling factor
public void addColumn(int col1,
int col2,
double scale)
A[col1, ] = A[col1, ] + scale * A[col2, ]
col1 - addend; the column to add to; the column changes afterwardcol2 - the column to add withscale - the scaling factor for col2public 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 | |||||||