![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
gVec implements a vector of generic length More...
#include <gvec.h>


Public Member Functions | |
| BaseArray< T > & | add (const BaseArray< T > &) |
| In-place addition to a vector. | |
| T | argmax () const |
| Returns the largest element in the vector. | |
| T | argmin () const |
| Returns the smallest element in the vector. | |
| void | asarray (T *v, unsigned long n) const |
Copies n elements from this vector to a new buffer v. | |
| gMat2D< T > & | asMatrix (bool ascolumn=true) |
| Returns a matrix representing the vector. | |
| const T & | at (unsigned long i) const |
| Returns a const reference to the i-th element. | |
| T & | at (unsigned long i) |
| Returns a reference to the i-th element. | |
| 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. | |
| void | clear () |
| Clears the vector, making it as if it had been default-constructed. | |
| bool | closeTo (const BaseArray< T > &, T tolerance) const |
| Checks if vector values are element by element close to a given array. | |
| gVec< T > & | copyLocations (const gVec< T > locs) |
Returns a subvector containing elements whose index in the vector is contained in locs. | |
| 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. | |
| gVec (unsigned long n=0) | |
| Initializes a vector of n elements. | |
| gVec (T *buf, unsigned long n, bool ownership=true) | |
| Initializes a vector of n elements from a data buffer. | |
| gVec (const gVec< T > &other) | |
| Constructor form an existing gVec. | |
| void | isequal (const T &value, std::vector< int > &indices) |
Writes into the vector indices the indices of the elements whose value is equal to the given one. | |
| 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. | |
| gVec< unsigned long > | nonzeros () const |
| Returns a subvector containing all nonzero values. | |
| gVec< T > | operator* (T) const |
| Returns a vector containing the multiplication of the vector by a scalar. | |
| gVec< T > | operator* (const gVec< T > &) const |
| Returns the element by element multiplication between two vectors. | |
| BaseArray< T > & | operator*= (T) |
| Multiplies all elements by a scalar. | |
| gVec< T > & | operator*= (const gVec< T > &) |
| In-place element by element multiplication by a vector. | |
| gVec< T > | operator+ (T) const |
| Returns a vector containing the sum between the vector and a scalar. | |
| gVec< T > | operator+ (const gVec< T > &) const |
| Returns the sum of two vectors. | |
| BaseArray< T > & | operator+= (T) |
| Adds a value to all elements. | |
| gVec< T > & | operator+= (const gVec< T > &) |
| In-place addition to a vector. | |
| gVec< T > | operator- () const |
| Inverts elements sign. | |
| gVec< T > | operator- (T val) const |
| Returns a vector containing the difference between the vector and a scalar. | |
| gVec< T > | operator- (const gVec< T > &v) const |
| Returns the difference between two vectors. | |
| BaseArray< T > & | operator-= (T) |
| Subtracts a value to all elements. | |
| gVec< T > & | operator-= (const gVec< T > &v) |
| In-place subtraction to a vector. | |
| gVec< T > | operator/ (T val) const |
| Returns a vector containing the division of the vector by a scalar. | |
| gVec< T > | operator/ (const gVec< T > &) const |
| Returns the element by element division between two vectors. | |
| BaseArray< T > & | operator/= (T) |
| Divides all elements by a scalar. | |
| gVec< T > & | operator/= (const gVec< T > &) |
| In-place element by element division by a vector. | |
| gVec< T > & | operator= (const gVec< T > &other) |
| Assignment operator. | |
| gVec< T > & | operator= (const T &val) |
Sets all elements of the vector to the value specified in val. | |
| const T & | operator[] (unsigned long i) const |
| Returns a const reference to the i-th element. | |
| T & | operator[] (unsigned long i) |
| Returns a reference to the i-th element. | |
| void | randomize () |
| Initializes the vector with pseudo-random values. | |
| gVec< T > & | reciprocal () const |
| Returns vector's multiplicative inverse. | |
| 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. | |
| void | set (const gVec< T > &v, unsigned long start=0) |
Copies all elements of a given vector v to the 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. | |
| gVec< T > | subvec (unsigned int len, unsigned int start=0) const |
Returns a subvector containing all values beginning from start. | |
| T | sum () const |
| Returns the sum of all elements in the vector. | |
| virtual std::string | what () const |
| Returns a string description of the vector. | |
Static Public Member Functions | |
| static gVec< T > | rand (unsigned long n=0) |
| Returns a n-length vector initialized with pseudo-random values. | |
| static gVec< T > | zeros (unsigned long n=0) |
| Returns a vector of all zeros. | |
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 > | |
| gVec< U > | operator* (U val, const gVec< U > &v) |
| Returns a vector containing the multiplication of a vector by a scalar. | |
| template<typename U > | |
| gVec< U > | operator+ (U val, const gVec< U > &v) |
| Returns a vector containing the sum between a vector and a scalar. | |
| template<typename U > | |
| gVec< U > | operator- (U val, const gVec< U > &v) |
| Returns a vector containing the difference between a vector and a scalar. | |
| template<typename U > | |
| gVec< U > | operator/ (U val, const gVec< U > &v) |
| Returns a vector containing the division of a vector by a scalar. | |
| template<typename U > | |
| std::ostream & | operator<< (std::ostream &, const gVec< U > &) |
| Writes vector's information and data to a stream. | |
| template<typename U > | |
| bool | operator== (const BaseArray< U > &, const U &) |
| Checks if all elements in a vector are equal to a given value. | |
| template<typename U > | |
| bool | operator== (const gVec< U > &, const U &) |
| Checks if all elements in a vector are equal to a given value. | |
| T | Cells type. |
| gurls::gVec< T >::gVec | ( | T * | buf, |
| unsigned long | n, | ||
| bool | ownership = true |
||
| ) |