This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Colwise dot product

Tags: None
(comma "," separated)
Ian Mackenzie
Registered Member
Posts
15
Karma
0

Colwise dot product

Mon May 17, 2010 5:38 pm
Is there a concise way to perform a columnwise dot product between two matrices? Assuming a and b are both 3 x n matrices, it's possible to do a.colwise().cross(b), but not a.colwise().dot(b). I tried (a.transpose() * b).diagonal(), but timings on my machine seemed to show that this was performing a full matrix multiplication before extracting the diagonal. Is there a nice way to do this without writing an explicit loop?
Ian Mackenzie
Registered Member
Posts
15
Karma
0

Re: Colwise dot product

Mon May 17, 2010 5:50 pm
Oops, just thought of one which seems to work: (a.cwise() * b).colwise().sum(). It seems to me that a.colwise().dot(b) would be nicer, though, so I've submitted a feature request to the issue tracker.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]