/** * Writes the lower triangular matrix into the specified matrix. * * @param lower Where the lower triangular matrix is written to. */ public virtual FMatrixRMaj getLower(FMatrixRMaj lower) { int numRows = LU.numRows; int numCols = LU.numRows < LU.numCols ? LU.numRows : LU.numCols; lower = UtilDecompositons_FDRM.checkZerosUT(lower, numRows, numCols); for (int i = 0; i < numCols; i++) { lower.unsafe_set(i, i, 1.0f); for (int j = 0; j < i; j++) { lower.unsafe_set(i, j, LU.unsafe_get(i, j)); } } if (numRows > numCols) { for (int i = numCols; i < numRows; i++) { for (int j = 0; j < numCols; j++) { lower.unsafe_set(i, j, LU.unsafe_get(i, j)); } } } return(lower); }
public virtual FMatrixRMaj getT(FMatrixRMaj T) { // write the values to T if (lower) { T = UtilDecompositons_FDRM.checkZerosUT(T, n, n); for (int i = 0; i < n; i++) { for (int j = 0; j <= i; j++) { T.unsafe_set(i, j, this.T.unsafe_get(i, j)); } } } else { T = UtilDecompositons_FDRM.checkZerosLT(T, n, n); for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { T.unsafe_set(i, j, this.T.unsafe_get(i, j)); } } } return(T); }