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

View File

@ -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) })
}
}