Ejemplo n.º 1
0
 private bool bidiagonalization(FMatrixRMaj orig)
 {
     // change the matrix to bidiagonal form
     if (transposed)
     {
         A_mod.reshape(orig.numCols, orig.numRows, false);
         CommonOps_FDRM.transpose(orig, A_mod);
     }
     else
     {
         A_mod.reshape(orig.numRows, orig.numCols, false);
         A_mod.set(orig);
     }
     return(!bidiag.decompose(A_mod));
 }
        public virtual bool decompose(FMatrixRMaj orig)
        {
            if (!decompQRP.decompose(orig))
            {
                return(false);
            }

            m   = orig.numRows;
            n   = orig.numCols;
            min = Math.Min(m, n);
            B.reshape(min, n, false);

            decompQRP.getR(B, true);

            // apply the column pivots.
            // TODO this is horribly inefficient
            FMatrixRMaj result = new FMatrixRMaj(min, n);
            FMatrixRMaj P      = decompQRP.getColPivotMatrix(null);

            CommonOps_FDRM.multTransB(B, P, result);
            B.set(result);

            return(decompBi.decompose(B));
        }