public void Test_BLAS2_SYR2() { ClearBuffer(hiMatrixANN); ClearBuffer(hiVectorXN); ClearBuffer(hiVectorYN); FillBuffer(hiMatrixANN); ConverToSymmetric(hiMatrixANN, N); FillBuffer(hiVectorXN); FillBuffer(hiVectorYN); diMatrixA = _gpu.Allocate(hiMatrixANN); diVectorXN = _gpu.CopyToDevice(hiVectorXN); diVectorYN = _gpu.CopyToDevice(hiVectorYN); // Lower fill mode _gpu.CopyToDevice(hiMatrixANN, diMatrixA); _blas.SYR2(N, Alpha, diVectorXN, diVectorYN, diMatrixA); _gpu.CopyFromDevice(diMatrixA, gpuResultNN); for (int i = 0; i < N; i++) { for (int j = 0; j <= i; j++) { double cpuResult = Alpha * (hiVectorXN[i] * hiVectorYN[j] + hiVectorYN[i] * hiVectorXN[j]) + hiMatrixANN[GetIndexColumnMajor(i, j, N)]; Assert.AreEqual(cpuResult, gpuResultNN[GetIndexColumnMajor(i, j, N)]); } } // Upper fill mode _gpu.CopyToDevice(hiMatrixANN, diMatrixA); _blas.SYR2(N, Alpha, diVectorXN, diVectorYN, diMatrixA, cublasFillMode.Upper); _gpu.CopyFromDevice(diMatrixA, gpuResultNN); for (int i = 0; i < N; i++) { for (int j = i; j < N; j++) { double cpuResult = Alpha * (hiVectorXN[i] * hiVectorYN[j] + hiVectorYN[i] * hiVectorXN[j]) + hiMatrixANN[GetIndexColumnMajor(i, j, N)]; Assert.AreEqual(cpuResult, gpuResultNN[GetIndexColumnMajor(i, j, N)]); } } _gpu.FreeAll(); }