3
$\begingroup$

Let $D$ be a sparse matrix. I want to compute $D\times D^T$. As $D$ is fairly large, so I am row-slicing $D$. That means for a range $(i,j)$, I am computing $C = D(i:j,:) \times D^T$ and performing some post-processing on $C$. I am choosing the index according to my available memory. I want to know whether there is any built-in function for doing that in Intel MKL. What I am doing now is:

  1. Pre-compute $D^T$.
  2. For a row-slice $(i,j)$, compute CSR-handler for $D(i:j,:)$
  3. $C = D(i:j,:) \times D^T$, using mkl_sparse_s_spmmd

This approach uses extra memory to compute and save $D^T$ as a pre-processing step. I am using spmmd because the resultant matrix will be dense. spmmd allows us to take operation on the first matrix but not the second. There is also an sp2m, but in this case, the multiplied matrix is sparse. Any methods I have missed?

$\endgroup$
2
  • 5
    $\begingroup$ The usual question applies for matrix-matrix products: What do you actually need the product for? Couldn't you get away with just implementing the action? $\endgroup$ Commented Apr 3, 2020 at 21:20
  • $\begingroup$ Is there some way to pass a transposed view to the method? Since all you really have to do is flip the iteration indices for the transposed matrix, doing a full precomputation seems to waste memory. $\endgroup$
    – MPIchael
    Commented Apr 6, 2020 at 9:09

1 Answer 1

1
$\begingroup$

https://software.intel.com/en-us/mkl-developer-reference-c-mkl-sparse-syrk

This routine is specifically designed for your problem. It will output the upper half of the resulting matrix, which is often preferable.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.