Tridiagonal
edu.rit.numeric

Class Tridiagonal



  • public class Tridiagonalextends Object
    Class Tridiagonal provides static methods for solving tridiagonal systems of linear equations.

    The Java code was translated from routines gsl_linalg_solve_tridiag(), gsl_linalg_solve_symm_tridiag(), gsl_linalg_solve_cyc_tridiag(), and gsl_linalg_solve_symm_cyc_tridiag() in the GNU Scientific Library Version 1.9.

    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      static voidsolve(double[] d, double[] e, double[] f, double[] b, double[] x)
      Solve the given tridiagonal system of linear equations.
      static voidsolveCyclic(double[] d, double[] e, double[] f, double[] b, double[] x)
      Solve the given cyclic tridiagonal system of linear equations.
      static voidsolveSymmetric(double[] d, double[] e, double[] b, double[] x)
      Solve the given symmetric tridiagonal system of linear equations.
      static voidsolveSymmetricCyclic(double[] d, double[] e, double[] b, double[] x)
      Solve the given symmetric cyclic tridiagonal system of linear equations.
    • Method Detail

      • solve

        public static void solve(double[] d,         double[] e,         double[] f,         double[] b,         double[] x)
        Solve the given tridiagonal system of linear equations. This method solves the general N-by-N system Ax = b where A is tridiagonal (N >= 2). The form of A for the 4-by-4 case is:
             [ d0  e0  0   0  ] A = [ f0  d1  e1  0  ]     [ 0   f1  d2  e2 ]     [ 0   0   f2  d3 ] 
        Parameters:
        d - (input) Vector of diagonal elements. Length N must be >= 2.
        e - (input) Vector of super-diagonal elements. Length must be N-1.
        f - (input) Vector of sub-diagonal elements. Length must be N-1.
        b - (input) Vector of right hand side elements. Length must be N.
        x - (output) Solution vector. Length must be N.
        Throws:
        NullPointerException - (unchecked exception) Thrown if any argument is null.
        IllegalArgumentException - (unchecked exception) Thrown if any argument is the wrong length.
        DomainException - (unchecked exception) Thrown if the linear system cannot be solved.
      • solveSymmetric

        public static void solveSymmetric(double[] d,                  double[] e,                  double[] b,                  double[] x)
        Solve the given symmetric tridiagonal system of linear equations. This method solves the general N-by-N system Ax = b where A is symmetric tridiagonal (N >= 2). The form of A for the 4-by-4 case is:
             [ d0  e0  0   0  ] A = [ e0  d1  e1  0  ]     [ 0   e1  d2  e2 ]     [ 0   0   e2  d3 ] 
        Parameters:
        d - (input) Vector of diagonal elements. Length N must be >= 2.
        e - (input) Vector of off-diagonal elements. Length must be N-1.
        b - (input) Vector of right hand side elements. Length must be N.
        x - (output) Solution vector. Length must be N.
        Throws:
        NullPointerException - (unchecked exception) Thrown if any argument is null.
        IllegalArgumentException - (unchecked exception) Thrown if any argument is the wrong length.
        DomainException - (unchecked exception) Thrown if the linear system cannot be solved.
      • solveCyclic

        public static void solveCyclic(double[] d,               double[] e,               double[] f,               double[] b,               double[] x)
        Solve the given cyclic tridiagonal system of linear equations. This method solves the general N-by-N system Ax = b where A is cyclic tridiagonal (N >= 3). The form of A for the 4-by-4 case is:
             [ d0  e0  0   f3 ] A = [ f0  d1  e1  0  ]     [ 0   f1  d2  e2 ]     [ e3  0   f2  d3 ] 
        Parameters:
        d - (input) Vector of diagonal elements. Length N must be >= 3.
        e - (input) Vector of super-diagonal elements. Length must be N.
        f - (input) Vector of sub-diagonal elements. Length must be N.
        b - (input) Vector of right hand side elements. Length must be N.
        x - (output) Solution vector. Length must be N.
        Throws:
        NullPointerException - (unchecked exception) Thrown if any argument is null.
        IllegalArgumentException - (unchecked exception) Thrown if any argument is the wrong length.
        DomainException - (unchecked exception) Thrown if the linear system cannot be solved.
      • solveSymmetricCyclic

        public static void solveSymmetricCyclic(double[] d,                        double[] e,                        double[] b,                        double[] x)
        Solve the given symmetric cyclic tridiagonal system of linear equations. This method solves the general N-by-N system Ax = b where A is symmetric cyclic tridiagonal (N >= 3). The form of A for the 4-by-4 case is:
             [ d0  e0  0   e3 ] A = [ e0  d1  e1  0  ]     [ 0   e1  d2  e2 ]     [ e3  0   e2  d3 ] 
        Parameters:
        d - (input) Vector of diagonal elements. Length N must be >= 3.
        e - (input) Vector of off-diagonal elements. Length must be N.
        b - (input) Vector of right hand side elements. Length must be N.
        x - (output) Solution vector. Length must be N.
        Throws:
        NullPointerException - (unchecked exception) Thrown if any argument is null.
        IllegalArgumentException - (unchecked exception) Thrown if any argument is the wrong length.
        DomainException - (unchecked exception) Thrown if the linear system cannot be solved.

SCaVis 2.2 © jWork.ORG