Open DanielTakeshi opened 9 years ago
The above won't quite work. A lame shortcut for now, since I'm not completely sure how to implement it in GSMat
s, is to use GSMat(SMat(a).t)
. For now, I'll leave this open in case we want to fix this later.
Transposing sparse matrices into a valid representation (CSC +COO in BIDMat) is very expensive because it requires a resort of indices. On the other hand, transpose of dense matrices is fast. Its often possible to get the result you want without sparse transpose. e.g. for a sparse S and dense M,
M * S^T = M ^ S (^ is directly implemented) S^T * M = (M^T * S)^T (two dense transposes)
We should probably implement this some time, but we need to find a way to discourage people from using it.
The GSMat class contains no transpose method. Something like this might work:
(Note the extra nnz0 term to include when checking the cache for GSMats).
However, I did a few tests and got some weird behavior when multiplying GSMats with other matrices (e.g.,
GSMat(a) * GMat(mkdiag(ones(3,1)))
), so I just wanted to check in and see if GSMats were really supposed to have transposes. It seems like they should because SMats have transposes.