Avoid modulo on `DMat::from_fn`.

This commit is contained in:
Sébastien Crozet 2014-07-27 09:13:13 +02:00
parent 335bdd8a01
commit 2f0234e7ac
1 changed files with 1 additions and 1 deletions

View File

@ -139,7 +139,7 @@ impl<N> DMat<N> {
DMat { DMat {
nrows: nrows, nrows: nrows,
ncols: ncols, 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) })
} }
} }