Class SORDecomposition

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

public class SORDecomposition extends Object
Performs a Successive Over-Relaxation (SOR) decomposition for solving linear systems of the form A x = b.

The input matrix A is decomposed into its diagonal part D, strictly lower triangular part L, and strictly upper triangular part U. The solver then applies an iterative SOR (Gauss-Seidel with relaxation) sweep to approximate the solution.

Author:
Enrico De Vecchi, Alessandro Gnoatto
  • Constructor Summary

    Constructors
    Constructor
    Description
    SORDecomposition(org.apache.commons.math3.linear.RealMatrix matrixA)
    Constructs the decomposition of the given matrix A into D, L, and U.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.commons.math3.linear.RealMatrix
    Returns the diagonal matrix D of the decomposition.
    org.apache.commons.math3.linear.RealMatrix
    Returns the strictly lower triangular matrix L of the decomposition.
    org.apache.commons.math3.linear.RealMatrix
    getSol(org.apache.commons.math3.linear.RealMatrix x0, org.apache.commons.math3.linear.RealMatrix b, double w, int steps)
    Performs a fixed number of SOR iterations to approximate the solution of A x = b.
    org.apache.commons.math3.linear.RealMatrix
    getSol(org.apache.commons.math3.linear.RealMatrix x0, org.apache.commons.math3.linear.RealMatrix b, double w, int maxIters, double tol)
    Performs SOR (Gauss-Seidel with relaxation) to solve A x = b.
    org.apache.commons.math3.linear.RealMatrix
    Returns the strictly upper triangular matrix U of the decomposition.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SORDecomposition

      public SORDecomposition(org.apache.commons.math3.linear.RealMatrix matrixA)
      Constructs the decomposition of the given matrix A into D, L, and U.
      Parameters:
      matrixA - The input square matrix to decompose.
  • Method Details

    • getD

      public org.apache.commons.math3.linear.RealMatrix getD()
      Returns the diagonal matrix D of the decomposition.
      Returns:
      The diagonal part of A.
    • getL

      public org.apache.commons.math3.linear.RealMatrix getL()
      Returns the strictly lower triangular matrix L of the decomposition.
      Returns:
      The strictly lower triangular part of A.
    • getU

      public org.apache.commons.math3.linear.RealMatrix getU()
      Returns the strictly upper triangular matrix U of the decomposition.
      Returns:
      The strictly upper triangular part of A.
    • getSol

      public org.apache.commons.math3.linear.RealMatrix getSol(org.apache.commons.math3.linear.RealMatrix x0, org.apache.commons.math3.linear.RealMatrix b, double w, int steps)
      Performs a fixed number of SOR iterations to approximate the solution of A x = b.

      This method is a backwards-compatible entry point which delegates to getSol(RealMatrix, RealMatrix, double, int, double) with tol = 0.0.

      Parameters:
      x0 - The initial guess for x (n x 1).
      b - The right-hand side vector b (n x 1).
      w - The relaxation factor omega (typically 0 < w < 2).
      steps - The number of iterations to perform.
      Returns:
      The approximate solution after the specified number of iterations.
    • getSol

      public org.apache.commons.math3.linear.RealMatrix getSol(org.apache.commons.math3.linear.RealMatrix x0, org.apache.commons.math3.linear.RealMatrix b, double w, int maxIters, double tol)
      Performs SOR (Gauss-Seidel with relaxation) to solve A x = b.

      If tol > 0.0, the iteration stops early when the infinity norm of the residual satisfies ||A x - b||_inf <= tol. If tol == 0.0, the solver always runs maxIters iterations.

      Parameters:
      x0 - Initial guess (n x 1).
      b - Right-hand side (n x 1).
      w - Relaxation factor omega (typically 0 < w < 2).
      maxIters - Maximum number of sweeps.
      tol - Residual tolerance in infinity norm (set to 0 to disable early stopping).
      Returns:
      Approximate solution.