Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Nalgebra: best practice to assign a Matrix to a part (submatrix) of an existing Matrix
Hi, All,
I'm using nalgebra
DMatrix
and want to assign a smaller dimension matrix y_1
to an equal-dimensional part (submatrix) of an existing matrix y
. Maybe I missed the right section of the nalgebra
documentation, but I can't find a better solution. The view_mut()
method does not manipulate the matrix in-place and can't be used as the LHS in assignment operations. I can use fill_with()
method for element-wise operations to do the job, but it is quite tedious and inefficient. I'm expecting an assignment statement like the view_mut()
method:
y.view_in_place_mut((0,0), (m, n)) = y_1;
or
y.set_submatrix((0,0), (m, n), y_1);
where y_1
is an m*n
matrix. Appreciate the assistance!
Sean Nie
3 posts - 2 participants
🏷️ Rust_feed