SuanShu, a Java numerical and statistical library

## com.numericalmethod.suanshu.matrix.doubles.matrixtype.dense.triangle Class LowerTriangularMatrix

java.lang.Object
com.numericalmethod.suanshu.matrix.doubles.matrixtype.dense.triangle.LowerTriangularMatrix

All Implemented Interfaces:
Table, DeepCopyable, AbelianGroup<Matrix>, Monoid<Matrix>, Ring<Matrix>, Matrix, MatrixAccess, MatrixRing, MatrixTable, Densifiable
Direct Known Subclasses:
CholeskyWang2006

public class LowerTriangularMatrixextends java.lang.Objectimplements Matrix, Densifiable

A lower triangular matrix has 0 entries where column index > row index. A lower triangular matrix is always square.

Constructor Summary
LowerTriangularMatrix(double[][] data)
Construct a lower triangular matrix from a 2D double[][] array.
LowerTriangularMatrix(int dim)
Construct a lower triangular matrix of dimension dim * dim.
LowerTriangularMatrix(LowerTriangularMatrix L)
Copy constructor.
LowerTriangularMatrix(Matrix A)
Construct a lower triangular matrix from a matrix.

Method Summary
 Matrix add(Matrix that)
this + that
 LowerTriangularMatrix 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(java.lang.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()
Get the number of columns.
 int nRows()
Get the number of rows.
 LowerTriangularMatrix ONE()
Get an identity matrix that has the same dimension as this matrix.
 LowerTriangularMatrix opposite()
Get the opposite of this matrix.
 LowerTriangularMatrix 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.
 UpperTriangularMatrix t()
t(A)
 DenseMatrix toDense()
Densify a matrix, i.e., convert a matrix implementation to the standard dense matrix, DenseMatrix.
 java.lang.String toString()

 LowerTriangularMatrix ZERO()
Get a zero matrix that has the same dimension as this matrix.

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

### LowerTriangularMatrix

public LowerTriangularMatrix(int dim)
Construct a lower triangular matrix of dimension dim * dim.

Parameters:
dim - the matrix dimension

### LowerTriangularMatrix

public LowerTriangularMatrix(double[][] data)
Construct a lower triangular matrix from a 2D double[][] array.

Parameters:
data - the 2D array input
Throws:
java.lang.IllegalArgumentException - when the input data is not a lower triangular

### LowerTriangularMatrix

public LowerTriangularMatrix(Matrix A)
Construct a lower triangular matrix from a matrix.

Parameters:
A - a matrix
Throws:
java.lang.IllegalArgumentException - when A is not square

### LowerTriangularMatrix

public LowerTriangularMatrix(LowerTriangularMatrix L)
Copy constructor.

Parameters:
L - a lower triangular matrix
Method Detail

### deepCopy

public LowerTriangularMatrix deepCopy()
Description copied from interface: DeepCopyable
The implementation returns an instance created from this by the copy constructor of the class, or just this if the instance itself is immutable.

Specified by:
deepCopy in interface DeepCopyable
Specified by:
deepCopy in interface Matrix
Returns:
an independent (deep) copy of the instance

### toDense

public DenseMatrix toDense()
Description copied from interface: Densifiable
Densify a matrix, i.e., convert a matrix implementation to the standard dense matrix, DenseMatrix.

Specified by:
toDense in interface Densifiable
Returns:
a matrix representation in DenseMatrix

### nRows

public int nRows()
Description copied from interface: Table
Get the number of rows. Rows count from 1.

Specified by:
nRows in interface Table
Returns:
the number of rows

### nCols

public int nCols()
Description copied from interface: Table
Get the number of columns. Columns count from 1.

Specified by:
nCols in interface Table
Returns:
the number of columns

### set

public void set(int i,
int j,
double value)
throws MatrixAccessException
Description copied from interface: MatrixAccess
Set the matrix entry at [i,j] to a value. This is the only method that may change a matrix.

Specified by:
set in interface MatrixAccess
Parameters:
i - the row index
j - the column index
value - the value to set A[i,j] to
Throws:
MatrixAccessException - if i or j is out of range

### get

public double get(int i,
int j)
throws MatrixAccessException
Description copied from interface: MatrixAccess
Get the matrix entry at [i,j].

Specified by:
get in interface MatrixAccess
Parameters:
i - the row index
j - the column index
Returns:
A[i,j]
Throws:
MatrixAccessException - if i or j is out of range

### getRow

public Vector getRow(int i)
Description copied from interface: Matrix
Get the specified row in the matrix as a vector.

Specified by:
getRow in interface Matrix
Parameters:
i - the row index
Returns:
the vector A[i, ]

### getColumn

public Vector getColumn(int j)
Description copied from interface: Matrix
Get the specified column in the matrix as a vector.

Specified by:
getColumn in interface Matrix
Parameters:
j - the column index
Returns:
a vector A[, j]

public Matrix add(Matrix that)
Description copied from interface: MatrixRing
this + that

Specified by:
add in interface AbelianGroup<Matrix>
Specified by:
add in interface MatrixRing
Parameters:
that - a matrix
Returns:
the sum of this and that

### minus

public Matrix minus(Matrix that)
Description copied from interface: MatrixRing
this - that

Specified by:
minus in interface AbelianGroup<Matrix>
Specified by:
minus in interface MatrixRing
Parameters:
that - a matrix
Returns:
the difference between this and that

### multiply

public Matrix multiply(Matrix that)
Description copied from interface: MatrixRing
this * that

Specified by:
multiply in interface Monoid<Matrix>
Specified by:
multiply in interface MatrixRing
Parameters:
that - a matrix
Returns:
the product ofthis and that

### t

public UpperTriangularMatrix t()
t(A)

Specified by:
t in interface MatrixRing
Returns:
an upper triangular matrix which is the transpose of this

### scaled

public LowerTriangularMatrix scaled(double scalar)
Description copied from interface: Matrix
Scale this matrix, A, by a constant.

Specified by:
scaled in interface Matrix
Parameters:
scalar - a double
Returns:
cA

### opposite

public LowerTriangularMatrix opposite()
Description copied from interface: MatrixRing
Get the opposite of this matrix.

Specified by:
opposite in interface AbelianGroup<Matrix>
Specified by:
opposite in interface MatrixRing
Returns:
-this

### multiply

public Vector multiply(Vector v)
Description copied from interface: Matrix
Right multiply this matrix, A, by a vector.

Specified by:
multiply in interface Matrix
Parameters:
v - a vector
Returns:
Av, a vector

### ZERO

public LowerTriangularMatrix ZERO()
Description copied from interface: MatrixRing
Get a zero matrix that has the same dimension as this matrix.

Specified by:
ZERO in interface AbelianGroup<Matrix>
Specified by:
ZERO in interface MatrixRing
Returns:
the 0 matrix

### ONE

public LowerTriangularMatrix ONE()
Description copied from interface: MatrixRing
Get an identity matrix that has the same dimension as this matrix. For a non-square matrix, it zeros out the rows (columns) with index > nCols (nRows).

Specified by:
ONE in interface Monoid<Matrix>
Specified by:
ONE in interface MatrixRing
Returns:
an identity matrix

### toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

### equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

### hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

SuanShu, a Java numerical and statistical library