Exemplo n.º 1
0
        public virtual bool decompose(DMatrixRMaj A)
        {
            Ablock.numRows     = A.numRows;
            Ablock.numCols     = A.numCols;
            Ablock.blockLength = blockLength;
            Ablock.data        = A.data;

            int tmpLength = Math.Min(Ablock.blockLength, A.numRows) * A.numCols;

            if (tmp == null || tmp.Length < tmpLength)
            {
                tmp = new double[tmpLength];
            }

            // doing an in-place convert is much more memory efficient at the cost of a little
            // but of CPU
            MatrixOps_DDRB.convertRowToBlock(A.numRows, A.numCols, Ablock.blockLength, A.data, tmp);

            bool ret = alg.decompose(Ablock);

            // convert it back to the normal format if it wouldn't have been modified
            if (!alg.inputModified())
            {
                MatrixOps_DDRB.convertBlockToRow(A.numRows, A.numCols, Ablock.blockLength, A.data, tmp);
            }

            return(ret);
        }
Exemplo n.º 2
0
        public virtual void convertBlockToRow(int numRows, int numCols, int blockLength,
                                              double[] data)
        {
            int tmpLength = Math.Min(blockLength, numRows) * numCols;

            if (tmp == null || tmp.Length < tmpLength)
            {
                tmp = new double[tmpLength];
            }

            MatrixOps_DDRB.convertBlockToRow(numRows, numCols, Ablock.blockLength, data, tmp);
        }