The stuff in src/heev.cc may indeed be something like what I'm looking for. I'll have to dig a bit more around in the source code I think.
Not exactly sure what you are asking for about the matrix type, but I can try to elaborate:
I have a dataset represented by a matrix X, slate::Matrix<scalar_t> X(...); where scalar_t is say float or double.
There is no inherent structure to X, it is dense and very tall, each row being a data sample with a number of features.
I'm interested in computing the distance matrix D which has elements d[i,j] = ||x[i,:] - x[j,:]||.
This could be done in various ways:
- 1. I could loop through the data a bunch
- 2. I could divide D into different tiles and distribute the computation on each tile
- 3. I could do the above, but write a GPU kernel for taking care of the actual computations
- 4. I could use a formula involving a matrix product, 2 row/columns-wise additions and a element-wise squareroot
There are possibly more ways.
1. is not very efficient,
2. and 3. are promising, likely the best given the required skillset, but will require a lot of code optimization to get good performance,
4. lets me use the existing gemm implementation and hopefully skip a lot of optimizing myself.
So I'm hoping to do 4. I might attempt 2.&3. on the side, but I'm also asked to try to get something working pretty fast, so I can't just take my time on 2.&3.
The formula for 4. requires computing the matrix product X * X^T, that matrix is of course symmetric, and it is the diagonal of that resulting matrix I'd want to extract.