Avoid modulo on `DMat::from_fn`.
This commit is contained in:
parent
335bdd8a01
commit
2f0234e7ac
|
@ -139,7 +139,7 @@ impl<N> DMat<N> {
|
|||
DMat {
|
||||
nrows: nrows,
|
||||
ncols: ncols,
|
||||
mij: Vec::from_fn(nrows * ncols, |i| f(i % nrows, i / nrows))
|
||||
mij: Vec::from_fn(nrows * ncols, |i| { let m = i / nrows; f(i - m * nrows, m) })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue