|
| VectorView (void) |
| Default constructor. More...
|
|
| VectorView (VectorView &other) |
| The copy constructor. More...
|
|
| VectorView (VectorMutable &other) |
| copy another VectorMutable More...
|
|
| VectorView (VectorMutable &v, size_t offset, size_t n, size_t stride=1) |
| VectorView constructor. More...
|
|
| VectorView (MatrixMutable &m, size_t i, bool row=true) |
|
| VectorView (gsl_vector *v) |
|
| VectorView (double *v, size_t size, size_t stride=1) |
|
| ~VectorView (void) |
|
bool | isview (void) const |
|
const VectorView & | operator= (const VectorView &) |
| The assignment operator. More...
|
|
const VectorView & | operator= (const VectorBase &) |
| The assignment operator. More...
|
|
template<class T > |
VectorView & | operator= (const VectorExpression< T > &rhs) |
| assignment from vector expression
|
|
| VectorView (proxy p) |
| create VectorView from proxy class
|
|
| operator proxy () |
|
void | all (double value) |
|
iterator | begin (void) |
|
const_iterator | begin (void) const |
|
const_iterator | begin (void) const |
|
void | div (const VectorBase &other) |
| This function performs element-wise division, . More...
|
|
iterator | end (void) |
|
const_iterator | end (void) const |
|
const_iterator | end (void) const |
|
gsl_vector * | gsl_vector_p (void) |
|
const gsl_vector * | gsl_vector_p (void) const |
|
const gsl_vector * | gsl_vector_p (void) const |
|
void | mul (const VectorBase &other) |
| This function performs element-wise multiplication, . More...
|
|
void | reverse (void) |
| Reverse the order of elements in the VectorMutable.
|
|
void | swap (size_t i, size_t j) |
| Exchange elements i and j.
|
|
double & | operator() (size_t i) |
| Element access operator. More...
|
|
const double & | operator() (size_t i) const |
| Element access operator. More...
|
|
const VectorMutable & | operator+= (const VectorBase &) |
| Addition and assign operator. VectorBase addition, . More...
|
|
template<class T > |
VectorMutable & | operator+= (const VectorExpression< T > &rhs) |
| Addition and assign operator. More...
|
|
const VectorMutable & | operator+= (double d) |
| Add a constant to a VectorBase, . More...
|
|
const VectorMutable & | operator-= (const VectorBase &) |
| Subtract and assign operator. VectorBase subtraction, . More...
|
|
template<class T > |
VectorMutable & | operator-= (const VectorExpression< T > &rhs) |
| Subtraction and assign operator. More...
|
|
const VectorMutable & | operator-= (double d) |
| Subtract a constant to a VectorBase, . More...
|
|
const VectorMutable & | operator*= (double d) |
| Multiply with scalar and assign operator, . More...
|
|
bool | equal (const VectorBase &, const double precision=0) const |
| Check whether VectorBases are equal within a user defined precision, set by precision. More...
|
|
size_t | size (void) const |
|
bool | operator== (const VectorBase &) const |
| Comparison operator. Takes linear time. More...
|
|
bool | operator!= (const VectorBase &) const |
| Comparison operator. Takes linear time. More...
|
|
double | operator* (const VectorBase &) const |
|
|
(Note that these are not member functions.)
|
template<class Derived1 , class Derived2 > |
double | operator* (const BasicVector< Derived1 > &lhs, const BasicVector< Derived2 > &rhs) |
|
template<typename T > |
expression::ScaledVector< T > | operator* (double k, const BasicVector< T > &vec) |
| scale a vector expression More...
|
|
template<typename T > |
expression::ScaledVector< T > | operator* (const BasicVector< T > &vec, double k) |
| scale a vector expression More...
|
|
template<class MATRIX , class VECTOR > |
expression::MatrixVector< MATRIX, VECTOR > | operator* (const BasicMatrix< MATRIX > &lhs, const BasicVector< VECTOR > &rhs) |
|
template<class MATRIX , class VECTOR > |
expression::MatrixVector< MatrixExpression< expression::TransposedMatrix< MATRIX > >, VECTOR > | operator* (const BasicVector< VECTOR > &lhs, const BasicMatrix< MATRIX > &rhs) |
|
template<class Derived1 , class Derived2 > |
expression::VectorBinary< Derived1, Derived2, expression::Plus > | operator+ (const BasicVector< Derived1 > &lhs, const BasicVector< Derived2 > &rhs) |
|
template<class Derived1 , class Derived2 > |
expression::VectorBinary< Derived1, Derived2, expression::Minus > | operator- (const BasicVector< Derived1 > &lhs, const BasicVector< Derived2 > &rhs) |
|
template<typename T > |
expression::ScaledVector< T > | operator- (const BasicVector< T > &vec) |
| negation operator More...
|
|
bool | isnull (const VectorBase &) |
| Check if all elements of the VectorBase are zero. More...
|
|
double | max (const VectorBase &) |
| Get the maximum value of the VectorBase. More...
|
|
size_t | max_index (const VectorBase &) |
| Locate the maximum value in the VectorBase. More...
|
|
double | min (const VectorBase &) |
| Get the minimum value of the VectorBase. More...
|
|
size_t | min_index (const VectorBase &) |
| Locate the minimum value in the VectorBase. More...
|
|
bool | nan (const VectorBase &templat, Vector &flag) |
| Create a VectorBase flag indicating NaN's in another VectorBase templat. More...
|
|
double | norm2_squared (const VectorBase &v) |
|
void | sort_index (std::vector< size_t > &sort_index, const VectorBase &invec) |
|
void | sort_smallest_index (std::vector< size_t > &sort_index, size_t k, const VectorBase &invec) |
|
void | sort_largest_index (std::vector< size_t > &sort_index, size_t k, const VectorBase &invec) |
|
double | sum (const VectorBase &) |
| Calculate the sum of all VectorBase elements. More...
|
|
std::ostream & | operator<< (std::ostream &s, const VectorBase &v) |
| The output operator for the VectorBase class. More...
|
|
This is the yat interface to gsl_vector_view.
This class can be used to create a vector view into a Matrix or a VectorMutable. Modifying a view will also modify the underlying data, i.e., the Matrix or VectorMutable that is viewed into. For that reason all constructors are taking non-const references to disallow mutable views into a const objects.
The fact that there is no copy constructor with const argument, but only a so-called move constructor (copying a non-const reference), implies that temporary objects such as objects returned from functions can not be copied directly. Instead the copying is done via a proxy class. Also since we can not bind a temporary to a non-const reference, a VectorView returned from a function cannot be sent directly to a function. For example
but you need to create a dummie object
or since sum is a const function, you can use VectorConstView
Matrix m(10,10);
sum(m.row_const_view(0));
Note that VectorView does not own underlying data, and a VectorView is not valid if Vector/Matrix owning the data is deallocated.
theplu::yat::utility::VectorView::VectorView |
( |
MatrixMutable & |
m, |
|
|
size_t |
i, |
|
|
bool |
row = true |
|
) |
| |
Matrix row/column view constructor.
Create a row/column VectorView view of matrix m, pointing at row/column i. The parameter row is used to set whether the view should be a row or column view. If row is set to true, the view will be a row view (default behaviour), and, naturally, a column view otherwise.
A VectorView view can be used as any VectorMutable with the difference that changes made to the view will also change the object that is viewed.
- Note
- If the object viewed by the view goes out of scope or is deleted, the view becomes invalid and the result of further use is undefined.