From 2f0234e7ac5dec58419d18cdd13523bd8d00385a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 27 Jul 2014 09:13:13 +0200 Subject: [PATCH] Avoid modulo on `DMat::from_fn`. --- src/structs/dmat.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structs/dmat.rs b/src/structs/dmat.rs index 2982c184..4d00f954 100644 --- a/src/structs/dmat.rs +++ b/src/structs/dmat.rs @@ -139,7 +139,7 @@ impl DMat { 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) }) } }