Merged the {vec, mat} and {vec, mat}_impl modules.

This commit is contained in:
Sébastien Crozet 2013-07-22 11:35:36 +02:00
parent ff24f70332
commit 3a64e05c62
4 changed files with 52 additions and 63 deletions

View File

@ -5,7 +5,7 @@ use traits::dim::Dim;
use traits::inv::Inv; use traits::inv::Inv;
use traits::rotation::{Rotation, Rotate, Rotatable}; use traits::rotation::{Rotation, Rotate, Rotatable};
use traits::translation::{Translation, Translate, Translatable}; use traits::translation::{Translation, Translate, Translatable};
use traits::transformation; use Ts = traits::transformation::Transform;
use traits::transformation::{Transformation, Transformable}; use traits::transformation::{Transformation, Transformable};
use traits::rlmul::{RMul, LMul}; use traits::rlmul::{RMul, LMul};
use traits::homogeneous::{ToHomogeneous, FromHomogeneous}; use traits::homogeneous::{ToHomogeneous, FromHomogeneous};
@ -192,8 +192,8 @@ Transformation<Transform<M, V>> for Transform<M, V>
{ *self = other * *self; } { *self = other * *self; }
} }
impl<M: transformation::Transform<V>, V: Add<V, V> + Sub<V, V>> impl<M: Ts<V>, V: Add<V, V> + Sub<V, V>>
transformation::Transform<V> for Transform<M, V> Ts<V> for Transform<M, V>
{ {
#[inline] #[inline]
fn transform_vec(&self, v: &V) -> V fn transform_vec(&self, v: &V) -> V

View File

@ -17,6 +17,14 @@ use traits::indexable::Indexable;
use traits::column::Column; use traits::column::Column;
use traits::iterable::{Iterable, IterableMut}; use traits::iterable::{Iterable, IterableMut};
pub use traits::column::*;
pub use traits::inv::*;
pub use traits::rlmul::*;
pub use traits::rotation::*;
pub use traits::transformation::*;
pub use traits::translation::*;
pub use traits::transpose::*;
mod mat_macros; mod mat_macros;
#[deriving(Eq, Ord, Encodable, Decodable, Clone, DeepClone, IterBytes, Rand, Zero, ToStr)] #[deriving(Eq, Ord, Encodable, Decodable, Clone, DeepClone, IterBytes, Rand, Zero, ToStr)]

View File

@ -15,8 +15,8 @@ extern mod extra;
mod dmat; mod dmat;
mod dvec; mod dvec;
mod vec_impl; pub mod vec;
mod mat_impl; pub mod mat;
// specialization for some 1d, 2d and 3d operations // specialization for some 1d, 2d and 3d operations
pub mod mat_spec; pub mod mat_spec;
@ -30,64 +30,39 @@ pub mod adaptors
pub mod transform; pub mod transform;
} }
pub mod vec pub mod num
{ {
pub use vec_impl::*;
pub use dvec::*;
pub use traits::sample::*;
pub use traits::dot::*;
pub use traits::cross::*;
pub use traits::basis::*;
pub use traits::norm::*;
pub use traits::vector_space::*;
pub use traits::sub_dot::*;
pub use traits::scalar_op::*;
}
pub mod mat
{
pub use mat_impl::*;
pub use dmat::*;
pub use traits::column::*;
pub use traits::inv::*;
pub use traits::transpose::*;
pub use traits::rotation::*;
pub use traits::translation::*;
pub use traits::transformation::*;
}
/// Useful linear-algebra related traits.
pub mod traits
{
pub use traits::indexable::*;
pub use traits::iterable::*;
pub use traits::dim::*; pub use traits::dim::*;
pub use traits::homogeneous::*;
pub use traits::ring::*; pub use traits::ring::*;
pub use traits::division_ring::*; pub use traits::division_ring::*;
pub use traits::rlmul::*; }
pub use traits::homogeneous::*;
pub mod sample; // FIXME: it would be better to hide all those from the outside!
pub mod indexable; /// Useful linear-algebra related traits.
pub mod column; mod traits
pub mod iterable; {
pub mod dot; mod sample;
pub mod cross; mod indexable;
pub mod inv; mod column;
pub mod transpose; mod iterable;
pub mod dim; mod dot;
pub mod basis; mod cross;
pub mod norm; mod inv;
pub mod rotation; mod transpose;
pub mod translation; mod dim;
pub mod transformation; mod basis;
pub mod vector_space; mod norm;
pub mod ring; mod rotation;
pub mod division_ring; mod translation;
pub mod sub_dot; mod transformation;
pub mod rlmul; mod vector_space;
pub mod scalar_op; mod ring;
pub mod homogeneous; mod division_ring;
mod sub_dot;
mod rlmul;
mod scalar_op;
mod homogeneous;
} }
#[cfg(test)] #[cfg(test)]

View File

@ -5,19 +5,25 @@ use std::vec::{VecIterator, VecMutIterator};
use std::iterator::{Iterator, IteratorUtil, FromIterator}; use std::iterator::{Iterator, IteratorUtil, FromIterator};
use std::cmp::ApproxEq; use std::cmp::ApproxEq;
use std::uint::iterate; use std::uint::iterate;
use traits::iterable::{Iterable, IterableMut};
use traits::basis::Basis; use traits::basis::Basis;
use traits::dim::Dim; use traits::dim::Dim;
use traits::dot::Dot;
use traits::sub_dot::SubDot;
use traits::norm::Norm;
use traits::translation::{Translation, Translatable}; use traits::translation::{Translation, Translatable};
use traits::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub};
use traits::ring::Ring; use traits::ring::Ring;
use traits::division_ring::DivisionRing; use traits::division_ring::DivisionRing;
use traits::homogeneous::{FromHomogeneous, ToHomogeneous}; use traits::homogeneous::{FromHomogeneous, ToHomogeneous};
use traits::indexable::Indexable; use traits::indexable::Indexable;
pub use traits::basis::*;
pub use traits::cross::*;
pub use traits::dot::*;
pub use traits::indexable::*;
pub use traits::iterable::*;
pub use traits::norm::*;
pub use traits::sample::*;
pub use traits::sub_dot::*;
pub use traits::vector_space::*;
pub use traits::scalar_op::*;
mod vec_macros; mod vec_macros;
#[deriving(Eq, Ord, Encodable, Decodable, Clone, DeepClone, Rand, Zero, ToStr)] #[deriving(Eq, Ord, Encodable, Decodable, Clone, DeepClone, Rand, Zero, ToStr)]