mikera.matrixx.decompose.impl.lu.LUPResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vectorz Show documentation
Show all versions of vectorz Show documentation
Fast double-precision vector and matrix maths library for Java, supporting N-dimensional numeric arrays.
package mikera.matrixx.decompose.impl.lu;
import mikera.matrixx.AMatrix;
import mikera.matrixx.decompose.ILUPResult;
import mikera.matrixx.impl.PermutationMatrix;
public class LUPResult implements ILUPResult {
final AMatrix l;
final AMatrix u;
final PermutationMatrix p;
public LUPResult(AMatrix l, AMatrix u, PermutationMatrix p) {
this.l=l;
this.u=u;
this.p=p;
}
public LUPResult(AMatrix l, AMatrix u) {
this (l,u,PermutationMatrix.createIdentity(l.rowCount()));
}
@Override
public AMatrix getL() {
return l;
}
@Override
public AMatrix getU() {
return u;
}
@Override
public PermutationMatrix getP() {
return p;
}
@Override
public double computeDeterminant() {
if (l.rowCount()!= u.columnCount()) {
throw new IllegalArgumentException("Input must be a square matrix");
}
return u.diagonalProduct()*p.determinant();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy