new lite version adapted from Matrix.h More...
#include <cstdlib>#include <vector>#include <iostream>#include <algorithm>#include "vnl_vector.h"#include <cassert>#include <vnl/vnl_math.h>#include <vnl/vnl_matrix.h>#include <vnl/vnl_numeric_traits.h>#include <vnl/vnl_c_vector.h>#include <vnl/vnl_sse.h>Go to the source code of this file.
Macros | |
| #define | vnl_vector_construct_hack() |
| #define | vnl_vector_alloc_blah(size) |
| #define | vnl_vector_free_blah |
| #define | VNL_VECTOR_INSTANTIATE_COMMON(T) |
| #define | VNL_VECTOR_INSTANTIATE(T) |
| #define | VNL_VECTOR_INSTANTIATE_COMPLEX(T) |
Functions | |
| template<class T > | |
| vnl_vector< T > | element_product (vnl_vector< T > const &v1, vnl_vector< T > const &v2) |
| Returns new vector whose elements are the products v1[i]*v2[i]. O(n). More... | |
| template<class T > | |
| vnl_vector< T > | element_quotient (vnl_vector< T > const &v1, vnl_vector< T > const &v2) |
| Returns new vector whose elements are the quotients v1[i]/v2[i]. O(n). More... | |
| template<class T > | |
| T | dot_product (vnl_vector< T > const &v1, vnl_vector< T > const &v2) |
| Returns the dot product of two nd-vectors, or [v1]*[v2]^T. O(n). More... | |
| template<class T > | |
| T | inner_product (vnl_vector< T > const &v1, vnl_vector< T > const &v2) |
| Hermitian inner product. O(n). More... | |
| template<class T > | |
| T | bracket (vnl_vector< T > const &u, vnl_matrix< T > const &A, vnl_vector< T > const &v) |
| Returns the 'matrix element' <u|A|v> = u^t * A * v. O(mn). More... | |
| template<class T > | |
| vnl_matrix< T > | outer_product (vnl_vector< T > const &v1, vnl_vector< T > const &v2) |
| Returns the nxn outer product of two nd-vectors, or [v1]^T*[v2]. O(n). More... | |
| template<class T > | |
| T | cos_angle (vnl_vector< T > const &a, vnl_vector< T > const &b) |
| template<class T > | |
| double | angle (vnl_vector< T > const &a, vnl_vector< T > const &b) |
| Returns smallest angle between two non-zero n-dimensional vectors. O(n). More... | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &s, vnl_vector< T > const &v) |
| Overloads the output operator to print a vector. O(n). More... | |
| template<class T > | |
| std::istream & | operator>> (std::istream &s, vnl_vector< T > &M) |
| Read a vnl_vector from an ascii std::istream. More... | |
new lite version adapted from Matrix.h
Each vector contains a protected data section that has a T* slot that points to the physical memory allocated for the one dimensional array. In addition, an integer specifies the number of elements for the vector. These values are provided in the constructors.
Several constructors are provided. See .h file for descriptions.
Methods are provided for destructive scalar and vector addition, multiplication, check for equality and inequality, fill, reduce, and access and set individual elements. Finally, both the input and output operators are overloaded to allow for formatted input and output of vector elements.
vnl_vector is a special type of matrix, and is implemented for space and time efficiency. When vnl_vector is pre_multiplied by/with matrix, m*v, vnl_vector is implicitly a column matrix. When vnl_vector is post_multiplied by/with matrix v*m, vnl_vector is implicitly a row matrix.
Definition in file vnl_vector.hxx.
| #define vnl_vector_alloc_blah | ( | size | ) |
Definition at line 62 of file vnl_vector.hxx.
| #define vnl_vector_construct_hack | ( | ) |
Definition at line 58 of file vnl_vector.hxx.
| #define vnl_vector_free_blah |
Definition at line 69 of file vnl_vector.hxx.
| #define VNL_VECTOR_INSTANTIATE | ( | T | ) |
Definition at line 843 of file vnl_vector.hxx.
| #define VNL_VECTOR_INSTANTIATE_COMMON | ( | T | ) |
Definition at line 824 of file vnl_vector.hxx.
| #define VNL_VECTOR_INSTANTIATE_COMPLEX | ( | T | ) |
Definition at line 848 of file vnl_vector.hxx.
| double angle | ( | vnl_vector< T > const & | a, |
| vnl_vector< T > const & | b | ||
| ) |
Returns smallest angle between two non-zero n-dimensional vectors. O(n).
Definition at line 716 of file vnl_vector.hxx.
| T bracket | ( | vnl_vector< T > const & | u, |
| vnl_matrix< T > const & | A, | ||
| vnl_vector< T > const & | v | ||
| ) |
Returns the 'matrix element' <u|A|v> = u^t * A * v. O(mn).
Definition at line 592 of file vnl_vector.hxx.
| T cos_angle | ( | vnl_vector< T > const & | a, |
| vnl_vector< T > const & | b | ||
| ) |
Definition at line 697 of file vnl_vector.hxx.
| T dot_product | ( | vnl_vector< T > const & | v1, |
| vnl_vector< T > const & | v2 | ||
| ) |
Returns the dot product of two nd-vectors, or [v1]*[v2]^T. O(n).
Definition at line 564 of file vnl_vector.hxx.
| vnl_vector<T> element_product | ( | vnl_vector< T > const & | v1, |
| vnl_vector< T > const & | v2 | ||
| ) |
Returns new vector whose elements are the products v1[i]*v2[i]. O(n).
Definition at line 514 of file vnl_vector.hxx.
| vnl_vector<T> element_quotient | ( | vnl_vector< T > const & | v1, |
| vnl_vector< T > const & | v2 | ||
| ) |
Returns new vector whose elements are the quotients v1[i]/v2[i]. O(n).
Definition at line 531 of file vnl_vector.hxx.
| T inner_product | ( | vnl_vector< T > const & | v1, |
| vnl_vector< T > const & | v2 | ||
| ) |
Hermitian inner product. O(n).
Definition at line 578 of file vnl_vector.hxx.
| std::ostream& operator<< | ( | std::ostream & | s, |
| vnl_vector< T > const & | v | ||
| ) |
Overloads the output operator to print a vector. O(n).
Write vector to a std::ostream.
Definition at line 802 of file vnl_vector.hxx.
| std::istream& operator>> | ( | std::istream & | s, |
| vnl_vector< T > & | M | ||
| ) |
Read a vnl_vector from an ascii std::istream.
Read vector from a std::istream.
If the vector has nonzero size on input, read that many values. Otherwise, read to EOF.
Definition at line 814 of file vnl_vector.hxx.
| vnl_matrix<T> outer_product | ( | vnl_vector< T > const & | v1, |
| vnl_vector< T > const & | v2 | ||
| ) |
Returns the nxn outer product of two nd-vectors, or [v1]^T*[v2]. O(n).
Definition at line 610 of file vnl_vector.hxx.
1.8.15