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
Multiply matrix by vector row-wise #1358
Comments
Can you elaborate on how you want this operation to work? The example you've given doesn't seem quite correct, as far as I can tell; m.row_iter_mut().zip(v.iter()).for_each(|(row, component)| {
row *= component;
}) should likely do roughly the same thing execution-wise as a built-in method would do; do you have a use-case for this for which this approach benchmarks poorly? Can you elaborate on the use-case for this per-row componentwise multiplication? This could be a built-in method on |
I have a 3x3 transformation matrix I agree with both your points:
I was just asking if it's a good idea. However, now that I think about it more. There's no need to add a method. This operation could use the |
How can I multiply a matrix and a vector "row-wise" in nalgebra? Like I would do in numpy
I understand that I can convert my vector into a square matrix, then use
*
(ordot
) or code a generic function that does this task but multiplying each row with a number will be faster.I thought there would be be a method/operator that does it, so I asked this question on the r/rust "simple question" post and on SO. It seems that such a method doesn't exist. Can you please confirm?
Moreover, if this is right, should we add this method, and what would be its name?
The text was updated successfully, but these errors were encountered: