Closed JEMH closed 2 months ago
To me the current asserts look wrong: assert!( start.0 + (steps.0 + 1) shape.0 <= my_shape.0 + steps.0, "Matrix slicing out of bounds." ); assert!( start.1 + (steps.1 + 1) shape.1 <= my_shape.1 + steps.1, "Matrix slicing out of bounds." ); }
From my understanding I would expect the first assertion to be start.0 + (shape.0 - 1) steps.0 <= my_shape.0 - 1 which can be written without subtraction as start.0 + shape.0 steps.0 + 1 <= my_shape.0 + steps.0
Similarly I think the second assertion should be start.1 + shape.1 * steps.1 + 1 <= my_shape.1 + steps.1
Is this correct?
After reading the documentation more closely, I see that I have misinterpreted the steps variables. the steps refer to the number of ignored rows/columns rather than the number of steps between the desired rows/columns. In my example above, I should have used (1, 1) for steps to achieve the desired result. Sorry for any inconvenience caused.
Using algebra 0.33.0 on my MacBook, I get out of bound errors when using view_with_steps_mut. It looks to me that there is a problem in the assert_view_index function. See below for a small example that generates the error.
Is there a problem or have I done something wrong?
use nalgebra::DMatrix;
Actual result.