KJB
|
Classes | |
class | kjb::Index_range |
class | kjb::Int_matrix |
This class implements matrices, in the linear-algebra sense, restricted to integer-valued elements. More... | |
class | kjb::Int_vector |
This class implements vectors, in the linear-algebra sense, restricted to integer-valued elements. More... | |
struct | kjb::Matrix_traits< value_type > |
struct | kjb::Matrix_traits< int > |
struct | kjb::Matrix_traits< double > |
class | kjb::Generic_matrix_view< Matrix_type > |
struct | kjb::Generic_const_matrix_view< Matrix_type > |
class | kjb::Matrix |
This class implements matrices, in the linear-algebra sense, with real-valued elements. More... | |
class | kjb::Matrix_d< M, N, Transposed > |
class | kjb::Matrix_stream_io |
static functions to read and write matrix classes with iostream. More... | |
class | kjb::Generic_vector_view< Vector_type > |
struct | kjb::Generic_const_vector_view< Vector_type > |
class | kjb::Vector |
This class implements vectors, in the linear-algebra sense, with real-valued elements. More... | |
class | kjb::Vector_d< D > |
class | kjb::Vector_stream_io |
functions to read and write vector classes with streams. More... | |
Typedefs | |
typedef boost::multi_array_ref < double, 2 > | kjb::Matrix_stl_view |
typedef Generic_matrix_view < Matrix > | kjb::Matrix_view |
typedef const Generic_matrix_view< const Matrix > | kjb::Const_matrix_view |
typedef Generic_vector_view < Matrix > | kjb::Matrix_vector_view |
typedef const Generic_vector_view< const Matrix > | kjb::Const_matrix_vector_view |
typedef Vector_d< 2 > | kjb::Vector2 |
typedef Vector_d< 3 > | kjb::Vector3 |
typedef Vector_d< 4 > | kjb::Vector4 |
Functions | |
template<class Indexable > | |
Indexable | kjb::ew_multiply (const Indexable &I, const Indexable &J) |
Multiply the elements of two Indexable things. Must be indexed via operator() and assignable. More... | |
template<class Indexable > | |
void | kjb::ew_abs_ow (Indexable &I) |
Element-wise abosulte value. More... | |
template<class Indexable > | |
void | kjb::ew_square_ow (Indexable &I) |
Square the elements of an indexable class in place. I must be indexed via operator(). More... | |
template<class Indexable > | |
Indexable | kjb::ew_square (const Indexable &I) |
Square the elements of an indexable class; the result is returned. I must be indexed via operator(). More... | |
template<class Indexable > | |
void | kjb::ew_sqrt_ow (Indexable &I) |
Take the square root of the elements of an indexable class in place. I must be indexed via operator(). More... | |
template<class Indexable > | |
Indexable | kjb::ew_sqrt (const Indexable &I) |
Take the square root the elements of an indexable class; the result is returned. I must be indexed via operator(). More... | |
void | kjb::swap (Index_range &r1, Index_range &r2) |
std::istream & | kjb::operator>> (std::istream &ist, Index_range &ir) |
Int_matrix | kjb::create_row_matrix (const Int_matrix::Vec_type &) |
Construct a one-row matrix by deep-copying a vector. More... | |
Int_matrix | kjb::create_diagonal_matrix (const Int_matrix::Vec_type &diagnoal) |
Construct a one-row matrix by deep-copying a vector. More... | |
Int_matrix | kjb::create_column_matrix (const Int_matrix::Vec_type &) |
Construct a one-column matrix by deep-copying a vector. More... | |
bool | kjb::operator== (const Int_matrix &op1, const Int_matrix::Impl_type &op2) |
Test for exact equality between two matrices. More... | |
std::ostream & | kjb::operator<< (std::ostream &out, const Int_matrix &m) |
Display matrix contents in an ASCII format. More... | |
Int_matrix | kjb::create_identity_int_matrix (int rank) |
Construct an identity matrix of specified rank. More... | |
Int_matrix | kjb::create_zero_int_matrix (int rows, int columns) |
Construct a zero matrix of specified size. More... | |
Int_matrix | kjb::create_zero_int_matrix (int rows) |
Construct a square zero matrix of specified size. More... | |
Int_matrix | kjb::operator* (const Int_matrix &op1, const Int_matrix &op2) |
Compute product of this matrix (on the left) and another. More... | |
Int_matrix | kjb::operator* (const Int_matrix &op1, Int_matrix::Value_type op2) |
Compute the product of this matrix and a scalar, yielding a new matrix. More... | |
Int_matrix | kjb::operator* (Int_matrix::Value_type op1, const Int_matrix &op2) |
Compute product of scalar and matrix, returning a new matrix. More... | |
Int_matrix | kjb::operator/ (const Int_matrix &op1, Int_matrix::Value_type op2) |
Compute new matrix equal to lefthand matrix with each entry divided by a scalar value. More... | |
Int_matrix | kjb::operator+ (const Int_matrix &op1, const Int_matrix &op2) |
Compute matrix addition, returning a new matrix. More... | |
Int_matrix | kjb::operator- (const Int_matrix &op1, const Int_matrix &op2) |
Compute matrix difference, returning a new matrix. More... | |
Int_matrix | kjb::operator- (const Int_matrix &op1) |
Return the additive inverse of this matrix. More... | |
bool | kjb::operator== (const Int_matrix &op1, const Int_matrix &op2) |
Test for exact equality between two matrices. More... | |
bool | kjb::operator!= (const Int_matrix &op1, const Int_matrix::Impl_type &op2) |
Test for any difference between two matrices. More... | |
bool | kjb::operator!= (const Int_matrix &op1, const Int_matrix &op2) |
Test for any difference between two matrices. More... | |
bool | kjb::operator== (const Int_matrix::Impl_type &op1, const Int_matrix &op2) |
Test for exact equality between two matrices. More... | |
bool | kjb::operator!= (const Int_matrix::Impl_type &op1, const Int_matrix &op2) |
Test for any difference between two matrices. More... | |
Int_matrix | kjb::matrix_transpose (const Int_matrix &op1) |
Test for any difference between two matrices. More... | |
Int_matrix | kjb::abs (const Int_matrix &mat) |
Compute the elementwise absolute value of a matrix. More... | |
Int_matrix::Value_type | kjb::max_abs_difference (const Int_matrix &op1, const Int_matrix &op2) |
Find the largest difference between two matrices. More... | |
Int_matrix::Value_type | kjb::min (const Int_matrix &mat) |
Return the minimum value in this matrix. More... | |
Int_matrix::Value_type | kjb::max (const Int_matrix &mat) |
Return the maximum value in this matrix. More... | |
Int_vector | kjb::operator* (const Int_vector &op1, const Int_matrix &op2) |
Return product of this (as a row-vec) times matrix on the right. More... | |
Int_vector | kjb::operator* (const Int_matrix &op1, const Int_vector &op2) |
Compute product of this matrix (on the left) and a column vector (on the right). More... | |
bool | kjb::operator== (const Int_vector &op1, const Int_vector::Impl_type &op2) |
Test for exact equality between vectors. More... | |
bool | kjb::operator< (const Int_vector &op1, const Int_vector &op2) |
Test weak lexicographic ordering between vectors. More... | |
Int_vector | kjb::cross (const Int_vector &op1, const Int_vector &op2) |
Compute cross product of op1 and op2. More... | |
std::ostream & | kjb::operator<< (std::ostream &out, const Int_vector &m) |
Display vector contents in an ASCII format. More... | |
Int_vector | kjb::create_random_int_vector (int length) |
Construct a vector with random contents. More... | |
Int_vector | kjb::create_vector_from_vector_section (const Int_vector &iv, int begin, int length) |
Construct a vector by deep-copying a section of another vector. More... | |
Int_vector | kjb::operator* (const Int_vector &op1, Int_vector::Value_type op2) |
Scalar multiply, resulting in a new vector, e.g., v * 6. More... | |
Int_vector | kjb::operator* (Int_vector::Value_type op1, const Int_vector &op2) |
Scalar multiplication of a vector. More... | |
Int_vector | kjb::operator/ (const Int_vector &op1, Int_vector::Value_type op2) |
Scalar integer division, yielding a new vector. More... | |
Int_vector | kjb::operator+ (const Int_vector &op1, const Int_vector &op2) |
Add two vectors, creating a new vector, e.g., v + w. More... | |
Int_vector | kjb::operator- (const Int_vector &op1, const Int_vector &op2) |
Subtract one vector from another, resulting in a new vector, e.g., v - w. More... | |
Int_vector | kjb::operator- (const Int_vector &op1) |
Return the negation of a vector, as in (-v), resulting in a new vector. More... | |
bool | kjb::operator== (const Int_vector::Impl_type &op1, const Int_vector &op2) |
Test for exact equality between vectors. More... | |
bool | kjb::operator!= (const Int_vector &op1, const Int_vector::Impl_type &op2) |
Test for (any) inequality between vectors. More... | |
bool | kjb::operator!= (const Int_vector::Impl_type &op1, const Int_vector &op2) |
Test for inequality between vectors. More... | |
bool | kjb::operator== (const Int_vector &op1, const Int_vector &op2) |
Test for exact equality between vectors. More... | |
bool | kjb::operator!= (const Int_vector &op1, const Int_vector &op2) |
Test for (any) inequality between vectors. More... | |
bool | kjb::operator<= (const Int_vector &op1, const Int_vector &op2) |
Test lexicographic ordering between vectors. More... | |
bool | kjb::operator> (const Int_vector &op1, const Int_vector &op2) |
Test lexicographic ordering between vectors. More... | |
bool | kjb::operator>= (const Int_vector &op1, const Int_vector &op2) |
Test lexicographic ordering between vectors. More... | |
Int_vector::Value_type | kjb::max_abs_difference (const Int_vector &op1, const Int_vector &op2) |
Return the maximum of the absolute values of the elementwise difference between two vectors, provided they have the same length. More... | |
long int | kjb::dot (const Int_vector &op1, const Int_vector &op2) |
Returns dot product of this and op2. More... | |
double | kjb::norm2 (const Int_vector &op1) |
Compute l2-norm of vector. More... | |
double | kjb::vector_distance (const Int_vector &op1, const Int_vector &op2) |
Compute the Euclidian distance between two vectors. More... | |
double | kjb::vector_distance_squared (const Int_vector &op1, const Int_vector &op2) |
Compute the square of the Euclidian distance between two vectors. More... | |
template<class Iterator > | |
Matrix_traits< typename std::iterator_traits< Iterator > ::value_type::value_type > ::Matrix_type | kjb::create_matrix_from_rows (Iterator begin, Iterator end) |
Build a matrix from a container of row vectors. More... | |
template<class Iterator > | |
Matrix_traits< typename std::iterator_traits< Iterator > ::value_type::value_type > ::Matrix_type | kjb::create_matrix_from_columns (const Iterator &begin, const Iterator &end) |
Build a matrix from a container of column vectors. More... | |
template<class Container_ > | |
Matrix_traits< typename Container_::value_type::value_type > ::Matrix_type | kjb::create_matrix_from_columns (const Container_ &cols) |
Build a matrix from a container of column vectors. More... | |
template<class Container_ > | |
Matrix_traits< typename Container_::value_type::value_type > ::Matrix_type | kjb::create_matrix_from_rows (const Container_ &rows) |
Build a matrix from a container of row vectors. More... | |
Matrix_stl_view | kjb::get_matrix_stl_view (kjb::Matrix &mat) |
Matrix | kjb::create_identity_matrix (int rank) |
Construct an identity matrix of specified rank. More... | |
Matrix | kjb::create_identity_matrix (int num_rows, int num_cols) |
Construct a rank-deficient identity matrix with the specified number of rows and columns. More... | |
Matrix | kjb::create_zero_matrix (int rows, int columns) |
Construct a zero matrix of specified size. More... | |
Matrix | kjb::create_zero_matrix (int size) |
Construct a square zero matrix of specified size. More... | |
Matrix | kjb::create_random_matrix (int num_rows, int num_cols) |
Matrix | kjb::create_gauss_random_matrix (int num_rows, int num_cols) |
Matrix | kjb::create_diagonal_matrix (const Matrix::Vec_type &diagonal) |
Construct a diagonal matrix from the specified vector. More... | |
Matrix | kjb::create_diagonal_matrix (const Matrix::Vec_type &diagonal, size_t n) |
Construct a "repeating" diagonal matrix from the specified vector. More... | |
Matrix | kjb::create_diagonal_matrix (int size, Matrix::Value_type a) |
Construct a diagonal matrix of the specified size, where the diagonal elements are set to the given value. More... | |
Matrix | kjb::create_row_matrix (const Vector &) |
Construct a one-row matrix by deep-copying a vector. More... | |
Matrix | kjb::create_column_matrix (const Vector &) |
Construct a one-column matrix by deep-copying a vector. More... | |
Matrix | kjb::operator* (const Matrix &op1, const Matrix &op2) |
Compute product of this matrix (on the left) and another. More... | |
Matrix | kjb::operator* (const Matrix &op1, Matrix::Value_type op2) |
Compute the product of this matrix and a scalar, yielding a new matrix. More... | |
Matrix | kjb::operator* (Matrix::Value_type op1, const Matrix &op2) |
Compute product of scalar and matrix, returning a new matrix. More... | |
Matrix | kjb::operator/ (const Matrix &op1, Matrix::Value_type op2) |
Compute new matrix equal to lefthand matrix with each entry divided by a scalar value. More... | |
Matrix | kjb::operator+ (const Matrix &op1, const Matrix &op2) |
Compute matrix addition, returning a new matrix. More... | |
Matrix | kjb::operator+ (const Matrix &op1, double op2) |
Compute matrix addition, returning a new matrix. More... | |
Matrix | kjb::operator- (const Matrix &op1, const Matrix &op2) |
Compute matrix difference, returning a new matrix. More... | |
Matrix | kjb::shift_rows_by (const Matrix &op1, const Vector &op2) |
Add the same vector to each row, return a new Matrix. More... | |
Matrix | kjb::shift_columns_by (const Matrix &op1, const Vector &op2) |
Add the same vector to each column, return a new Matrix. More... | |
Matrix | kjb::ew_multiply_rows_by (const Matrix &op1, const Vector &op2) |
Elementwise multiply each row of op1 by a op2, return a new Matrix. More... | |
Matrix | kjb::ew_multiply (const Matrix &op1, const Matrix &op2) |
Elementwise product of two matrices. More... | |
Matrix | kjb::operator- (const Matrix &op1, double op2) |
Compute matrix difference, returning a new matrix. More... | |
Matrix | kjb::operator- (const Matrix &op1) |
Return the additive inverse of this matrix. More... | |
bool | kjb::operator== (const Matrix &op1, const Matrix::Impl_type &op2) |
Test for exact equality between two matrices. More... | |
bool | kjb::operator== (const Matrix &op1, const Matrix &op2) |
Test for exact equality between two matrices. More... | |
bool | kjb::operator!= (const Matrix &op1, const Matrix::Impl_type &op2) |
Test for any difference between two matrices. More... | |
bool | kjb::operator!= (const Matrix &op1, const Matrix &op2) |
Test for any difference between two matrices. More... | |
bool | kjb::operator== (const Matrix::Impl_type &op1, const Matrix &op2) |
Test for exact equality between two matrices. More... | |
bool | kjb::operator!= (const Matrix::Impl_type &op1, const Matrix &op2) |
Test for any difference between two matrices. More... | |
bool | kjb::operator< (const Matrix &op1, const Matrix &op2) |
Returns true if a is lexicographically less-than b. More... | |
Matrix | kjb::matrix_inverse (const Matrix &op1) |
Invert this matrix. More... | |
Matrix | kjb::matrix_transpose (const Matrix &op1) |
Transpose this matrix. More... | |
Matrix | kjb::abs (const Matrix &mat) |
Compute the elementwise absolute value of a matrix. More... | |
double | kjb::sum_squared_elements (const Matrix &mat) |
Compute the sum of squared elements. More... | |
Matrix::Value_type | kjb::max_abs_difference (const Matrix &op1, const Matrix &op2) |
Find the largest difference between two matrices. More... | |
Matrix::Value_type | kjb::min (const Matrix &mat) |
Return the minimum value in this matrix. More... | |
Matrix::Value_type | kjb::max (const Matrix &mat) |
Return the maximum value in this matrix. More... | |
std::ostream & | kjb::operator<< (std::ostream &out, const Matrix &m) |
Display matrix contents in an ASCII format. More... | |
double | kjb::det (const Matrix &mat) |
Matrix | kjb::outer_product (const Vector &v1, const Vector &v2) |
Matrix::Vec_type | kjb::sum_matrix_cols (const Matrix &) |
Compute the matrix's sum across columns (a.k.a. row-wise sum) More... | |
Matrix::Vec_type | kjb::sum_matrix_rows (const Matrix &) |
Compute the matrix's sum down (a.k.a. columnar sum), like MATLAB. More... | |
Int_matrix | kjb::create_int_matrix_from_matrix_floor (const Matrix &) |
Construct an Int_matrix with elements equal to the floor() of a given floating-point Matrix. More... | |
Int_matrix | kjb::floor (const Matrix &m) |
Int_matrix | kjb::create_int_matrix_from_matrix_ceil (const Matrix &) |
Construct a matrix with elements equal to the ceiling, ceil() of a given floating-point Matrix. More... | |
Matrix | kjb::logical_or (Matrix a, Matrix b) |
returns a matrix with 1s and 0s. 1 if either has a non zero value in that position, 0 otherwise More... | |
Matrix | kjb::logical_and (Matrix a, Matrix b) |
returns a matrix with 1s and 0s. 1 if both matricies have a non zero value in that position, 0 otherwise More... | |
Matrix | kjb::logical_not (Matrix a) |
returns a matrix with 1s and 0s. 1 if the value is 0, and 0 otherwise. More... | |
Matrix | kjb::tile_matrix (Matrix trixy, unsigned m, unsigned n) |
Construct a tiling of the given matrix. More... | |
Matrix | kjb::tile_matrix (int tehnum, unsigned m, unsigned n) |
Construct a tiling of the given matrix, in this case, a matrix of the given number with the specified size. More... | |
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) |
template<std::size_t D> | |
Vector | kjb::operator* (const Matrix &m, const Vector_d< D > v) |
multiply by static vector More... | |
Vector | kjb::multiply_matrix_and_vector_d_dispatch_ (const Matrix &m, const double *v, size_t size) |
dispatch for operator*(Matrix, Vector_d). This deals with a circular dependency between matrix.h and vector_d.h by moving template code into a cpp file. DO NOT CALL DIRECTLY! More... | |
template<std::size_t D> | |
Vector_d< D > | kjb::operator- (const Vector_d< D > &first, const Vector_d< D > &second) |
template<std::size_t D> | |
Vector_d< D > | kjb::operator- (const Vector_d< D > &first, double second) |
template<std::size_t D> | |
Vector_d< D > | kjb::operator- (double first, const Vector_d< D > &second) |
template<std::size_t D> | |
Vector_d< D > | kjb::operator- (const Vector_d< D > &first) |
template<std::size_t D> | |
Vector_d< D > | kjb::operator+ (const Vector_d< D > &first, const Vector_d< D > &second) |
template<std::size_t D> | |
Vector_d< D > | kjb::operator+ (const Vector_d< D > &first, double second) |
template<std::size_t D> | |
Vector_d< D > | kjb::operator+ (double first, const Vector_d< D > &second) |
template<std::size_t D> | |
Vector_d< D > | kjb::operator* (const Vector_d< D > &v, double s) |
template<std::size_t D> | |
Vector_d< D > | kjb::operator* (double s, const Vector_d< D > &v) |
template<std::size_t D> | |
Vector_d< D > | kjb::operator/ (const Vector_d< D > &v, double s) |
template<std::size_t N> | |
void | kjb::swap (Vector_d< N > &first, Vector_d< N > &second) |
template<std::size_t N> | |
bool | kjb::operator== (const Vector_d< N > &first, const Vector_d< N > &second) |
template<std::size_t N> | |
bool | kjb::operator!= (const Vector_d< N > &first, const Vector_d< N > &second) |
template<std::size_t N> | |
bool | kjb::operator< (const Vector_d< N > &first, const Vector_d< N > &second) |
template<std::size_t N> | |
bool | kjb::operator> (const Vector_d< N > &first, const Vector_d< N > &second) |
template<std::size_t N> | |
bool | kjb::operator<= (const Vector_d< N > &first, const Vector_d< N > &second) |
template<std::size_t N> | |
bool | kjb::operator>= (const Vector_d< N > &first, const Vector_d< N > &second) |
template<size_t D> | |
double | kjb::norm1 (const kjb::Vector_d< D > &v) |
template<size_t D> | |
double | kjb::norm2 (const kjb::Vector_d< D > &v) |
template<size_t D> | |
Vector_d< D > | kjb::create_random_vector () |
template<size_t D> | |
Vector_d< D > | kjb::create_gauss_random_vector () |
Vector2 | kjb::create_random_vector2 () |
Vector3 | kjb::create_random_vector3 () |
Vector4 | kjb::create_random_vector4 () |
template<size_t D> | |
Vector_d< D > | kjb::create_unit_vector (size_t d) |
Vector2 | kjb::make_vector2 (const Vector &v) |
Vector3 | kjb::make_vector3 (const Vector &v) |
Vector4 | kjb::make_vector4 (const Vector &v) |
template<std::size_t D> | |
std::ostream & | kjb::operator<< (std::ostream &out, const Vector_d< D > &v) |
template<std::size_t D> | |
std::istream & | kjb::operator>> (std::istream &ist, Vector_d< D > &v) |
template<std::size_t D> | |
double | kjb::dot (const Vector_d< D > &op1, const Vector_d< D > &op2) |
template<std::size_t D> | |
double | kjb::vector_distance (const Vector_d< D > &op1, const Vector_d< D > &op2) |
Compute the Euclidian distance between two vectors. More... | |
template<std::size_t D> | |
double | kjb::vector_distance_squared (const Vector_d< D > &op1, const Vector_d< D > &op2) |
Compute the Euclidian distance between two vectors. More... | |
Vector3 | kjb::cross (const Vector3 &op1, const Vector3 &op2) |
kjb::Int_matrix::Int_matrix (int rows, int cols, const Value_type *data) | |
Ctor builds a matrix and initializes entries from an array. More... | |
kjb::Int_matrix::Int_matrix (const std::string &file_name) | |
Read matrix from file. More... | |
Int_matrix & | kjb::Int_matrix::resize (int new_rows, int new_cols, Value_type pad=Value_type(0)) |
Resize this matrix, retaining previous values. More... | |
Vec_type | kjb::Int_matrix::get_row (int row) const |
Return a specified row of this matrix, in the form of an Int_vector. More... | |
Vec_type | kjb::Int_matrix::get_col (int col) const |
Return a specified column of this matrix, in the form of an Int_vector. More... | |
Int_matrix & | kjb::Int_matrix::operator/= (Int_matrix::Value_type op2) |
Perform integer division on each entry in the matrix by a scalar value. More... | |
Mat_type & | kjb::Int_matrix::mapcar (Mapper) |
Transform the elements of a matrix. More... | |
template<class Generic_vector > | |
void | kjb::Int_matrix::set_row (int row, const Generic_vector &v) |
Replace a row of the matrix with the given vector. More... | |
template<class Iterator > | |
void | kjb::Int_matrix::set_row (int row, Iterator begin, Iterator end) |
Dispatch for set_row. Don't call directly. More... | |
template<class Generic_vector > | |
void | kjb::Int_matrix::set_col (int col, const Generic_vector &v) |
Replace a column of the matrix with the given vector. "vector" can be any collection of values convertible to int. More... | |
template<class Iterator > | |
void | kjb::Int_matrix::set_col (int col, Iterator begin, Iterator end) |
Dispatch for set_col. Don't call directly. More... | |
kjb::Int_vector::Int_vector (const Mat_type &src) | |
Ctor builds from a one-row or one-column Int_matrix (making a deep copy). More... | |
kjb::Int_vector::Int_vector (const std::string &file_name) | |
Construct a vector by reading contents from a named file. More... | |
Int_vector & | kjb::Int_vector::resize (int new_length, Value_type pad=Value_type(0)) |
Resize vector, retaining previous values. More... | |
Int_vector & | kjb::Int_vector::randomize (int length) |
Clobber current vector; resize and fill with random values. More... | |
Int_vector & | kjb::Int_vector::operator/= (Value_type op2) |
Scalar integer division of self, in-place. More... | |
Vec_type & | kjb::Int_vector::mapcar (Mapper) |
Transform the elements of a vector. More... | |
kjb::Int_matrix | kjb::Int_vector::hat () const |
Construct an "equivalent" skew-symmetric matrix from 3-vector. More... | |
Int_vector & | kjb::Int_vector::cross_with (const Int_vector &op2) |
Compute (in place) cross product of this vector and op2. More... | |
template<typename InputIterator > | |
void | kjb::Int_vector::insert (iterator position, InputIterator begin_, InputIterator end_) |
Insert range [begin, end) before position. More... | |
template<typename OutputIterator > | |
OutputIterator | kjb::Matrix::get_all_rows (OutputIterator result) const |
Return all rows of this matrix into the provided iterator. More... | |
template<typename OutputIterator > | |
OutputIterator | kjb::Matrix::get_all_cols (OutputIterator result) const |
Return all columns of this matrix into the provided iterator. More... | |
template<class Generic_vector > | |
void | kjb::Matrix::set_row (int row, const Generic_vector &v) |
Replace a row of the matrix with the given vector. More... | |
template<class Iterator > | |
void | kjb::Matrix::set_row (int row, Iterator begin, Iterator end) |
Dispatch for set_row. Don't call directly. More... | |
template<class Generic_vector > | |
void | kjb::Matrix::set_col (int col, const Generic_vector &v) |
Replace a column of the matrix with the given vector. "vector" can be any collection of values convertible to double. More... | |
template<class Iterator > | |
void | kjb::Matrix::set_col (int col, Iterator begin, Iterator end) |
Dispatch for set_col. Don't call directly. More... | |
template<typename InputIterator > | |
void | kjb::Vector::insert (iterator position, InputIterator begin_, InputIterator end_) |
Insert range [begin, end) before position. More... | |
template<typename InputIterator > | |
void | kjb::Vector::assign (InputIterator begin_, InputIterator end_) |
Assign this vector to the values in sequence (begin_, and_) More... | |
This group tries to gather all the general-purpose matrix- and vector-related functions and classes, including basic math and basic utilities and manipulations.
typedef const Generic_vector_view<const Matrix> kjb::Const_matrix_vector_view |
typedef const Generic_matrix_view<const Matrix> kjb::Const_matrix_view |
typedef boost::multi_array_ref<double, 2> kjb::Matrix_stl_view |
typedef Generic_vector_view<Matrix> kjb::Matrix_vector_view |
typedef Generic_matrix_view<Matrix> kjb::Matrix_view |
typedef Vector_d< 2 > kjb::Vector2 |
typedef Vector_d< 3 > kjb::Vector3 |
typedef Vector_d< 4 > kjb::Vector4 |
|
inline |
Compute the elementwise absolute value of a matrix.
|
inline |
Compute the elementwise absolute value of a matrix.
void kjb::Vector::assign | ( | InputIterator | begin_, |
InputIterator | end_ | ||
) |
Assign this vector to the values in sequence (begin_, and_)
|
inline |
Concatenate two vectors.
Vector kjb::cat_vectors | ( | InputIterator | first, |
InputIterator | last | ||
) |
Concatenate the vectors in the given sequence of vectors.
Int_matrix kjb::create_column_matrix | ( | const Int_matrix::Vec_type & | vec | ) |
Construct a one-column matrix by deep-copying a vector.
Matrix kjb::create_column_matrix | ( | const Matrix::Vec_type & | vec | ) |
Construct a one-column matrix by deep-copying a vector.
Int_matrix kjb::create_diagonal_matrix | ( | const Int_matrix::Vec_type & | diagonal | ) |
Construct a one-row matrix by deep-copying a vector.
Matrix kjb::create_diagonal_matrix | ( | const Matrix::Vec_type & | diagonal | ) |
Construct a diagonal matrix from the specified vector.
Matrix kjb::create_diagonal_matrix | ( | const Matrix::Vec_type & | diagonal, |
size_t | n | ||
) |
Construct a "repeating" diagonal matrix from the specified vector.
|
inline |
Construct a diagonal matrix of the specified size, where the diagonal elements are set to the given value.
Matrix kjb::create_gauss_random_matrix | ( | int | num_rows, |
int | num_cols | ||
) |
Construct a matrix with gaussian random values. Numbers are generated from kjb_rand(), which is seeded by kjb_seed_rand().
Vector_d< D > kjb::create_gauss_random_vector | ( | ) |
Vector kjb::create_gauss_random_vector | ( | int | length | ) |
Construct a vector with values drawn from a standard Gaussian distribution (mean 0, variance 1);.
|
inline |
Construct an identity matrix of specified rank.
|
inline |
Construct an identity matrix of specified rank.
|
inline |
Construct a rank-deficient identity matrix with the specified number of rows and columns.
Int_matrix kjb::create_int_matrix_from_matrix_ceil | ( | const Matrix & | ) |
Construct a matrix with elements equal to the ceiling, ceil() of a given floating-point Matrix.
Int_matrix kjb::create_int_matrix_from_matrix_floor | ( | const Matrix & | ) |
Construct an Int_matrix with elements equal to the floor() of a given floating-point Matrix.
Matrix_traits<typename std::iterator_traits<Iterator>::value_type::value_type>::Matrix_type kjb::create_matrix_from_columns | ( | const Iterator & | begin, |
const Iterator & | end | ||
) |
Build a matrix from a container of column vectors.
|
inline |
Build a matrix from a container of column vectors.
Matrix_traits<typename std::iterator_traits<Iterator>::value_type::value_type>::Matrix_type kjb::create_matrix_from_rows | ( | Iterator | begin, |
Iterator | end | ||
) |
Build a matrix from a container of row vectors.
|
inline |
Build a matrix from a container of row vectors.
|
inline |
Construct a vector with random contents.
|
inline |
Construct a matrix with uniform random values in [0,1]. Numbers are generated from kjb_rand(), which is seeded by kjb_seed_rand().
Vector_d< D > kjb::create_random_vector | ( | ) |
|
inline |
Construct a vector with values drawn from a uniform distribution over [0,1].
|
inline |
|
inline |
|
inline |
Int_matrix kjb::create_row_matrix | ( | const Int_matrix::Vec_type & | vec | ) |
Construct a one-row matrix by deep-copying a vector.
Matrix kjb::create_row_matrix | ( | const Matrix::Vec_type & | vec | ) |
Construct a one-row matrix by deep-copying a vector.
kjb::Vector kjb::create_uniformly_spaced_vector | ( | double | a, |
double | b, | ||
unsigned | n | ||
) |
Vector_d< D > kjb::create_unit_vector | ( | size_t | d | ) |
|
inline |
Construct a vector by deep-copying a section of another vector.
|
inline |
Construct a vector by deep-copying a section of another vector.
|
inline |
Construct a zero matrix of specified size.
|
inline |
Construct a square zero matrix of specified size.
|
inline |
Construct a zero matrix of specified size.
|
inline |
Construct a square zero matrix of specified size.
|
inline |
Construct a vector containing zeroes.
Int_vector kjb::cross | ( | const Int_vector & | op1, |
const Int_vector & | op2 | ||
) |
Compute cross product of op1 and op2.
Store result in this vector. Only defined for dimension = 3.
|
inline |
Compute cross product between two 3-vectors
Vector kjb::cross | ( | const Vector & | op1, |
const Vector & | op2 | ||
) |
Compute cross product of op1 and op2.
Store result in this vector. Only defined for dimension = 3.
Int_vector & kjb::Int_vector::cross_with | ( | const Int_vector & | op2 | ) |
Compute (in place) cross product of this vector and op2.
Store result in this vector. Only defined for dimension = 3.
double kjb::det | ( | const Matrix & | mat | ) |
Compute the matrix determinant.
|
inline |
Returns dot product of this and op2.
|
inline |
Returns dot product of op1 and op2.
void kjb::ew_abs_ow | ( | Indexable & | I | ) |
Element-wise abosulte value.
Indexable kjb::ew_multiply | ( | const Indexable & | I, |
const Indexable & | J | ||
) |
Multiply the elements of two Indexable things. Must be indexed via operator() and assignable.
|
inline |
Elementwise product of two matrices.
|
inline |
Elementwise multiply each row of op1 by a op2, return a new Matrix.
Indexable kjb::ew_sqrt | ( | const Indexable & | I | ) |
Take the square root the elements of an indexable class; the result is returned. I must be indexed via operator().
void kjb::ew_sqrt_ow | ( | Indexable & | I | ) |
Take the square root of the elements of an indexable class in place. I must be indexed via operator().
Indexable kjb::ew_square | ( | const Indexable & | I | ) |
Square the elements of an indexable class; the result is returned. I must be indexed via operator().
void kjb::ew_square_ow | ( | Indexable & | I | ) |
Square the elements of an indexable class in place. I must be indexed via operator().
Int_vector kjb::floor | ( | const Vector & | realv | ) |
Build an Int_vector that is the element-wise floor of a real Vector.
Int_matrix kjb::floor | ( | const Matrix & | m | ) |
alias for create_int_matrix_from_matrix_floor()
OutputIterator kjb::Matrix::get_all_cols | ( | OutputIterator | result | ) | const |
Return all columns of this matrix into the provided iterator.
OutputIterator kjb::Matrix::get_all_rows | ( | OutputIterator | result | ) | const |
Return all rows of this matrix into the provided iterator.
Int_matrix::Vec_type kjb::Int_matrix::get_col | ( | int | col | ) | const |
Return a specified column of this matrix, in the form of an Int_vector.
Matrix_stl_view kjb::get_matrix_stl_view | ( | kjb::Matrix & | mat | ) |
Get view of the matrix that has a similar interface to an stl-style std::vector<std::vector<double> >. When subscripting, inidices are specified using subscript operators, not the parentheses operator; i.e. you can index using m[1][2] instead of m(1,2); This is a lightweight operation: no copy is made, only metadata is allocated; Naturally, caller is responsible for ensuring that the returned view is outlived by this Matrix.
Int_matrix::Vec_type kjb::Int_matrix::get_row | ( | int | row | ) | const |
Return a specified row of this matrix, in the form of an Int_vector.
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'.
Int_matrix kjb::Int_vector::hat | ( | ) | const |
Construct an "equivalent" skew-symmetric matrix from 3-vector.
The result is useful for computing a cross product. Only implemented for dimension = 3. The formula is as follows:
( 0 -c b ) Hat of (a b c)' := ( c 0 -a ) ( -b a 0 ).
void kjb::Int_vector::insert | ( | iterator | position, |
InputIterator | begin_, | ||
InputIterator | end_ | ||
) |
Insert range [begin, end) before position.
void kjb::Vector::insert | ( | iterator | position, |
InputIterator | begin_, | ||
InputIterator | end_ | ||
) |
Insert range [begin, end) before position.
kjb::Int_matrix::Int_matrix | ( | int | rows, |
int | cols, | ||
const Value_type * | data | ||
) |
Ctor builds a matrix and initializes entries from an array.
The data array must be of length at least (rows x cols). The matrix is filled in row-major order.
kjb::Int_matrix::Int_matrix | ( | const std::string & | file_name | ) |
Read matrix from file.
|
explicit |
Ctor builds from a one-row or one-column Int_matrix (making a deep copy).
kjb::Int_vector::Int_vector | ( | const std::string & | file_name | ) |
Construct a vector by reading contents from a named file.
Matrix kjb::logical_and | ( | Matrix | a, |
Matrix | b | ||
) |
returns a matrix with 1s and 0s. 1 if both matricies have a non zero value in that position, 0 otherwise
Matrix kjb::logical_not | ( | Matrix | a | ) |
returns a matrix with 1s and 0s. 1 if the value is 0, and 0 otherwise.
Matrix kjb::logical_or | ( | Matrix | a, |
Matrix | b | ||
) |
returns a matrix with 1s and 0s. 1 if either has a non zero value in that position, 0 otherwise
Vector2 kjb::make_vector2 | ( | const Vector & | v | ) |
Vector3 kjb::make_vector3 | ( | const Vector & | v | ) |
Vector4 kjb::make_vector4 | ( | const Vector & | v | ) |
Int_matrix & kjb::Int_matrix::mapcar | ( | Mapper | fun | ) |
Transform the elements of a matrix.
Apply a transformation fun to each element of the matrix, in place, and return an lvalue of the modified matrix.
Int_vector & kjb::Int_vector::mapcar | ( | Mapper | fun | ) |
Transform the elements of a vector.
Apply a transformation fun to each element of the vector, in place, and return an lvalue of the modified vector.
Matrix kjb::matrix_inverse | ( | const Matrix & | op1 | ) |
Invert this matrix.
|
inline |
Test for any difference between two matrices.
|
inline |
Transpose this matrix.
|
inline |
Return the maximum value in this matrix.
|
inline |
Return the maximum element in the vector.
|
inline |
Return the maximum value in this matrix.
|
inline |
Find the largest difference between two matrices.
That is, this method compares two matrices of the same size, computes the absolute values of the differences of corresponding elements, and returns the maximum.
Dimension_mismatch | if they differ in sizes |
|
inline |
Return the maximum of the absolute values of the elementwise difference between two vectors, provided they have the same length.
Dimension_mismatch,if | the lengths differ. |
Matrix::Value_type kjb::max_abs_difference | ( | const Matrix & | op1, |
const Matrix & | op2 | ||
) |
Find the largest difference between two matrices.
That is, this method compares two matrices of the same size, computes the absolute values of the differences of corresponding elements, and returns the maximum.
Dimension_mismatch | if they differ in sizes |
|
inline |
Return the maximum of the absolute values of the elementwise difference between two vectors, provided they have the same length.
Dimension_mismatch,if | the lengths differ. |
|
inline |
Return the minimum value in this matrix.
|
inline |
Return the minimum element in the vector.
|
inline |
Return the minimum value in this matrix.
Vector kjb::multiply_matrix_and_vector_d_dispatch_ | ( | const Matrix & | m, |
const double * | v, | ||
size_t | size | ||
) |
dispatch for operator*(Matrix, Vector_d). This deals with a circular dependency between matrix.h and vector_d.h by moving template code into a cpp file. DO NOT CALL DIRECTLY!
double kjb::norm1 | ( | const kjb::Vector_d< D > & | v | ) |
|
inline |
Compute L1-norm of vector.
This function is required for some KJB algorithms, and is required to adhere to the ModelParameters concept.
double kjb::norm2 | ( | const kjb::Vector_d< D > & | v | ) |
|
inline |
Compute l2-norm of vector.
This function is required for some KJB algorithms, and is required to adhere to the ModelParameters concept.
|
inline |
Compute L2-norm of vector.
This function is required for some KJB algorithms, and is required to adhere to the ModelParameters concept.
bool kjb::operator!= | ( | const Vector_d< N > & | first, |
const Vector_d< N > & | second | ||
) |
|
inline |
Test for any difference between two matrices.
|
inline |
Test for any difference between two matrices.
|
inline |
Test for any difference between two matrices.
|
inline |
Test for (any) inequality between vectors.
|
inline |
Test for inequality between vectors.
This is an inline to allow the KJB C struct appear on the left side of the ==.
|
inline |
Test for (any) inequality between vectors.
|
inline |
Test for (any) inequality between vectors.
|
inline |
Test for inequality between vectors.
This is an inline to allow the KJB C struct appear on the left side of the ==.
|
inline |
Test for (any) inequality between vectors.
|
inline |
Test for any difference between two matrices.
|
inline |
Test for any difference between two matrices.
|
inline |
Test for any difference between two matrices.
Int_vector kjb::operator* | ( | const Int_vector & | op1, |
const Int_matrix & | op2 | ||
) |
Return product of this (as a row-vec) times matrix on the right.
Semantics could be expressed as vT * M, where vT is this vector, as a row, and M is a matrix with the same number of rows as the length of vT.
Vector kjb::operator* | ( | const Matrix & | m, |
const Vector_d< D > | v | ||
) |
multiply by static vector
Int_vector kjb::operator* | ( | const Int_matrix & | op1, |
const Int_vector & | op2 | ||
) |
Compute product of this matrix (on the left) and a column vector (on the right).
Dimension_mismatch | if the number of columns of this matrix does not equal the length of right factor op2. |
Vector kjb::operator* | ( | const Vector & | op1, |
const Matrix & | op2 | ||
) |
Return product of op1 (as a row-vec) times matrix on the right.
Semantics could be expressed as op1^T * M, where M is a matrix with the same number of rows as the length of op1^T.
Vector kjb::operator* | ( | const Matrix & | op1, |
const Vector & | op2 | ||
) |
Compute product of this matrix (on the left) and a column vector (on the right).
Dimension_mismatch | if the number of columns of this matrix does not equal the length of right factor op2. |
|
inline |
Compute product of this matrix (on the left) and another.
Dimension_mismatch | if the number of columns of this matrix does not equal the number of rows of right factor op2. |
|
inline |
Compute the product of this matrix and a scalar, yielding a new matrix.
|
inline |
Compute product of scalar and matrix, returning a new matrix.
|
inline |
Scalar multiply, resulting in a new vector, e.g., v * 6.
|
inline |
Scalar multiplication of a vector.
This is an inline to allow the scalar to appear on the left side of the operator.
|
inline |
Scalar multiply, resulting in a new vector, e.g., v * 6.
|
inline |
Scalar multiplication of a vector.
This is an inline to allow the scalar to appear on the left side of the operator.
|
inline |
Compute product of this matrix (on the left) and another.
Dimension_mismatch | if the number of columns of this matrix does not equal the number of rows of right factor op2. |
|
inline |
Compute the product of this matrix and a scalar, yielding a new matrix.
|
inline |
Compute product of scalar and matrix, returning a new matrix.
Vector_d< D > kjb::operator+ | ( | const Vector_d< D > & | first, |
const Vector_d< D > & | second | ||
) |
|
inline |
Compute matrix addition, returning a new matrix.
|
inline |
Add two vectors, creating a new vector, e.g., v + w.
|
inline |
Add two vectors, creating a new vector, e.g., v + w.
|
inline |
Compute matrix addition, returning a new matrix.
|
inline |
Compute matrix addition, returning a new matrix.
Vector_d< D > kjb::operator- | ( | const Vector_d< D > & | first, |
const Vector_d< D > & | second | ||
) |
|
inline |
Compute matrix difference, returning a new matrix.
|
inline |
Return the additive inverse of this matrix.
|
inline |
Subtract one vector from another, resulting in a new vector, e.g., v - w.
|
inline |
Return the negation of a vector, as in (-v), resulting in a new vector.
|
inline |
Subtract one vector from another, resulting in a new vector, e.g., v - w.
|
inline |
Return the negation of a vector, as in (-v), resulting in a new vector.
|
inline |
Compute matrix difference, returning a new matrix.
|
inline |
Compute matrix difference, returning a new matrix.
|
inline |
Return the additive inverse of this matrix.
|
inline |
Compute new matrix equal to lefthand matrix with each entry divided by a scalar value.
Divide_by_zero | if the given value is zero. |
|
inline |
Scalar integer division, yielding a new vector.
|
inline |
Scalar division, yielding a new vector.
|
inline |
Compute new matrix equal to lefthand matrix with each entry divided by a scalar value.
Divide_by_zero | if the given value is zero. |
Int_matrix & kjb::Int_matrix::operator/= | ( | Int_matrix::Value_type | op2 | ) |
Perform integer division on each entry in the matrix by a scalar value.
Divide_by_zero | if the scalar value is zero. |
Int_vector & kjb::Int_vector::operator/= | ( | Value_type | op2 | ) |
Scalar integer division of self, in-place.
bool kjb::operator< | ( | const Int_vector & | op1, |
const Int_vector & | op2 | ||
) |
Test weak lexicographic ordering between vectors.
bool kjb::operator< | ( | const Vector_d< N > & | first, |
const Vector_d< N > & | second | ||
) |
bool kjb::operator< | ( | const Vector & | op1, |
const Vector & | op2 | ||
) |
Test weak lexicographic ordering between vectors.
|
inline |
Returns true if a is lexicographically less-than b.
std::ostream & kjb::operator<< | ( | std::ostream & | out, |
const Vector_d< D > & | v | ||
) |
std::ostream & kjb::operator<< | ( | std::ostream & | out, |
const Int_matrix & | m | ||
) |
Display matrix contents in an ASCII format.
This routine is mostly for debugging; consider one of the many KJB output routines for more output in a more standardized form.
std::ostream & kjb::operator<< | ( | std::ostream & | out, |
const Int_vector & | m | ||
) |
Display vector contents in an ASCII format.
This routine is mostly for debugging; consider one of the many KJB output routines for more output in a more standardized form.
std::ostream & kjb::operator<< | ( | std::ostream & | out, |
const Vector & | m | ||
) |
Display vector contents in an ASCII format.
This routine is mostly for debugging; consider one of the many KJB output routines for more output in a more standardized form.
std::ostream & kjb::operator<< | ( | std::ostream & | out, |
const Matrix & | m | ||
) |
Display matrix contents in an ASCII format.
This routine is mostly for debugging; consider one of the many KJB output routines for more output in a more standardized form.
bool kjb::operator<= | ( | const Vector_d< N > & | first, |
const Vector_d< N > & | second | ||
) |
|
inline |
Test lexicographic ordering between vectors.
|
inline |
Test lexicographic ordering between vectors.
bool kjb::operator== | ( | const Int_matrix & | op1, |
const Int_matrix::Impl_type & | op2 | ||
) |
Test for exact equality between two matrices.
bool kjb::operator== | ( | const Int_vector & | op1, |
const Int_vector::Impl_type & | op2 | ||
) |
Test for exact equality between vectors.
bool kjb::operator== | ( | const Vector_d< N > & | first, |
const Vector_d< N > & | second | ||
) |
bool kjb::operator== | ( | const Vector & | op1, |
const Vector::Impl_type & | op2 | ||
) |
Test for exact equality between vectors.
bool kjb::operator== | ( | const Matrix & | op1, |
const Matrix::Impl_type & | op2 | ||
) |
Test for exact equality between two matrices.
|
inline |
Test for exact equality between two matrices.
|
inline |
Test for exact equality between two matrices.
|
inline |
Test for exact equality between vectors.
This is an inline to allow the KJB C struct appear on the left side of the ==.
|
inline |
Test for exact equality between vectors.
|
inline |
Test for exact equality between vectors.
This is an inline to allow the KJB C struct appear on the left side of the ==.
|
inline |
Test for exact equality between vectors.
|
inline |
Test for exact equality between two matrices.
|
inline |
Test for exact equality between two matrices.
bool kjb::operator> | ( | const Vector_d< N > & | first, |
const Vector_d< N > & | second | ||
) |
|
inline |
Test lexicographic ordering between vectors.
|
inline |
Test lexicographic ordering between vectors.
bool kjb::operator>= | ( | const Vector_d< N > & | first, |
const Vector_d< N > & | second | ||
) |
|
inline |
Test lexicographic ordering between vectors.
|
inline |
Test lexicographic ordering between vectors.
std::istream & kjb::operator>> | ( | std::istream & | ist, |
Vector_d< D > & | v | ||
) |
|
inline |
Read Index range from a text stream. Assumes string has no whitespace
|
inline |
Compute the outer-product (dyadic product) of two vectors.
Int_vector & kjb::Int_vector::randomize | ( | int | length | ) |
Clobber current vector; resize and fill with random values.
Random values are uniformly distributed between 0 and RAND_MAX.
Int_matrix & kjb::Int_matrix::resize | ( | int | new_rows, |
int | new_cols, | ||
Value_type | pad = Value_type(0) |
||
) |
Resize this matrix, retaining previous values.
Int_vector & kjb::Int_vector::resize | ( | int | new_length, |
Value_type | pad = Value_type(0) |
||
) |
Resize vector, retaining previous values.
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.
void kjb::Int_matrix::set_col | ( | int | col, |
const Generic_vector & | v | ||
) |
Replace a column of the matrix with the given vector. "vector" can be any collection of values convertible to int.
void kjb::Int_matrix::set_col | ( | int | col, |
Iterator | begin, | ||
Iterator | end | ||
) |
Dispatch for set_col. Don't call directly.
void kjb::Matrix::set_col | ( | int | col, |
const Generic_vector & | v | ||
) |
Replace a column of the matrix with the given vector. "vector" can be any collection of values convertible to double.
void kjb::Matrix::set_col | ( | int | col, |
Iterator | begin, | ||
Iterator | end | ||
) |
Dispatch for set_col. Don't call directly.
void kjb::Int_matrix::set_row | ( | int | row, |
const Generic_vector & | v | ||
) |
Replace a row of the matrix with the given vector.
void kjb::Int_matrix::set_row | ( | int | row, |
Iterator | begin, | ||
Iterator | end | ||
) |
Dispatch for set_row. Don't call directly.
void kjb::Matrix::set_row | ( | int | row, |
const Generic_vector & | v | ||
) |
Replace a row of the matrix with the given vector.
void kjb::Matrix::set_row | ( | int | row, |
Iterator | begin, | ||
Iterator | end | ||
) |
Dispatch for set_row. Don't call directly.
|
inline |
Add the same vector to each column, return a new Matrix.
|
inline |
Add the same vector to each row, return a new Matrix.
std::istream & kjb::stream_read_vector | ( | std::istream & | ist, |
Vector & | m | ||
) |
Read vector from an input stream.
Vector is assumed to have been written using stream_write_vector().
If you aren't using boost serialization, this is the preferred way to de-serialize a vector.
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.
If you aren't using boost serialization, this is the preferred way to serialize a vector for later reading with stream_read_vector.
Matrix::Vec_type kjb::sum_matrix_cols | ( | const Matrix & | ) |
Compute the matrix's sum across columns (a.k.a. row-wise sum)
This is a thin wrapper around kjb_c::sum_matrix_cols.
Matrix::Vec_type kjb::sum_matrix_rows | ( | const Matrix & | ) |
Compute the matrix's sum down (a.k.a. columnar sum), like MATLAB.
This is a thin wrapper around kjb_c::sum_matrix_rows.
|
inline |
Compute the sum of squared elements.
void kjb::swap | ( | Vector_d< N > & | first, |
Vector_d< N > & | second | ||
) |
|
inline |
Matrix kjb::tile_matrix | ( | Matrix | trixy, |
unsigned | m, | ||
unsigned | n | ||
) |
Construct a tiling of the given matrix.
Matrix kjb::tile_matrix | ( | int | tehnum, |
unsigned | m, | ||
unsigned | n | ||
) |
Construct a tiling of the given matrix, in this case, a matrix of the given number with the specified size.
Deprecated on 17 July 2013. Remove in 6 months (after 16 January 2014).
double kjb::vector_distance | ( | const Vector_d< D > & | op1, |
const Vector_d< D > & | op2 | ||
) |
Compute the Euclidian distance between two vectors.
A routine that computes the distance between two vectors
|
inline |
Compute the Euclidian distance between two vectors.
A routine that computes the distance between two vectors
|
inline |
Compute the Euclidian distance between two vectors.
A routine that computes the distance between two vectors
double kjb::vector_distance_squared | ( | const Vector_d< D > & | op1, |
const Vector_d< D > & | op2 | ||
) |
Compute the Euclidian distance between two vectors.
A routine that computes the distance between two vectors
|
inline |
Compute the square of the Euclidian distance between two vectors.
A routine that computes the square of the distance between two vectors
|
inline |
Compute the square of the Euclidian distance between two vectors.
A routine that computes the square of the distance between two vectors