Hey guys, maybe I’m just blind, but I haven’t found an overview of all the kinds of arithmetics and how to express them with nalgebra, apart from the obvious ones.
I am talking about all possible pairings like:
Adding scalar to existing matrix
I came up with the following:
the_matrix.iter_mut().for_each(|e| *e = *e + the_scalar);
Adding scalar to matrix, producing new matrix
I came up with the following:
the_matrix.map(|e| e + the_scalar);
after having tested many, many horrible things, such as:
&the_matrix + na::DMatrix::from_element(the_matrix.nrows(), the_matrixncols(), 1.0) * the_scalar;
And then I accidentially found add_scalar()
in the changelog…
Adding a column-vector to each column of an existing matrix
I came up with the following:
the_matrix.column_iter_mut().for_each(|mut col| col += &the_vector);
Adding a column-vector to each column of a matrix, producing a new matrix
…??
Adding a row-vector to each row of a matrix
the_matrix.row_iter_mut().for_each(|mut row| row += &the_vector);
Adding a row-vector to each row of a matrix, producing a new matrix
…??
Multiplying a column-vector with each column of a matrix, producing a new matrix
etc.
Is there an overview for these arithmetics?