I am new to using Jama for matrices. My problem is while I’m using det() method (which is related with LUDecomposition class) it gives "Matrix must be square". Ok my matrix is triangle but with LUDecomposition it should give me square matrix. My code like this
public double findDeterminant(Matrix mtrx) {
LUDecomposition dec = new LUDecomposition(mtrx);
det = dec.det();
return det;
}
From the documentation of
LUDecomposition:Did you perhaps mean to find the determinant of
getU()orgetL()(one of which will be square, based on the description above)?The
detmethod ofLUDecompositionreturns the determinant of the matrix that was used to construct the object (in your casemtrx, which I’m assuming isn’t square).