Example #1
0
        /**
         * Converts 'A' into a block matrix and call setA() on the block matrix solver.
         *
         * @param A The A matrix in the linear equation. Not modified. Reference saved.
         * @return true if it can solve the system.
         */
        public virtual bool setA(DMatrixRMaj A)
        {
            blockA.reshape(A.numRows, A.numCols, false);
            MatrixOps_DDRB.convert(A, blockA);

            return(alg.setA(blockA));
        }
Example #2
0
        /**
         * Creates a block matrix the same size as A_inv, inverts the matrix and copies the results back
         * onto A_inv.
         *
         * @param A_inv Where the inverted matrix saved. Modified.
         */
        public virtual void invert(DMatrixRMaj A_inv)
        {
            blockB.reshape(A_inv.numRows, A_inv.numCols, false);

            alg.invert(blockB);

            MatrixOps_DDRB.convert(blockB, A_inv);
        }
        /**
         * Only converts the B matrix and passes that onto solve.  Te result is then copied into
         * the input 'X' matrix.
         *
         * @param B A matrix &real; <sup>m &times; p</sup>.  Not modified.
         * @param X A matrix &real; <sup>n &times; p</sup>, where the solution is written to.  Modified.
         */
        public override void solve(DMatrixRMaj B, DMatrixRMaj X)
        {
            blockB.reshape(B.numRows, B.numCols, false);
            MatrixOps_DDRB.convert(B, blockB);

            // since overwrite B is true X does not need to be passed in
            alg.solve(blockB, null);

            MatrixOps_DDRB.convert(blockB, X);
        }
Example #4
0
        public virtual /**/ double quality()
        {
            return(alg.quality());
        }

        /**
         * Converts B and X into block matrices and calls the block matrix solve routine.
         *
         * @param B A matrix &real; <sup>m &times; p</sup>.  Not modified.
         * @param X A matrix &real; <sup>n &times; p</sup>, where the solution is written to.  Modified.
         */
        public virtual void solve(DMatrixRMaj B, DMatrixRMaj X)
        {
            blockB.reshape(B.numRows, B.numCols, false);
            blockX.reshape(X.numRows, X.numCols, false);
            MatrixOps_DDRB.convert(B, blockB);

            alg.solve(blockB, blockX);

            MatrixOps_DDRB.convert(blockX, X);
        }
        public virtual DMatrixRMaj getT(DMatrixRMaj T)
        {
            DMatrixRBlock T_block = ((CholeskyOuterForm_DDRB)alg).getT(null);

            if (T == null)
            {
                T = new DMatrixRMaj(T_block.numRows, T_block.numCols);
            }

            MatrixOps_DDRB.convert(T_block, T);
            // todo set zeros
            return(T);
        }
        //@Override
        public DMatrixRMaj getR(DMatrixRMaj R, bool compact)
        {
            DMatrixRBlock Rblock;

            Rblock = ((QRDecompositionHouseholder_DDRB)alg).getR(null, compact);

            if (R == null)
            {
                R = new DMatrixRMaj(Rblock.numRows, Rblock.numCols);
            }
            MatrixOps_DDRB.convert(Rblock, R);

            return(R);
        }