Ejemplo n.º 1
0
        /**
         * <p>
         * Performs a rank-1 update operation on the submatrix specified by V with the multiply on the right.<br>
         * <br>
         * C = (I - &gamma;*v*v<sup>T</sup>)*A<br>
         * </p>
         * <p>
         * The order that matrix multiplies are performed has been carefully selected
         * to minimize the number of operations.
         * </p>
         *
         * <p>
         * Before this can become a truly generic operation the submatrix specification needs
         * to be made more generic.
         * </p>
         */
        public static void rank1UpdateMultR(DMatrixSparseCSC V, int colV, double gamma,
                                            DMatrixSparseCSC A, DMatrixSparseCSC C,
                                            IGrowArray gw, DGrowArray gx)
        {
            if (V.numRows != A.numRows)
            {
                throw new ArgumentException("Number of rows in V and A must match");
            }

            C.nz_length = 0;
            C.numRows   = V.numRows;
            C.numCols   = 0;

            for (int i = 0; i < A.numCols; i++)
            {
                double tau = CommonOps_DSCC.dotInnerColumns(V, colV, A, i, gw, gx);
                ImplCommonOps_DSCC.addColAppend(1.0, A, i, -gamma * tau, V, colV, C, gw);
            }
        }