libgenua
Basic Geometry, Numerical Algorithms and Interfaces
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Types | Public Member Functions | Private Attributes | List of all members
DVector< Type > Class Template Reference

Detailed Description

template<class Type>
class DVector< Type >

Heap-allocated array.

This is a very thin wrapper layer around the std::vector template, which adds checked access, mathematical operations such as array + array, etc.

Currently, no expression templates are used. As a result, vector expressions involve a lot of copying and are utterly inefficient unless you write out everything fortran-style. However, DVector is meant to be used for small- to medium size problems (n < 1000), so that this usually is not a problem. For large problems, consider POOMA.

Element access is checked using assert(), so you can switch it off by defining the macro NDEBUG at compile time.

#include <dvector.h>

Public Types

typedef Eigen::Matrix< Type,
Eigen::Dynamic, Eigen::Dynamic > 
EigenMatrix
 for interfacing with the Eigen library
 

Public Member Functions

 DVector ()
 empty vector
 
 DVector (size_t n)
 zero-initialized sized construction
 
 DVector (size_t n, const Type &x)
 construction, initialization
 
 DVector (const Type *x, size_t n)
 initialized construction
 
template<typename ConvertibleType >
 DVector (std::initializer_list< ConvertibleType > list)
 list initialization, uses std::copy to convert type
 
template<class InputIterator >
 DVector (InputIterator a, InputIterator b)
 initialized construction
 
template<class AnotherType >
 DVector (const DVector< AnotherType > &x)
 initialized construction
 
template<class AnotherType >
 DVector (const DVector< AnotherType > &x, const Indices &idx)
 construct by reordering another vector
 
 DVector (const std::string &s)
 assignment of a string e.g. of the form "3.4 5.6 0.3 0.5"
 
template<class AnotherType >
 DVector (const Eigen::Matrix< AnotherType, Eigen::Dynamic, Eigen::Dynamic > &a)
 conversion from Eigen matrix
 
template<class AnotherType >
 DVector (const Eigen::Map< const Eigen::Matrix< AnotherType, Eigen::Dynamic, Eigen::Dynamic > > &a)
 conversion from Eigen map
 
 DVector (const DVector< Type > &x)
 copy construction
 
 DVector (DVector< Type > &&t)
 move constructor
 
DVector< Type > & operator= (DVector< Type > &&tmp)
 move assignment
 
bool operator== (const DVector< Type > &rhs) const
 equality element-by-element
 
bool operator!= (const DVector< Type > &rhs) const
 equality element-by-element
 
Type * pointer ()
 pointer to first element
 
const Type * pointer () const
 pointer to first element
 
iterator begin ()
 iterator to first element
 
const_iterator begin () const
 iterator to first element
 
iterator end ()
 iterator pointing to one-past last
 
const_iterator end () const
 iterator to first element
 
riterator rbegin ()
 iterator to first element of reversed vector
 
const_riterator rbegin () const
 iterator to first element of reversed vector
 
riterator rend ()
 iterator pointing to one-past last (of reversed vector)
 
const_riterator rend () const
 iterator to first element (of reversed vector)
 
size_t size () const
 return size
 
size_t bytes () const
 number of bytes actually occupied (not capacity)
 
bool empty () const
 true if size() == 0
 
reference operator[] (size_t i)
 checked access
 
const_reference operator[] (size_t i) const
 checked access
 
DVector< Type > operator[] (const Indices &idx) const
 construct a subset
 
reference operator() (size_t i)
 checked access
 
const_reference operator() (size_t i) const
 checked access
 
void push_back (const Type &x)
 append after end
 
void pop_back ()
 erase last element
 
void resize (size_t n)
 change size, zero out
 
void allocate (size_t n)
 just allocate space, do not zero out
 
void expand (size_t n, const Type &v)
 expend size with value v
 
size_t capacity () const
 currently allocated space
 
void clear ()
 NOTE Changed semantic to match std::vector ...
 
reference front ()
 reference to first element
 
const_reference front () const
 copy of first element
 
reference back ()
 reference to last element
 
const_reference back () const
 copy of last element
 
iterator insert (iterator pos, const Type &x)
 insert x before pos
 
template<typename Iterator >
void insert (iterator pos, Iterator first, Iterator last)
 insert range before pos
 
iterator erase (iterator p1)
 erase element
 
iterator erase (iterator p1, iterator p2)
 erase elements
 
void reserve (size_t n)
 reserve storage
 
void swap (DVector< Type > &v)
 swap contents with other array
 
EigenMap mmap ()
 create a mutable map object for interfacing with Eigen (column vector)
 
EigenMap rmmap ()
 create a mutable map object for interfacing with Eigen (row vector)
 
ConstEigenMap cmap () const
 create a constant map object for interfacing with Eigen (column vector)
 
ConstEigenMap rcmap () const
 create a constant map object for interfacing with Eigen (row vector)
 

Private Attributes

container data
 storage
 

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