|
| Gsl_Vector (size_t dims) |
| ctor to build an uninitialized vector of a given size More...
|
|
| Gsl_Vector (const kjb::Vector &kv) |
| conversion ctor makes a copy of a KJB vector More...
|
|
| Gsl_Vector (const Gsl_Vector &src) |
| copy ctor More...
|
|
| Gsl_Vector (const gsl_vector &vec_to_be_copied) |
| ctor copies an unwrapped GSL vector, does NOT take ownership. More...
|
|
Gsl_Vector & | operator= (const Gsl_Vector &src) |
| assignment operator More...
|
|
double * | begin () |
|
const double * | begin () const |
|
double * | end () |
|
const double * | end () const |
|
void | swap (Gsl_Vector &v) |
| swap the contents of two vectors More...
|
|
| ~Gsl_Vector () |
| dtor releases the resources in a vector More...
|
|
template<class Iterator > |
| Gsl_Vector (Iterator begin, Iterator end) |
| ctor constructs from a pair of input iterators More...
|
|
size_t | size () const |
| returns the size of the vector More...
|
|
double | at (size_t index) const |
| element access for the vector, returning an rvalue More...
|
|
double & | at (size_t index) |
| element access for the vector, returning an lvalue More...
|
|
double & | front () |
| access the first element of the vector, returning an lvalue More...
|
|
double | front () const |
| access the first element of the vector, returning an rvalue More...
|
|
double & | back () |
| access the last element of the vector, returning an lvalue More...
|
|
double | back () const |
| access the last element of the vector, returning an rvalue More...
|
|
Gsl_Vector & | set_all (double val) |
| set all vector members to a given value More...
|
|
Gsl_Vector & | set_zero () |
| set all vector members to zero More...
|
|
Gsl_Vector & | set_basis (size_t index) |
| Init to the (j+1)th column of identity matrix, given argument j. More...
|
|
| operator gsl_vector * () |
| Automatically (danger!) convert a wrapped object into a pointer. More...
|
|
kjb::Vector | vec () const |
| Export contents in a KJB Vector (the C++ kind). More...
|
|
Gsl_Vector | ew_multiply (const Gsl_Vector &that) const |
| Perform element-wise multiplcation of two vectors, same size. More...
|
|
double | sum () const |
| Return the sum of the elements of the vector. More...
|
|
double | dot (const Gsl_Vector &that) const |
| Return the dot product of two vectors. More...
|
|
double | l2_norm () const |
| Return the L2 norm (the Euclidean norm) of the vector. More...
|
|
bool | is_normal () const |
| Test whether all vector entries are "normal" values. More...
|
|
Gsl_Vector & | operator+= (const Gsl_Vector &that) |
| Add a vector of the same size to this vector, elementwise. More...
|
|
Gsl_Vector | operator+ (const Gsl_Vector &that) const |
| Return the sum of this vector and another vector of same size. More...
|
|
Gsl_Vector & | operator-= (const Gsl_Vector &that) |
| Subtract a vector of the same size from this vector, elementwise. More...
|
|
Gsl_Vector | operator- (const Gsl_Vector &that) const |
| Return the difference of two vectors of the same size. More...
|
|
Gsl_Vector & | ow_multiply_vector_by_scalar (double scalar) |
| Scale by a real value, like kjb_c::ow_multiply_vector_by_scalar. More...
|
|
Gsl_Vector & | operator*= (double scalar) |
| Scale by a real value, like ow_multiply_vector_by_scalar. More...
|
|
Gsl_Vector & | ow_reverse () |
| Reverse the order of the elements of the vector, in place. More...
|
|
Gsl_Vector | operator* (double scalar) const |
| Scale by a real value and return the result. More...
|
|
Gsl_Vector & | operator+= (double scalar) |
| add scalar to each elt. of this vector, in-place More...
|
|
Gsl_Vector | operator+ (double scalar) const |
| Return copy of this vector with a scalar added to each elt. More...
|
|
Gsl_Vector & | operator-= (double scalar) |
| subtract scalar from each elt. of this vector, in-place More...
|
|
Gsl_Vector | operator- (double scalar) const |
| Return copy of this vector w/ a scalar subtracted from each elt. More...
|
|
Gsl_Vector | operator- () const |
| Return copy of this vector with every element negated. More...
|
|
double | max () const |
| return the maximum value in the vector More...
|
|
double | min () const |
| return the minimum value in the vector More...
|
|
RAII wrapper for GSL vector objects.
Note the "operator gsl_vector*()" method, which makes it transparent. GSL is the Gnu Scientific Library. Ordinary GSL vectors are a resource with an API in C, so they must be allocated and freed. This C++ wrapper will automatically free the object when control flow leaves the object's scope. (That's just the basic RAII paradigm.)
Implementation invariant: pointer m_vec is never to be left equal to NULL.
Perform element-wise multiplcation of two vectors, same size.
This method is similar to kjb_c::multiply_vectors(), and basically a wrapped up version of gsl_vector_mul().
This is not overloaded star because multiplication between two vectors is not self explanatory (inner, outer, scalar, elementwise)? Thus the name needs to be descriptive. The name "ew_multiply" is not my favorite, but lib/m_cpp uses something similar. There are two differences between this and that function:
- That ew_multiply permits two vectors of different sizes to be arguments, but GSL does not; this follows GSL.
- That ew_multiply overwrites one of the original KJB vectors; this is const.