The best way to iterate over sections of 2D arrays in Rust
问题 I'm learning Rust by porting a small program that was written in C. It works with comparable performance to the C version. Still, I can't help but feeling my code could be better, hence this post. The following code solves a matrix equation using Gaussian elimination, which requires iterating over portions of an array. pub struct MatrixEquation { vec: Vec<f64>, mat: Vec<Vec<f64>>, } impl MatrixEquation { fn solve(&mut self) { let size = self.vec.len(); // Transform matrix to upper triangular