Moving row/col slicing traits to a better place

This commit is contained in:
Vincent Barrielle 2014-05-09 23:05:23 +02:00
parent 5611307b4d
commit d1a58f960c
5 changed files with 19 additions and 16 deletions

View File

@ -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;

View File

@ -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)]

View File

@ -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;

View File

@ -244,17 +244,6 @@ pub trait Mean<N> {
fn mean(&Self) -> N;
}
/// Trait for objects that support column slicing
pub trait ColSlice<VecLike> {
/// 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<VecLike> {
/// 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 {

View File

@ -91,6 +91,18 @@ pub trait Col<C> {
// a lot of operations.
}
/// Trait to access part of a column of a matrix
pub trait ColSlice<C> {
/// 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<R> {
/// 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.