virtual public DMatrixRMaj getQ(DMatrixRMaj Q, bool compact)
        {
            if (compact)
            {
                Q = UtilDecompositons_DDRM.ensureIdentity(Q, numRows, minLength);
            }
            else
            {
                Q = UtilDecompositons_DDRM.ensureIdentity(Q, numRows, numRows);
            }

            for (int j = minLength - 1; j >= 0; j--)
            {
                double[] u = dataQR[j];

                QrHelperFunctions_DDRM.rank1UpdateMultR_u0(Q, u, 1.0, gammas[j], j, j, numRows, v);
            }

            return(Q);
        }
Esempio n. 2
0
        override public DMatrixRMaj getQ(DMatrixRMaj Q, bool compact)
        {
            if (compact)
            {
                Q = UtilDecompositons_DDRM.ensureIdentity(Q, numRows, minLength);
            }
            else
            {
                Q = UtilDecompositons_DDRM.ensureIdentity(Q, numRows, numRows);
            }

            for (int j = rank - 1; j >= 0; j--)
            {
                double[] u = dataQR[j];

                double vv = u[j];
                u[j] = 1;
                QrHelperFunctions_DDRM.rank1UpdateMultR(Q, u, gammas[j], j, j, numRows, v);
                u[j] = vv;
            }

            return(Q);
        }
Esempio n. 3
0
        public DMatrixRMaj getQ(DMatrixRMaj Q, bool compact)
        {
            if (compact)
            {
                Q = UtilDecompositons_DDRM.ensureIdentity(Q, numRows, minLength);
            }
            else
            {
                Q = UtilDecompositons_DDRM.ensureIdentity(Q, numRows, numRows);
            }

            // Unlike applyQ() this takes advantage of zeros in the identity matrix
            // by not multiplying across all rows.
            for (int j = minLength - 1; j >= 0; j--)
            {
                int    diagIndex = j * numRows + j;
                double before    = QR.data[diagIndex];
                QR.data[diagIndex] = 1;
                QrHelperFunctions_DDRM.rank1UpdateMultR(Q, QR.data, j * numRows, gammas[j], j, j, numRows, v);
                QR.data[diagIndex] = before;
            }

            return(Q);
        }