Package no.uib.cipr.matrix
Class SPDTridiagMatrix
- java.lang.Object
-
- no.uib.cipr.matrix.AbstractMatrix
-
- no.uib.cipr.matrix.SymmTridiagMatrix
-
- no.uib.cipr.matrix.SPDTridiagMatrix
-
- All Implemented Interfaces:
java.lang.Iterable<MatrixEntry>
,Matrix
public class SPDTridiagMatrix extends SymmTridiagMatrix
Symmetrical positive definite tridiagonal matrix. Same asSymmTridiagMatrix
, and is used as a marker class to allow for more efficient solvers.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface no.uib.cipr.matrix.Matrix
Matrix.Norm
-
-
Field Summary
-
Fields inherited from class no.uib.cipr.matrix.AbstractMatrix
numColumns, numRows
-
-
Constructor Summary
Constructors Constructor Description SPDTridiagMatrix(int n)
Constructor for SPDTridiagMatrixSPDTridiagMatrix(Matrix A)
Constructor for SPDTridiagMatrixSPDTridiagMatrix(Matrix A, boolean deep)
Constructor for SPDTridiagMatrix
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SPDTridiagMatrix
copy()
Creates a deep copy of the matrixMatrix
solve(Matrix B, Matrix X)
X = A\B
.-
Methods inherited from class no.uib.cipr.matrix.SymmTridiagMatrix
add, get, getDiagonal, getOffDiagonal, iterator, set, solve, transpose, transSolve, transSolve, zero
-
Methods inherited from class no.uib.cipr.matrix.AbstractMatrix
add, add, check, checkMultAdd, checkMultAdd, checkRank1, checkRank1, checkRank2, checkRank2, checkSize, checkSolve, checkSolve, checkTransABmultAdd, checkTransAmultAdd, checkTransBmultAdd, checkTransMultAdd, checkTranspose, checkTranspose, checkTransRank1, checkTransRank2, isSquare, max, max, mult, mult, mult, mult, multAdd, multAdd, multAdd, multAdd, norm, norm1, normF, normInf, numColumns, numRows, rank1, rank1, rank1, rank1, rank1, rank1, rank2, rank2, rank2, rank2, scale, set, set, toString, transABmult, transABmult, transABmultAdd, transABmultAdd, transAmult, transAmult, transAmultAdd, transAmultAdd, transBmult, transBmult, transBmultAdd, transBmultAdd, transMult, transMult, transMultAdd, transMultAdd, transpose, transRank1, transRank1, transRank2, transRank2
-
-
-
-
Constructor Detail
-
SPDTridiagMatrix
public SPDTridiagMatrix(int n)
Constructor for SPDTridiagMatrix- Parameters:
n
- Size of the matrix. Since the matrix must be square, this equals both the number of rows and columns
-
SPDTridiagMatrix
public SPDTridiagMatrix(Matrix A)
Constructor for SPDTridiagMatrix- Parameters:
A
- Matrix to copy contents from. Only main and the superdiagonal is copied over
-
SPDTridiagMatrix
public SPDTridiagMatrix(Matrix A, boolean deep)
Constructor for SPDTridiagMatrix- Parameters:
A
- Matrix to copy contents from. Only main and the superdiagonal is copied overdeep
- True for a deep copy. For shallow copiesA
must be aSymmTridiagMatrix
-
-
Method Detail
-
copy
public SPDTridiagMatrix copy()
Description copied from interface:Matrix
Creates a deep copy of the matrix- Specified by:
copy
in interfaceMatrix
- Overrides:
copy
in classSymmTridiagMatrix
- Returns:
- A
-
solve
public Matrix solve(Matrix B, Matrix X)
Description copied from interface:Matrix
X = A\B
. Not all matrices support this operation, those that do not throwUnsupportedOperationException
. Note that it is often more efficient to use a matrix decomposition and its associated solver- Specified by:
solve
in interfaceMatrix
- Overrides:
solve
in classSymmTridiagMatrix
- Parameters:
B
- Matrix with the same number of rows asA
, and the same number of columns asX
X
- Matrix with a number of rows equalA.numColumns()
, and the same number of columns asB
- Returns:
- X
-
-