public ZMatrixRMaj getLower(ZMatrixRMaj lower) { int numRows = LU.numRows; int numCols = LU.numRows < LU.numCols ? LU.numRows : LU.numCols; lower = UtilDecompositons_ZDRM.checkZerosUT(lower, numRows, numCols); for (int i = 0; i < numCols; i++) { lower.set(i, i, 1.0, 0.0); for (int j = 0; j < i; j++) { int indexLU = LU.getIndex(i, j); int indexL = lower.getIndex(i, j); double real = LU.data[indexLU]; double imaginary = LU.data[indexLU + 1]; lower.data[indexL] = real; lower.data[indexL + 1] = imaginary; } } if (numRows > numCols) { for (int i = numCols; i < numRows; i++) { for (int j = 0; j < numCols; j++) { int indexLU = LU.getIndex(i, j); int indexL = lower.getIndex(i, j); double real = LU.data[indexLU]; double imaginary = LU.data[indexLU + 1]; lower.data[indexL] = real; lower.data[indexL + 1] = imaginary; } } } return(lower); }
ZMatrixRMaj CholeskyDecomposition <ZMatrixRMaj> .getT(ZMatrixRMaj T) { // write the values to T if (lower) { T = UtilDecompositons_ZDRM.checkZerosUT(T, n, n); for (int i = 0; i < n; i++) { int index = i * n * 2; for (int j = 0; j <= i; j++) { T.data[index] = this.T.data[index]; index++; T.data[index] = this.T.data[index]; index++; } } } else { T = UtilDecompositons_ZDRM.checkZerosLT(T, n, n); for (int i = 0; i < n; i++) { int index = (i * n + i) * 2; for (int j = i; j < n; j++) { T.data[index] = this.T.data[index]; index++; T.data[index] = this.T.data[index]; index++; } } } return(T); }