diff --git a/src/linalg/decompositions.rs b/src/linalg/decompositions.rs index bee21f37..0c957682 100644 --- a/src/linalg/decompositions.rs +++ b/src/linalg/decompositions.rs @@ -1,7 +1,8 @@ use std::num::{Zero, Float}; use na::DVec; use na::DMat; -use traits::operations::{Transpose, ColSlice}; +use traits::operations::Transpose; +use traits::structure::ColSlice; use traits::geometry::Norm; use std::cmp::min; diff --git a/src/structs/dmat.rs b/src/structs/dmat.rs index ac9cac7c..8fac029c 100644 --- a/src/structs/dmat.rs +++ b/src/structs/dmat.rs @@ -8,8 +8,8 @@ use std::num::{One, Zero}; use traits::operations::ApproxEq; use std::mem; use structs::dvec::{DVec, DVecMulRhs}; -use traits::operations::{Inv, Transpose, Mean, Cov, ColSlice, RowSlice}; -use traits::structure::Cast; +use traits::operations::{Inv, Transpose, Mean, Cov}; +use traits::structure::{Cast, ColSlice, RowSlice}; use std::fmt::{Show, Formatter, Result}; #[doc(hidden)] diff --git a/src/traits/mod.rs b/src/traits/mod.rs index c973e80a..9c774d80 100644 --- a/src/traits/mod.rs +++ b/src/traits/mod.rs @@ -5,10 +5,11 @@ pub use self::geometry::{AbsoluteRotate, Cross, CrossMatrix, Dot, FromHomogeneou Transform, Transformation, Translate, Translation, UniformSphereSample}; pub use self::structure::{FloatVec, FloatVecExt, Basis, Cast, Col, Dim, Indexable, - Iterable, IterableMut, Mat, Row, AnyVec, VecExt}; + Iterable, IterableMut, Mat, Row, AnyVec, VecExt, + ColSlice, RowSlice}; pub use self::operations::{Absolute, ApproxEq, Cov, Inv, LMul, Mean, Outer, PartialOrd, RMul, - ScalarAdd, ScalarSub, Transpose, ColSlice, RowSlice}; + ScalarAdd, ScalarSub, Transpose}; pub use self::operations::{PartialOrdering, PartialLess, PartialEqual, PartialGreater, NotComparable}; pub mod geometry; diff --git a/src/traits/operations.rs b/src/traits/operations.rs index 34f38d9a..b71a1ff2 100644 --- a/src/traits/operations.rs +++ b/src/traits/operations.rs @@ -244,17 +244,6 @@ pub trait Mean { fn mean(&Self) -> N; } -/// Trait for objects that support column slicing -pub trait ColSlice { - /// Returns a view to a slice of a column of a matrix. - fn col_slice(&self, col_id :uint, row_start: uint, row_end: uint) -> VecLike; -} - -/// Trait for objects that support column slicing -pub trait RowSlice { - /// Returns a view to a slice of a row of a matrix. - fn row_slice(&self, row_id :uint, col_start: uint, col_end: uint) -> VecLike; -} // /// Cholesky decomposition. // pub trait Chol { diff --git a/src/traits/structure.rs b/src/traits/structure.rs index db0f1be9..eb86190a 100644 --- a/src/traits/structure.rs +++ b/src/traits/structure.rs @@ -91,6 +91,18 @@ pub trait Col { // a lot of operations. } +/// Trait to access part of a column of a matrix +pub trait ColSlice { + /// Returns a view to a slice of a column of a matrix. + fn col_slice(&self, col_id :uint, row_start: uint, row_end: uint) -> C; +} + +/// Trait to access part of a row of a matrix +pub trait RowSlice { + /// Returns a view to a slice of a row of a matrix. + fn row_slice(&self, row_id :uint, col_start: uint, col_end: uint) -> R; +} + /// Trait of objects having a spacial dimension known at compile time. pub trait Dim { /// The dimension of the object.