LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
ndarray::Vector< T, N > Class Template Reference

A fixed-size 1D array class. More...

#include <Vector.h>

Public Types

typedef T Element
 
typedef T Value
 
typedef T & Reference
 
typedef T const & ConstReference
 
typedef T * Iterator
 
typedef T const * ConstIterator
 
typedef Value value_type
 
typedef Iterator iterator
 
typedef ConstIterator const_iterator
 
typedef Reference reference
 
typedef ConstReference const_reference
 
typedef
boost::reverse_iterator< T * > 
reverse_iterator
 
typedef
boost::reverse_iterator< const
T * > 
const_reverse_iterator
 
typedef T * pointer
 
typedef int difference_type
 
typedef int size_type
 
typedef boost::mpl::int_< N > ND
 

Public Member Functions

size_type size () const
 Return the size of the Vector. More...
 
size_type max_size () const
 Return the size of the Vector. More...
 
bool empty () const
 Return true if size() == 0. More...
 
iterator begin ()
 Return an iterator to the beginning of the Vector. More...
 
const_iterator begin () const
 Return a const_iterator to the beginning of the Vector. More...
 
iterator end ()
 Return an iterator to the end of the Vector. More...
 
const_iterator end () const
 Return a const_iterator to the end of the Vector. More...
 
reverse_iterator rbegin ()
 Return a reverse_iterator to the beginning of the reversed Vector. More...
 
const_reverse_iterator rbegin () const
 Return a const_reverse_iterator to the beginning of the reversed Vector. More...
 
reverse_iterator rend ()
 Return a reverse_iterator to the end of the reversed Vector. More...
 
const_reverse_iterator rend () const
 Return a const_reverse_iterator to the end of the reversed Vector. More...
 
reference front ()
 Return a reference to the first element. More...
 
reference back ()
 Return a reference to the last element. More...
 
const_reference front () const
 Return a const_reference to the first element. More...
 
const_reference back () const
 Return a const_reference to the last element. More...
 
reference operator[] (int i)
 Return a reference to the element with the given index. More...
 
const_reference operator[] (int i) const
 Return a const_reference to the element with the given index. More...
 
template<int Start, int Stop>
Vector< T, Stop-Start > getRange () const
 Create a new Vector that is a subset of this. More...
 
template<int M>
Vector< T, M > first () const
 Create a new Vector from the first M elements of this. More...
 
template<int M>
Vector< T, M > last () const
 Create a new Vector from the last M elements of this. More...
 
 Vector ()
 Default constructor. More...
 
template<typename U >
 Vector (U scalar)
 Construct with copies of a scalar. More...
 
template<typename U >
 Vector (Vector< U, N > const &other)
 Converting copy constructor. More...
 
bool operator== (Vector const &other) const
 Return true if elements of other are equal to the elements of this. More...
 
bool operator!= (Vector const &other) const
 Return false if any elements of other are not equal to the elements of this. More...
 
sum () const
 Return the sum of all elements. More...
 
product () const
 Return the product of all elements. More...
 
Vector reverse () const
 Return a Vector with the elements reversed. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator= (Vector< U, N > const &other)
 Augmented = assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator= (U scalar)
 Augmented = assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator+= (Vector< U, N > const &other)
 Augmented += assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator+= (U scalar)
 Augmented += assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator-= (Vector< U, N > const &other)
 Augmented -= assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator-= (U scalar)
 Augmented -= assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator*= (Vector< U, N > const &other)
 Augmented *= assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator*= (U scalar)
 Augmented *= assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator/= (Vector< U, N > const &other)
 Augmented /= assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator/= (U scalar)
 Augmented /= assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator%= (Vector< U, N > const &other)
 Augmented %= assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator%= (U scalar)
 Augmented %= assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator&= (Vector< U, N > const &other)
 Augmented &= assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator&= (U scalar)
 Augmented &= assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator^= (Vector< U, N > const &other)
 Augmented ^= assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator^= (U scalar)
 Augmented ^= assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator|= (Vector< U, N > const &other)
 Augmented |= assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator|= (U scalar)
 Augmented |= assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator<<= (Vector< U, N > const &other)
 Augmented <<= assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator<<= (U scalar)
 Augmented <<= assignment from a scalar. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator>>= (Vector< U, N > const &other)
 Augmented >>= assignment from another vector. More...
 
template<typename U >
boost::enable_if
< boost::is_convertible< U, T >
, Vector & >::type 
operator>>= (U scalar)
 Augmented >>= assignment from a scalar. More...
 

Public Attributes

elems [N]
 

Friends

std::ostream & operator<< (std::ostream &os, Vector< T, N > const &obj)
 Stream output. More...
 

Detailed Description

template<typename T, int N>
class ndarray::Vector< T, N >

A fixed-size 1D array class.

Vector (with T==int) is primarily used as the data type for the shape and strides attributes of Array.

Vector is implemented almost exactly as a non-aggregate boost::array, but with the addition of mathematical operators and a few other utility functions.

Definition at line 93 of file Vector.h.

Member Typedef Documentation

template<typename T, int N>
typedef ConstIterator ndarray::Vector< T, N >::const_iterator

Definition at line 104 of file Vector.h.

template<typename T, int N>
typedef ConstReference ndarray::Vector< T, N >::const_reference

Definition at line 106 of file Vector.h.

template<typename T, int N>
typedef boost::reverse_iterator<const T*> ndarray::Vector< T, N >::const_reverse_iterator

Definition at line 108 of file Vector.h.

template<typename T, int N>
typedef T const* ndarray::Vector< T, N >::ConstIterator

Definition at line 100 of file Vector.h.

template<typename T, int N>
typedef T const& ndarray::Vector< T, N >::ConstReference

Definition at line 98 of file Vector.h.

template<typename T, int N>
typedef int ndarray::Vector< T, N >::difference_type

Definition at line 110 of file Vector.h.

template<typename T, int N>
typedef T ndarray::Vector< T, N >::Element

Definition at line 95 of file Vector.h.

template<typename T, int N>
typedef T* ndarray::Vector< T, N >::Iterator

Definition at line 99 of file Vector.h.

template<typename T, int N>
typedef Iterator ndarray::Vector< T, N >::iterator

Definition at line 103 of file Vector.h.

template<typename T, int N>
typedef boost::mpl::int_<N> ndarray::Vector< T, N >::ND

Definition at line 114 of file Vector.h.

template<typename T, int N>
typedef T* ndarray::Vector< T, N >::pointer

Definition at line 109 of file Vector.h.

template<typename T, int N>
typedef T& ndarray::Vector< T, N >::Reference

Definition at line 97 of file Vector.h.

template<typename T, int N>
typedef Reference ndarray::Vector< T, N >::reference

Definition at line 105 of file Vector.h.

template<typename T, int N>
typedef boost::reverse_iterator<T*> ndarray::Vector< T, N >::reverse_iterator

Definition at line 107 of file Vector.h.

template<typename T, int N>
typedef int ndarray::Vector< T, N >::size_type

Definition at line 111 of file Vector.h.

template<typename T, int N>
typedef T ndarray::Vector< T, N >::Value

Definition at line 96 of file Vector.h.

template<typename T, int N>
typedef Value ndarray::Vector< T, N >::value_type

Definition at line 102 of file Vector.h.

Constructor & Destructor Documentation

template<typename T, int N>
ndarray::Vector< T, N >::Vector ( )
inline

Default constructor.

Initializes the elements to zero.

Definition at line 184 of file Vector.h.

184 { this->template operator=(detail::DefaultValue<T>::get()); }
boost::enable_if< boost::is_convertible< U, T >, Vector & >::type operator=(Vector< U, N > const &other)
Augmented = assignment from another vector.
Definition: Vector.h:233
template<typename T, int N>
template<typename U >
ndarray::Vector< T, N >::Vector ( scalar)
inlineexplicit

Construct with copies of a scalar.

Definition at line 188 of file Vector.h.

188  {
189  this->template operator=(scalar);
190  }
boost::enable_if< boost::is_convertible< U, T >, Vector & >::type operator=(Vector< U, N > const &other)
Augmented = assignment from another vector.
Definition: Vector.h:233
template<typename T, int N>
template<typename U >
ndarray::Vector< T, N >::Vector ( Vector< U, N > const &  other)
inlineexplicit

Converting copy constructor.

Definition at line 194 of file Vector.h.

194  {
195  this->template operator=(other);
196  }
boost::enable_if< boost::is_convertible< U, T >, Vector & >::type operator=(Vector< U, N > const &other)
Augmented = assignment from another vector.
Definition: Vector.h:233

Member Function Documentation

template<typename T, int N>
reference ndarray::Vector< T, N >::back ( )
inline

Return a reference to the last element.

Definition at line 139 of file Vector.h.

139 { return *(elems+N-1); }
template<typename T, int N>
const_reference ndarray::Vector< T, N >::back ( ) const
inline

Return a const_reference to the last element.

Definition at line 143 of file Vector.h.

143 { return *(elems+N-1); }
template<typename T, int N>
iterator ndarray::Vector< T, N >::begin ( void  )
inline

Return an iterator to the beginning of the Vector.

Definition at line 120 of file Vector.h.

120 { return elems; }
template<typename T, int N>
const_iterator ndarray::Vector< T, N >::begin ( void  ) const
inline

Return a const_iterator to the beginning of the Vector.

Definition at line 122 of file Vector.h.

122 { return elems; }
template<typename T, int N>
bool ndarray::Vector< T, N >::empty ( ) const
inline

Return true if size() == 0.

Definition at line 118 of file Vector.h.

template<typename T, int N>
iterator ndarray::Vector< T, N >::end ( void  )
inline

Return an iterator to the end of the Vector.

Definition at line 124 of file Vector.h.

124 { return elems+N; }
template<typename T, int N>
const_iterator ndarray::Vector< T, N >::end ( void  ) const
inline

Return a const_iterator to the end of the Vector.

Definition at line 126 of file Vector.h.

126 { return elems+N; }
template<typename T, int N>
template<int M>
Vector<T,M> ndarray::Vector< T, N >::first ( ) const
inline

Create a new Vector from the first M elements of this.

Definition at line 159 of file Vector.h.

159  {
160  Vector<T,M> r;
161  std::copy(begin(), begin() + M, r.begin());
162  return r;
163  }
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
Definition: eigen.h:390
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
template<typename T, int N>
reference ndarray::Vector< T, N >::front ( )
inline

Return a reference to the first element.

Definition at line 137 of file Vector.h.

137 { return *elems; }
template<typename T, int N>
const_reference ndarray::Vector< T, N >::front ( ) const
inline

Return a const_reference to the first element.

Definition at line 141 of file Vector.h.

141 { return *elems; }
template<typename T, int N>
template<int Start, int Stop>
Vector<T,Stop-Start> ndarray::Vector< T, N >::getRange ( ) const
inline

Create a new Vector that is a subset of this.

Definition at line 152 of file Vector.h.

152  {
153  Vector<T,Stop-Start> r;
154  std::copy(begin() + Start, begin()+Stop, r.begin());
155  return r;
156  }
Vector()
Default constructor.
Definition: Vector.h:184
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
Definition: eigen.h:390
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
template<typename T, int N>
template<int M>
Vector<T,M> ndarray::Vector< T, N >::last ( ) const
inline

Create a new Vector from the last M elements of this.

Definition at line 166 of file Vector.h.

166  {
167  Vector<T,M> r;
168  std::copy(begin() + (N - M), begin() + N, r.begin());
169  return r;
170  }
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
Definition: eigen.h:390
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
template<typename T, int N>
size_type ndarray::Vector< T, N >::max_size ( ) const
inline

Return the size of the Vector.

Definition at line 117 of file Vector.h.

template<typename T, int N>
bool ndarray::Vector< T, N >::operator!= ( Vector< T, N > const &  other) const
inline

Return false if any elements of other are not equal to the elements of this.

Definition at line 204 of file Vector.h.

204  {
205  return !(*this == other);
206  }
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator%= ( Vector< U, N > const &  other)
inline

Augmented %= assignment from another vector.

Definition at line 313 of file Vector.h.

313  {
314  typename Vector<U,N>::ConstIterator j = other.begin();
315  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) %= (*j);
316  return *this;
317  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator%= ( scalar)
inline

Augmented %= assignment from a scalar.

Definition at line 321 of file Vector.h.

321  {
322  for (Iterator i = begin(); i != end(); ++i) (*i) %= scalar;
323  return *this;
324  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator&= ( Vector< U, N > const &  other)
inline

Augmented &= assignment from another vector.

Definition at line 329 of file Vector.h.

329  {
330  typename Vector<U,N>::ConstIterator j = other.begin();
331  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) &= (*j);
332  return *this;
333  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator&= ( scalar)
inline

Augmented &= assignment from a scalar.

Definition at line 337 of file Vector.h.

337  {
338  for (Iterator i = begin(); i != end(); ++i) (*i) &= scalar;
339  return *this;
340  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator*= ( Vector< U, N > const &  other)
inline

Augmented *= assignment from another vector.

Definition at line 281 of file Vector.h.

281  {
282  typename Vector<U,N>::ConstIterator j = other.begin();
283  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) *= (*j);
284  return *this;
285  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator*= ( scalar)
inline

Augmented *= assignment from a scalar.

Definition at line 289 of file Vector.h.

289  {
290  for (Iterator i = begin(); i != end(); ++i) (*i) *= scalar;
291  return *this;
292  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator+= ( Vector< U, N > const &  other)
inline

Augmented += assignment from another vector.

Definition at line 249 of file Vector.h.

249  {
250  typename Vector<U,N>::ConstIterator j = other.begin();
251  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) += (*j);
252  return *this;
253  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator+= ( scalar)
inline

Augmented += assignment from a scalar.

Definition at line 257 of file Vector.h.

257  {
258  for (Iterator i = begin(); i != end(); ++i) (*i) += scalar;
259  return *this;
260  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator-= ( Vector< U, N > const &  other)
inline

Augmented -= assignment from another vector.

Definition at line 265 of file Vector.h.

265  {
266  typename Vector<U,N>::ConstIterator j = other.begin();
267  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) -= (*j);
268  return *this;
269  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator-= ( scalar)
inline

Augmented -= assignment from a scalar.

Definition at line 273 of file Vector.h.

273  {
274  for (Iterator i = begin(); i != end(); ++i) (*i) -= scalar;
275  return *this;
276  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator/= ( Vector< U, N > const &  other)
inline

Augmented /= assignment from another vector.

Definition at line 297 of file Vector.h.

297  {
298  typename Vector<U,N>::ConstIterator j = other.begin();
299  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) /= (*j);
300  return *this;
301  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator/= ( scalar)
inline

Augmented /= assignment from a scalar.

Definition at line 305 of file Vector.h.

305  {
306  for (Iterator i = begin(); i != end(); ++i) (*i) /= scalar;
307  return *this;
308  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator<<= ( Vector< U, N > const &  other)
inline

Augmented <<= assignment from another vector.

Definition at line 377 of file Vector.h.

377  {
378  typename Vector<U,N>::ConstIterator j = other.begin();
379  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) <<= (*j);
380  return *this;
381  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator<<= ( scalar)
inline

Augmented <<= assignment from a scalar.

Definition at line 385 of file Vector.h.

385  {
386  for (Iterator i = begin(); i != end(); ++i) (*i) <<= scalar;
387  return *this;
388  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator= ( Vector< U, N > const &  other)
inline

Augmented = assignment from another vector.

Definition at line 233 of file Vector.h.

233  {
234  typename Vector<U,N>::ConstIterator j = other.begin();
235  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) = (*j);
236  return *this;
237  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator= ( scalar)
inline

Augmented = assignment from a scalar.

Definition at line 241 of file Vector.h.

241  {
242  for (Iterator i = begin(); i != end(); ++i) (*i) = scalar;
243  return *this;
244  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
bool ndarray::Vector< T, N >::operator== ( Vector< T, N > const &  other) const
inline

Return true if elements of other are equal to the elements of this.

Definition at line 199 of file Vector.h.

199  {
200  return std::equal(begin(), end(), other.begin());
201  }
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
< unspecified-expression-type > equal(ExpressionBase< Operand > const &operand, Scalar const &scalar)
Definition: operators.h:796
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator>>= ( Vector< U, N > const &  other)
inline

Augmented >>= assignment from another vector.

Definition at line 393 of file Vector.h.

393  {
394  typename Vector<U,N>::ConstIterator j = other.begin();
395  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) >>= (*j);
396  return *this;
397  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator>>= ( scalar)
inline

Augmented >>= assignment from a scalar.

Definition at line 401 of file Vector.h.

401  {
402  for (Iterator i = begin(); i != end(); ++i) (*i) >>= scalar;
403  return *this;
404  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
reference ndarray::Vector< T, N >::operator[] ( int  i)
inline

Return a reference to the element with the given index.

Definition at line 146 of file Vector.h.

146 { return elems[i]; }
template<typename T, int N>
const_reference ndarray::Vector< T, N >::operator[] ( int  i) const
inline

Return a const_reference to the element with the given index.

Definition at line 148 of file Vector.h.

148 { return elems[i]; }
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator^= ( Vector< U, N > const &  other)
inline

Augmented ^= assignment from another vector.

Definition at line 345 of file Vector.h.

345  {
346  typename Vector<U,N>::ConstIterator j = other.begin();
347  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) ^= (*j);
348  return *this;
349  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator^= ( scalar)
inline

Augmented ^= assignment from a scalar.

Definition at line 353 of file Vector.h.

353  {
354  for (Iterator i = begin(); i != end(); ++i) (*i) ^= scalar;
355  return *this;
356  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator|= ( Vector< U, N > const &  other)
inline

Augmented |= assignment from another vector.

Definition at line 361 of file Vector.h.

361  {
362  typename Vector<U,N>::ConstIterator j = other.begin();
363  for (Iterator i = begin(); i != end(); ++i, ++j) (*i) |= (*j);
364  return *this;
365  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
template<typename U >
boost::enable_if<boost::is_convertible<U,T>,Vector&>::type ndarray::Vector< T, N >::operator|= ( scalar)
inline

Augmented |= assignment from a scalar.

Definition at line 369 of file Vector.h.

369  {
370  for (Iterator i = begin(); i != end(); ++i) (*i) |= scalar;
371  return *this;
372  }
T * Iterator
Definition: Vector.h:99
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
T ndarray::Vector< T, N >::product ( ) const
inline

Return the product of all elements.

Definition at line 216 of file Vector.h.

216  {
217  T r = 1;
218  for (ConstIterator i = begin(); i != end(); ++i) r *= (*i);
219  return r;
220  }
T const * ConstIterator
Definition: Vector.h:100
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
reverse_iterator ndarray::Vector< T, N >::rbegin ( )
inline

Return a reverse_iterator to the beginning of the reversed Vector.

Definition at line 128 of file Vector.h.

128 { return reverse_iterator(end()); }
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
boost::reverse_iterator< T * > reverse_iterator
Definition: Vector.h:107
template<typename T, int N>
const_reverse_iterator ndarray::Vector< T, N >::rbegin ( ) const
inline

Return a const_reverse_iterator to the beginning of the reversed Vector.

Definition at line 130 of file Vector.h.

130 { return const_reverse_iterator(end()); }
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
boost::reverse_iterator< const T * > const_reverse_iterator
Definition: Vector.h:108
template<typename T, int N>
reverse_iterator ndarray::Vector< T, N >::rend ( )
inline

Return a reverse_iterator to the end of the reversed Vector.

Definition at line 132 of file Vector.h.

132 { return reverse_iterator(begin()); }
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
boost::reverse_iterator< T * > reverse_iterator
Definition: Vector.h:107
template<typename T, int N>
const_reverse_iterator ndarray::Vector< T, N >::rend ( ) const
inline

Return a const_reverse_iterator to the end of the reversed Vector.

Definition at line 134 of file Vector.h.

134 { return const_reverse_iterator(begin()); }
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
boost::reverse_iterator< const T * > const_reverse_iterator
Definition: Vector.h:108
template<typename T, int N>
Vector ndarray::Vector< T, N >::reverse ( ) const
inline

Return a Vector with the elements reversed.

Definition at line 223 of file Vector.h.

223  {
224  Vector r;
225  std::copy(begin(), end(), r.rbegin());
226  return r;
227  }
Vector()
Default constructor.
Definition: Vector.h:184
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
Definition: eigen.h:390
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124
template<typename T, int N>
size_type ndarray::Vector< T, N >::size ( ) const
inline

Return the size of the Vector.

Definition at line 116 of file Vector.h.

template<typename T, int N>
T ndarray::Vector< T, N >::sum ( ) const
inline

Return the sum of all elements.

Definition at line 209 of file Vector.h.

209  {
210  T r = 0;
211  for (ConstIterator i = begin(); i != end(); ++i) r += (*i);
212  return r;
213  }
T const * ConstIterator
Definition: Vector.h:100
iterator begin()
Return an iterator to the beginning of the Vector.
Definition: Vector.h:120
iterator end()
Return an iterator to the end of the Vector.
Definition: Vector.h:124

Friends And Related Function Documentation

template<typename T, int N>
std::ostream& operator<< ( std::ostream &  os,
Vector< T, N > const &  obj 
)
friend

Stream output.

Definition at line 173 of file Vector.h.

173  {
174  os << "(";
175  std::copy(obj.begin(), obj.end(), std::ostream_iterator<T>(os,","));
176  return os << ")";
177  }
SelectEigenView< T >::Type copy(Eigen::EigenBase< T > const &other)
Copy an arbitrary Eigen expression into a new EigenView.
Definition: eigen.h:390

Member Data Documentation

template<typename T, int N>
T ndarray::Vector< T, N >::elems[N]

Definition at line 406 of file Vector.h.


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