예제 #1
0
        /***
         * void  cvGEMM( const CvArr* src1, const CvArr* src2, double alpha,
         *            const CvArr* src3, double beta, CvArr* dst, int tABC=0 );
         #define cvMatMulAdd( src1, src2, src3, dst ) cvGEMM( src1, src2, 1, src3, 1, dst, 0 )
         #define cvMatMul( src1, src2, dst ) cvMatMulAdd( src1, src2, 0, dst )
         *
         * src1
         *  The first source array.
         * src2
         *  The second source array.
         * src3
         *  The third source array (shift). Can be NULL, if there is no shift.
         * dst
         *  The destination array.
         * tABC
         *  The operation flags that can be 0 or combination of the following values:
         *  CV_GEMM_A_T - transpose src1
         *  CV_GEMM_B_T - transpose src2
         *  CV_GEMM_C_T - transpose src3
         *  for example, CV_GEMM_A_T+CV_GEMM_C_T corresponds to
         *
         *  alpha*src1T*src2 + beta*srcT
         *
         * The function cvGEMM performs generalized matrix multiplication:
         *
         * dst = alpha*op(src1)*op(src2) + beta*op(src3), where op(X) is X or XT
         ***/

        internal static void cvGEMM(CDVMatrix src1, CDVMatrix src2, double alpha, CDVMatrix src3, double beta, CDVMatrix dst, int tABC)
        {
            CDVMatrix matrix1 = new CDVMatrix(src1);

            matrix1.Multiply(alpha);
            matrix1.Multiply(src2);

            CDVMatrix matrix2 = new CDVMatrix(src3);

            matrix2.Multiply(beta);

            dst.Copy(matrix1);
            dst.Add(matrix2);
        }
예제 #2
0
        public static CDVMatrix Multiplication(CDVMatrix pCDVMatrix1, CDVMatrix pCDVMatrix2)
        {
            if (pCDVMatrix1 == null || pCDVMatrix2 == null)
            {
                return(null);
            }
            CDVMatrix vret = new CDVMatrix(pCDVMatrix1);

            vret.Multiply(pCDVMatrix2);
            return(vret);
        }