Adapted for the compiler 'incomming' branch.
This commit is contained in:
parent
4146385e09
commit
0b8058e88f
|
@ -1,6 +1,6 @@
|
||||||
use core::num::{One, Zero};
|
use std::num::{One, Zero};
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
use traits::workarounds::rlmul::{RMul, LMul};
|
use traits::workarounds::rlmul::{RMul, LMul};
|
||||||
use traits::dim::Dim;
|
use traits::dim::Dim;
|
||||||
use traits::inv::Inv;
|
use traits::inv::Inv;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use core::num::{One, Zero};
|
use std::num::{One, Zero};
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
use traits::dim::Dim;
|
use traits::dim::Dim;
|
||||||
use traits::inv::Inv;
|
use traits::inv::Inv;
|
||||||
use traits::rotation::Rotation;
|
use traits::rotation::Rotation;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use core::num::{One, Zero};
|
use std::num::{One, Zero};
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
use traits::dim::Dim;
|
use traits::dim::Dim;
|
||||||
use traits::inv::Inv;
|
use traits::inv::Inv;
|
||||||
use traits::transpose::Transpose;
|
use traits::transpose::Transpose;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use core::num::{Zero, One, Algebraic};
|
use std::num::{Zero, One, Algebraic};
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
use traits::basis::Basis;
|
use traits::basis::Basis;
|
||||||
use traits::dim::Dim;
|
use traits::dim::Dim;
|
||||||
use traits::dot::Dot;
|
use traits::dot::Dot;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use core::num::{One, Zero};
|
use std::num::{One, Zero};
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
use core::util::swap;
|
use std::util::swap;
|
||||||
use traits::dim::Dim;
|
use traits::dim::Dim;
|
||||||
use traits::inv::Inv;
|
use traits::inv::Inv;
|
||||||
use traits::transpose::Transpose;
|
use traits::transpose::Transpose;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use core::num::{Zero, One, Algebraic};
|
use std::num::{Zero, One, Algebraic};
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
use dim1::vec1::{Vec1, vec1};
|
use dim1::vec1::{Vec1, vec1};
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
use traits::basis::Basis;
|
use traits::basis::Basis;
|
||||||
use traits::cross::Cross;
|
use traits::cross::Cross;
|
||||||
use traits::dim::Dim;
|
use traits::dim::Dim;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use core::num::{One, Zero};
|
use std::num::{One, Zero};
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
use core::util::swap;
|
use std::util::swap;
|
||||||
use traits::dim::Dim;
|
use traits::dim::Dim;
|
||||||
use traits::inv::Inv;
|
use traits::inv::Inv;
|
||||||
use traits::transpose::Transpose;
|
use traits::transpose::Transpose;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use core::num::{Zero, One, Algebraic, abs};
|
use std::num::{Zero, One, Algebraic, abs};
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
use traits::basis::Basis;
|
use traits::basis::Basis;
|
||||||
use traits::cross::Cross;
|
use traits::cross::Cross;
|
||||||
use traits::dim::Dim;
|
use traits::dim::Dim;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use core::num::{One, Zero};
|
use std::uint::iterate;
|
||||||
use core::vec::{from_elem, swap, all, all2, len};
|
use std::num::{One, Zero};
|
||||||
use core::cmp::ApproxEq;
|
use std::vec::{from_elem, swap, all, all2, len};
|
||||||
|
use std::cmp::ApproxEq;
|
||||||
use traits::inv::Inv;
|
use traits::inv::Inv;
|
||||||
use traits::division_ring::DivisionRing;
|
use traits::division_ring::DivisionRing;
|
||||||
use traits::transpose::Transpose;
|
use traits::transpose::Transpose;
|
||||||
|
@ -25,7 +26,7 @@ pub fn one_mat_with_dim<T: Copy + One + Zero>(dim: uint) -> DMat<T>
|
||||||
let mut res = zero_mat_with_dim(dim);
|
let mut res = zero_mat_with_dim(dim);
|
||||||
let _1 = One::one::<T>();
|
let _1 = One::one::<T>();
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{ res.set(i, i, &_1); }
|
{ res.set(i, i, &_1); }
|
||||||
|
|
||||||
res
|
res
|
||||||
|
@ -67,13 +68,13 @@ Mul<DMat<T>, DMat<T>> for DMat<T>
|
||||||
let dim = self.dim;
|
let dim = self.dim;
|
||||||
let mut res = zero_mat_with_dim(dim);
|
let mut res = zero_mat_with_dim(dim);
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{
|
{
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{
|
{
|
||||||
let mut acc = Zero::zero::<T>();
|
let mut acc = Zero::zero::<T>();
|
||||||
|
|
||||||
for uint::range(0u, dim) |k|
|
for iterate(0u, dim) |k|
|
||||||
{ acc += self.at(i, k) * other.at(k, j); }
|
{ acc += self.at(i, k) * other.at(k, j); }
|
||||||
|
|
||||||
res.set(i, j, &acc);
|
res.set(i, j, &acc);
|
||||||
|
@ -94,9 +95,9 @@ RMul<DVec<T>> for DMat<T>
|
||||||
let dim = self.dim;
|
let dim = self.dim;
|
||||||
let mut res : DVec<T> = zero_vec_with_dim(dim);
|
let mut res : DVec<T> = zero_vec_with_dim(dim);
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{
|
{
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{ res.at[i] = res.at[i] + other.at[j] * self.at(i, j); }
|
{ res.at[i] = res.at[i] + other.at[j] * self.at(i, j); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,9 +115,9 @@ LMul<DVec<T>> for DMat<T>
|
||||||
let dim = self.dim;
|
let dim = self.dim;
|
||||||
let mut res : DVec<T> = zero_vec_with_dim(dim);
|
let mut res : DVec<T> = zero_vec_with_dim(dim);
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{
|
{
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{ res.at[i] = res.at[i] + other.at[j] * self.at(j, i); }
|
{ res.at[i] = res.at[i] + other.at[j] * self.at(j, i); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +144,7 @@ Inv for DMat<T>
|
||||||
let _0T = Zero::zero::<T>();
|
let _0T = Zero::zero::<T>();
|
||||||
|
|
||||||
// inversion using Gauss-Jordan elimination
|
// inversion using Gauss-Jordan elimination
|
||||||
for uint::range(0u, dim) |k|
|
for iterate(0u, dim) |k|
|
||||||
{
|
{
|
||||||
// search a non-zero value on the k-th column
|
// search a non-zero value on the k-th column
|
||||||
// FIXME: would it be worth it to spend some more time searching for the
|
// FIXME: would it be worth it to spend some more time searching for the
|
||||||
|
@ -164,7 +165,7 @@ Inv for DMat<T>
|
||||||
// swap pivot line
|
// swap pivot line
|
||||||
if (n0 != k)
|
if (n0 != k)
|
||||||
{
|
{
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{
|
{
|
||||||
let off_n0_j = self.offset(n0, j);
|
let off_n0_j = self.offset(n0, j);
|
||||||
let off_k_j = self.offset(k, j);
|
let off_k_j = self.offset(k, j);
|
||||||
|
@ -176,31 +177,31 @@ Inv for DMat<T>
|
||||||
|
|
||||||
let pivot = self.at(k, k);
|
let pivot = self.at(k, k);
|
||||||
|
|
||||||
for uint::range(k, dim) |j|
|
for iterate(k, dim) |j|
|
||||||
{
|
{
|
||||||
let selfval = &(self.at(k, j) / pivot);
|
let selfval = &(self.at(k, j) / pivot);
|
||||||
self.set(k, j, selfval);
|
self.set(k, j, selfval);
|
||||||
}
|
}
|
||||||
|
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{
|
{
|
||||||
let resval = &(res.at(k, j) / pivot);
|
let resval = &(res.at(k, j) / pivot);
|
||||||
res.set(k, j, resval);
|
res.set(k, j, resval);
|
||||||
}
|
}
|
||||||
|
|
||||||
for uint::range(0u, dim) |l|
|
for iterate(0u, dim) |l|
|
||||||
{
|
{
|
||||||
if (l != k)
|
if (l != k)
|
||||||
{
|
{
|
||||||
let normalizer = self.at(l, k);
|
let normalizer = self.at(l, k);
|
||||||
|
|
||||||
for uint::range(k, dim) |j|
|
for iterate(k, dim) |j|
|
||||||
{
|
{
|
||||||
let selfval = &(self.at(l, j) - self.at(k, j) * normalizer);
|
let selfval = &(self.at(l, j) - self.at(k, j) * normalizer);
|
||||||
self.set(l, j, selfval);
|
self.set(l, j, selfval);
|
||||||
}
|
}
|
||||||
|
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{
|
{
|
||||||
let resval = &(res.at(l, j) - res.at(k, j) * normalizer);
|
let resval = &(res.at(l, j) - res.at(k, j) * normalizer);
|
||||||
res.set(l, j, resval);
|
res.set(l, j, resval);
|
||||||
|
@ -228,9 +229,9 @@ impl<T:Copy> Transpose for DMat<T>
|
||||||
{
|
{
|
||||||
let dim = self.dim;
|
let dim = self.dim;
|
||||||
|
|
||||||
for uint::range(1u, dim) |i|
|
for iterate(1u, dim) |i|
|
||||||
{
|
{
|
||||||
for uint::range(0u, dim - 1) |j|
|
for iterate(0u, dim - 1) |j|
|
||||||
{
|
{
|
||||||
let off_i_j = self.offset(i, j);
|
let off_i_j = self.offset(i, j);
|
||||||
let off_j_i = self.offset(j, i);
|
let off_j_i = self.offset(j, i);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use core::num::{Zero, One, Algebraic};
|
use std::uint::iterate;
|
||||||
use core::vec::{map_zip, map, all2, len, from_elem, all};
|
use std::num::{Zero, One, Algebraic};
|
||||||
use core::cmp::ApproxEq;
|
use std::vec::{map_zip, map, all2, len, from_elem, all};
|
||||||
|
use std::cmp::ApproxEq;
|
||||||
use traits::ring::Ring;
|
use traits::ring::Ring;
|
||||||
use traits::division_ring::DivisionRing;
|
use traits::division_ring::DivisionRing;
|
||||||
use traits::dot::Dot;
|
use traits::dot::Dot;
|
||||||
|
@ -28,7 +29,7 @@ impl<T: Copy + DivisionRing + Algebraic + Clone + ApproxEq<T>> DVec<T>
|
||||||
{
|
{
|
||||||
let mut res : ~[DVec<T>] = ~[];
|
let mut res : ~[DVec<T>] = ~[];
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{
|
{
|
||||||
let mut basis_element : DVec<T> = zero_vec_with_dim(dim);
|
let mut basis_element : DVec<T> = zero_vec_with_dim(dim);
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ impl<T: Copy + DivisionRing + Algebraic + Clone + ApproxEq<T>> DVec<T>
|
||||||
let dim = len(self.at);
|
let dim = len(self.at);
|
||||||
let mut res : ~[DVec<T>] = ~[];
|
let mut res : ~[DVec<T>] = ~[];
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{
|
{
|
||||||
let mut basis_element : DVec<T> = zero_vec_with_dim(len(self.at));
|
let mut basis_element : DVec<T> = zero_vec_with_dim(len(self.at));
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ Dot<T> for DVec<T>
|
||||||
|
|
||||||
let mut res = Zero::zero::<T>();
|
let mut res = Zero::zero::<T>();
|
||||||
|
|
||||||
for uint::range(0u, len(self.at)) |i|
|
for iterate(0u, len(self.at)) |i|
|
||||||
{ res += self.at[i] * other.at[i]; }
|
{ res += self.at[i] * other.at[i]; }
|
||||||
|
|
||||||
res
|
res
|
||||||
|
@ -119,7 +120,7 @@ impl<T: Copy + Ring> SubDot<T> for DVec<T>
|
||||||
{
|
{
|
||||||
let mut res = Zero::zero::<T>();
|
let mut res = Zero::zero::<T>();
|
||||||
|
|
||||||
for uint::range(0u, len(self.at)) |i|
|
for iterate(0u, len(self.at)) |i|
|
||||||
{ res += (self.at[i] - a.at[i]) * b.at[i]; }
|
{ res += (self.at[i] - a.at[i]) * b.at[i]; }
|
||||||
|
|
||||||
res
|
res
|
||||||
|
@ -134,7 +135,7 @@ ScalarMul<T> for DVec<T>
|
||||||
|
|
||||||
fn scalar_mul_inplace(&mut self, s: &T)
|
fn scalar_mul_inplace(&mut self, s: &T)
|
||||||
{
|
{
|
||||||
for uint::range(0u, len(self.at)) |i|
|
for iterate(0u, len(self.at)) |i|
|
||||||
{ self.at[i] *= *s; }
|
{ self.at[i] *= *s; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +149,7 @@ ScalarDiv<T> for DVec<T>
|
||||||
|
|
||||||
fn scalar_div_inplace(&mut self, s: &T)
|
fn scalar_div_inplace(&mut self, s: &T)
|
||||||
{
|
{
|
||||||
for uint::range(0u, len(self.at)) |i|
|
for iterate(0u, len(self.at)) |i|
|
||||||
{ self.at[i] /= *s; }
|
{ self.at[i] /= *s; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +162,7 @@ ScalarAdd<T> for DVec<T>
|
||||||
|
|
||||||
fn scalar_add_inplace(&mut self, s: &T)
|
fn scalar_add_inplace(&mut self, s: &T)
|
||||||
{
|
{
|
||||||
for uint::range(0u, len(self.at)) |i|
|
for iterate(0u, len(self.at)) |i|
|
||||||
{ self.at[i] += *s; }
|
{ self.at[i] += *s; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +175,7 @@ ScalarSub<T> for DVec<T>
|
||||||
|
|
||||||
fn scalar_sub_inplace(&mut self, s: &T)
|
fn scalar_sub_inplace(&mut self, s: &T)
|
||||||
{
|
{
|
||||||
for uint::range(0u, len(self.at)) |i|
|
for iterate(0u, len(self.at)) |i|
|
||||||
{ self.at[i] -= *s; }
|
{ self.at[i] -= *s; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +214,7 @@ Norm<T> for DVec<T>
|
||||||
{
|
{
|
||||||
let l = self.norm();
|
let l = self.norm();
|
||||||
|
|
||||||
for uint::range(0u, len(self.at)) |i|
|
for iterate(0u, len(self.at)) |i|
|
||||||
{ self.at[i] /= l; }
|
{ self.at[i] /= l; }
|
||||||
|
|
||||||
l
|
l
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use core::num::{One, Zero};
|
use std::uint::iterate;
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::num::{One, Zero};
|
||||||
use core::cmp::ApproxEq;
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
|
use std::cmp::ApproxEq;
|
||||||
use traits::dim::Dim;
|
use traits::dim::Dim;
|
||||||
use traits::inv::Inv;
|
use traits::inv::Inv;
|
||||||
use traits::division_ring::DivisionRing;
|
use traits::division_ring::DivisionRing;
|
||||||
|
@ -61,13 +62,13 @@ Mul<NMat<D, T>, NMat<D, T>> for NMat<D, T>
|
||||||
let dim = Dim::dim::<D>();
|
let dim = Dim::dim::<D>();
|
||||||
let mut res = Zero::zero::<NMat<D, T>>();
|
let mut res = Zero::zero::<NMat<D, T>>();
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{
|
{
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{
|
{
|
||||||
let mut acc: T = Zero::zero();
|
let mut acc: T = Zero::zero();
|
||||||
|
|
||||||
for uint::range(0u, dim) |k|
|
for iterate(0u, dim) |k|
|
||||||
{ acc += self[(i, k)] * other[(k, j)]; }
|
{ acc += self[(i, k)] * other[(k, j)]; }
|
||||||
|
|
||||||
res.set(i, j, &acc);
|
res.set(i, j, &acc);
|
||||||
|
@ -86,9 +87,9 @@ RMul<NVec<D, T>> for NMat<D, T>
|
||||||
let dim = Dim::dim::<D>();
|
let dim = Dim::dim::<D>();
|
||||||
let mut res : NVec<D, T> = Zero::zero();
|
let mut res : NVec<D, T> = Zero::zero();
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{
|
{
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{ res.at.at[i] = res.at.at[i] + other.at.at[j] * self[(i, j)]; }
|
{ res.at.at[i] = res.at.at[i] + other.at.at[j] * self[(i, j)]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +105,9 @@ LMul<NVec<D, T>> for NMat<D, T>
|
||||||
let dim = Dim::dim::<D>();
|
let dim = Dim::dim::<D>();
|
||||||
let mut res : NVec<D, T> = Zero::zero();
|
let mut res : NVec<D, T> = Zero::zero();
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{
|
{
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{ res.at.at[i] = res.at.at[i] + other.at.at[j] * self[(j, i)]; }
|
{ res.at.at[i] = res.at.at[i] + other.at.at[j] * self[(j, i)]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,9 +159,9 @@ impl<D: Dim, T: Rand + Zero + Copy> Rand for NMat<D, T>
|
||||||
let dim = Dim::dim::<D>();
|
let dim = Dim::dim::<D>();
|
||||||
let mut res : NMat<D, T> = Zero::zero();
|
let mut res : NMat<D, T> = Zero::zero();
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{
|
{
|
||||||
for uint::range(0u, dim) |j|
|
for iterate(0u, dim) |j|
|
||||||
{ res.set(i, j, &rng.gen()); }
|
{ res.set(i, j, &rng.gen()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use core::num::{Zero, Algebraic};
|
use std::uint::iterate;
|
||||||
use core::rand::{Rand, Rng, RngUtil};
|
use std::num::{Zero, Algebraic};
|
||||||
use core::vec::{map};
|
use std::rand::{Rand, Rng, RngUtil};
|
||||||
use core::cmp::ApproxEq;
|
use std::vec::{map};
|
||||||
|
use std::cmp::ApproxEq;
|
||||||
use ndim::dvec::{DVec, zero_vec_with_dim, is_zero_vec};
|
use ndim::dvec::{DVec, zero_vec_with_dim, is_zero_vec};
|
||||||
use traits::basis::Basis;
|
use traits::basis::Basis;
|
||||||
use traits::ring::Ring;
|
use traits::ring::Ring;
|
||||||
|
@ -189,7 +190,7 @@ impl<D: Dim, T: Rand + Zero + Copy> Rand for NVec<D, T>
|
||||||
let dim = Dim::dim::<D>();
|
let dim = Dim::dim::<D>();
|
||||||
let mut res : NVec<D, T> = Zero::zero();
|
let mut res : NVec<D, T> = Zero::zero();
|
||||||
|
|
||||||
for uint::range(0u, dim) |i|
|
for iterate(0u, dim) |i|
|
||||||
{ res.at.at[i] = rng.gen() }
|
{ res.at.at[i] = rng.gen() }
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#[test]
|
#[test]
|
||||||
use core::num::{One, abs};
|
use std::num::{Real, One, abs};
|
||||||
#[test]
|
#[test]
|
||||||
use core::rand::{random};
|
use std::rand::{random};
|
||||||
#[test]
|
#[test]
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
#[test]
|
#[test]
|
||||||
use traits::inv::Inv;
|
use traits::inv::Inv;
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -25,7 +25,7 @@ use adaptors::rotmat::Rotmat;
|
||||||
|
|
||||||
macro_rules! test_inv_mat_impl(
|
macro_rules! test_inv_mat_impl(
|
||||||
($t:ty) => (
|
($t:ty) => (
|
||||||
for uint::range(0u, 10000u) |_|
|
for 10000.times
|
||||||
{
|
{
|
||||||
let randmat : $t = random();
|
let randmat : $t = random();
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ fn test_inv_mat2()
|
||||||
fn test_inv_mat3()
|
fn test_inv_mat3()
|
||||||
{ test_inv_mat_impl!(Mat3<f64>); }
|
{ test_inv_mat_impl!(Mat3<f64>); }
|
||||||
|
|
||||||
|
// FIXME: ICE
|
||||||
// #[test]
|
// #[test]
|
||||||
// fn test_inv_nmat()
|
// fn test_inv_nmat()
|
||||||
// { test_inv_mat_impl!(NMat<d7, f64>); }
|
// { test_inv_mat_impl!(NMat<d7, f64>); }
|
||||||
|
@ -53,10 +54,10 @@ fn test_inv_mat3()
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rotation2()
|
fn test_rotation2()
|
||||||
{
|
{
|
||||||
for uint::range(0u, 10000u) |_|
|
for 10000.times
|
||||||
{
|
{
|
||||||
let randmat = One::one::<Rotmat<Mat2<f64>>>();
|
let randmat = One::one::<Rotmat<Mat2<f64>>>();
|
||||||
let ang = &vec1(abs::<f64>(random()) % f64::consts::pi);
|
let ang = &vec1(abs::<f64>(random()) % Real::pi());
|
||||||
|
|
||||||
assert!(randmat.rotated(ang).rotation().approx_eq(ang));
|
assert!(randmat.rotated(ang).rotation().approx_eq(ang));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#[test]
|
#[test]
|
||||||
use core::num::{Zero, One};
|
use std::num::{Zero, One};
|
||||||
#[test]
|
#[test]
|
||||||
use core::rand::{random};
|
use std::rand::{random};
|
||||||
#[test]
|
#[test]
|
||||||
use core::vec::{all, all2};
|
use std::vec::{all, all2};
|
||||||
#[test]
|
#[test]
|
||||||
use core::cmp::ApproxEq;
|
use std::cmp::ApproxEq;
|
||||||
#[test]
|
#[test]
|
||||||
use dim3::vec3::Vec3;
|
use dim3::vec3::Vec3;
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -27,7 +27,7 @@ use traits::norm::Norm;
|
||||||
|
|
||||||
macro_rules! test_commut_dot_impl(
|
macro_rules! test_commut_dot_impl(
|
||||||
($t:ty) => (
|
($t:ty) => (
|
||||||
for uint::range(0u, 10000u) |_|
|
for 10000.times
|
||||||
{
|
{
|
||||||
let v1 : $t = random();
|
let v1 : $t = random();
|
||||||
let v2 : $t = random();
|
let v2 : $t = random();
|
||||||
|
@ -39,7 +39,7 @@ macro_rules! test_commut_dot_impl(
|
||||||
|
|
||||||
macro_rules! test_basis_impl(
|
macro_rules! test_basis_impl(
|
||||||
($t:ty) => (
|
($t:ty) => (
|
||||||
for uint::range(0u, 10000u) |_|
|
for 10000.times
|
||||||
{
|
{
|
||||||
let basis = Basis::canonical_basis::<$t>();
|
let basis = Basis::canonical_basis::<$t>();
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ macro_rules! test_basis_impl(
|
||||||
|
|
||||||
macro_rules! test_subspace_basis_impl(
|
macro_rules! test_subspace_basis_impl(
|
||||||
($t:ty) => (
|
($t:ty) => (
|
||||||
for uint::range(0u, 10000u) |_|
|
for 10000.times
|
||||||
{
|
{
|
||||||
let v : Vec3<f64> = random();
|
let v : Vec3<f64> = random();
|
||||||
let v1 = v.normalized();
|
let v1 = v.normalized();
|
||||||
|
@ -72,7 +72,7 @@ macro_rules! test_subspace_basis_impl(
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cross_vec3()
|
fn test_cross_vec3()
|
||||||
{
|
{
|
||||||
for uint::range(0u, 10000u) |_|
|
for 10000.times
|
||||||
{
|
{
|
||||||
let v1 : Vec3<f64> = random();
|
let v1 : Vec3<f64> = random();
|
||||||
let v2 : Vec3<f64> = random();
|
let v2 : Vec3<f64> = random();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use core::num::{One, Zero};
|
use std::num::{One, Zero};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trait of elements of a ring. A rings is an algebraic structure, the
|
* Trait of elements of a ring. A rings is an algebraic structure, the
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use core::num::Zero;
|
use std::num::Zero;
|
||||||
use traits::division_ring::DivisionRing;
|
use traits::division_ring::DivisionRing;
|
||||||
use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv};
|
use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue