|   Registered Member   
 | 
							Greetings, Making sure I am not crazy here, but using broadcasting you can add a column or row vector to each column or row in a matrix (or array) doing something like: 
 (Please excuse code inefficiencies, I am just trying to get this to work). You can also subtract in the same manner. However, am I correct in that you cannot multiply like this? I.E. replace the last line with m=m.rowwise()*v.array(). If I try this I get a compile error and I can't figure out a way to replicate the addition/subtraction broadcasting result with multiplication in order to multiply a column or row vector to each column or row in a matrix. Any help would be appreciated. Thanks. | 
|   Moderator   
 | 
							This has been recently added in the default branch. Meanwhile you can express it a diagonal matrix product: m = v.asDiagonal() * m.matrix(); | 
|   Registered Member   
 | |
|   Registered Member   
 | 
							Hi, sorry to reopen this old topic but m = v.asDiagonal() * m.matrix(); did not give the result I was expecting. Example: 
 the first cout line gives: 
 which is as expected, however the second cout line gives: 
 which is not the same functionality of m.rowwise()+v.array(). Replicating the same functionality of m.rowwise()+v.array() with multiplication should give me: 
 Is there any way to get this? Thank you. | 
|   Moderator   
 | 
							to mimic a rowwise op do the product on the right: m.matrix() * v.asDiagonal() | 
|   Registered Member   
 | 
							Ah ok excellent, this worked.  Thank you very much!  (as you could tell, matrix math is not my forte   ) | 
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]
 
		 
		 
		 
		