|
reconciliation_lib 0.1
Library for data reconciliation algorithms
|
RAII wrapper around a heap-allocated gsl_vector.
More...
#include <gsl_wrapper.h>
Public Member Functions | |
| vector (int n) | |
Allocate an uninitialised vector of length n. | |
| vector (int n, double x) | |
Allocate a vector of length n with all elements set to x. | |
| vector (int n, const double *x) | |
Allocate a vector of length n and copy values from the array x. | |
| vector (const vector &src) | |
| Copy constructor. | |
| ~vector () | |
| Destructor — frees the underlying GSL allocation. | |
| gsl_vector * | gsl_internal () |
Return a pointer to the underlying gsl_vector (mutable). | |
| const gsl_vector * | gsl_internal () const |
Return a pointer to the underlying gsl_vector (read-only). | |
| int | size () const |
| Return the number of elements. | |
| void | set (int i, double val) |
Set element i to val. | |
| double | get (int i) const |
Return element i. | |
| double | operator[] (int i) const |
Return element i (read-only subscript). | |
| vector & | operator= (const vector &src) |
| Copy-assign from another vector. | |
| vector & | operator= (const vector_view &src) |
| Copy-assign from a view. | |
| vector & | operator+= (const vector &src) |
| vector | operator+ (const vector &src) const |
| vector & | operator-= (const vector &src) |
| vector | operator- (const vector &src) const |
| vector | operator- () const |
Unary negation — returns -(*this). | |
| vector & | operator*= (double d) |
Scale all elements by d in place. | |
| vector | operator* (double d) const |
Return a copy scaled by d. | |
| double | norm1 () const |
| Return the L1 norm (sum of absolute values). | |
| double | norm2 () const |
| Return the L2 (Euclidean) norm. | |
| vector_view | subvector (int k, int n) |
Return a view of n elements starting at index k. | |
| const vector_view | subvector (int k, int n) const |
Return a view of n elements starting at index k. | |
Private Attributes | |
| gsl_vector * | v |
Friends | |
| class | matrix |
RAII wrapper around a heap-allocated gsl_vector.
Owns the underlying GSL allocation and frees it on destruction. Arithmetic operators follow GSL semantics (element-wise).
| dvrlib::vector::vector | ( | int | n | ) |
Allocate an uninitialised vector of length n.
Allocate a vector of length n with all elements set to x.
Allocate a vector of length n and copy values from the array x.
| dvrlib::vector::~vector | ( | ) |
Destructor — frees the underlying GSL allocation.
| gsl_vector * dvrlib::vector::gsl_internal | ( | ) |
Return a pointer to the underlying gsl_vector (mutable).
| const gsl_vector * dvrlib::vector::gsl_internal | ( | ) | const |
Return a pointer to the underlying gsl_vector (read-only).
| double dvrlib::vector::norm1 | ( | ) | const |
Return the L1 norm (sum of absolute values).
| double dvrlib::vector::norm2 | ( | ) | const |
Return the L2 (Euclidean) norm.
| vector dvrlib::vector::operator* | ( | double | d | ) | const |
Return a copy scaled by d.
| vector & dvrlib::vector::operator*= | ( | double | d | ) |
Scale all elements by d in place.
| vector dvrlib::vector::operator+ | ( | const vector & | src | ) | const |
| vector & dvrlib::vector::operator+= | ( | const vector & | src | ) |
| vector dvrlib::vector::operator- | ( | ) | const |
Unary negation — returns -(*this).
| vector dvrlib::vector::operator- | ( | const vector & | src | ) | const |
| vector & dvrlib::vector::operator-= | ( | const vector & | src | ) |
| vector & dvrlib::vector::operator= | ( | const vector & | src | ) |
Copy-assign from another vector.
| vector & dvrlib::vector::operator= | ( | const vector_view & | src | ) |
Copy-assign from a view.
| double dvrlib::vector::operator[] | ( | int | i | ) | const |
Return element i (read-only subscript).
| int dvrlib::vector::size | ( | ) | const |
Return the number of elements.
| vector_view dvrlib::vector::subvector | ( | int | k, |
| int | n | ||
| ) |
Return a view of n elements starting at index k.
| [in] | k | Start index (0-based). |
| [in] | n | Number of elements in the sub-vector. |
| const vector_view dvrlib::vector::subvector | ( | int | k, |
| int | n | ||
| ) | const |
Return a view of n elements starting at index k.
| [in] | k | Start index (0-based). |
| [in] | n | Number of elements in the sub-vector. |
|
private |