You have to read the cublas gemm documentation carefully.
There is a way to compute A' * A
direct with the cublas<T>gemm
, but it's tricky.
cublasSgemm(handle, CUBLAS_OP_T, CUBLAS_OP_N, N, K, M, &alpha,
A, M, A, M, &beta, B, N);
This is a kind of a little hack - A is your matrix of dimension A(MxN)
stored in column major order and K = N
.
Therefor as response you wil get B = A' * A
.