Package de.labathome.trustconstr.matrix
Record Class SVDResult
java.lang.Object
java.lang.Record
de.labathome.trustconstr.matrix.SVDResult
Singular-value decomposition
A = U * diag(s) * V^T.
Shapes:
Uis m x mshas lengthmin(m, n); values are non-negative and monotonically non-increasing (LAPACK convention)Vtis n x n (already transposed -- i.e.V^Tfrom the textbook decomposition; rows are right-singular vectors)
-
Constructor Summary
ConstructorsConstructorDescriptionSVDResult(DenseMatrix U, double[] s, DenseMatrix Vt) Creates an instance of aSVDResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intrank(double tol) Number of singular values strictly greater thantol.double[]Element-wise reciprocal of the singular values, with values at or below the LAPACK numerical-zero thresholdmax(m,n) * ulp(sigma_max)mapped to0.double[]s()Returns the value of thesrecord component.final StringtoString()Returns a string representation of this record class.U()Returns the value of theUrecord component.Vt()Returns the value of theVtrecord component.
-
Constructor Details
-
SVDResult
Creates an instance of aSVDResultrecord class.- Parameters:
U- the value for theUrecord components- the value for thesrecord componentVt- the value for theVtrecord component
-
-
Method Details
-
rank
public int rank(double tol) Number of singular values strictly greater thantol. Use the LAPACK conventiontol = max(m,n) * ulp(sigma_max)for numerical rank if no problem-specific cutoff is known.- Parameters:
tol- singular-value cutoff- Returns:
- numerical rank
-
reciprocalSingularValues
public double[] reciprocalSingularValues()Element-wise reciprocal of the singular values, with values at or below the LAPACK numerical-zero thresholdmax(m,n) * ulp(sigma_max)mapped to0. Use this when formingA^+ = V * diag(1/s) * U^T.- Returns:
- length-
min(m, n)reciprocal singular values, with entries below the cutoff zeroed out
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
U
Returns the value of theUrecord component.- Returns:
- the value of the
Urecord component
-
s
public double[] s()Returns the value of thesrecord component.- Returns:
- the value of the
srecord component
-
Vt
Returns the value of theVtrecord component.- Returns:
- the value of the
Vtrecord component
-