@Override
public void solve(BlockMatrix64F B, BlockMatrix64F X) {
if( B.blockLength != blockLength )
throw new IllegalArgumentException("Unexpected blocklength in B.");
D1Submatrix64F L = new D1Submatrix64F(chol.getT(null));
if( X != null ) {
if( X.blockLength != blockLength )
throw new IllegalArgumentException("Unexpected blocklength in X.");
if( X.numRows != L.col1 ) throw new IllegalArgumentException("Not enough rows in X");
}
if( B.numRows != L.col1 ) throw new IllegalArgumentException("Not enough rows in B");
// L * L^T*X = B
// Solve for Y: L*Y = B
BlockTriangularSolver.solve(blockLength,false,L,new D1Submatrix64F(B),false);
// L^T * X = Y
BlockTriangularSolver.solve(blockLength,false,L,new D1Submatrix64F(B),true);
if( X != null ) {
// copy the solution from B into X
BlockMatrixOps.extractAligned(B,X);
}