Record Class CholResult

java.lang.Object
java.lang.Record
de.labathome.trustconstr.matrix.CholResult

public record CholResult(double[] factor, int n, boolean upper) extends Record
Cholesky factorisation of a symmetric positive-definite matrix. factor holds the LAPACK dpotrf output verbatim -- the upper (if upper) or lower triangle stores the Cholesky factor; the other triangle is unspecified. Reuse the captured factor for repeated solves via solve(DenseMatrix) (one dpotrs call, no re-factoring).
  • Constructor Summary

    Constructors
    Constructor
    Description
    CholResult(double[] factor, int n, boolean upper)
    Creates an instance of a CholResult record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    double[]
    Returns the value of the factor record component.
    final int
    Returns a hash code value for this object.
    int
    n()
    Returns the value of the n record component.
    Solve A x = rhs where A is the original SPD matrix factored into factor().
    final String
    Returns a string representation of this record class.
    boolean
    Returns the value of the upper record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CholResult

      public CholResult(double[] factor, int n, boolean upper)
      Creates an instance of a CholResult record class.
      Parameters:
      factor - the value for the factor record component
      n - the value for the n record component
      upper - the value for the upper record component
  • Method Details

    • solve

      public DenseMatrix solve(DenseMatrix rhs)
      Solve A x = rhs where A is the original SPD matrix factored into factor(). Multiple right-hand sides supported via the column count of rhs. Does not modify factor().
      Parameters:
      rhs - right-hand side (n x nrhs); must have the same row count as the factored matrix
      Returns:
      the solution x (n x nrhs)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • factor

      public double[] factor()
      Returns the value of the factor record component.
      Returns:
      the value of the factor record component
    • n

      public int n()
      Returns the value of the n record component.
      Returns:
      the value of the n record component
    • upper

      public boolean upper()
      Returns the value of the upper record component.
      Returns:
      the value of the upper record component