Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSMat contains no transpose method #27

Open
DanielTakeshi opened this issue May 2, 2015 · 2 comments
Open

GSMat contains no transpose method #27

DanielTakeshi opened this issue May 2, 2015 · 2 comments

Comments

@DanielTakeshi
Copy link
Contributor

The GSMat class contains no transpose method. Something like this might work:

override def t = {
  val out = GSMat.newOrCheckGSMat(ncols, nrows, nnz0, null, GUID, "t".##)
  CUMATD.transpose(this.data, nrows, out.data, ncols, nrows, ncols)
  cudaDeviceSynchronize()
  out
}

(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.

@DanielTakeshi
Copy link
Contributor Author

The above won't quite work. A lame shortcut for now, since I'm not completely sure how to implement it in GSMats, is to use GSMat(SMat(a).t). For now, I'll leave this open in case we want to fix this later.

@jcanny
Copy link
Contributor

jcanny commented Sep 27, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants