KJB
|
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionality. More...
#include "m/m_vector.h"
#include "m/m_vec_norm.h"
#include "m/m_vec_metric.h"
#include "m_cpp/m_serialization.h"
#include "l_cpp/l_exception.h"
#include <algorithm>
#include <iterator>
#include <vector>
Go to the source code of this file.
Classes | |
class | kjb::Generic_vector_view< Vector_type > |
class | kjb::Generic_matrix_view< Matrix_type > |
class | kjb::Vector |
This class implements vectors, in the linear-algebra sense, with real-valued elements. More... | |
Namespaces | |
kjb | |
Classes and functions for dealing with trajectory files. | |
Typedefs | |
typedef Generic_vector_view < Vector > | kjb::Vector_view |
typedef const Generic_vector_view< const Vector > | kjb::Const_vector_view |
Functions | |
Vector | kjb::create_random_vector (int length) |
Construct a vector with values drawn from a uniform distribution over [0,1]. More... | |
Vector | kjb::create_gauss_random_vector (int length) |
Construct a vector with values drawn from a standard Gaussian distribution (mean 0, variance 1);. More... | |
Vector | kjb::create_zero_vector (int length) |
Construct a vector containing zeroes. More... | |
Vector | kjb::create_vector_from_vector_section (const Vector &iv, int begin, int length) |
Construct a vector by deep-copying a section of another vector. More... | |
Vector | kjb::operator* (const Vector &op1, const Matrix &op2) |
Return product of op1 (as a row-vec) times matrix on the right. More... | |
Vector | kjb::operator* (const Matrix &op1, const Vector &op2) |
Compute product of this matrix (on the left) and a column vector (on the right). More... | |
Vector | kjb::operator* (const Vector &op1, Vector::Value_type op2) |
Scalar multiply, resulting in a new vector, e.g., v * 6. More... | |
Vector | kjb::operator* (Vector::Value_type op1, const Vector &op2) |
Scalar multiplication of a vector. More... | |
Vector | kjb::operator/ (const Vector &op1, Vector::Value_type op2) |
Scalar division, yielding a new vector. More... | |
Vector | kjb::operator+ (const Vector &op1, const Vector &op2) |
Add two vectors, creating a new vector, e.g., v + w. More... | |
Vector | kjb::operator- (const Vector &op1, const Vector &op2) |
Subtract one vector from another, resulting in a new vector, e.g., v - w. More... | |
Vector | kjb::operator- (const Vector &op1) |
Return the negation of a vector, as in (-v), resulting in a new vector. More... | |
bool | kjb::operator== (const Vector &op1, const Vector::Impl_type &op2) |
Test for exact equality between vectors. More... | |
bool | kjb::operator== (const Vector::Impl_type &op1, const Vector &op2) |
Test for exact equality between vectors. More... | |
bool | kjb::operator!= (const Vector &op1, const Vector::Impl_type &op2) |
Test for (any) inequality between vectors. More... | |
bool | kjb::operator!= (const Vector::Impl_type &op1, const Vector &op2) |
Test for inequality between vectors. More... | |
bool | kjb::operator== (const Vector &op1, const Vector &op2) |
Test for exact equality between vectors. More... | |
bool | kjb::operator!= (const Vector &op1, const Vector &op2) |
Test for (any) inequality between vectors. More... | |
bool | kjb::operator< (const Vector &op1, const Vector &op2) |
Test weak lexicographic ordering between vectors. More... | |
bool | kjb::operator<= (const Vector &op1, const Vector &op2) |
Test lexicographic ordering between vectors. More... | |
bool | kjb::operator> (const Vector &op1, const Vector &op2) |
Test lexicographic ordering between vectors. More... | |
bool | kjb::operator>= (const Vector &op1, const Vector &op2) |
Test lexicographic ordering between vectors. More... | |
std::ostream & | kjb::operator<< (std::ostream &out, const Vector &m) |
Display vector contents in an ASCII format. More... | |
std::ostream & | kjb::stream_write_vector (std::ostream &ost, const Vector &m) |
Write vector to an output stream so it can be read with read_vector. More... | |
std::istream & | kjb::stream_read_vector (std::istream &ist, Vector &m) |
Read vector from an input stream. More... | |
Vector::Value_type | kjb::max_abs_difference (const Vector &op1, const Vector &op2) |
Return the maximum of the absolute values of the elementwise difference between two vectors, provided they have the same length. More... | |
Vector::Value_type | kjb::dot (const Vector &op1, const Vector &op2) |
Returns dot product of op1 and op2. More... | |
Vector | kjb::cross (const Vector &op1, const Vector &op2) |
Compute cross product of op1 and op2. More... | |
double | kjb::norm1 (const Vector &op) |
Compute L1-norm of vector. More... | |
double | kjb::norm2 (const Vector &op1) |
Compute L2-norm of vector. More... | |
double | kjb::vector_distance (const Vector &op1, const Vector &op2) |
Compute the Euclidian distance between two vectors. More... | |
double | kjb::vector_distance_squared (const Vector &op1, const Vector &op2) |
Compute the square of the Euclidian distance between two vectors. More... | |
Vector::Value_type | kjb::max (const Vector &vec) |
Return the maximum element in the vector. More... | |
Vector::Value_type | kjb::min (const Vector &vec) |
Return the minimum element in the vector. More... | |
Vector | kjb::cat_vectors (const Vector &first, const Vector &second) |
Concatenate two vectors. More... | |
template<class InputIterator > | |
Vector | kjb::cat_vectors (InputIterator first, InputIterator last) |
Concatenate the vectors in the given sequence of vectors. More... | |
template<class OutputIterator > | |
OutputIterator | kjb::separate_vector (const Vector &vec, int sz, OutputIterator result) |
Separate the given vector into vectors of the give size; the vectors will be output into the output iterator. More... | |
std::vector< Vector > | kjb::get_transpose (const std::vector< Vector > &m) |
Treat a std::vector of kjb::Vectors as a matrix and get its 'transpose'. More... | |
Int_vector | kjb::floor (const Vector &realv) |
Build an Int_vector that is the element-wise floor of a real Vector. More... | |
kjb::Vector | kjb::create_uniformly_spaced_vector (double a, double b, unsigned n) |
void | kjb::swap (Vector &v1, Vector &v2) |
Non-member swap. More... | |
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionality.
If you make changes to this file, PLEASE CONSIDER making parallel changes to l_int_vector.h, whose structure closely parallels the structure of this file. Tip: use vimdiff on both files to show the parallel structure.
Although this class has much the same interface as class Int_vector, they are not derived from a common abstract interface, because (1) we want as much speed as possible – this code should be eligible to put inside a tight inner loop; and (2) I don't know whether that would be useful.