Class TridiagonalMatrix

java.lang.Object
net.finmath.finitedifference.solvers.TridiagonalMatrix

public class TridiagonalMatrix extends Object
Data container representing a tridiagonal matrix by its three diagonals.

A tridiagonal matrix has non-zero entries only on the main diagonal, the first lower diagonal, and the first upper diagonal. Instead of storing the full matrix, this class stores those three diagonals in separate arrays.

For a matrix of dimension n:

  • lower[i] stores the entry below the main diagonal in row i,
  • diag[i] stores the main diagonal entry in row i,
  • upper[i] stores the entry above the main diagonal in row i.

By convention, lower[0] and upper[n-1] are typically unused.

Author:
Alessandro Gnoatto
  • Constructor Details

    • TridiagonalMatrix

      public TridiagonalMatrix(int n)
      Creates a tridiagonal matrix representation of dimension n.

      All three diagonal arrays are initialized with length n and filled with zeros.

      Parameters:
      n - The dimension of the tridiagonal matrix.
  • Method Details

    • getUpperDiagonal

      public double[] getUpperDiagonal()
    • getMainDiagonal

      public double[] getMainDiagonal()
    • getLowerDiagonal

      public double[] getLowerDiagonal()