forked from M-Labs/nalgebra
Changed loops order in from_fn_generic
This commit is contained in:
parent
3751602fb5
commit
b1616e236c
@ -186,3 +186,21 @@ fn mat_mul_mat(bench: &mut Bencher) {
|
||||
test::black_box(a.mul_to(&b, &mut ab));
|
||||
})
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn mat100_from_fn(bench: &mut Bencher) {
|
||||
bench.iter(|| {
|
||||
DMatrix::from_fn(100, 100, |a, b| {
|
||||
a + b
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn mat500_from_fn(bench: &mut Bencher) {
|
||||
bench.iter(|| {
|
||||
DMatrix::from_fn(500, 500, |a, b| {
|
||||
a + b
|
||||
});
|
||||
})
|
||||
}
|
||||
|
@ -108,8 +108,8 @@ where
|
||||
{
|
||||
let mut res = unsafe { Self::new_uninitialized_generic(nrows, ncols) };
|
||||
|
||||
for i in 0..nrows.value() {
|
||||
for j in 0..ncols.value() {
|
||||
for i in 0..nrows.value() {
|
||||
unsafe { *res.get_unchecked_mut(i, j) = f(i, j) }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user