Boost.uBlas 1.49
Linear Algebra in C++: matrices, vectors and numeric algorithms

boost::numeric::ublas::unit_vector< T, ALLOC > Class Template Reference

unit_vector represents a canonical unit vector unit_vector represents a canonical unit vector. The k-th unit vector of dimension $n$ holds 0 for every value $u_i$ s.t. $i \neq k$ and 1 when $i=k$. At construction, the value k is given after the dimension of the vector. More...

#include <vector.hpp>

Inheritance diagram for boost::numeric::ublas::unit_vector< T, ALLOC >:
Collaboration diagram for boost::numeric::ublas::unit_vector< T, ALLOC >:

List of all members.

Classes

class  const_iterator

Public Types

typedef vector_reference
< self_type
closure_type
typedef const vector_reference
< const self_type
const_closure_type
typedef const T & const_reference
typedef reverse_iterator_base
< const_iterator
const_reverse_iterator
typedef unit_vector< T, ALLOC > container_type
typedef ALLOC::difference_type difference_type
typedef unit_vector< T, ALLOC > expression_type
typedef const_iterator iterator
typedef T & reference
typedef ALLOC::size_type size_type
typedef sparse_tag storage_category
typedef vector_tag type_category
typedef T value_type

Public Member Functions

BOOST_UBLAS_INLINE unit_vector ()
 Simple constructor with dimension and index 0.
BOOST_UBLAS_INLINE unit_vector (size_type size, size_type index=0)
 Constructor of unit_vector.
BOOST_UBLAS_INLINE unit_vector (const unit_vector &v)
 Copy-constructor.
BOOST_UBLAS_INLINE unit_vectorassign_temporary (unit_vector &v)
BOOST_UBLAS_INLINE const_iterator begin () const
BOOST_UBLAS_INLINE const_iterator end () const
BOOST_UBLAS_INLINE const_iterator find (size_type i) const
BOOST_UBLAS_INLINE const_pointer find_element (size_type i) const
 Return a const pointer to the element of index i.
BOOST_UBLAS_INLINE size_type index () const
 Return the order of the unit vector.
BOOST_UBLAS_INLINE const_reference operator() (size_type i) const
BOOST_UBLAS_INLINE const
container_type
operator() () const
BOOST_UBLAS_INLINE container_typeoperator() ()
BOOST_UBLAS_INLINE unit_vectoroperator= (const unit_vector &v)
BOOST_UBLAS_INLINE const_reference operator[] (size_type i) const
BOOST_UBLAS_INLINE
const_reverse_iterator 
rbegin () const
BOOST_UBLAS_INLINE
const_reverse_iterator 
rend () const
BOOST_UBLAS_INLINE void resize (size_type size, bool=true)
 Resize the vector. The values are preserved by default (i.e. the index does not change)
template<class Archive >
void serialize (Archive &ar, const unsigned int)
BOOST_UBLAS_INLINE size_type size () const
 Return the size (dimension) of the vector.
BOOST_UBLAS_INLINE void swap (unit_vector &v)

Static Public Attributes

static const unsigned complexity

Private Types

typedef const T * const_pointer
typedef bool const_subiterator_type
typedef const value_type const_value_type
typedef unit_vector< T, ALLOC > self_type

Private Attributes

size_type index_
size_type size_

Static Private Attributes

static const_value_type one_
static const_value_type zero_ = T()

Friends

BOOST_UBLAS_INLINE friend void swap (unit_vector &v1, unit_vector &v2)

Detailed Description

template<class T, class ALLOC>
class boost::numeric::ublas::unit_vector< T, ALLOC >

unit_vector represents a canonical unit vector unit_vector represents a canonical unit vector. The k-th unit vector of dimension $n$ holds 0 for every value $u_i$ s.t. $i \neq k$ and 1 when $i=k$. At construction, the value k is given after the dimension of the vector.

Template Parameters:
Tis the type of elements in the vector. They must be 0 and 1 assignable in order for the vector to have its unit-vector semantic.
ALLOCa specific allocator can be specified if needed. Most of the time this parameter is omited.

Definition at line 1075 of file vector.hpp.


Member Typedef Documentation

template<class T, class ALLOC>
typedef const T* boost::numeric::ublas::unit_vector< T, ALLOC >::const_pointer [private]

Definition at line 1078 of file vector.hpp.

template<class T, class ALLOC>
typedef unit_vector<T, ALLOC> boost::numeric::ublas::unit_vector< T, ALLOC >::self_type [private]

Definition at line 1079 of file vector.hpp.

template<class T, class ALLOC>
typedef ALLOC::size_type boost::numeric::ublas::unit_vector< T, ALLOC >::size_type

Definition at line 1084 of file vector.hpp.

template<class T, class ALLOC>
typedef ALLOC::difference_type boost::numeric::ublas::unit_vector< T, ALLOC >::difference_type

Definition at line 1085 of file vector.hpp.

template<class T, class ALLOC>
typedef T boost::numeric::ublas::unit_vector< T, ALLOC >::value_type

Definition at line 1086 of file vector.hpp.

template<class T, class ALLOC>
typedef const T& boost::numeric::ublas::unit_vector< T, ALLOC >::const_reference

Definition at line 1087 of file vector.hpp.

template<class T, class ALLOC>
typedef T& boost::numeric::ublas::unit_vector< T, ALLOC >::reference

Definition at line 1088 of file vector.hpp.

template<class T, class ALLOC>
typedef const vector_reference<const self_type> boost::numeric::ublas::unit_vector< T, ALLOC >::const_closure_type

Definition at line 1089 of file vector.hpp.

template<class T, class ALLOC>
typedef vector_reference<self_type> boost::numeric::ublas::unit_vector< T, ALLOC >::closure_type

Definition at line 1090 of file vector.hpp.

template<class T, class ALLOC>
typedef sparse_tag boost::numeric::ublas::unit_vector< T, ALLOC >::storage_category

Definition at line 1091 of file vector.hpp.

template<class T, class ALLOC>
typedef bool boost::numeric::ublas::unit_vector< T, ALLOC >::const_subiterator_type [private]

Definition at line 1194 of file vector.hpp.

template<class T, class ALLOC>
typedef const_iterator boost::numeric::ublas::unit_vector< T, ALLOC >::iterator

Definition at line 1269 of file vector.hpp.

Definition at line 1281 of file vector.hpp.

template<class T, class ALLOC>
typedef const value_type boost::numeric::ublas::unit_vector< T, ALLOC >::const_value_type [private]

Definition at line 1306 of file vector.hpp.

typedef unit_vector< T, ALLOC > boost::numeric::ublas::vector_container< unit_vector< T, ALLOC > >::container_type [inherited]

Definition at line 281 of file expression_types.hpp.


Constructor & Destructor Documentation

template<class T, class ALLOC>
BOOST_UBLAS_INLINE boost::numeric::ublas::unit_vector< T, ALLOC >::unit_vector ( ) [inline]

Simple constructor with dimension and index 0.

Definition at line 1096 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE boost::numeric::ublas::unit_vector< T, ALLOC >::unit_vector ( size_type  size,
size_type  index = 0 
) [inline, explicit]

Constructor of unit_vector.

Parameters:
sizeis the dimension of the vector
indexis the order of the vector

Definition at line 1104 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE boost::numeric::ublas::unit_vector< T, ALLOC >::unit_vector ( const unit_vector< T, ALLOC > &  v) [inline]

Copy-constructor.

Definition at line 1110 of file vector.hpp.


Member Function Documentation

template<class T, class ALLOC>
BOOST_UBLAS_INLINE size_type boost::numeric::ublas::unit_vector< T, ALLOC >::size ( ) const [inline]

Return the size (dimension) of the vector.

Definition at line 1119 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE size_type boost::numeric::ublas::unit_vector< T, ALLOC >::index ( ) const [inline]

Return the order of the unit vector.

Definition at line 1125 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE void boost::numeric::ublas::unit_vector< T, ALLOC >::resize ( size_type  size,
bool  = true 
) [inline]

Resize the vector. The values are preserved by default (i.e. the index does not change)

Parameters:
sizeis the new size of the vector

Definition at line 1135 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE const_pointer boost::numeric::ublas::unit_vector< T, ALLOC >::find_element ( size_type  i) const [inline]

Return a const pointer to the element of index i.

Definition at line 1144 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE const_reference boost::numeric::ublas::unit_vector< T, ALLOC >::operator() ( size_type  i) const [inline]

Definition at line 1153 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE const_reference boost::numeric::ublas::unit_vector< T, ALLOC >::operator[] ( size_type  i) const [inline]

Definition at line 1161 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE unit_vector& boost::numeric::ublas::unit_vector< T, ALLOC >::operator= ( const unit_vector< T, ALLOC > &  v) [inline]

Definition at line 1167 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE unit_vector& boost::numeric::ublas::unit_vector< T, ALLOC >::assign_temporary ( unit_vector< T, ALLOC > &  v) [inline]

Definition at line 1173 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE void boost::numeric::ublas::unit_vector< T, ALLOC >::swap ( unit_vector< T, ALLOC > &  v) [inline]

Definition at line 1180 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE const_iterator boost::numeric::ublas::unit_vector< T, ALLOC >::find ( size_type  i) const [inline]

Definition at line 1200 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE const_iterator boost::numeric::ublas::unit_vector< T, ALLOC >::begin ( ) const [inline]

Definition at line 1272 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE const_iterator boost::numeric::ublas::unit_vector< T, ALLOC >::end ( ) const [inline]

Definition at line 1276 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE const_reverse_iterator boost::numeric::ublas::unit_vector< T, ALLOC >::rbegin ( ) const [inline]

Definition at line 1284 of file vector.hpp.

template<class T, class ALLOC>
BOOST_UBLAS_INLINE const_reverse_iterator boost::numeric::ublas::unit_vector< T, ALLOC >::rend ( ) const [inline]

Definition at line 1288 of file vector.hpp.

template<class T, class ALLOC>
template<class Archive >
void boost::numeric::ublas::unit_vector< T, ALLOC >::serialize ( Archive &  ar,
const unsigned  int 
) [inline]

Definition at line 1294 of file vector.hpp.

BOOST_UBLAS_INLINE const container_type& boost::numeric::ublas::vector_container< unit_vector< T, ALLOC > >::operator() ( ) const [inline, inherited]
BOOST_UBLAS_INLINE container_type& boost::numeric::ublas::vector_container< unit_vector< T, ALLOC > >::operator() ( ) [inline, inherited]

Friends And Related Function Documentation

template<class T, class ALLOC>
BOOST_UBLAS_INLINE friend void swap ( unit_vector< T, ALLOC > &  v1,
unit_vector< T, ALLOC > &  v2 
) [friend]

Definition at line 1187 of file vector.hpp.


Member Data Documentation

template<class T, class ALLOC>
size_type boost::numeric::ublas::unit_vector< T, ALLOC >::size_ [private]

Definition at line 1304 of file vector.hpp.

template<class T, class ALLOC>
size_type boost::numeric::ublas::unit_vector< T, ALLOC >::index_ [private]

Definition at line 1305 of file vector.hpp.

template<class T, class ALLOC>
unit_vector< T, ALLOC >::const_value_type boost::numeric::ublas::unit_vector< T, ALLOC >::zero_ = T() [static, private]

Definition at line 1307 of file vector.hpp.

template<class T, class ALLOC>
unit_vector< T, ALLOC >::const_value_type boost::numeric::ublas::unit_vector< T, ALLOC >::one_ [static, private]

Definition at line 1308 of file vector.hpp.

const unsigned boost::numeric::ublas::vector_container< unit_vector< T, ALLOC > >::complexity [static, inherited]

The documentation for this class was generated from the following file: