diff --git a/src/ndim/nmat.rs b/src/ndim/nmat.rs index 34d37b5a..51b7317b 100644 --- a/src/ndim/nmat.rs +++ b/src/ndim/nmat.rs @@ -134,8 +134,7 @@ LMul> for NMat impl + Quot + Sub + Neg - > + Mul + Quot + Sub + Neg> Inv for NMat { fn inverse(&self) -> NMat @@ -161,7 +160,7 @@ Inv for NMat // instead? // FIXME: this is kind of uggly… - // … but we cannot use position_betwee since we are iterating on one + // … but we cannot use position_between since we are iterating on one // columns let mut n0 = 0u; // index of a non-zero entry diff --git a/src/traits/cross.rs b/src/traits/cross.rs index cf17a324..87fafae2 100644 --- a/src/traits/cross.rs +++ b/src/traits/cross.rs @@ -1,4 +1,5 @@ pub trait Cross { + /// Computes the cross product between two elements (usually vectors). fn cross(&self, other : &Self) -> Result; } diff --git a/src/traits/dim.rs b/src/traits/dim.rs index 00364f34..fd91c070 100644 --- a/src/traits/dim.rs +++ b/src/traits/dim.rs @@ -1,14 +1,25 @@ pub trait Dim { + /// The dimension of the object. fn dim() -> uint; } // Some dimension token. Useful to restrict the dimension of n-dimensional // object at the type-level. +/// Dimensional token for 0-dimensions. Dimensional tokens are the preferred +/// way to specify at the type level the dimension of n-dimensional objects. pub struct d0; +/// Dimensional token for 1-dimension. Dimensional tokens are the preferred +/// way to specify at the type level the dimension of n-dimensional objects. pub struct d1; +/// Dimensional token for 2-dimensions. Dimensional tokens are the preferred +/// way to specify at the type level the dimension of n-dimensional objects. pub struct d2; +/// Dimensional token for 3-dimensions. Dimensional tokens are the preferred +/// way to specify at the type level the dimension of n-dimensional objects. pub struct d3; +/// Dimensional token for 4-dimensions. Dimensional tokens are the preferred +/// way to specify at the type level the dimension of n-dimensional objects. pub struct d4; impl Dim for d0 diff --git a/src/traits/dot.rs b/src/traits/dot.rs index 4d57eeff..ead40d7f 100644 --- a/src/traits/dot.rs +++ b/src/traits/dot.rs @@ -1,6 +1,14 @@ pub trait Dot { + /// Computes the dot (inner) product of two objects. fn dot(&self, &Self) -> T; + /// Computes the norm a an object. fn norm(&self) -> T; + /** + * Computes the squared norm of an object. + * + * Computes the squared norm of an object. Computation of the squared norm + * is usually faster than the norm itself. + */ fn sqnorm(&self) -> T; // { self.dot(self); } } diff --git a/src/traits/inv.rs b/src/traits/inv.rs index ac995c77..4b5dc283 100644 --- a/src/traits/inv.rs +++ b/src/traits/inv.rs @@ -1,5 +1,7 @@ pub trait Inv { + /// Returns the inverse of an element. fn inverse(&self) -> Self; + /// Inplace version of `inverse`. fn invert(&mut self); } diff --git a/src/traits/transpose.rs b/src/traits/transpose.rs index 459adac2..4eedec92 100644 --- a/src/traits/transpose.rs +++ b/src/traits/transpose.rs @@ -1,6 +1,8 @@ // FIXME: valid only for square matrices… pub trait Transpose { + /// Computes the transpose of a matrix. fn transposed(&self) -> Self; + /// Inplace version of `transposed`. fn transpose(&mut self); }