KJB
|
#include <m_vec_view.h>
Public Types | |
typedef Generic_vector_view | Self |
typedef Vector_type::value_type | Value_type |
typedef int | Size_type |
Public Member Functions | |
Generic_vector_view (Vector_type &vec, const Index_range &indices) | |
Generic_vector_view (Vector_type &vec) | |
Generic_vector_view (const Generic_vector_view &src) | |
bool | operator== (const Self &other) |
bool | operator== (const Vector_type &other) |
bool | operator!= (const Self &other) |
bool | operator!= (const Vector_type &other) |
Value_type & | operator[] (int i) |
Value_type | operator[] (int i) const |
Size_type | size () const |
Self & | operator= (const Vector_type &vec) |
Self & | operator= (const Self &vec) |
Self & | operator= (const Value_type &s) |
Self & | operator= (const std::vector< double > &v) |
Self & | operator= (const std::vector< float > &v) |
Self & | operator*= (Value_type s) |
double | dot (const Self &s) |
double | dot (const Vector_type &s) |
Self & | operator/= (Value_type s) |
Self & | operator+= (const Self &s) |
Self & | operator+= (const Vector_type &s) |
Self & | operator-= (const Self &s) |
Self & | operator-= (const Vector_type &s) |
Protected Member Functions | |
template<class Generic_vector > | |
bool | equality (const Generic_vector &mat) |
template<class Generic_vector > | |
Self & | assign (const Generic_vector &vec) |
template<class Generic_vector > | |
Self & | plus_equals (const Generic_vector &vec) |
template<class Generic_vector > | |
double | dot_with_ (const Generic_vector &vec) |
template<class Generic_vector > | |
Self & | minus_equals (const Generic_vector &vec) |
Protected Attributes | |
Index_range | indices_ |
Vector_type & | vec_ |
Represents a filtered "view" of another vector. This object has the same semantics as a real vector, but altering it will alter the "visible" elements of the underlying vector. Here's an example
Vector vec(5, 1.0); Index_range I(2,3); Vector_view vec_view = vec(I); vec_view *= -1; assert(vec[0]) == 1); assert(vec[1]) == 1); assert(vec[2]) == -1); assert(vec[3]) == -1); assert(vec[4]) == 1);
Matlab-style indexing is possible, by leveraging the implicit conversion constructor from string to Index_range:
vec("2:3") *= -1;
typedef Generic_vector_view kjb::Generic_vector_view< Vector_type >::Self |
typedef int kjb::Generic_vector_view< Vector_type >::Size_type |
typedef Vector_type::value_type kjb::Generic_vector_view< Vector_type >::Value_type |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
generic version of operator=(). Made private to avoid unwanted template instantiation.
|
inline |
|
inline |
|
inlineprotected |
generic version of dot(). Made private to avoid unwanted template instantiation
|
inlineprotected |
generic version of operator=(). Made private to avoid unwanted template instantiation.
|
inlineprotected |
generic version of operator-=(). Made private to avoid unwanted template instantiation
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set all elements to s
|
inline |
If this object has only 1 column or 1 row, set it equal to v or v', respectively.
|
inline |
If this object has only 1 column or 1 row, set it equal to v or v', respectively.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
generic version of operator+=. Made private to avoid unwanted template instantiation
|
inline |
|
protected |
|
protected |