public class UpperTriangularMatrix extends Object implements Matrix, Densifiable
Constructor and Description |
---|
UpperTriangularMatrix(double[][] data)
Constructs an upper triangular matrix from a 2D
double[][] array. |
UpperTriangularMatrix(int dim)
Constructs an upper triangular matrix of dimension dim * dim.
|
UpperTriangularMatrix(Matrix A)
Constructs an upper triangular matrix from a matrix.
|
UpperTriangularMatrix(UpperTriangularMatrix U)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
Matrix |
add(Matrix that)
this + that
|
UpperTriangularMatrix |
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.
|
Vector |
getRow(int i)
Get the specified row in the matrix as a vector.
|
int |
hashCode() |
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.
|
UpperTriangularMatrix |
ONE()
Get an identity matrix that has the same dimension as this matrix.
|
UpperTriangularMatrix |
opposite()
Get the opposite of this matrix.
|
UpperTriangularMatrix |
scaled(double scalar)
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.
|
LowerTriangularMatrix |
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() |
UpperTriangularMatrix |
ZERO()
Get a zero matrix that has the same dimension as this matrix.
|
public UpperTriangularMatrix(int dim)
dim
- the matrix dimensionpublic UpperTriangularMatrix(double[][] data)
double[][]
array.data
- the 2D array inputIllegalArgumentException
- when the input data
is not a upper triangularpublic UpperTriangularMatrix(Matrix A)
A
- a matrixIllegalArgumentException
- when A
is not squarepublic UpperTriangularMatrix(UpperTriangularMatrix U)
U
- an upper triangular matrixpublic UpperTriangularMatrix deepCopy()
DeepCopyable
this
by the copy
constructor of the class, or just this
if the instance itself is
immutable.deepCopy
in interface Matrix
deepCopy
in interface DeepCopyable
public DenseMatrix toDense()
Densifiable
DenseMatrix
.toDense
in interface Densifiable
DenseMatrix
public int nRows()
Table
public int nCols()
Table
public void set(int i, int j, double value) throws MatrixAccessException
MatrixAccess
set
in interface MatrixAccess
i
- 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
MatrixAccess
get
in interface MatrixAccess
i
- the row indexj
- the column indexMatrixAccessException
- if i or j is out of rangepublic Vector getRow(int i)
Matrix
public Vector getColumn(int j)
Matrix
public Matrix add(Matrix that)
MatrixRing
add
in interface MatrixRing
add
in interface AbelianGroup<Matrix>
that
- a matrixthis
and that
public Matrix minus(Matrix that)
MatrixRing
minus
in interface MatrixRing
minus
in interface AbelianGroup<Matrix>
that
- a matrixthis
and that
public Matrix multiply(Matrix that)
MatrixRing
multiply
in interface MatrixRing
multiply
in interface Monoid<Matrix>
that
- a matrixthis
and that
public LowerTriangularMatrix t()
MatrixRing
t
in interface MatrixRing
public UpperTriangularMatrix scaled(double scalar)
Matrix
public UpperTriangularMatrix opposite()
MatrixRing
opposite
in interface MatrixRing
opposite
in interface AbelianGroup<Matrix>
public Vector multiply(Vector v)
Matrix
public UpperTriangularMatrix ZERO()
MatrixRing
ZERO
in interface MatrixRing
ZERO
in interface AbelianGroup<Matrix>
public UpperTriangularMatrix ONE()
MatrixRing
ONE
in interface MatrixRing
ONE
in interface Monoid<Matrix>
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.