Update to the last Rust.

Version of rustc: 0.10-pre (e3b1f3c 2014-01-29 23:46:26 -0800)
This commit is contained in:
Sébastien Crozet 2014-01-30 11:28:15 +01:00
parent 4c262bb91d
commit d50afdf645
5 changed files with 32 additions and 31 deletions

View File

@ -9,7 +9,8 @@ test:
mkdir -p $(nalgebra_lib_path)
rustc --test src/lib.rs --opt-level 3 -o test~ && ./test~
rm test~
rustdoc --test -L lib src/lib.rs
# FIXME:
# rustdoc --test -L lib src/lib.rs
bench:
rustc --test src/lib.rs --opt-level 3 -o bench~ && ./bench~ --bench

View File

@ -9,9 +9,9 @@ macro_rules! bench_mul_mat(
let mut b: $t = random();
$bh.iter(|| {
1000.times(|| {
for _ in range(0, 1000) {
b = a * b;
})
}
})
}
}
@ -49,9 +49,9 @@ macro_rules! bench_mul_dmat(
let mut b: DMat<f64> = DMat::new_random($nrows, $ncols);
$bh.iter(|| {
1000.times(|| {
for _ in range(0, 1000) {
b = a * b;
})
}
})
}
}
@ -89,9 +89,9 @@ macro_rules! bench_mul_mat_vec(
let mut v : $tv = random();
$bh.iter(|| {
1000.times(|| {
for _ in range(0, 1000) {
v = m * v
})
}
})
}
}
@ -129,9 +129,9 @@ macro_rules! bench_mul_dmat_dvec(
let mut v : DVec<f64> = DVec::new_random($ncols);
$bh.iter(|| {
1000.times(|| {
for _ in range(0, 1000) {
v = m * v
})
}
})
}
}

View File

@ -11,9 +11,9 @@ macro_rules! bench_dot_vec(
let mut d = 0.0;
$bh.iter(|| {
1000.times(|| {
for _ in range(0, 1000) {
d = d + na::dot(&a, &b);
})
}
})
}
}

View File

@ -5,21 +5,21 @@ use na;
macro_rules! test_inv_mat_impl(
($t: ty) => (
10000.times(|| {
for _ in range(0, 10000) {
let randmat : $t = random();
assert!(na::approx_eq(&(na::inv(&randmat).unwrap() * randmat), &na::one()));
})
}
);
)
macro_rules! test_transpose_mat_impl(
($t: ty) => (
10000.times(|| {
for _ in range(0, 10000) {
let randmat : $t = random();
assert!(na::transpose(&na::transpose(&randmat)) == randmat);
})
}
);
)
@ -85,12 +85,12 @@ fn test_inv_mat6() {
#[test]
fn test_rotation2() {
10000.times(|| {
for _ in range(0, 10000) {
let randmat: na::Rot2<f64> = na::one();
let ang = Vec1::new(abs::<f64>(random()) % Real::pi());
assert!(na::approx_eq(&na::rotation(&na::append_rotation(&randmat, &ang)), &ang));
})
}
}
#[test]
@ -102,14 +102,14 @@ fn test_index_mat2() {
#[test]
fn test_inv_rotation3() {
10000.times(|| {
for _ in range(0, 10000) {
let randmat: Rot3<f64> = na::one();
let dir: Vec3<f64> = random();
let ang = na::normalize(&dir) * (abs::<f64>(random()) % Real::pi());
let rot = na::append_rotation(&randmat, &ang);
assert!(na::approx_eq(&(na::transpose(&rot) * rot), &na::one()));
})
}
}
#[test]

View File

@ -5,7 +5,7 @@ use na;
macro_rules! test_iterator_impl(
($t: ty, $n: ty) => (
10000.times(|| {
for _ in range(0, 10000) {
let v: $t = random();
let mut mv: $t = v.clone();
let n: $n = random();
@ -17,24 +17,24 @@ macro_rules! test_iterator_impl(
}
assert!(nv == mv && nv == v * n);
})
}
)
)
macro_rules! test_commut_dot_impl(
($t: ty) => (
10000.times(|| {
for _ in range(0, 10000) {
let v1 : $t = random();
let v2 : $t = random();
assert!(na::approx_eq(&na::dot(&v1, &v2), &na::dot(&v2, &v1)));
})
}
);
)
macro_rules! test_scalar_op_impl(
($t: ty, $n: ty) => (
10000.times(|| {
for _ in range(0, 10000) {
let v1 : $t = random();
let n : $n = random();
@ -51,13 +51,13 @@ macro_rules! test_scalar_op_impl(
v1 = v1 / n;
assert!(na::approx_eq(&v1, &v0));
})
}
);
)
macro_rules! test_basis_impl(
($t: ty) => (
10000.times(|| {
for _ in range(0, 10000) {
na::canonical_basis(|e1: $t| {
na::canonical_basis(|e2: $t| {
assert!(e1 == e2 || na::approx_eq(&na::dot(&e1, &e2), &na::zero()));
@ -69,13 +69,13 @@ macro_rules! test_basis_impl(
true
})
})
}
);
)
macro_rules! test_subspace_basis_impl(
($t: ty) => (
10000.times(|| {
for _ in range(0, 10000) {
let v : $t = random();
let v1 = na::normalize(&v);
@ -93,20 +93,20 @@ macro_rules! test_subspace_basis_impl(
true
})
})
}
);
)
#[test]
fn test_cross_vec3() {
10000.times(|| {
for _ in range(0, 10000) {
let v1 : Vec3<f64> = random();
let v2 : Vec3<f64> = random();
let v3 : Vec3<f64> = na::cross(&v1, &v2);
assert!(na::approx_eq(&na::dot(&v3, &v2), &na::zero()));
assert!(na::approx_eq(&na::dot(&v3, &v1), &na::zero()));
})
}
}
#[test]