![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
BaseArray is the base class for all classes implementing vectors and matrices as arrays of cells. More...
#include <basearray.h>
Public Member Functions | |
BaseArray< T > & | add (const BaseArray< T > &) |
In-place addition to a vector. | |
void | asarray (T *v, unsigned long n) const |
Copies n elements from this vector to a new buffer v . | |
BaseArray () | |
Default constructor, initializes an empty vector. | |
BaseArray (unsigned long n) | |
Initializes a vector of n elements. | |
BaseArray (const BaseArray< T > &other) | |
Initializes a vector copying elements from another vector. | |
const T * | begin () const |
Returns a const pointer to the begin of vector buffer. | |
T * | begin () |
Returns a non-const pointer to the begin of vector buffer. | |
bool | closeTo (const BaseArray< T > &, T tolerance) const |
Checks if vector values are element by element close to a given array. | |
BaseArray< T > & | divide (const BaseArray< T > &) |
In-place element by element division by a vector. | |
const T * | end () const |
Returns a const pointer to the end of vector buffer. | |
T * | end () |
Returns a non-const pointer to the end of vector buffer. | |
const T * | getData () const |
Returns a const pointer to the vector buffer. | |
T * | getData () |
Returns a non-const pointer to the vector buffer. | |
unsigned long | getSize () const |
Returns vector length. | |
template<class Archive > | |
void | load (Archive &, const unsigned int) |
Deserializes the vector from a generic archive. | |
const T & | max () const |
Returns a reference to the element with the largest value in the vector. | |
const T & | min () const |
Returns a reference to the element with the smallest value in the vector. | |
BaseArray< T > & | multiply (const BaseArray< T > &) |
In-place element by element multiplication by a vector. | |
BaseArray< T > & | operator*= (T) |
Multiplies all elements by a scalar. | |
BaseArray< T > & | operator+= (T) |
Adds a value to all elements. | |
BaseArray< T > & | operator-= (T) |
Subtracts a value to all elements. | |
BaseArray< T > & | operator/= (T) |
Divides all elements by a scalar. | |
BaseArray< T > & | operator= (const BaseArray< T > &other) |
Copies values form vector other to this one. | |
BaseArray< T > & | operator= (const T &val) |
Sets all elements of the vector to the value specified in val . | |
void | randomize () |
Initializes the vector with pseudo-random values. | |
void | resize (unsigned long n) |
Resizes the vector to length n . | |
template<class Archive > | |
void | save (Archive &, const unsigned int) const |
Serializes the vector to a generic archive. | |
void | set (const T *v, unsigned long n, unsigned long start=0) |
Copies n elements of a given vector v to this vector starting from start . | |
BaseArray< T > & | setReciprocal () |
In-place multiplicative inverse of each element. | |
BaseArray< T > & | subtract (const BaseArray< T > &) |
In-place subtraction to a vector. | |
T | sum () const |
Returns the sum of all elements in the vector. | |
virtual std::string | what () const =0 |
Returns a string description of the vector. | |
~BaseArray () | |
Destructor. | |
Protected Member Functions | |
void | alloc (unsigned long n) |
Allocates the n elements data buffer. | |
Protected Attributes | |
T * | data |
Pointer to the data buffer. | |
bool | isowner |
Flag indicating whether vector has ownership of (and has to deallocate in destructor) the pointed buffer or not. | |
unsigned long | size |
Data buffer length. | |
Friends | |
class | boost::serialization::access |
template<typename U > | |
bool | operator== (const BaseArray< U > &, const U &) |
Checks if all elements in a vector are equal to a given value. |
T | Cells type. |
Definition at line 72 of file basearray.h.