The module VECTOR


linalg/VECTOR.H

Generic implementations for vectors are gathered in the namespace VECTOR. These are generic functions, that can be used to build new linear classes. The type R must provide the following definitions or methods:
<B><PRE>
  typename  index_t 
  typename  value_type 
  index_t this-$>$ size() 
  value_type this-$>$ operator[](index_t) 
</PRE></B>
template < class R>  inline ostream & VECTOR::Print(ostream & os, const R & v)
Output function for general vectors: [v1, v2, ...].

template < class R>  inline istream & VECTOR::Read(istream & is, R & V)
Input operator for standard vectors. The input format is of the form s c0 c1 ... where s is the number of elements.

template < class V, class W>  void VECTOR::assign(V & a, const W & b)
Assignation of a vector to another.

template < class V, class I>  void VECTOR::reserve(V & a, I n)
Reserve the space in a for n entries.

template < class R, class I, class C>  void VECTOR::reserve(vector< R>  & a, I n, const C & v)
Reserve the space in a for n entries set to v.

template < class V, class W>  void VECTOR::plus(V & a, const W & b, const W & c)
Addition of two vectors.

template < class V, class W>  void VECTOR::plus(V & a, const W & b)
Addition of two vectors.

template < class V, class W>  void VECTOR::minus(V & a, const W & b, const W & c)
Substraction of two vectors.

template < class V, class W>  void VECTOR::minus(V & a, const W & b)
Substraction of two vectors.

template < class V, class W>  void VECTOR::mult(V & a, const V & b, const W & c)
Scalar multiplication.

template < class V, class W>  void VECTOR::mult(V & a, const W & c)
Inplace scalar multiplication.

template < class V, class W>  void VECTOR::div(V & a, const W & c)
Inplace scalar division.

template < class C, class R>  C VECTOR::norm(const R & v)
The default norm of a vector is the L2 norm.

template < class R>  RealOf< typename R::value_type> ::TYPE VECTOR::norm(const R & v, unsigned int n)
The L2 norm of the subvector vector of size n.

template < class C,class R>  C VECTOR::norm(const R & v, int p)
Norm Lp of a vector.

template < class R, class S>  typename R::value_type VECTOR::prod(const S & v, const R & w)
Innerproduct of two vectors.