Record Class Residual

java.lang.Object
java.lang.Record
de.labathome.trustconstr.records.Residual
Record Components:
sl - lower residual (f(x) - lb)
sb - upper residual (ub - f(x))

public record Residual(double[] sl, double[] sb) extends Record
Lower and upper residuals for a two-sided constraint lb ≤ f(x) ≤ ub. Returned by LinearConstraint.residual(de.labathome.trustconstr.matrix.Matrix) and Bounds.residual(de.labathome.trustconstr.matrix.Matrix).

Mirrors scipy's tuple return shape from LinearConstraint.residual(x) and Bounds.residual(x):

     sl = f(x) - lb     (non-negative iff lower bound is satisfied)
     sb = ub - f(x)     (non-negative iff upper bound is satisfied)
 

Both components are non-negative iff every row of the constraint is satisfied. A negative entry indicates the corresponding row is violated.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Residual(double[] sl, double[] sb)
    Creates an instance of a Residual record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double[]
    sb()
    Returns the value of the sb record component.
    double[]
    sl()
    Returns the value of the sl record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • Residual

      public Residual(double[] sl, double[] sb)
      Creates an instance of a Residual record class.
      Parameters:
      sl - the value for the sl record component
      sb - the value for the sb record component
  • Method Details

    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • sl

      public double[] sl()
      Returns the value of the sl record component.
      Returns:
      the value of the sl record component
    • sb

      public double[] sb()
      Returns the value of the sb record component.
      Returns:
      the value of the sb record component