Logo MTL4

mtl::vector Namespace Reference

Namespace for vectors and views and operations exclusively on vectors. More...


Namespaces

namespace  fixed
 Namespace for fixed vector dimension types.
namespace  non_fixed
 Namespace for non-fixed vector dimension types, i.e. size dynamically determined at run-time.

Classes

struct  crtp_assign< Vector, mat_cvec_times_expr< E1, E2 > >
 Assign matrix vector product by calling mult. More...
struct  crtp_assign< Vector, Value[Rows]>
 Assign c-style 1D-array, because it's easier to initialize. More...
struct  crtp_plus_assign< Vector, mat_cvec_times_expr< E1, E2 > >
 Assign-add matrix vector product by calling mult. More...
struct  crtp_minus_assign< Vector, mat_cvec_times_expr< E1, E2 > >
 Assign-add matrix vector product by calling mult. More...
struct  crtp_vector_assign
 Base class to provide vector assignment operators generically. More...
struct  vec_const_ref_expr
 Class for providing interface for a vector given as reference. More...

Functions

template<typename T >
mtl::traits::enable_if_vector
< T, T & >::type 
crop (T &x)
 Remove all zero entries from a collection.
template<typename Vector1 , typename Vector2 >
detail::dot_result< Vector1,
Vector2 >::type 
dot (const Vector1 &v1, const Vector2 &v2)
 Dot product defined as hermitian(v) * w.
template<typename Vector1 , typename Vector2 >
detail::dot_result< Vector1,
Vector2 >::type 
dot_real (const Vector1 &v1, const Vector2 &v2)
 Dot product without conjugate defined as trans(v) * w.
template<unsigned long Unroll, typename Vector >
traits::enable_if_vector
< Vector, typename
RealMagnitude< typename
Collection< Vector >
::value_type >::type >::type 
infinity_norm (const Vector &vector)
template<typename Factor , typename Vector >
traits::enable_if_vector
< Vector, Vector & >::type 
left_scale_inplace (const Factor &alpha, Vector &v)
 Scale vector c from left with scalar or matrix factor alpha; c is altered.
template<typename VectorReal , typename VectorImaginary , typename VectorComplex >
void merge_complex_vector (const VectorReal &r, const VectorImaginary &i, VectorComplex &c)
 Merge two real-valued vectors into one complex-valued vector.
template<unsigned long Unroll, typename Vector >
traits::enable_if_vector
< Vector, typename
RealMagnitude< typename
Collection< Vector >
::value_type >::type >::type 
one_norm (const Vector &vector)
template<typename Op1 , typename Op2 >
mtl::traits::vec_mult_result
< Op1, Op2 >::type 
operator* (const Op1 &op1, const Op2 &op2)
 Multiplication for all supported types of operations.
template<typename Op1 , typename Op2 >
traits::div_result< Op1, Op2 >
::type 
operator/ (const Op1 &op1, const Op2 &op2)
 Division of matrices and vectors by salars.
template<typename Value >
void orth (Value &value)
template<typename Value >
void orth (Value &value, typename mtl::Collection< Value >::size_type i)
template<typename Value >
dense2D< typename
mtl::Collection< typename
mtl::Collection< Value >
::value_type >::value_type > 
orthogonalize_factors (Value &v)
template<typename VectorComplex , typename VectorReal , typename VectorImaginary >
void split_complex_vector (const VectorComplex &c, VectorReal &r, VectorImaginary &i)
 Split one complex-valued vector into two real-valued vectors.
template<unsigned long Unroll, typename Value >
RealMagnitude< typename
Collection< Value >
::value_type >::type 
two_norm (const Value &value)


Detailed Description

Namespace for vectors and views and operations exclusively on vectors.


Function Documentation

template<typename T >
mtl::traits::enable_if_vector<T, T&>::type mtl::vector::crop ( T &  x  )  [inline]

Remove all zero entries from a collection.

Does nothing for dense collections

template<typename Vector1 , typename Vector2 >
detail::dot_result< Vector1, Vector2 >::type mtl::vector::dot ( const Vector1 &  v1,
const Vector2 &  v2 
) [inline]

Dot product defined as hermitian(v) * w.

Dot product with user-specified unrolling defined as hermitian(v) * w.

Unrolled eight times by default

template<typename Vector1 , typename Vector2 >
detail::dot_result< Vector1, Vector2 >::type mtl::vector::dot_real ( const Vector1 &  v1,
const Vector2 &  v2 
) [inline]

Dot product without conjugate defined as trans(v) * w.

Dot product without conjugate with user-specified unrolling defined as trans(v) * w.

Unrolled eight times by default

template<unsigned long Unroll, typename Vector >
mtl::traits::enable_if_vector< Vector, typename RealMagnitude< typename Collection< Vector >::value_type >::type >::type mtl::vector::infinity_norm ( const Vector &  vector  )  [inline]

Infinity-norm for vectors: infinity_norm(x) $\rightarrow |x|_\infty$.

Return values:
The magnitude type of the respective value type, see Magnitude.
The norms are defined as $|v|_\infty=\max_i |v_i|$.

Vector norms are unrolled 8-fold by default. An n-fold unrolling can be generated with infinity_norm<n>(x). The maximum for n is 8 (it might be increased later).

template<typename VectorReal , typename VectorImaginary , typename VectorComplex >
void mtl::vector::merge_complex_vector ( const VectorReal &  r,
const VectorImaginary &  i,
VectorComplex &  c 
) [inline]

Merge two real-valued vectors into one complex-valued vector.

Elements of the complex vector must be constructible from two real elements. Complex vector is resized if its size is 0 otherwise the vectors must have the same length.

template<unsigned long Unroll, typename Vector >
traits::enable_if_vector< Vector, typename RealMagnitude< typename Collection< Vector >::value_type >::type >::type mtl::vector::one_norm ( const Vector &  vector  )  [inline]

One-norm for vectors: one_norm(x) $\rightarrow |x|_1$.

Return values:
The magnitude type of the respective value type, see Magnitude.
The norms are defined as $|v|_1=\sum_i |v_i|$. Vector norms are unrolled 8-fold by default. An n-fold unrolling can be generated with one_norm<n>(x). The maximum for n is 8 (it might be increased later).

template<typename Op1 , typename Op2 >
mtl::traits::vec_mult_result<Op1, Op2>::type mtl::vector::operator* ( const Op1 &  op1,
const Op2 &  op2 
) [inline]

Multiplication for all supported types of operations.

Enable-if-like technique make sure that only called when properly defined

template<typename Op1 , typename Op2 >
traits::div_result<Op1,Op2>::type mtl::vector::operator/ ( const Op1 &  op1,
const Op2 &  op2 
) [inline]

Division of matrices and vectors by salars.

Enable-if-like technique make sure that only called when properly defined

template<typename Value >
void mtl::vector::orth ( Value &  value,
typename mtl::Collection< Value >::size_type  i 
) [inline]

Orthonormalize the i-th entry of a vector of vectors.

The i-th vector is orthogonalized w.r.t. to the preceeding ones and consecutively normalized. The outer type must be a random access collection and the vector type must provide a dot function. For instance dense_vector<dense_vector<double> > or std::vector<dense_vector<std::complex<double> > > are eligible. It is planned to implement the function for matrices as well where the columns will be ortho-normalized.

template<typename Value >
void mtl::vector::orth ( Value &  value  )  [inline]

Orthonormalize a vector of vectors.

The outer type must be a random access collection and the vector type must provide a dot function. For instance dense_vector<dense_vector<double> > or std::vector<dense_vector<std::complex<double> > > are eligible. It is planned to implement the function for matrices as well where the columns will be ortho-normalized.

template<typename Value >
dense2D<typename mtl::Collection <typename mtl::Collection<Value>::value_type >::value_type > mtl::vector::orthogonalize_factors ( Value &  v  )  [inline]

Orthogonalize a vector of vectors.

Opposed to orth the vectors are not normalized. An upper matrix with the factors used in the orthogonalization is returned. The diagonal contains dot(v[i], v[i]). The returned factors are for instance used in bicgstab_ell. The outer type must be a random access collection and the vector type must provide a dot function. For instance dense_vector<dense_vector<double> > or std::vector<dense_vector<std::complex<double> > > are eligible.

template<typename VectorComplex , typename VectorReal , typename VectorImaginary >
void mtl::vector::split_complex_vector ( const VectorComplex &  c,
VectorReal &  r,
VectorImaginary &  i 
) [inline]

Split one complex-valued vector into two real-valued vectors.

Elements of the real vector must be assignable from the real and imaginary part of the complex elements. Real vectors are resized if their size is 0 otherwise the vectors must have the same length.

template<unsigned long Unroll, typename Value >
RealMagnitude< typename Collection< Value >::value_type >::type mtl::vector::two_norm ( const Value &  value  )  [inline]

Two-norm for vectors: two_norm(x) $\rightarrow |x|_2$.

Return values:
The magnitude type of the respective value type, see Magnitude. The norms are defined as $|v|_2=\sqrt{\sum_i |v_i|^2}$.
Vector norms are unrolled 8-fold by default. An n-fold unrolling can be generated with two_norm<n>(x). The maximum for n is 8 (it might be increased later).


mtl::vector Namespace Reference -- MTL 4 -- Peter Gottschling and Andrew Lumsdaine -- Generated on 24 Aug 2009 by Doxygen 1.5.9 -- Copyright 2008-09 by TU Dresden and the Trustees of Indiana University.