コード例 #1
0
        public void Test_BLAS2_GER()
        {
            ClearBuffer(hiMatrixA);
            ClearBuffer(hiVectorXM);
            ClearBuffer(hiVectorYN);

            FillBuffer(hiMatrixA);
            FillBuffer(hiVectorXM);
            FillBuffer(hiVectorYN);

            diMatrixA  = _gpu.CopyToDevice(hiMatrixA);
            diVectorXM = _gpu.CopyToDevice(hiVectorXM);
            diVectorYN = _gpu.CopyToDevice(hiVectorYN);

            _blas.GER(M, N, Alpha, diVectorXM, diVectorYN, diMatrixA);

            _gpu.CopyFromDevice(diMatrixA, gpuResultMN);

            for (int i = 0; i < M; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    double cpuResult = Alpha * hiVectorXM[i] * hiVectorYN[j] + hiMatrixA[GetIndexColumnMajor(i, j, M)];
                    Assert.AreEqual(cpuResult, gpuResultMN[GetIndexColumnMajor(i, j, M)]);
                }
            }

            _gpu.FreeAll();
        }