pele
Python energy landscape explorer
 All Classes Namespaces Functions Variables Typedefs
Public Types | Public Member Functions
pele::Array< dtype > Class Template Reference

#include <array.h>

Inheritance diagram for pele::Array< dtype >:
pele::MatrixAdapter< dtype >

List of all members.

Public Types

typedef dtype * iterator
typedef dtype const * const_iterator

Public Member Functions

 Array ()
 Array (size_t size)
 Array (size_t size, dtype const &val)
 Array (dtype *data, size_t size)
 Array (std::vector< dtype > &x)
void wrap (Array< dtype > x)
dtype * data ()
dtype const * data () const
size_t size () const
dtype & operator[] (const size_t i)
dtype const & operator[] (const size_t i) const
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
bool operator== (Array< dtype > const rhs) const
bool operator!= (Array< dtype > const rhs) const
Array< dtype > & assign (const Array< dtype > &rhs)
Array< dtype > & assign (dtype const &d)
Array< dtype > copy () const
void free ()
bool empty () const
long int reference_count () const
Array< dtype > & operator+= (const Array< dtype > &rhs)
Array< dtype > & operator+= (const dtype &rhs)
Array< dtype > & operator-= (const Array< dtype > &rhs)
Array< dtype > & operator-= (const dtype &rhs)
Array< dtype > & operator*= (const Array< dtype > &rhs)
Array< dtype > & operator*= (const dtype &rhs)
Array< dtype > operator* (const dtype rhs)
Array< dtype > & operator/= (const Array< dtype > &rhs)
Array< dtype > & operator/= (const dtype &rhs)
dtype sum () const
dtype prod () const
Array< dtype > view (size_t ibegin, size_t iend) const
dtype get_max () const
dtype get_min () const

Detailed Description

template<typename dtype>
class pele::Array< dtype >

Definition at line 68 of file array.h.


Member Typedef Documentation

template<typename dtype>
typedef dtype const* pele::Array< dtype >::const_iterator

Definition at line 171 of file array.h.

template<typename dtype>
typedef dtype* pele::Array< dtype >::iterator

return iterators over data

Definition at line 170 of file array.h.


Constructor & Destructor Documentation

template<typename dtype>
pele::Array< dtype >::Array ( ) [inline]

The size of the array. default constructor

create an array of size 0

Definition at line 81 of file array.h.

template<typename dtype>
pele::Array< dtype >::Array ( size_t  size) [inline]

construct an array with a given size

Definition at line 90 of file array.h.

template<typename dtype>
pele::Array< dtype >::Array ( size_t  size,
dtype const &  val 
) [inline]

construct an array with a given size, each element is a copy of val

Definition at line 99 of file array.h.

template<typename dtype>
pele::Array< dtype >::Array ( dtype *  data,
size_t  size 
) [inline]

wrap some data that is passed. Do not take ownership of the data.

Definition at line 109 of file array.h.

template<typename dtype>
pele::Array< dtype >::Array ( std::vector< dtype > &  x) [inline]

wrap a vector. This memory should never be deleted.

Definition at line 118 of file array.h.


Member Function Documentation

template<typename dtype>
Array<dtype>& pele::Array< dtype >::assign ( const Array< dtype > &  rhs) [inline]

Assignment function: copy the data into the existing array

arrays must be of same size

Definition at line 210 of file array.h.

template<typename dtype>
Array<dtype>& pele::Array< dtype >::assign ( dtype const &  d) [inline]

assign each element of the array to be d

Definition at line 225 of file array.h.

template<typename dtype>
iterator pele::Array< dtype >::begin ( ) [inline]

Definition at line 172 of file array.h.

template<typename dtype>
const_iterator pele::Array< dtype >::begin ( ) const [inline]

Definition at line 174 of file array.h.

template<typename dtype>
Array<dtype> pele::Array< dtype >::copy ( ) const [inline]

assign each element of the array to be return a copy of the array.

Definition at line 245 of file array.h.

template<typename dtype>
dtype* pele::Array< dtype >::data ( ) [inline]

return pointer to data

Definition at line 153 of file array.h.

template<typename dtype>
dtype const* pele::Array< dtype >::data ( ) const [inline]

Definition at line 154 of file array.h.

template<typename dtype>
bool pele::Array< dtype >::empty ( ) const [inline]

Returns whether the array is empty (i.e. whether its size is 0).

Definition at line 265 of file array.h.

template<typename dtype>
iterator pele::Array< dtype >::end ( ) [inline]

Definition at line 173 of file array.h.

template<typename dtype>
const_iterator pele::Array< dtype >::end ( ) const [inline]

Definition at line 175 of file array.h.

template<typename dtype>
void pele::Array< dtype >::free ( ) [inline]

wrap a new empty array.

Definition at line 255 of file array.h.

template<typename dtype>
dtype pele::Array< dtype >::get_max ( ) const [inline]

Get maximum and minimum elements of array.

Definition at line 416 of file array.h.

template<typename dtype>
dtype pele::Array< dtype >::get_min ( ) const [inline]

Definition at line 417 of file array.h.

template<typename dtype>
bool pele::Array< dtype >::operator!= ( Array< dtype > const  rhs) const [inline]

Definition at line 199 of file array.h.

template<typename dtype>
Array<dtype> pele::Array< dtype >::operator* ( const dtype  rhs) [inline]

Definition at line 341 of file array.h.

template<typename dtype>
Array<dtype>& pele::Array< dtype >::operator*= ( const Array< dtype > &  rhs) [inline]

Definition at line 320 of file array.h.

template<typename dtype>
Array<dtype>& pele::Array< dtype >::operator*= ( const dtype &  rhs) [inline]

Definition at line 333 of file array.h.

template<typename dtype>
Array<dtype>& pele::Array< dtype >::operator+= ( const Array< dtype > &  rhs) [inline]

Compound Assignment Operators += -= *=

Definition at line 278 of file array.h.

template<typename dtype>
Array<dtype>& pele::Array< dtype >::operator+= ( const dtype &  rhs) [inline]

Definition at line 291 of file array.h.

template<typename dtype>
Array<dtype>& pele::Array< dtype >::operator-= ( const Array< dtype > &  rhs) [inline]

Definition at line 299 of file array.h.

template<typename dtype>
Array<dtype>& pele::Array< dtype >::operator-= ( const dtype &  rhs) [inline]

Definition at line 312 of file array.h.

template<typename dtype>
Array<dtype>& pele::Array< dtype >::operator/= ( const Array< dtype > &  rhs) [inline]

Definition at line 347 of file array.h.

template<typename dtype>
Array<dtype>& pele::Array< dtype >::operator/= ( const dtype &  rhs) [inline]

Definition at line 360 of file array.h.

template<typename dtype>
bool pele::Array< dtype >::operator== ( Array< dtype > const  rhs) const [inline]

equality operator

test if they wrap the same data

Definition at line 195 of file array.h.

template<typename dtype>
dtype& pele::Array< dtype >::operator[] ( const size_t  i) [inline]

access an element in the array

Definition at line 164 of file array.h.

template<typename dtype>
dtype const& pele::Array< dtype >::operator[] ( const size_t  i) const [inline]

Definition at line 165 of file array.h.

template<typename dtype>
dtype pele::Array< dtype >::prod ( ) const [inline]
template<typename dtype>
long int pele::Array< dtype >::reference_count ( ) const [inline]

Definition at line 270 of file array.h.

template<typename dtype>
size_t pele::Array< dtype >::size ( ) const [inline]

return the size of the array

Definition at line 159 of file array.h.

template<typename dtype>
dtype pele::Array< dtype >::sum ( ) const [inline]

returns the sum of all elements (reduces the array)

Definition at line 373 of file array.h.

template<typename dtype>
Array<dtype> pele::Array< dtype >::view ( size_t  ibegin,
size_t  iend 
) const [inline]

return a view of the array.

Definition at line 399 of file array.h.

template<typename dtype>
void pele::Array< dtype >::wrap ( Array< dtype >  x) [inline]

wrap another array is implemented by shared_ptr parent class

Note, the input here is a const array, but this constructs a modifiable array. This is a loophole around the const declaration, but i'm not sure there is any way around it. The compiler complains if this is not here. e.g. for constructions like Array(x.copy())

This is commented because it just duplicates the default copy constructor

Array(Array<dtype> const & x) : _memory(x._memory) _data(x._data), _size(x._size) {}

Definition at line 143 of file array.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs