Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

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...

Inherits vector_container< unit_vector< T, ALLOC > >.

List of all members.

Classes

class  const_iterator

Public Types

typedef ALLOC::size_type size_type
typedef ALLOC::difference_type difference_type
typedef T value_type
typedef const T & const_reference
typedef T & reference
typedef const vector_reference
< const self_type
const_closure_type
typedef vector_reference
< self_type
closure_type
typedef sparse_tag storage_category
typedef const_iterator iterator
typedef reverse_iterator_base
< const_iterator
const_reverse_iterator

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 size_type size () const
 Return the size (dimension) of the vector.
BOOST_UBLAS_INLINE size_type index () const
 Return the order of the unit vector.
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).
BOOST_UBLAS_INLINE const_pointer find_element (size_type i) const
 Return a const pointer to the element of index i.
BOOST_UBLAS_INLINE const_reference operator() (size_type i) const
BOOST_UBLAS_INLINE const_reference operator[] (size_type i) const
BOOST_UBLAS_INLINE unit_vectoroperator= (const unit_vector &v)
BOOST_UBLAS_INLINE unit_vectorassign_temporary (unit_vector &v)
BOOST_UBLAS_INLINE void swap (unit_vector &v)
BOOST_UBLAS_INLINE const_iterator find (size_type i) const
BOOST_UBLAS_INLINE const_iterator begin () const
BOOST_UBLAS_INLINE const_iterator end () const
BOOST_UBLAS_INLINE
const_reverse_iterator 
rbegin () const
BOOST_UBLAS_INLINE
const_reverse_iterator 
rend () const
template<class Archive >
void serialize (Archive &ar, const unsigned int)

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 >

Template Parameters:
T is 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.
ALLOC a specific allocator can be specified if needed. Most of the time this parameter is omited.

Constructor & Destructor Documentation

template<class T, class ALLOC>
BOOST_UBLAS_INLINE boost::numeric::ublas::unit_vector< T, ALLOC >::unit_vector ( size_type  size,
size_type  index = 0 
) [explicit]
Parameters:
size is the dimension of the vector
index is the order of the vector

Member Function Documentation

template<class T, class ALLOC>
BOOST_UBLAS_INLINE void boost::numeric::ublas::unit_vector< T, ALLOC >::resize ( size_type  size,
bool  = true 
)
Parameters:
size is the new size of the vector

Generated on Sun Jul 4 20:31:07 2010 for ublas by  doxygen 1.6.1