Moved DivisionRing to ring.rs.
This commit is contained in:
parent
344d761be5
commit
cead4f8410
|
@ -1,7 +1,7 @@
|
|||
use std::num::{One, Zero};
|
||||
use std::rand::{Rand, Rng, RngUtil};
|
||||
use std::cmp::ApproxEq;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::ring::DivisionRing;
|
||||
use traits::rlmul::{RMul, LMul};
|
||||
use traits::cross::Cross;
|
||||
use traits::dim::Dim;
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::rand::{Rand, Rng, RngUtil};
|
|||
use std::cmp::ApproxEq;
|
||||
use traits::dim::Dim;
|
||||
use traits::inv::Inv;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::ring::DivisionRing;
|
||||
use traits::rotation::{Rotation, Rotate, Rotatable};
|
||||
use traits::translation::{Translation, Translate, Translatable};
|
||||
use Ts = traits::transformation::Transform;
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::num::{One, Zero};
|
|||
use std::vec::from_elem;
|
||||
use std::cmp::ApproxEq;
|
||||
use traits::inv::Inv;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::ring::DivisionRing;
|
||||
use traits::transpose::Transpose;
|
||||
use traits::rlmul::{RMul, LMul};
|
||||
use dvec::{DVec, zero_vec_with_dim};
|
||||
|
|
|
@ -4,8 +4,7 @@ use std::vec::from_elem;
|
|||
use std::cmp::ApproxEq;
|
||||
use std::iterator::FromIterator;
|
||||
use traits::iterable::{Iterable, IterableMut};
|
||||
use traits::ring::Ring;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::ring::{Ring, DivisionRing};
|
||||
use traits::dot::Dot;
|
||||
use traits::sub_dot::SubDot;
|
||||
use traits::norm::Norm;
|
||||
|
|
|
@ -6,9 +6,8 @@ use std::cmp::ApproxEq;
|
|||
use std::vec::{VecIterator, VecMutIterator};
|
||||
use vec::{Vec1, Vec2, Vec3, Vec4, Vec5, Vec6};
|
||||
use traits::dim::Dim;
|
||||
use traits::ring::Ring;
|
||||
use traits::ring::{Ring, DivisionRing};
|
||||
use traits::inv::Inv;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::transpose::Transpose;
|
||||
use traits::rlmul::{RMul, LMul};
|
||||
use traits::transformation::Transform;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::num::{Zero, One};
|
||||
use mat::{Mat1, Mat2, Mat3};
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::ring::DivisionRing;
|
||||
use traits::inv::Inv;
|
||||
|
||||
// some specializations:
|
||||
|
@ -52,7 +52,8 @@ Inv for Mat2<N> {
|
|||
false
|
||||
}
|
||||
else {
|
||||
*self = Mat2::new(self.m22 / det , -self.m12 / det,
|
||||
*self = Mat2::new(
|
||||
self.m22 / det , -self.m12 / det,
|
||||
-self.m21 / det, self.m11 / det);
|
||||
|
||||
true
|
||||
|
|
|
@ -64,7 +64,6 @@ pub mod traits
|
|||
pub mod transformation;
|
||||
pub mod vector_space;
|
||||
pub mod ring;
|
||||
pub mod division_ring;
|
||||
pub mod sub_dot;
|
||||
pub mod rlmul;
|
||||
pub mod scalar_op;
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
use traits::ring::Ring;
|
||||
|
||||
/**
|
||||
* Trait of elements of a division ring. A division ring is an algebraic
|
||||
* structure like a ring, but with the division operator.
|
||||
*/
|
||||
pub trait DivisionRing : Ring + Div<Self, Self>
|
||||
{ }
|
||||
|
||||
impl<N: Ring + Div<N, N>> DivisionRing for N;
|
|
@ -11,3 +11,12 @@ Sub<Self, Self> + Add<Self, Self> + Neg<Self> + Mul<Self, Self> + One + Zero { }
|
|||
|
||||
impl<N: Sub<N, N> + Add<N, N> + Neg<N> + Mul<N, N> + One + Zero>
|
||||
Ring for N;
|
||||
|
||||
/**
|
||||
* Trait of elements of a division ring. A division ring is an algebraic
|
||||
* structure like a ring, but with the division operator.
|
||||
*/
|
||||
pub trait DivisionRing : Ring + Div<Self, Self>
|
||||
{ }
|
||||
|
||||
impl<N: Ring + Div<N, N>> DivisionRing for N;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::num::Zero;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::ring::DivisionRing;
|
||||
use traits::scalar_op::{ScalarMul, ScalarDiv};
|
||||
|
||||
/// Trait of elements of a vector space. A vector space is an algebraic
|
||||
|
@ -7,8 +7,7 @@ use traits::scalar_op::{ScalarMul, ScalarDiv};
|
|||
/// scalar multiplication (the scalar being a element of a `DivisionRing`), and
|
||||
/// has a distinct element (`Zero`) neutral wrt the addition.
|
||||
pub trait VectorSpace<N>
|
||||
: Sub<Self, Self> + Add<Self, Self> + Neg<Self> + Zero +
|
||||
ScalarMul<N> + ScalarDiv<N> { }
|
||||
: Sub<Self, Self> + Add<Self, Self> + Neg<Self> + Zero + ScalarMul<N> + ScalarDiv<N> { }
|
||||
|
||||
impl<V: Sub<V, V> + Add<V, V> + Neg<V> + Zero + ScalarMul<N> + ScalarDiv<N>,
|
||||
N: DivisionRing> VectorSpace<N> for V;
|
||||
|
|
|
@ -7,8 +7,7 @@ use std::cmp::ApproxEq;
|
|||
use traits::basis::Basis;
|
||||
use traits::dim::Dim;
|
||||
use traits::translation::{Translation, Translatable};
|
||||
use traits::ring::Ring;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::ring::{Ring, DivisionRing};
|
||||
use traits::homogeneous::{FromHomogeneous, ToHomogeneous};
|
||||
use traits::indexable::Indexable;
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ use traits::sub_dot::SubDot;
|
|||
use traits::norm::Norm;
|
||||
use traits::translation::{Translation, Translatable};
|
||||
use traits::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub};
|
||||
use traits::ring::Ring;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::ring::{Ring, DivisionRing};
|
||||
use traits::indexable::Indexable;
|
||||
use vec;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::num::{Zero, One};
|
||||
use traits::basis::Basis;
|
||||
use traits::cross::Cross;
|
||||
use traits::division_ring::DivisionRing;
|
||||
use traits::ring::DivisionRing;
|
||||
use traits::norm::Norm;
|
||||
use traits::sample::UniformSphereSample;
|
||||
use vec::{Vec1, Vec2, Vec3};
|
||||
|
|
Loading…
Reference in New Issue