Class TridiagonalMatrix
- java.lang.Object
-
- com.opengamma.strata.math.impl.linearalgebra.TridiagonalMatrix
-
- All Implemented Interfaces:
Matrix
public class TridiagonalMatrix extends Object implements Matrix
Class representing a tridiagonal matrix. $$ \begin{align*} \begin{pmatrix} a_1 & b_1 & 0 & \cdots & 0 & 0 & 0 \\ c_1 & a_2 & b_2 & \cdots & 0 & 0 & 0 \\ 0 & & \ddots & & \vdots & \vdots & \vdots \\ 0 & 0 & 0 & & c_{n-2} & a_{n-1} & b_{n-1} \\ 0 & 0 & 0 & \cdots & 0 & c_{n-1} & a_n \end{pmatrix} \end{align*} $$
-
-
Constructor Summary
Constructors Constructor Description TridiagonalMatrix(double[] a, double[] b, double[] c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
dimensions()
Gets the number of dimensions of the matrix.boolean
equals(Object obj)
double[]
getDiagonal()
double[]
getDiagonalData()
Direct access to Diagonal Data.double
getEntry(int... index)
Gets the entry for the indices.double[]
getLowerSubDiagonal()
double[]
getLowerSubDiagonalData()
Direct access to lower sub-Diagonal Data.double[]
getUpperSubDiagonal()
double[]
getUpperSubDiagonalData()
Direct access to upper sub-Diagonal Data.int
hashCode()
int
size()
Gets the size of the matrix.DoubleMatrix
toDoubleMatrix()
-
-
-
Constructor Detail
-
TridiagonalMatrix
public TridiagonalMatrix(double[] a, double[] b, double[] c)
- Parameters:
a
- An array containing the diagonal values of the matrix, not nullb
- An array containing the upper sub-diagonal values of the matrix, not null. Its length must be one less than the length of the diagonal arrayc
- An array containing the lower sub-diagonal values of the matrix, not null. Its length must be one less than the length of the diagonal array
-
-
Method Detail
-
getDiagonalData
public double[] getDiagonalData()
Direct access to Diagonal Data.- Returns:
- An array of the values of the diagonal
-
getDiagonal
public double[] getDiagonal()
- Returns:
- An array of the values of the diagonal
-
getUpperSubDiagonalData
public double[] getUpperSubDiagonalData()
Direct access to upper sub-Diagonal Data.- Returns:
- An array of the values of the upper sub-diagonal
-
getUpperSubDiagonal
public double[] getUpperSubDiagonal()
- Returns:
- An array of the values of the upper sub-diagonal
-
getLowerSubDiagonalData
public double[] getLowerSubDiagonalData()
Direct access to lower sub-Diagonal Data.- Returns:
- An array of the values of the lower sub-diagonal
-
getLowerSubDiagonal
public double[] getLowerSubDiagonal()
- Returns:
- An array of the values of the lower sub-diagonal
-
toDoubleMatrix
public DoubleMatrix toDoubleMatrix()
- Returns:
- Returns the tridiagonal matrix as a
DoubleMatrix
-
dimensions
public int dimensions()
Description copied from interface:Matrix
Gets the number of dimensions of the matrix.Each matrix type has a fixed number of dimensions, returned by this method.
- Specified by:
dimensions
in interfaceMatrix
- Returns:
- the dimensions of the matrix
-
size
public int size()
Description copied from interface:Matrix
Gets the size of the matrix.This is the total number of elements in the matrix.
-
getEntry
public double getEntry(int... index)
Gets the entry for the indices.- Parameters:
index
- the indices- Returns:
- the entry
-
-