public class BidiagonalMatrix extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
BidiagonalMatrix.BidiagonalMatrixType
the available types of bi-diagonal matrices
|
| Constructor and Description |
|---|
BidiagonalMatrix(BidiagonalMatrix that)
Copy constructor.
|
BidiagonalMatrix(double[][] data)
Constructs a bi-diagonal matrix from a 2D
double[][] array. |
BidiagonalMatrix(int dim,
BidiagonalMatrix.BidiagonalMatrixType type)
Constructs a 0 bi-diagonal matrix of dimension dim * dim.
|
| Modifier and Type | Method and Description |
|---|---|
Matrix |
add(Matrix that)
this + that
|
BidiagonalMatrix |
deepCopy()
The implementation returns an instance created from
this by the copy
constructor of the class, or just this if the instance itself is
immutable. |
boolean |
equals(Object obj) |
double |
get(int i,
int j)
Get the matrix entry at [i,j].
|
Vector |
getColumn(int j)
Get the specified column in the matrix as a vector.
|
DenseVector |
getDiagonal()
Gets the main diagonal of the matrix.
|
Vector |
getRow(int i)
Get the specified row in the matrix as a vector.
|
DenseVector |
getSubDiagonal()
Gets the sub-diagonal of the matrix.
|
DenseVector |
getSuperDiagonal()
Gets the super-diagonal of the matrix.
|
BidiagonalMatrix.BidiagonalMatrixType |
getType()
Gets the bi-diagonal matrix type.
|
int |
hashCode() |
boolean |
isUnreduced(double epsilon)
A bi-diagonal matrix is unreduced if it has no 0 on both the super and main
diagonals.
|
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()
Gets the number of columns.
|
int |
nRows()
Gets the number of rows.
|
BidiagonalMatrix |
ONE()
Get an identity matrix that has the same dimension as this matrix.
|
BidiagonalMatrix |
opposite()
For each a in G, there exists an element b in G such that
a + b = b + a = 0.
|
BidiagonalMatrix |
scaled(double c)
Scale this matrix, A, by a constant.
|
void |
set(int i,
int j,
double value)
Set the matrix entry at [i,j] to a value.
|
BidiagonalMatrix |
t()
Get the transpose of this matrix.
|
DenseMatrix |
toDense()
Densify a matrix, i.e., convert a matrix implementation to the standard dense matrix,
DenseMatrix. |
String |
toString() |
BidiagonalMatrix |
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.
|
public BidiagonalMatrix(double[][] data)
double[][] array. There are always two
rows.
The longer row is the main diagonal and has one more element.
If the first row is shorter, it is an upper bi-diagonal matrix.
If the second row is shorter, it is a lower bi-diagonal matrix.
For example,
gives \[ \begin{bmatrix} 1 & 2 & 0 & 0 & 0\\ 0 & 4 & 5 & 0 & 0\\ 0 & 0 & 7 & 8 & 0\\ 0 & 0 & 0 & 10 & 11\\ 0 & 0 & 0 & 0 & 13 \end{bmatrix} \] We allownew double[][]{ {2, 5, 8, 11}, {1, 4, 7, 10, 13} }
null input when a diagonal is 0s, except for the main diagonal.
For example,
gives \[ \begin{bmatrix} 1 & 0 & 0 & 0 & 0\\ 0 & 4 & 0 & 0 & 0\\ 0 & 0 & 7 & 0 & 0\\ 0 & 0 & 0 & 10 & 0\\ 0 & 0 & 0 & 0 & 13 \end{bmatrix} \] The following is not allowed because the dimension cannot be determined.new double[][]{ {1, 4, 7, 10, 13}, null }
This implementation treats a diagonal matrix as an upper bi-diagonal matrix.new double[][]{ null, null }
data - the 2D array inputpublic BidiagonalMatrix(int dim,
BidiagonalMatrix.BidiagonalMatrixType type)
dim - the dimension of the matrixtype - the type of bi-diagonal matrix to createpublic BidiagonalMatrix(BidiagonalMatrix that)
that - a bi-diagonal matrixpublic BidiagonalMatrix deepCopy()
DeepCopyablethis by the copy
constructor of the class, or just this if the instance itself is
immutable.public BidiagonalMatrix.BidiagonalMatrixType getType()
public boolean isUnreduced(double epsilon)
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0true if this is unreducedpublic Matrix add(Matrix that)
MatrixRingadd in interface MatrixRingadd in interface AbelianGroup<Matrix>that - a matrixthis and thatpublic Matrix minus(Matrix that)
MatrixRingminus in interface MatrixRingminus in interface AbelianGroup<Matrix>that - a matrixthis and thatpublic Matrix multiply(Matrix that)
BidiagonalMatrix.BidiagonalMatrixType.UPPER
and one is BidiagonalMatrix.BidiagonalMatrixType.LOWER, the product of the two bi-diagonal matrices is
a tridiagonal matrix.multiply in interface MatrixRingmultiply in interface Monoid<Matrix>that - a matrixthis * thatpublic BidiagonalMatrix scaled(double c)
Matrixc - a doublepublic BidiagonalMatrix opposite()
AbelianGroupthis.add(this.opposite()) == this.ZEROpublic BidiagonalMatrix t()
MatrixRingpublic BidiagonalMatrix ZERO()
AbelianGrouppublic BidiagonalMatrix ONE()
MatrixRingpublic DenseMatrix toDense()
DensifiableDenseMatrix.toDense in interface DensifiableDenseMatrixpublic DenseVector getDiagonal()
public DenseVector getSuperDiagonal()
public DenseVector getSubDiagonal()
public int nRows()
Tablepublic int nCols()
Tablepublic void set(int i,
int j,
double value)
throws MatrixAccessException
MatrixAccessset in interface MatrixAccessi - the row indexj - the column indexvalue - the value to set A[i,j] toMatrixAccessException - if i or j is out of rangepublic double get(int i,
int j)
throws MatrixAccessException
MatrixAccessget in interface MatrixAccessi - the row indexj - the column indexMatrixAccessException - if i or j is out of rangepublic Vector getRow(int i)
Matrixpublic Vector getColumn(int j)
Matrixpublic Vector multiply(Vector v)
MatrixCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.