Mathematical vector class, templated by type of element. More...
#include <vnl_fwd.h>

Public Types | |
| typedef T | element_type |
| Type defs for iterators. More... | |
| typedef size_t | size_type |
| typedef T * | iterator |
| Type defs for iterators. More... | |
| typedef T const * | const_iterator |
| Const iterator type. More... | |
| typedef vnl_c_vector< T >::abs_t | abs_t |
Public Member Functions | |
| vnl_vector () | |
| Creates an empty vector. O(1). More... | |
| vnl_vector (size_t len) | |
| Creates a vector containing n uninitialized elements. More... | |
| vnl_vector (size_t len, T const &v0) | |
| Creates a vector containing n elements, all set to v0. More... | |
| vnl_vector (size_t len, size_t n, T const values[]) | |
| Creates a vector containing len elements, with the first n. More... | |
| vnl_vector (T const *data_block, size_t n) | |
| Creates a vector containing len elements, initialized with values from. More... | |
| vnl_vector (vnl_vector< T > const &) | |
| Copy constructor. More... | |
| vnl_vector (vnl_vector< T > const &, vnl_vector< T > const &, vnl_tag_add) | |
| vnl_vector (vnl_vector< T > const &, vnl_vector< T > const &, vnl_tag_sub) | |
| vnl_vector (vnl_vector< T > const &, T, vnl_tag_mul) | |
| vnl_vector (vnl_vector< T > const &, T, vnl_tag_div) | |
| vnl_vector (vnl_vector< T > const &, T, vnl_tag_add) | |
| vnl_vector (vnl_vector< T > const &, T, vnl_tag_sub) | |
| vnl_vector (vnl_matrix< T > const &, vnl_vector< T > const &, vnl_tag_mul) | |
| vnl_vector (vnl_vector< T > const &, vnl_matrix< T > const &, vnl_tag_mul) | |
| vnl_vector (vnl_vector< T > &that, vnl_tag_grab) | |
| ~vnl_vector () | |
| Destructor. More... | |
| size_t | size () const |
| Return the length, number of elements, dimension of this vector. More... | |
| void | put (size_t i, T const &v) |
| Put value at given position in vector. More... | |
| T | get (size_t i) const |
| Get value at element i. More... | |
| vnl_vector & | fill (T const &v) |
| Set all values to v. More... | |
| vnl_vector & | copy_in (T const *ptr) |
| Sets elements to ptr[i]. More... | |
| void | copy_out (T *) const |
| Copy elements to ptr[i]. More... | |
| vnl_vector & | set (T const *ptr) |
| Sets elements to ptr[i]. More... | |
| T & | operator() (size_t i) |
| Return reference to the element at specified index. More... | |
| T const & | operator() (size_t i) const |
| Return reference to the element at specified index. No range checking. More... | |
| T & | operator[] (size_t i) |
| Return reference to the element at specified index. No range checking. More... | |
| T const & | operator[] (size_t i) const |
| Return reference to the element at specified index. No range checking. More... | |
| vnl_vector< T > & | operator= (T const &v) |
| Set all elements to value v. More... | |
| vnl_vector< T > & | operator= (vnl_vector< T > const &rhs) |
| Copy operator. More... | |
| vnl_vector< T > & | operator+= (T) |
| Add scalar value to all elements. More... | |
| vnl_vector< T > & | operator-= (T value) |
| Subtract scalar value from all elements. More... | |
| vnl_vector< T > & | operator *= (T) |
| Multiply all elements by scalar. More... | |
| vnl_vector< T > & | operator/= (T) |
| Divide all elements by scalar. More... | |
| vnl_vector< T > & | operator+= (vnl_vector< T > const &rhs) |
| Add rhs to this and return *this. More... | |
| vnl_vector< T > & | operator-= (vnl_vector< T > const &rhs) |
| Subtract rhs from this and return *this. More... | |
| vnl_vector< T > & | pre_multiply (vnl_matrix< T > const &M) |
| this = M(*this) where M is a suitable matrix. More... | |
| vnl_vector< T > & | post_multiply (vnl_matrix< T > const &M) |
| *this = (*this)*M where M is a suitable matrix. More... | |
| vnl_vector< T > & | operator *= (vnl_matrix< T > const &m) |
| *this = (*this)*M where M is a suitable matrix. More... | |
| vnl_vector< T > | operator+ () const |
| Unary plus operator. More... | |
| vnl_vector< T > | operator- () const |
| Unary minus operator. More... | |
| vnl_vector< T > | operator+ (T v) const |
| vnl_vector< T > | operator- (T v) const |
| vnl_vector< T > | operator * (T v) const |
| vnl_vector< T > | operator/ (T v) const |
| vnl_vector< T > | operator+ (vnl_vector< T > const &v) const |
| vnl_vector< T > | operator- (vnl_vector< T > const &v) const |
| vnl_vector< T > | operator * (vnl_matrix< T > const &M) const |
| T const * | data_block () const |
| Access the contiguous block storing the elements in the vector. O(1). More... | |
| T * | data_block () |
| Access the contiguous block storing the elements in the vector. O(1). More... | |
| iterator | begin () |
| Iterator pointing to start of data. More... | |
| iterator | end () |
| Iterator pointing to element beyond end of data. More... | |
| const_iterator | begin () const |
| Iterator pointing to start of data. More... | |
| const_iterator | end () const |
| Iterator pointing to element beyond end of data. More... | |
| vnl_vector< T > const & | as_ref () const |
| Return a reference to this. More... | |
| vnl_vector< T > & | as_ref () |
| Return a reference to this. More... | |
| vnl_vector< T > | apply (T(*f)(T)) const |
| Applies function to elements. More... | |
| vnl_vector< T > | apply (T(*f)(T const &)) const |
| Applies function to elements. More... | |
| vnl_vector< T > | extract (size_t len, size_t start=0) const |
| Returns a subvector specified by the start index and length. O(n). More... | |
| vnl_vector< T > & | update (vnl_vector< T > const &, size_t start=0) |
| Replaces elements with index beginning at start, by values of v. O(n). More... | |
| abs_t | squared_magnitude () const |
| Return sum of squares of elements. More... | |
| abs_t | magnitude () const |
| Return magnitude (length) of vector. More... | |
| abs_t | one_norm () const |
| Return sum of absolute values of the elements. More... | |
| abs_t | two_norm () const |
| Return sqrt of sum of squares of values of elements. More... | |
| abs_t | inf_norm () const |
| Return largest absolute element value. More... | |
| vnl_vector< T > & | normalize () |
| Normalise by dividing through by the magnitude. More... | |
| abs_t | rms () const |
| Root Mean Squares of values. More... | |
| T | min_value () const |
| Smallest value. More... | |
| T | max_value () const |
| Largest value. More... | |
| size_t | arg_min () const |
| Location of smallest value. More... | |
| size_t | arg_max () const |
| Location of largest value. More... | |
| T | mean () const |
| Mean of values in vector. More... | |
| T | sum () const |
| Sum of values in a vector. More... | |
| vnl_vector< T > & | flip () |
| Reverse the order of the elements. More... | |
| vnl_vector< T > & | flip (const size_t &b, const size_t &e) |
| Reverse the order of the elements from index b to 1-e, inclusive. More... | |
| vnl_vector< T > | roll (const int &shift) const |
| Roll the vector forward by the specified shift. More... | |
| vnl_vector & | roll_inplace (const int &shift) |
| Roll the vector forward by the specified shift. More... | |
| void | swap (vnl_vector< T > &that) |
| Set this to that and that to this. More... | |
| void | assert_size (size_t VXL_USED_IN_DEBUG(sz)) const |
| Check that size()==sz if not, abort();. More... | |
| void | assert_finite () const |
| Check that this is finite if not, abort();. More... | |
| bool | is_finite () const |
| Return true if it's finite. More... | |
| bool | is_zero () const |
| Return true iff all the entries are zero. More... | |
| bool | empty () const |
| Return true iff the size is zero. More... | |
| bool | is_equal (vnl_vector< T > const &rhs, double tol) const |
| Return true if all elements of vectors are equal, within given tolerance. More... | |
| bool | operator_eq (vnl_vector< T > const &v) const |
| Return true if *this == v. More... | |
| bool | operator== (vnl_vector< T > const &that) const |
| Equality test. More... | |
| bool | operator!= (vnl_vector< T > const &that) const |
| Inequality test. More... | |
| bool | set_size (size_t n) |
| Resize to n elements. More... | |
| void | clear () |
| Make the vector as if it had been default-constructed. More... | |
| bool | read_ascii (std::istream &s) |
| Read from text stream. More... | |
Static Public Member Functions | |
| static vnl_vector< T > | read (std::istream &s) |
| Read from text stream. More... | |
Protected Member Functions | |
| void | assert_size_internal (size_t sz) const |
| void | assert_finite_internal () const |
| void | destroy () |
| Frees up the array inside vector. O(1). More... | |
Protected Attributes | |
| size_t | num_elmts |
| T * | data |
Friends | |
| class | vnl_matrix< T > |
Related Functions | |
(Note that these are not member functions.) | |
| template<class T > | |
| VNL_EXPORT vnl_vector< T > | vnl_convolve (vnl_vector< T > const &v1, vnl_vector< T > const &v2, int use_fft=0) |
| Convolve two vnl_vector<T>'s, with the same base type T. More... | |
| template<class T1 , class T2 , class U > | |
| VNL_EXPORT vnl_vector< U > | vnl_convolve_cyclic (vnl_vector< T1 > const &v1, vnl_vector< T2 > const &v2, U *, bool use_fft=false) |
| Cyclically convolve two vnl_vector<T>'s of the same length. More... | |
| template<class T > | |
| void | vsl_b_write (vsl_b_ostream &os, const vnl_vector< T > &v) |
| Binary save vnl_vector to stream. More... | |
| template<class T > | |
| void | vsl_b_read (vsl_b_istream &is, vnl_vector< T > &v) |
| Binary load vnl_vector from stream. More... | |
| template<class T > | |
| void | vsl_print_summary (std::ostream &os, const vnl_vector< T > &b) |
| Print human readable summary of object to a stream. More... | |
| template<class T > | |
| VNL_EXPORT vnl_vector< std::complex< T > > | vnl_complexify (vnl_vector< T > const &R) |
| Return complexified version of real vector R. More... | |
| template<class T > | |
| VNL_EXPORT vnl_vector< std::complex< T > > | vnl_complexify (vnl_vector< T > const &R, vnl_vector< T > const &I) |
| Return complex vector R+j*I from two real vectors R and I. More... | |
| template<class S , class T > | |
| VNL_EXPORT void | vnl_copy (S const *const src, T *const dst, const unsigned n) |
| Easy conversion between vectors and matrices templated over different types. More... | |
| template<class S , class T > | |
| VNL_EXPORT void | vnl_copy (S const &, T &) |
| Easy conversion between vectors and matrices templated over different types. More... | |
| template<class T > | |
| T | vnl_cross_2d (const vnl_vector< T > &v1, const vnl_vector< T > &v2) |
| Compute the 2-D cross product. More... | |
| template<class T > | |
| vnl_vector< T > | vnl_cross_3d (const vnl_vector< T > &v1, const vnl_vector< T > &v2) |
| Compute the 3-D cross product. More... | |
| template<class T > | |
| vnl_vector< T > | operator * (vnl_diag_matrix< T > const &D, vnl_vector< T > const &A) |
| Multiply a vnl_diag_matrix by a vnl_vector. n flops. More... | |
| template<class T > | |
| vnl_vector< T > | operator * (vnl_vector< T > const &A, vnl_diag_matrix< T > const &D) |
| Multiply a vnl_vector by a vnl_diag_matrix. n flops. More... | |
| template<class T > | |
| VNL_EXPORT vnl_vector< T > | vnl_imag (vnl_vector< std::complex< T > > const &C) |
| Vector of imaginary parts of vnl_vector<std::complex<T> >. More... | |
| template<class T > | |
| VNL_EXPORT std::ostream & | vnl_matlab_print (std::ostream &, vnl_vector< T > const &, char const *variable_name=nullptr, vnl_matlab_print_format=vnl_matlab_print_format_default) |
| print a vnl_vector<T>. More... | |
| template<class T > | |
| VNL_EXPORT bool | operator< (vnl_vector< T > const &lhs, vnl_vector< T > const &rhs) |
| Define a complete ordering on vnl_vector. More... | |
| template<class T > | |
| VNL_EXPORT vnl_vector< T > | vnl_real (vnl_vector< std::complex< T > > const &C) |
| Vector of real parts of vnl_vector<std::complex<T> >. More... | |
| template<class T > | |
| vnl_vector< T > | operator+ (T s, vnl_vector< T > const &v) |
| add scalar and vector. O(n). More... | |
| template<class T > | |
| vnl_vector< T > | operator- (T s, vnl_vector< T > const &v) |
| subtract vector from scalar. O(n). More... | |
| template<class T > | |
| vnl_vector< T > | operator * (T s, vnl_vector< T > const &v) |
| multiply scalar and vector. O(n). More... | |
| template<class T > | |
| void | swap (vnl_vector< T > &a, vnl_vector< T > &b) |
| Interchange the two vectors. More... | |
| template<class T > | |
| T | vnl_vector_ssd (vnl_vector< T > const &v1, vnl_vector< T > const &v2) |
| Euclidean Distance between two vectors. More... | |
| template<class T > | |
| VNL_EXPORT std::ostream & | operator<< (std::ostream &, vnl_vector< T > const &) |
| Write vector to a std::ostream. More... | |
| template<class T > | |
| VNL_EXPORT std::istream & | operator>> (std::istream &, vnl_vector< T > &) |
| Read vector from a std::istream. More... | |
| template<class T > | |
| void | x_write (std::ostream &os, vnl_vector< T > const &v, std::string name="vnl_vector") |
| XML save vnl_vector to stream. More... | |
| template<class T > | |
| void | x_write_tree (std::ostream &os, vnl_vector< T > const &v, std::string name="vnl_vector") |
| XML save vnl_vector as a 2-level tree to stream. More... | |
Mathematical vector class, templated by type of element.
The vnl_vector<T> class implements one-dimensional arithmetic vectors to be used with the vnl_matrix<T> class. vnl_vector<T> has size fixed by constructor time or changed by assignment operator. For faster, non-mallocing vectors with size known at compile time, use vnl_vector_fixed* or vnl_T_n (e.g. vnl_double_3).
NOTE: Vectors are indexed from zero! Thus valid elements are [0,size()-1].
| typedef vnl_c_vector<T>::abs_t vnl_vector< T >::abs_t |
Definition at line 276 of file vnl_vector.h.
| typedef T const* vnl_vector< T >::const_iterator |
Const iterator type.
Definition at line 249 of file vnl_vector.h.
| typedef T vnl_vector< T >::element_type |
Type defs for iterators.
Definition at line 237 of file vnl_vector.h.
| typedef T* vnl_vector< T >::iterator |
Type defs for iterators.
Definition at line 241 of file vnl_vector.h.
| typedef size_t vnl_vector< T >::size_type |
Definition at line 238 of file vnl_vector.h.
|
inline |
Creates an empty vector. O(1).
Definition at line 80 of file vnl_vector.h.
|
explicit |
Creates a vector containing n uninitialized elements.
Creates a vector with specified length. O(n).
Elements are not initialized.
Definition at line 80 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | size_t | len, |
| T const & | v0 | ||
| ) |
Creates a vector containing n elements, all set to v0.
Creates a vector of specified length, and initialize all elements with value. O(n).
Definition at line 90 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | size_t | len, |
| size_t | n, | ||
| T const | values[] | ||
| ) |
Creates a vector containing len elements, with the first n.
Creates a vector of specified length and initialize first n elements with values. O(n).
elements taken from the array values[]. O(n).
Definition at line 103 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | T const * | datablck, |
| size_t | len | ||
| ) |
Creates a vector containing len elements, initialized with values from.
Creates a vector from a block array of data, stored row-wise.
a data block.
Values in datablck are copied. O(n).
Definition at line 129 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | vnl_vector< T > const & | v | ) |
Copy constructor.
Creates a new copy of vector v. O(n).
Definition at line 116 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | vnl_vector< T > const & | u, |
| vnl_vector< T > const & | v, | ||
| vnl_tag_add | |||
| ) |
Definition at line 139 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | vnl_vector< T > const & | u, |
| vnl_vector< T > const & | v, | ||
| vnl_tag_sub | |||
| ) |
Definition at line 152 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | vnl_vector< T > const & | u, |
| T | s, | ||
| vnl_tag_mul | |||
| ) |
Definition at line 165 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | vnl_vector< T > const & | u, |
| T | s, | ||
| vnl_tag_div | |||
| ) |
Definition at line 174 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | vnl_vector< T > const & | u, |
| T | s, | ||
| vnl_tag_add | |||
| ) |
Definition at line 183 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | vnl_vector< T > const & | u, |
| T | s, | ||
| vnl_tag_sub | |||
| ) |
Definition at line 192 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | vnl_matrix< T > const & | M, |
| vnl_vector< T > const & | v, | ||
| vnl_tag_mul | |||
| ) |
Definition at line 201 of file vnl_vector.hxx.
| vnl_vector< T >::vnl_vector | ( | vnl_vector< T > const & | v, |
| vnl_matrix< T > const & | M, | ||
| vnl_tag_mul | |||
| ) |
Definition at line 214 of file vnl_vector.hxx.
|
inline |
Definition at line 111 of file vnl_vector.h.
| vnl_vector< T >::~vnl_vector | ( | ) |
Destructor.
This destructor is not virtual for performance reasons. However, this means that subclasses cannot allocate memory.
Definition at line 226 of file vnl_vector.hxx.
| vnl_vector< T > vnl_vector< T >::apply | ( | T(*)(T) | f | ) | const |
Applies function to elements.
Return the vector made by applying "f" to each element.
Definition at line 554 of file vnl_vector.hxx.
| vnl_vector< T > vnl_vector< T >::apply | ( | T(*)(T const &) | f | ) | const |
Applies function to elements.
Definition at line 545 of file vnl_vector.hxx.
|
inline |
Location of largest value.
Definition at line 312 of file vnl_vector.h.
|
inline |
Location of smallest value.
Definition at line 309 of file vnl_vector.h.
|
inline |
Return a reference to this.
Useful in code which would prefer not to know if its argument is a vector, vector_ref or a vector_fixed. Note that it doesn't return a vector_ref, so it's only useful in templates or macros.
Definition at line 259 of file vnl_vector.h.
|
inline |
Return a reference to this.
Definition at line 262 of file vnl_vector.h.
|
inline |
Check that this is finite if not, abort();.
This function does or tests nothing if NDEBUG is defined
Definition at line 355 of file vnl_vector.h.
|
protected |
Definition at line 749 of file vnl_vector.hxx.
|
inline |
Check that size()==sz if not, abort();.
This function does or tests nothing if NDEBUG is defined
Definition at line 347 of file vnl_vector.h.
|
protected |
Definition at line 759 of file vnl_vector.hxx.
|
inline |
Iterator pointing to start of data.
Definition at line 243 of file vnl_vector.h.
|
inline |
Iterator pointing to start of data.
Definition at line 251 of file vnl_vector.h.
| void vnl_vector< T >::clear | ( | ) |
Make the vector as if it had been default-constructed.
Definition at line 240 of file vnl_vector.hxx.
| vnl_vector< T > & vnl_vector< T >::copy_in | ( | T const * | ptr | ) |
Sets elements to ptr[i].
Sets elements of a vector to those in an array. O(n).
Note: ptr[i] must be valid for i=0..size()-1
Definition at line 327 of file vnl_vector.hxx.
| void vnl_vector< T >::copy_out | ( | T * | ptr | ) | const |
Copy elements to ptr[i].
Sets elements of an array to those in vector. O(n).
Note: ptr[i] must be valid for i=0..size()-1
Definition at line 336 of file vnl_vector.hxx.
|
inline |
Access the contiguous block storing the elements in the vector. O(1).
data_block()[0] is the first element of the vector
Definition at line 230 of file vnl_vector.h.
|
inline |
Access the contiguous block storing the elements in the vector. O(1).
data_block()[0] is the first element of the vector
Definition at line 234 of file vnl_vector.h.
|
protected |
Frees up the array inside vector. O(1).
Definition at line 234 of file vnl_vector.hxx.
|
inline |
Return true iff the size is zero.
Definition at line 368 of file vnl_vector.h.
|
inline |
Iterator pointing to element beyond end of data.
Definition at line 246 of file vnl_vector.h.
|
inline |
Iterator pointing to element beyond end of data.
Definition at line 253 of file vnl_vector.h.
| vnl_vector< T > vnl_vector< T >::extract | ( | size_t | len, |
| size_t | start = 0 |
||
| ) | const |
Returns a subvector specified by the start index and length. O(n).
Definition at line 497 of file vnl_vector.hxx.
| vnl_vector< T > & vnl_vector< T >::fill | ( | T const & | v | ) |
Set all values to v.
Sets all elements of a vector to a specified fill value. O(n).
Definition at line 314 of file vnl_vector.hxx.
| vnl_vector< T > & vnl_vector< T >::flip | ( | ) |
Reverse the order of the elements.
Element i swaps with element size()-1-i
Definition at line 624 of file vnl_vector.hxx.
| vnl_vector< T > & vnl_vector< T >::flip | ( | const size_t & | b, |
| const size_t & | e | ||
| ) |
Reverse the order of the elements from index b to 1-e, inclusive.
When b = 0 and e = size(), this is equivalent to flip();
Definition at line 636 of file vnl_vector.hxx.
|
inline |
Get value at element i.
Gets the element at specified index and return its value. O(1).
Range check is performed.
Definition at line 415 of file vnl_vector.h.
|
inline |
Return largest absolute element value.
Definition at line 291 of file vnl_vector.h.
| bool vnl_vector< T >::is_equal | ( | vnl_vector< T > const & | rhs, |
| double | tol | ||
| ) | const |
Return true if all elements of vectors are equal, within given tolerance.
Definition at line 768 of file vnl_vector.hxx.
| bool vnl_vector< T >::is_finite | ( | ) | const |
Return true if it's finite.
Definition at line 728 of file vnl_vector.hxx.
| bool vnl_vector< T >::is_zero | ( | ) | const |
Return true iff all the entries are zero.
Definition at line 738 of file vnl_vector.hxx.
|
inline |
Return magnitude (length) of vector.
Definition at line 282 of file vnl_vector.h.
|
inline |
Largest value.
Definition at line 306 of file vnl_vector.h.
|
inline |
Mean of values in vector.
Definition at line 315 of file vnl_vector.h.
|
inline |
Smallest value.
Definition at line 303 of file vnl_vector.h.
|
inline |
Normalise by dividing through by the magnitude.
Definition at line 294 of file vnl_vector.h.
|
inline |
Return sum of absolute values of the elements.
Definition at line 285 of file vnl_vector.h.
|
inline |
Definition at line 219 of file vnl_vector.h.
|
inline |
Definition at line 224 of file vnl_vector.h.
| vnl_vector< T > & vnl_vector< T >::operator *= | ( | T | value | ) |
Multiply all elements by scalar.
Multiplies all elements of vector with value. O(n).
Definition at line 374 of file vnl_vector.hxx.
|
inline |
*this = (*this)*M where M is a suitable matrix.
this is treated as a row vector
Definition at line 207 of file vnl_vector.h.
|
inline |
Inequality test.
Definition at line 380 of file vnl_vector.h.
|
inline |
Return reference to the element at specified index.
There are assert style boundary checks - #define NDEBUG to turn them off.
Definition at line 151 of file vnl_vector.h.
|
inline |
Return reference to the element at specified index. No range checking.
There are assert style boundary checks - #define NDEBUG to turn them off.
Definition at line 160 of file vnl_vector.h.
|
inline |
|
inline |
Definition at line 217 of file vnl_vector.h.
|
inline |
Definition at line 222 of file vnl_vector.h.
| vnl_vector< T > & vnl_vector< T >::operator+= | ( | T | value | ) |
Add scalar value to all elements.
Increments all elements of vector with value. O(n).
Definition at line 364 of file vnl_vector.hxx.
| vnl_vector< T > & vnl_vector< T >::operator+= | ( | vnl_vector< T > const & | rhs | ) |
Add rhs to this and return *this.
Mutates lhs vector with its addition with rhs vector. O(n).
Definition at line 395 of file vnl_vector.hxx.
| vnl_vector< T > vnl_vector< T >::operator- | ( | ) | const |
Unary minus operator.
Creates new vector containing the negation of THIS vector. O(n).
Return new vector = -1*(*this)
Definition at line 469 of file vnl_vector.hxx.
|
inline |
Definition at line 218 of file vnl_vector.h.
|
inline |
Definition at line 223 of file vnl_vector.h.
|
inline |
Subtract scalar value from all elements.
Definition at line 183 of file vnl_vector.h.
| vnl_vector< T > & vnl_vector< T >::operator-= | ( | vnl_vector< T > const & | rhs | ) |
Subtract rhs from this and return *this.
Mutates lhs vector with its subtraction with rhs vector. O(n).
Definition at line 410 of file vnl_vector.hxx.
|
inline |
Definition at line 220 of file vnl_vector.h.
| vnl_vector< T > & vnl_vector< T >::operator/= | ( | T | value | ) |
Divide all elements by scalar.
Divides all elements of vector by value. O(n).
Definition at line 384 of file vnl_vector.hxx.
|
inline |
Set all elements to value v.
Definition at line 174 of file vnl_vector.h.
| vnl_vector< T > & vnl_vector< T >::operator= | ( | vnl_vector< T > const & | rhs | ) |
Copy operator.
Copies rhs vector into lhs vector. O(n).
Changes the dimension of lhs vector if necessary.
Definition at line 345 of file vnl_vector.hxx.
|
inline |
Equality test.
Definition at line 377 of file vnl_vector.h.
|
inline |
Return reference to the element at specified index. No range checking.
Definition at line 169 of file vnl_vector.h.
|
inline |
Return reference to the element at specified index. No range checking.
Definition at line 171 of file vnl_vector.h.
| bool vnl_vector< T >::operator_eq | ( | vnl_vector< T > const & | v | ) | const |
Return true if *this == v.
Definition at line 783 of file vnl_vector.hxx.
| vnl_vector< T > & vnl_vector< T >::post_multiply | ( | vnl_matrix< T > const & | m | ) |
*this = (*this)*M where M is a suitable matrix.
Post-multiplies vector with matrix and stores result back in vector.
this is treated as a row vector
v = v * m. O(m*n). Vector is assumed a row matrix.
Definition at line 447 of file vnl_vector.hxx.
| vnl_vector< T > & vnl_vector< T >::pre_multiply | ( | vnl_matrix< T > const & | m | ) |
this = M(*this) where M is a suitable matrix.
Pre-multiplies vector with matrix and stores result back in vector.
this is treated as a column vector
v = m * v. O(m*n). Vector is assumed a column matrix.
Definition at line 425 of file vnl_vector.hxx.
|
inline |
Put value at given position in vector.
Puts the value at specified index. O(1).
Range check is performed.
Definition at line 429 of file vnl_vector.h.
|
static |
Read from text stream.
Definition at line 303 of file vnl_vector.hxx.
| bool vnl_vector< T >::read_ascii | ( | std::istream & | s | ) |
Read from text stream.
Read a vnl_vector from an ascii std::istream.
If the vector has nonzero size on input, read that many values. Otherwise, read to EOF.
Definition at line 276 of file vnl_vector.hxx.
|
inline |
Root Mean Squares of values.
Definition at line 300 of file vnl_vector.h.
| vnl_vector< T > vnl_vector< T >::roll | ( | const int & | shift | ) | const |
Roll the vector forward by the specified shift.
The shift is cyclical, such that the elements which are displaced from the end reappear at the beginning. Negative shifts and shifts >= the length of the array are supported. A new vector is returned; the underlying data is unchanged.
Definition at line 655 of file vnl_vector.hxx.
| vnl_vector< T > & vnl_vector< T >::roll_inplace | ( | const int & | shift | ) |
Roll the vector forward by the specified shift.
The shift is cyclical, such that the elements which are displaced from the end reappear at the beginning. Negative shifts and shifts >= the length of the array are supported.
Definition at line 670 of file vnl_vector.hxx.
|
inline |
Sets elements to ptr[i].
Note: ptr[i] must be valid for i=0..size()-1
Definition at line 147 of file vnl_vector.h.
| bool vnl_vector< T >::set_size | ( | size_t | n | ) |
Resize to n elements.
This is a destructive resize, in that the old data is lost if size() != n before the call. If size() is already n, this is a null operation.
Definition at line 250 of file vnl_vector.hxx.
|
inline |
Return the length, number of elements, dimension of this vector.
Definition at line 126 of file vnl_vector.h.
|
inline |
Return sum of squares of elements.
Definition at line 279 of file vnl_vector.h.
|
inline |
Sum of values in a vector.
Definition at line 318 of file vnl_vector.h.
| void vnl_vector< T >::swap | ( | vnl_vector< T > & | that | ) |
Set this to that and that to this.
Definition at line 679 of file vnl_vector.hxx.
|
inline |
Return sqrt of sum of squares of values of elements.
Definition at line 288 of file vnl_vector.h.
| vnl_vector< T > & vnl_vector< T >::update | ( | vnl_vector< T > const & | v, |
| size_t | start = 0 |
||
| ) |
Replaces elements with index beginning at start, by values of v. O(n).
Definition at line 480 of file vnl_vector.hxx.
|
related |
Multiply a vnl_diag_matrix by a vnl_vector. n flops.
Definition at line 352 of file vnl_diag_matrix.h.
|
related |
Multiply a vnl_vector by a vnl_diag_matrix. n flops.
Definition at line 362 of file vnl_diag_matrix.h.
|
related |
multiply scalar and vector. O(n).
Definition at line 466 of file vnl_vector.h.
|
related |
add scalar and vector. O(n).
Definition at line 450 of file vnl_vector.h.
|
related |
subtract vector from scalar. O(n).
Definition at line 458 of file vnl_vector.h.
|
related |
Define a complete ordering on vnl_vector.
This is useful to create a set, or map of vectors.
The ordering itself is implementation defined - so don't rely on the meaning of less here.
Definition at line 24 of file vnl_operators.h.
|
related |
Write vector to a std::ostream.
|
related |
Read vector from a std::istream.
|
related |
Interchange the two vectors.
Definition at line 474 of file vnl_vector.h.
|
related |
Return complexified version of real vector R.
Definition at line 48 of file vnl_complex_ops.hxx.
|
related |
Return complex vector R+j*I from two real vectors R and I.
Definition at line 95 of file vnl_complex_ops.hxx.
|
related |
Convolve two vnl_vector<T>'s, with the same base type T.
The returned vnl_vector has the same base type T, and is identical to the return value of the previous function when T1 = T2 = U.
|
related |
Cyclically convolve two vnl_vector<T>'s of the same length.
.
A cyclic convolution requires that the lengths of the input vectors are identical. If this is not the case, an assert failure occurs. The length of the returned vector equals the length of the inputs.
Since the convolution theorem states that a cyclic convolution followed by an FFT is the same as an FFT followed by a multiplication, a cyclic convolution can also be implemented using 3 FFTs on n points and n complex multiplications. By default, vnl_convolve_cyclic does not use FFTs. By specifying "true" as the fourth argument, calculation of the convolution is done using FFTs. This will generally be faster for large n, especially if the vectors are not sparse, and/or if n is a power of 2.
|
related |
Easy conversion between vectors and matrices templated over different types.
Definition at line 15 of file vnl_copy.cxx.
|
related |
Easy conversion between vectors and matrices templated over different types.
Definition at line 22 of file vnl_copy.cxx.
|
related |
Compute the 2-D cross product.
Definition at line 24 of file vnl_cross.h.
|
related |
Compute the 3-D cross product.
Definition at line 65 of file vnl_cross.h.
|
related |
Vector of imaginary parts of vnl_vector<std::complex<T> >.
Definition at line 227 of file vnl_complex_ops.hxx.
|
related |
print a vnl_vector<T>.
|
friend |
Definition at line 77 of file vnl_vector.h.
|
related |
Vector of real parts of vnl_vector<std::complex<T> >.
Definition at line 156 of file vnl_complex_ops.hxx.
|
related |
Euclidean Distance between two vectors.
Sum of Differences squared.
Definition at line 480 of file vnl_vector.h.
|
related |
Binary load vnl_vector from stream.
|
related |
Binary save vnl_vector to stream.
|
related |
Print human readable summary of object to a stream.
|
related |
XML save vnl_vector to stream.
|
related |
XML save vnl_vector as a 2-level tree to stream.
|
protected |
Definition at line 398 of file vnl_vector.h.
|
protected |
Definition at line 397 of file vnl_vector.h.
1.8.15