Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | Related Functions
vnl_file_matrix< T > Class Template Reference

Class to load a matrix from a file. More...

#include <vnl_file_matrix.h>

Inheritance diagram for vnl_file_matrix< T >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef vnl_c_vector< T >::abs_t abs_t
 Type def for norms.
typedef T element_type
typedef T * iterator
 Iterators.
typedef T const * const_iterator
 Const iterators.

Public Member Functions

 vnl_file_matrix (char const *filename)
 Load matrix from filename.
 operator safe_bool () const
bool operator! () const
unsigned rows () const
 Return number of rows.
unsigned columns () const
 Return number of columns.
unsigned cols () const
 Return number of columns.
unsigned size () const
 Return number of elements.
void put (unsigned r, unsigned c, T const &)
 set element with boundary checks if error checking is on.
get (unsigned r, unsigned c) const
 get element with boundary checks if error checking is on.
T * operator[] (unsigned r)
 return pointer to given row.
T const * operator[] (unsigned r) const
 return pointer to given row.
T & operator() (unsigned r, unsigned c)
 Access an element for reading or writing.
T const & operator() (unsigned r, unsigned c) const
 Access an element for reading.
vnl_matrixfill (T const &)
 Sets all elements of matrix to specified value, and returns "*this".
vnl_matrixfill_diagonal (T const &)
 Sets all diagonal elements of matrix to specified value; returns "*this".
vnl_matrixset_diagonal (vnl_vector< T > const &)
 Sets the diagonal elements of this matrix to the specified list of values.
vnl_matrixcopy_in (T const *)
 Fills (laminates) this matrix with the given data, then returns it.
vnl_matrixset (T const *d)
 Fills (laminates) this matrix with the given data, then returns it.
void copy_out (T *) const
 Fills the given array with this matrix.
vnl_matrix< T > & operator+= (T value)
 Add rhs to each element of lhs matrix in situ.
vnl_matrix< T > & operator+= (vnl_matrix< T > const &)
 Add rhs to lhs matrix in situ.
vnl_matrix< T > & operator-= (T value)
 Subtract rhs from each element of lhs matrix in situ.
vnl_matrix< T > & operator-= (vnl_matrix< T > const &)
 Subtract rhs from lhs matrix in situ.
vnl_matrix< T > & operator*= (T value)
 Scalar multiplication in situ of lhs matrix by rhs.
vnl_matrix< T > & operator*= (vnl_matrix< T > const &rhs)
 Multiply lhs matrix in situ by rhs.
vnl_matrix< T > & operator/= (T value)
 Scalar division of lhs matrix in situ by rhs.
vnl_matrix< T > operator- () const
 Negate all elements of matrix.
vnl_matrix< T > operator- (T const &v) const
 Subtract rhs from each element of lhs matrix and return result in new matrix.
vnl_matrix< T > operator- (vnl_matrix< T > const &rhs) const
 Matrix subtract rhs from lhs and return result in new matrix.
vnl_matrix< T > operator+ (T const &v) const
 Add rhs to each element of lhs matrix and return result in new matrix.
vnl_matrix< T > operator+ (vnl_matrix< T > const &rhs) const
 Matrix add rhs to lhs matrix and return result in new matrix.
vnl_matrix< T > operator* (T const &v) const
 Scalar multiplication of lhs matrix by rhs and return result in new matrix.
vnl_matrix< T > operator* (vnl_matrix< T > const &rhs) const
 Matrix multiply lhs by rhs matrix and return result in new matrix.
vnl_matrix< T > operator/ (T const &v) const
 Scalar division of lhs matrix by rhs and return result in new matrix.
vnl_matrix< T > apply (T(*f)(T)) const
 Make a new matrix by applying function to each element.
vnl_matrix< T > apply (T(*f)(T const &)) const
 Make a new matrix by applying function to each element.
vnl_matrix< T > transpose () const
 Return transpose.
vnl_matrix< T > conjugate_transpose () const
 Return conjugate transpose.
vnl_matrix< T > & update (vnl_matrix< T > const &, unsigned top=0, unsigned left=0)
 Set values of this matrix to those of M, starting at [top,left].
vnl_matrixset_column (unsigned i, T const *v)
 Set the elements of the i'th column to v[i] (No bounds checking).
vnl_matrixset_column (unsigned i, T value)
 Set the elements of the i'th column to value, then return *this.
vnl_matrixset_column (unsigned j, vnl_vector< T > const &v)
 Set j-th column to v, then return *this.
vnl_matrixset_columns (unsigned starting_column, vnl_matrix< T > const &M)
 Set columns to those in M, starting at starting_column, then return *this.
vnl_matrixset_row (unsigned i, T const *v)
 Set the elements of the i'th row to v[i] (No bounds checking).
vnl_matrixset_row (unsigned i, T value)
 Set the elements of the i'th row to value, then return *this.
vnl_matrixset_row (unsigned i, vnl_vector< T > const &)
 Set the i-th row.
vnl_matrix< T > extract (unsigned r, unsigned c, unsigned top=0, unsigned left=0) const
 Extract a sub-matrix of size r x c, starting at (top,left).
void extract (vnl_matrix< T > &sub_matrix, unsigned top=0, unsigned left=0) const
 Extract a sub-matrix starting at (top,left).
vnl_vector< T > get_row (unsigned r) const
 Get a vector equal to the given row.
vnl_vector< T > get_column (unsigned c) const
 Get a vector equal to the given column.
vnl_matrix< T > get_n_rows (unsigned rowstart, unsigned n) const
 Get n rows beginning at rowstart.
vnl_matrix< T > get_n_columns (unsigned colstart, unsigned n) const
 Get n columns beginning at colstart.
vnl_vector< T > get_diagonal () const
 Return a vector with the content of the (main) diagonal.
vnl_matrixset_identity ()
 Sets this matrix to an identity matrix, then returns "*this".
vnl_matrixinplace_transpose ()
 Transposes this matrix efficiently, and returns it.
vnl_matrixflipud ()
 Reverses the order of rows, and returns "*this".
vnl_matrixfliplr ()
 Reverses the order of columns, and returns "*this".
vnl_matrixnormalize_rows ()
 Normalizes each row so it is a unit vector, and returns "*this".
vnl_matrixnormalize_columns ()
 Normalizes each column so it is a unit vector, and returns "*this".
vnl_matrixscale_row (unsigned row, T value)
 Scales elements in given row by a factor T, and returns "*this".
vnl_matrixscale_column (unsigned col, T value)
 Scales elements in given column by a factor T, and returns "*this".
void swap (vnl_matrix< T > &that)
 Swap this matrix with that matrix.
abs_t array_one_norm () const
 Return sum of absolute values of elements.
abs_t array_two_norm () const
 Return square root of sum of squared absolute element values.
abs_t array_inf_norm () const
 Return largest absolute element value.
abs_t absolute_value_sum () const
 Return sum of absolute values of elements.
abs_t absolute_value_max () const
 Return largest absolute value.
abs_t operator_one_norm () const
abs_t operator_inf_norm () const
abs_t frobenius_norm () const
 Return Frobenius norm of matrix (sqrt of sum of squares of its elements).
abs_t fro_norm () const
 Return Frobenius norm of matrix (sqrt of sum of squares of its elements).
abs_t rms () const
 Return RMS of all elements.
min_value () const
 Return minimum value of elements.
max_value () const
 Return maximum value of elements.
unsigned arg_min () const
 Return location of minimum value of elements.
unsigned arg_max () const
 Return location of maximum value of elements.
mean () const
 Return mean of all matrix elements.
bool empty () const
 Return true iff the size is zero.
bool is_identity () const
 Return true if all elements equal to identity.
bool is_identity (double tol) const
 Return true if all elements equal to identity, within given tolerance.
bool is_zero () const
 Return true if all elements equal to zero.
bool is_zero (double tol) const
 Return true if all elements equal to zero, within given tolerance.
bool is_equal (vnl_matrix< T > const &rhs, double tol) const
 Return true if all elements of both matrices are equal, within given tolerance.
bool is_finite () const
 Return true if finite.
bool has_nans () const
 Return true if matrix contains NaNs.
void assert_size (unsigned r, unsigned c) const
 abort if size is not as expected.
void assert_finite () const
 abort if matrix contains any INFs or NANs.
bool read_ascii (vcl_istream &s)
 Read a vnl_matrix from an ascii vcl_istream.
T const * data_block () const
 Access the contiguous block storing the elements in the matrix row-wise. O(1).
T * data_block ()
 Access the contiguous block storing the elements in the matrix row-wise. O(1).
T const *const * data_array () const
 Access the 2D array, so that elements can be accessed with array[row][col] directly.
T ** data_array ()
 Access the 2D array, so that elements can be accessed with array[row][col] directly.
iterator begin ()
 Iterator pointing to start of data.
const_iterator begin () const
 Iterator pointing to start of data.
iterator end ()
 Iterator pointing to element beyond end of data.
const_iterator end () const
 Iterator pointing to element beyond end of data.
vnl_matrix< T > const & as_ref () const
 Return a reference to this.
vnl_matrix< T > & as_ref ()
 Return a reference to this.
bool operator_eq (vnl_matrix< T > const &rhs) const
 Return true if *this == rhs.
bool operator== (vnl_matrix< T > const &that) const
 Equality operator.
bool operator!= (vnl_matrix< T > const &that) const
 Inequality operator.
void print (vcl_ostream &os) const
 Print matrix to os in some hopefully sensible format.
void clear ()
 Make the matrix as if it had been default-constructed.
bool set_size (unsigned r, unsigned c)
 Resize to r rows by c columns. Old data lost.

Static Public Member Functions

static vnl_matrix< T > read (vcl_istream &s)
 Read a vnl_matrix from an ascii vcl_istream, automatically determining file size if the input matrix has zero size.

Protected Member Functions

void assert_size_internal (unsigned r, unsigned c) const
 Abort unless M has the given size.
void assert_finite_internal () const
 Abort if any element of M is inf or nan.
void destroy ()
 Delete data.

Static Protected Member Functions

static void inline_function_tickler ()

Protected Attributes

unsigned num_rows
unsigned num_cols
T ** data

Private Attributes

 VCL_SAFE_BOOL_DEFINE
bool ok_

Related Functions

(Note that these are not member functions.)

template<class T >
vnl_matrix< T > operator- (vnl_matrix< T > const &A, vnl_diag_matrix< T > const &D)
 Subtract a vnl_diag_matrix from a vnl_matrix. n adds, mn copies.
template<class T >
vnl_matrix< T > operator- (vnl_diag_matrix< T > const &D, vnl_matrix< T > const &A)
 Subtract a vnl_matrix from a vnl_diag_matrix. n adds, mn copies.
template<class T , unsigned int N>
vnl_matrix_fixed< T, N, N > operator- (vnl_matrix_fixed< T, N, N > const &A, vnl_diag_matrix_fixed< T, N > const &D)
 Subtract a vnl_diag_matrix_fixed from a vnl_matrix. n adds, mn copies.
template<class T , unsigned int N>
vnl_matrix_fixed< T, N, N > operator- (vnl_diag_matrix_fixed< T, N > const &D, vnl_matrix_fixed< T, N, N > const &A)
 Subtract a vnl_matrix from a vnl_diag_matrix_fixed. n adds, mn copies.
template<class T >
vnl_matrix< T > operator+ (vnl_matrix< T > const &A, vnl_diag_matrix< T > const &D)
 Add a vnl_diag_matrix to a vnl_matrix. n adds, mn copies.
template<class T >
vnl_matrix< T > operator+ (vnl_diag_matrix< T > const &D, vnl_matrix< T > const &A)
 Add a vnl_matrix to a vnl_diag_matrix. n adds, mn copies.
template<class T , unsigned int N>
vnl_matrix_fixed< T, N, N > operator+ (vnl_matrix_fixed< T, N, N > const &A, vnl_diag_matrix_fixed< T, N > const &D)
 Add a vnl_diag_matrix_fixed to a vnl_matrix. n adds, mn copies.
template<class T , unsigned int N>
vnl_matrix_fixed< T, N, N > operator+ (vnl_diag_matrix_fixed< T, N > const &D, vnl_matrix_fixed< T, N, N > const &A)
 Add a vnl_matrix to a vnl_diag_matrix_fixed. n adds, mn copies.
template<class T >
vnl_matrix< T > operator+ (T const &value, vnl_matrix< T > const &m)
template<class T >
vnl_matrix< T > operator* (vnl_matrix< T > const &A, vnl_diag_matrix< T > const &D)
 Multiply a vnl_matrix by a vnl_diag_matrix. Just scales the columns - mn flops.
template<class T >
vnl_matrix< T > operator* (vnl_diag_matrix< T > const &D, vnl_matrix< T > const &A)
 Multiply a vnl_diag_matrix by a vnl_matrix. Just scales the rows - mn flops.
template<class T , unsigned int R, unsigned int C>
vnl_matrix_fixed< T, R, C > operator* (vnl_matrix_fixed< T, R, C > const &A, vnl_diag_matrix_fixed< T, C > const &D)
 Multiply a vnl_matrix by a vnl_diag_matrix_fixed. Just scales the columns - mn flops.
template<class T , unsigned int R, unsigned int C>
vnl_matrix_fixed< T, R, C > operator* (vnl_diag_matrix_fixed< T, R > const &D, vnl_matrix_fixed< T, R, C > const &A)
 Multiply a vnl_diag_matrix_fixed by a vnl_matrix. Just scales the rows - mn flops.
template<class T >
vnl_matrix< T > operator* (T const &value, vnl_matrix< T > const &m)
template<class T >
vnl_sparse_matrix< T > operator* (T const &value, vnl_sparse_matrix< T > const &m)
template<class T >
vnl_vector< T > operator* (vnl_matrix< T > const &m, vnl_vector< T > const &v)
 multiply matrix and (column) vector. O(m*n).
template<class T >
void swap (vnl_matrix< T > &A, vnl_matrix< T > &B)
 Swap two matrices.
template<class T >
vnl_determinant (vnl_matrix< T > const &M, bool balance=false)
 evaluation using direct methods for sizes of 2x2, 3x3, and 4x4 or qr decomposition for other matrices.
template<class T >
void vnl_matrix_update (vnl_matrix< T > &M, const vnl_vector< T > &a, const vnl_vector< T > &b)
 Perform rank 1 update of M: M+=(a*b').
template<class T >
vnl_matrix< T > vnl_orthogonal_complement (vnl_vector< T > const &v)
 Return a matrix whose columns span is the orthogonal complement of v.
template<class T >
void vsl_b_write (vsl_b_ostream &os, const vnl_matrix< T > &v)
 Binary save vnl_matrix to stream.
template<class T >
void vsl_b_read (vsl_b_istream &is, vnl_matrix< T > &v)
 Binary load vnl_matrix from stream.
template<class T >
void vsl_print_summary (vcl_ostream &os, const vnl_matrix< T > &b)
 Print human readable summary of object to a stream.
template<class T >
vnl_matrix< vcl_complex< T > > vnl_complexify (vnl_matrix< T > const &R)
 Return complexified version of real matrix R.
template<class T >
vnl_matrix< vcl_complex< T > > vnl_complexify (vnl_matrix< T > const &R, vnl_matrix< T > const &I)
 Return complex matrix R+j*I from two real matrices R and I.
template<class T >
vnl_matrix< T > vnl_imag (vnl_matrix< vcl_complex< T > > const &C)
 Matrix of imaginary parts of vnl_matrix<vcl_complex<T> >.
template<class T >
vnl_matrix< T > vnl_inverse (vnl_matrix< T > const &m)
 Calculates inverse of a small vnl_matrix_fixed (not using svd).
template<class T >
vnl_matrix< T > vnl_inverse_transpose (vnl_matrix< T > const &m)
 Calculates transpose of the inverse of a small vnl_matrix_fixed (not using svd).
template<class T >
vcl_ostream & vnl_matlab_print (vcl_ostream &, vnl_matrix< T > const &, char const *variable_name=0, vnl_matlab_print_format=vnl_matlab_print_format_default)
 print a vnl_matrix<T>.
template<class T >
bool operator< (vnl_matrix< T > const &lhs, vnl_matrix< T > const &rhs)
 Define a complete ordering on vnl_matrix.
template<class T >
vnl_matrix< T > vnl_power (vnl_matrix< T > const &m, int n)
 Calculates nth power of a square vnl_matrix (not using svd).
template<class T >
unsigned int vnl_rank (vnl_matrix< T > const &mat, vnl_rank_type=vnl_rank_both)
 Returns the rank of a matrix.
template<class T >
vnl_matrix< T > vnl_rank_row_reduce (vnl_matrix< T > const &mat, vnl_rank_pivot_type=vnl_rank_pivot_all)
 Row reduce a matrix.
template<class T >
vnl_matrix< T > vnl_rank_column_reduce (vnl_matrix< T > const &mat, vnl_rank_pivot_type=vnl_rank_pivot_all)
 Column reduce a matrix.
template<class T >
vnl_matrix< T > vnl_rank_row_column_reduce (vnl_matrix< T > const &mat, vnl_rank_pivot_type=vnl_rank_pivot_all)
 Row and column reduce a matrix.
template<class T >
vnl_matrix< T > vnl_real (vnl_matrix< vcl_complex< T > > const &C)
 Matrix of real parts of vnl_matrix<vcl_complex<T> >.
vnl_matrix< double > vnl_rotation_matrix (vnl_vector< double > const &axis)
 Returns an orthogonal 3x3 matrix which is a rotation about the axis, by an angle equal to ||axis||.
template<class T >
vnl_trace (vnl_matrix< T > const &M)
 Calculate trace of a matrix.
template<class T >
void x_write (vcl_ostream &os, vnl_matrix< T > const &v, vcl_string name="vnl_matrix")
 XML save vnl_matrix to stream.
template<class T >
void x_write_tree (vcl_ostream &os, vnl_matrix< T > const &v, vcl_string name="vnl_matrix")
 XML save vnl_matrix as a 3-level tree to stream.

Detailed Description

template<class T>
class vnl_file_matrix< T >

Class to load a matrix from a file.

Definition at line 23 of file vnl_file_matrix.h.


Member Typedef Documentation

template<class T>
typedef vnl_c_vector<T>::abs_t vnl_matrix< T >::abs_t [inherited]

Type def for norms.

Definition at line 490 of file vnl_matrix.h.

template<class T>
typedef T const* vnl_matrix< T >::const_iterator [inherited]

Const iterators.

Definition at line 616 of file vnl_matrix.h.

template<class T>
typedef T vnl_matrix< T >::element_type [inherited]

Definition at line 606 of file vnl_matrix.h.

template<class T>
typedef T* vnl_matrix< T >::iterator [inherited]

Iterators.

Definition at line 609 of file vnl_matrix.h.


Constructor & Destructor Documentation

template<class T >
vnl_file_matrix< T >::vnl_file_matrix ( char const *  filename)

Load matrix from filename.

Definition at line 17 of file vnl_file_matrix.txx.


Member Function Documentation

template<class T>
abs_t vnl_matrix< T >::absolute_value_max ( ) const [inline, inherited]

Return largest absolute value.

Definition at line 505 of file vnl_matrix.h.

template<class T>
abs_t vnl_matrix< T >::absolute_value_sum ( ) const [inline, inherited]

Return sum of absolute values of elements.

Definition at line 502 of file vnl_matrix.h.

template<class T>
vnl_matrix< T > vnl_matrix< T >::apply ( T(*)(T)  f) const [inherited]

Make a new matrix by applying function to each element.

Return the matrix made by applying "f" to each element.

Definition at line 728 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > vnl_matrix< T >::apply ( T(*)(T const &)  f) const [inherited]

Make a new matrix by applying function to each element.

Return the matrix made by applying "f" to each element.

Definition at line 719 of file vnl_matrix.txx.

template<class T>
unsigned vnl_matrix< T >::arg_max ( ) const [inline, inherited]

Return location of maximum value of elements.

Definition at line 532 of file vnl_matrix.h.

template<class T>
unsigned vnl_matrix< T >::arg_min ( ) const [inline, inherited]

Return location of minimum value of elements.

Definition at line 529 of file vnl_matrix.h.

template<class T>
abs_t vnl_matrix< T >::array_inf_norm ( ) const [inline, inherited]

Return largest absolute element value.

Definition at line 499 of file vnl_matrix.h.

template<class T>
abs_t vnl_matrix< T >::array_one_norm ( ) const [inline, inherited]

Return sum of absolute values of elements.

Definition at line 493 of file vnl_matrix.h.

template<class T>
abs_t vnl_matrix< T >::array_two_norm ( ) const [inline, inherited]

Return square root of sum of squared absolute element values.

Definition at line 496 of file vnl_matrix.h.

template<class T>
vnl_matrix<T> const& vnl_matrix< T >::as_ref ( ) const [inline, inherited]

Return a reference to this.

Useful in code which would prefer not to know if its argument is a matrix, matrix_ref or a matrix_fixed. Note that it doesn't return a matrix_ref, so it's only useful in templates or macros.

Definition at line 626 of file vnl_matrix.h.

template<class T>
vnl_matrix<T>& vnl_matrix< T >::as_ref ( ) [inline, inherited]

Return a reference to this.

Definition at line 629 of file vnl_matrix.h.

template<class T>
void vnl_matrix< T >::assert_finite ( ) const [inline, inherited]

abort if matrix contains any INFs or NANs.

This function does or tests nothing if NDEBUG is defined

Definition at line 573 of file vnl_matrix.h.

template<class T >
void vnl_matrix< T >::assert_finite_internal ( ) const [protected, inherited]

Abort if any element of M is inf or nan.

Definition at line 1270 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::assert_size ( unsigned  r,
unsigned  c 
) const [inline, inherited]

abort if size is not as expected.

This function does or tests nothing if NDEBUG is defined

Definition at line 565 of file vnl_matrix.h.

template<class T >
void vnl_matrix< T >::assert_size_internal ( unsigned  r,
unsigned  c 
) const [protected, inherited]

Abort unless M has the given size.

Definition at line 1296 of file vnl_matrix.txx.

template<class T>
iterator vnl_matrix< T >::begin ( ) [inline, inherited]

Iterator pointing to start of data.

Definition at line 611 of file vnl_matrix.h.

template<class T>
const_iterator vnl_matrix< T >::begin ( ) const [inline, inherited]

Iterator pointing to start of data.

Definition at line 618 of file vnl_matrix.h.

template<class T >
void vnl_matrix< T >::clear ( ) [inherited]

Make the matrix as if it had been default-constructed.

Definition at line 394 of file vnl_matrix.txx.

template<class T>
unsigned vnl_matrix< T >::cols ( ) const [inline, inherited]

Return number of columns.

A synonym for columns()

Definition at line 178 of file vnl_matrix.h.

template<class T>
unsigned vnl_matrix< T >::columns ( ) const [inline, inherited]

Return number of columns.

A synonym for cols()

Definition at line 174 of file vnl_matrix.h.

template<class T >
vnl_matrix< T > vnl_matrix< T >::conjugate_transpose ( ) const [inherited]

Return conjugate transpose.

Definition at line 753 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::copy_in ( T const *  p) [inherited]

Fills (laminates) this matrix with the given data, then returns it.

Fill this matrix with the given data.

We assume that the argument points to a contiguous rows*cols array, stored rowwise. No bounds checking on the array. Returning "*this" allows "chaining" two or more operations: e.g., to fill a square matrix column-wise, fill it rowwise then transpose:

     M.copy_in(array).inplace_transpose();

Returning "*this" also allows passing a filled-in matrix as argument to a function f, without having to name the constructed matrix:

     f(vnl_matrix<double>(3,3).copy_in(array));

We assume that p points to a contiguous rows*cols array, stored rowwise.

Definition at line 896 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::copy_out ( T *  p) const [inherited]

Fills the given array with this matrix.

Fill the given array with this matrix.

We assume that the argument points to a contiguous rows*cols array, stored rowwise. No bounds checking on the array.

We assume that p points to a contiguous rows*cols array, stored rowwise.

Definition at line 908 of file vnl_matrix.txx.

template<class T>
T const* const* vnl_matrix< T >::data_array ( ) const [inline, inherited]

Access the 2D array, so that elements can be accessed with array[row][col] directly.

2d array, [row][column].

Definition at line 600 of file vnl_matrix.h.

template<class T>
T* * vnl_matrix< T >::data_array ( ) [inline, inherited]

Access the 2D array, so that elements can be accessed with array[row][col] directly.

2d array, [row][column].

Definition at line 604 of file vnl_matrix.h.

template<class T>
T const* vnl_matrix< T >::data_block ( ) const [inline, inherited]

Access the contiguous block storing the elements in the matrix row-wise. O(1).

1d array, row-major order.

Definition at line 592 of file vnl_matrix.h.

template<class T>
T* vnl_matrix< T >::data_block ( ) [inline, inherited]

Access the contiguous block storing the elements in the matrix row-wise. O(1).

1d array, row-major order.

Definition at line 596 of file vnl_matrix.h.

template<class T >
void vnl_matrix< T >::destroy ( ) [protected, inherited]

Delete data.

Frees up the dynamic storage used by matrix.

O(m*n).

Definition at line 388 of file vnl_matrix.txx.

template<class T>
bool vnl_matrix< T >::empty ( ) const [inline, inherited]

Return true iff the size is zero.

Definition at line 540 of file vnl_matrix.h.

template<class T>
iterator vnl_matrix< T >::end ( ) [inline, inherited]

Iterator pointing to element beyond end of data.

Definition at line 613 of file vnl_matrix.h.

template<class T>
const_iterator vnl_matrix< T >::end ( ) const [inline, inherited]

Iterator pointing to element beyond end of data.

Definition at line 620 of file vnl_matrix.h.

template<class T >
vnl_matrix< T > vnl_matrix< T >::extract ( unsigned  rowz,
unsigned  colz,
unsigned  top = 0,
unsigned  left = 0 
) const [inherited]

Extract a sub-matrix of size r x c, starting at (top,left).

Returns a copy of submatrix of THIS matrix, specified by the top-left corner and size in rows, cols. O(m*n).

Thus it contains elements [top,top+r-1][left,left+c-1]

Use update() to copy new values of this submatrix back into THIS matrix.

Definition at line 787 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::extract ( vnl_matrix< T > &  sub_matrix,
unsigned  top = 0,
unsigned  left = 0 
) const [inherited]

Extract a sub-matrix starting at (top,left).

The output is stored in sub_matrix, and it should have the required size on entry. Thus the result will contain elements [top,top+sub_matrix.rows()-1][left,left+sub_matrix.cols()-1]

Definition at line 795 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::fill ( T const &  value) [inherited]

Sets all elements of matrix to specified value, and returns "*this".

Sets all elements of matrix to specified value. O(m*n).

Complexity $O(r.c)$ Returning "*this" allows "chaining" two or more operations: e.g., to set a matrix to a column-normalized all-elements-equal matrix, say

     M.fill(1).normalize_columns();

Returning "*this" also allows passing such a matrix as argument to a function f, without having to name the constructed matrix:

Definition at line 438 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::fill_diagonal ( T const &  value) [inherited]

Sets all diagonal elements of matrix to specified value; returns "*this".

Sets all diagonal elements of matrix to specified value. O(n).

Complexity $O(\min(r,c))$ Returning "*this" allows "chaining" two or more operations: e.g., to set a 3x3 matrix to [5 0 0][0 10 0][0 0 15], just say

     M.fill_diagonal(5).scale_row(1,2).scale_column(2,3);

Returning "*this" also allows passing a diagonal-filled matrix as argument to a function f, without having to name the constructed matrix:

Definition at line 449 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T > & vnl_matrix< T >::fliplr ( ) [inherited]

Reverses the order of columns, and returns "*this".

Reverse order of columns.

Returning "*this" allows "chaining" two or more operations: e.g., to flip both up-down and left-right, one could just say

     M.flipud().fliplr();

Definition at line 1470 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T > & vnl_matrix< T >::flipud ( ) [inherited]

Reverses the order of rows, and returns "*this".

Reverse order of rows. Name is from Matlab, meaning "flip upside down".

Returning "*this" allows "chaining" two or more operations: e.g., to flip both up-down and left-right, one could just say

     M.flipud().fliplr();

Definition at line 1450 of file vnl_matrix.txx.

template<class T>
abs_t vnl_matrix< T >::fro_norm ( ) const [inline, inherited]

Return Frobenius norm of matrix (sqrt of sum of squares of its elements).

Definition at line 517 of file vnl_matrix.h.

template<class T>
abs_t vnl_matrix< T >::frobenius_norm ( ) const [inline, inherited]

Return Frobenius norm of matrix (sqrt of sum of squares of its elements).

Definition at line 514 of file vnl_matrix.h.

template<class T >
T vnl_matrix< T >::get ( unsigned  row,
unsigned  column 
) const [inline, inherited]

get element with boundary checks if error checking is on.

Returns the value of the element at specified row and column. O(1).

Checks for valid range of indices.

Definition at line 700 of file vnl_matrix.h.

template<class T >
vnl_vector< T > vnl_matrix< T >::get_column ( unsigned  c) const [inherited]

Get a vector equal to the given column.

Create a vector out of column[column_index].

Definition at line 1042 of file vnl_matrix.txx.

template<class T >
vnl_vector< T > vnl_matrix< T >::get_diagonal ( ) const [inherited]

Return a vector with the content of the (main) diagonal.

Definition at line 1057 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T > vnl_matrix< T >::get_n_columns ( unsigned  colstart,
unsigned  n 
) const [inherited]

Get n columns beginning at colstart.

Returns a copy of n columns, starting from "column".

Definition at line 1011 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T > vnl_matrix< T >::get_n_rows ( unsigned  rowstart,
unsigned  n 
) const [inherited]

Get n rows beginning at rowstart.

Returns a copy of n rows, starting from "row".

Definition at line 998 of file vnl_matrix.txx.

template<class T >
vnl_vector< T > vnl_matrix< T >::get_row ( unsigned  r) const [inherited]

Get a vector equal to the given row.

Create a vector out of row[row_index].

Definition at line 1027 of file vnl_matrix.txx.

template<class T >
bool vnl_matrix< T >::has_nans ( ) const [inherited]

Return true if matrix contains NaNs.

Return true if any element of (*this) is nan.

Definition at line 1246 of file vnl_matrix.txx.

template<class T >
void vnl_matrix< T >::inline_function_tickler ( ) [static, protected, inherited]

Definition at line 540 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T > & vnl_matrix< T >::inplace_transpose ( ) [inherited]

Transposes this matrix efficiently, and returns it.

Transpose matrix M in place.

Returning "*this" allows "chaining" two or more operations: e.g., to fill a square matrix column-wise, fill it rowwise then transpose:

     M.copy_in(array).inplace_transpose();

Works for rectangular matrices using an enormously clever algorithm from ACM TOMS.

Definition at line 1640 of file vnl_matrix.txx.

template<class T>
bool vnl_matrix< T >::is_equal ( vnl_matrix< T > const &  rhs,
double  tol 
) const [inherited]

Return true if all elements of both matrices are equal, within given tolerance.

Definition at line 1174 of file vnl_matrix.txx.

template<class T >
bool vnl_matrix< T >::is_finite ( ) const [inherited]

Return true if finite.

Return false if any element of (*this) is inf or nan.

Definition at line 1258 of file vnl_matrix.txx.

template<class T >
bool vnl_matrix< T >::is_identity ( ) const [inherited]

Return true if all elements equal to identity.

Definition at line 1192 of file vnl_matrix.txx.

template<class T >
bool vnl_matrix< T >::is_identity ( double  tol) const [inherited]

Return true if all elements equal to identity, within given tolerance.

Return true if maximum absolute deviation of M from identity is <= tol.

Definition at line 1207 of file vnl_matrix.txx.

template<class T >
bool vnl_matrix< T >::is_zero ( ) const [inherited]

Return true if all elements equal to zero.

Definition at line 1221 of file vnl_matrix.txx.

template<class T >
bool vnl_matrix< T >::is_zero ( double  tol) const [inherited]

Return true if all elements equal to zero, within given tolerance.

Return true if max(abs((*this))) <= tol.

Definition at line 1234 of file vnl_matrix.txx.

template<class T>
T vnl_matrix< T >::max_value ( ) const [inline, inherited]

Return maximum value of elements.

Definition at line 526 of file vnl_matrix.h.

template<class T>
T vnl_matrix< T >::mean ( ) const [inline, inherited]

Return mean of all matrix elements.

Definition at line 535 of file vnl_matrix.h.

template<class T>
T vnl_matrix< T >::min_value ( ) const [inline, inherited]

Return minimum value of elements.

Definition at line 523 of file vnl_matrix.h.

template<class T >
vnl_matrix< T > & vnl_matrix< T >::normalize_columns ( ) [inherited]

Normalizes each column so it is a unit vector, and returns "*this".

Make each column of the matrix have unit norm.

Zero columns are not modified Returning "*this" allows "chaining" two or more operations: e.g., to set a matrix to a column-normalized all-elements-equal matrix, say

     M.fill(1).normalize_columns();

Returning "*this" also allows passing such a matrix as argument to a function f, without having to name the constructed matrix:

All-zero columns are ignored.

Definition at line 951 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T > & vnl_matrix< T >::normalize_rows ( ) [inherited]

Normalizes each row so it is a unit vector, and returns "*this".

Make each row of the matrix have unit norm.

Zero rows are not modified Returning "*this" allows "chaining" two or more operations: e.g., to set a matrix to a row-normalized all-elements-equal matrix, say

     M.fill(1).normalize_rows();

Returning "*this" also allows passing such a matrix as argument to a function f, without having to name the constructed matrix:

All-zero rows are ignored.

Definition at line 929 of file vnl_matrix.txx.

template<class T >
vnl_file_matrix< T >::operator safe_bool ( ) const [inline]

Definition at line 29 of file vnl_file_matrix.h.

template<class T >
bool vnl_file_matrix< T >::operator! ( ) const [inline]

Definition at line 31 of file vnl_file_matrix.h.

template<class T>
bool vnl_matrix< T >::operator!= ( vnl_matrix< T > const &  that) const [inline, inherited]

Inequality operator.

Definition at line 640 of file vnl_matrix.h.

template<class T>
T& vnl_matrix< T >::operator() ( unsigned  r,
unsigned  c 
) [inline, inherited]

Access an element for reading or writing.

There are assert style boundary checks - #define NDEBUG to turn them off.

Definition at line 200 of file vnl_matrix.h.

template<class T>
T const& vnl_matrix< T >::operator() ( unsigned  r,
unsigned  c 
) const [inline, inherited]

Access an element for reading.

There are assert style boundary checks - #define NDEBUG to turn them off.

Definition at line 211 of file vnl_matrix.h.

template<class T>
vnl_matrix<T> vnl_matrix< T >::operator* ( T const &  v) const [inline, inherited]

Scalar multiplication of lhs matrix by rhs and return result in new matrix.

Definition at line 323 of file vnl_matrix.h.

template<class T>
vnl_matrix<T> vnl_matrix< T >::operator* ( vnl_matrix< T > const &  rhs) const [inline, inherited]

Matrix multiply lhs by rhs matrix and return result in new matrix.

Definition at line 333 of file vnl_matrix.h.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::operator*= ( value) [inherited]

Scalar multiplication in situ of lhs matrix by rhs.

Definition at line 566 of file vnl_matrix.txx.

template<class T>
vnl_matrix<T>& vnl_matrix< T >::operator*= ( vnl_matrix< T > const &  rhs) [inline, inherited]

Multiply lhs matrix in situ by rhs.

Definition at line 310 of file vnl_matrix.h.

template<class T>
vnl_matrix<T> vnl_matrix< T >::operator+ ( T const &  v) const [inline, inherited]

Add rhs to each element of lhs matrix and return result in new matrix.

Definition at line 317 of file vnl_matrix.h.

template<class T>
vnl_matrix<T> vnl_matrix< T >::operator+ ( vnl_matrix< T > const &  rhs) const [inline, inherited]

Matrix add rhs to lhs matrix and return result in new matrix.

Definition at line 329 of file vnl_matrix.h.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::operator+= ( value) [inherited]

Add rhs to each element of lhs matrix in situ.

Definition at line 548 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::operator+= ( vnl_matrix< T > const &  rhs) [inherited]

Add rhs to lhs matrix in situ.

Adds lhs matrix with rhs matrix, and stores in place in lhs matrix.

O(m*n). The dimensions of the two matrices must be identical.

Definition at line 588 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T > vnl_matrix< T >::operator- ( ) const [inherited]

Negate all elements of matrix.

Returns new matrix which is the negation of THIS matrix.

O(m*n).

Definition at line 667 of file vnl_matrix.txx.

template<class T>
vnl_matrix<T> vnl_matrix< T >::operator- ( T const &  v) const [inline, inherited]

Subtract rhs from each element of lhs matrix and return result in new matrix.

Definition at line 320 of file vnl_matrix.h.

template<class T>
vnl_matrix<T> vnl_matrix< T >::operator- ( vnl_matrix< T > const &  rhs) const [inline, inherited]

Matrix subtract rhs from lhs and return result in new matrix.

Definition at line 331 of file vnl_matrix.h.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::operator-= ( value) [inherited]

Subtract rhs from each element of lhs matrix in situ.

Definition at line 557 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::operator-= ( vnl_matrix< T > const &  rhs) [inherited]

Subtract rhs from lhs matrix in situ.

Subtract lhs matrix with rhs matrix and store in place in lhs matrix.

O(m*n). The dimensions of the two matrices must be identical.

Definition at line 609 of file vnl_matrix.txx.

template<class T>
vnl_matrix<T> vnl_matrix< T >::operator/ ( T const &  v) const [inline, inherited]

Scalar division of lhs matrix by rhs and return result in new matrix.

Definition at line 326 of file vnl_matrix.h.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::operator/= ( value) [inherited]

Scalar division of lhs matrix in situ by rhs.

Definition at line 575 of file vnl_matrix.txx.

template<class T>
bool vnl_matrix< T >::operator== ( vnl_matrix< T > const &  that) const [inline, inherited]

Equality operator.

Definition at line 637 of file vnl_matrix.h.

template<class T>
T* vnl_matrix< T >::operator[] ( unsigned  r) [inline, inherited]

return pointer to given row.

No boundary checking here.

Definition at line 192 of file vnl_matrix.h.

template<class T>
T const* vnl_matrix< T >::operator[] ( unsigned  r) const [inline, inherited]

return pointer to given row.

No boundary checking here.

Definition at line 196 of file vnl_matrix.h.

template<class T>
bool vnl_matrix< T >::operator_eq ( vnl_matrix< T > const &  rhs) const [inherited]

Return true if *this == rhs.

Two matrices are equal if and only if they have the same dimensions and the same values.

O(m*n). Elements are compared with operator== as default. Change this default with set_compare() at run time or by specializing vnl_matrix_compare at compile time.

Definition at line 1157 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T >::abs_t vnl_matrix< T >::operator_inf_norm ( ) const [inherited]

Definition at line 1507 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T >::abs_t vnl_matrix< T >::operator_one_norm ( ) const [inherited]

Definition at line 1491 of file vnl_matrix.txx.

template<class T >
void vnl_matrix< T >::print ( vcl_ostream &  os) const [inherited]

Print matrix to os in some hopefully sensible format.

Definition at line 507 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::put ( unsigned  row,
unsigned  column,
T const &  value 
) [inline, inherited]

set element with boundary checks if error checking is on.

Puts value into element at specified row and column. O(1).

Checks for valid range of indices.

Definition at line 715 of file vnl_matrix.h.

template<class T >
vnl_matrix< T > vnl_matrix< T >::read ( vcl_istream &  s) [static, inherited]

Read a vnl_matrix from an ascii vcl_istream, automatically determining file size if the input matrix has zero size.

Read a vnl_matrix from an ascii vcl_istream.

Automatically determines file size if the input matrix has zero size. This is a static method so you can type <verb> vnl_matrix<float> M = vnl_matrix<float>::read(cin); </verb> which many people prefer to the ">>" alternative.

Definition at line 1433 of file vnl_matrix.txx.

template<class T >
bool vnl_matrix< T >::read_ascii ( vcl_istream &  s) [inherited]

Read a vnl_matrix from an ascii vcl_istream.

Automatically determines file size if the input matrix has zero size.

Definition at line 1308 of file vnl_matrix.txx.

template<class T>
abs_t vnl_matrix< T >::rms ( ) const [inline, inherited]

Return RMS of all elements.

Definition at line 520 of file vnl_matrix.h.

template<class T>
unsigned vnl_matrix< T >::rows ( ) const [inline, inherited]

Return number of rows.

Definition at line 170 of file vnl_matrix.h.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::scale_column ( unsigned  col,
value 
) [inherited]

Scales elements in given column by a factor T, and returns "*this".

Multiply column[column_index] by value.

Returning "*this" allows "chaining" two or more operations: e.g., to set a 3x3 matrix to [3 0 0][0 2 0][0 0 1], one could say

     M.set_identity().scale_row(0,3).scale_column(1,2);

Definition at line 985 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::scale_row ( unsigned  row,
value 
) [inherited]

Scales elements in given row by a factor T, and returns "*this".

Multiply row[row_index] by value.

Returning "*this" allows "chaining" two or more operations: e.g., to set a 3x3 matrix to [3 0 0][0 2 0][0 0 1], one could say

     M.set_identity().scale_row(0,3).scale_column(1,2);

Definition at line 972 of file vnl_matrix.txx.

template<class T>
vnl_matrix& vnl_matrix< T >::set ( T const *  d) [inline, inherited]

Fills (laminates) this matrix with the given data, then returns it.

A synonym for copy_in()

Definition at line 274 of file vnl_matrix.h.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::set_column ( unsigned  i,
T const *  v 
) [inherited]

Set the elements of the i'th column to v[i] (No bounds checking).

Set column[column_index] to data at given address.

Definition at line 1101 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::set_column ( unsigned  i,
value 
) [inherited]

Set the elements of the i'th column to value, then return *this.

Set column[column_index] to given value.

Definition at line 1122 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::set_column ( unsigned  j,
vnl_vector< T > const &  v 
) [inherited]

Set j-th column to v, then return *this.

Set column[column_index] to given vector.

Definition at line 1110 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::set_columns ( unsigned  starting_column,
vnl_matrix< T > const &  M 
) [inherited]

Set columns to those in M, starting at starting_column, then return *this.

Set columns starting at starting_column to given matrix.

Definition at line 1132 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::set_diagonal ( vnl_vector< T > const &  diag) [inherited]

Sets the diagonal elements of this matrix to the specified list of values.

Returning "*this" allows "chaining" two or more operations: see the reasoning (and the examples) in the documentation for method fill_diagonal().

Definition at line 459 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T > & vnl_matrix< T >::set_identity ( ) [inherited]

Sets this matrix to an identity matrix, then returns "*this".

Fill this matrix with a matrix having 1s on the main diagonal and 0s elsewhere.

Returning "*this" allows e.g. passing an identity matrix as argument to a function f, without having to name the constructed matrix:

Returning "*this" also allows "chaining" two or more operations: e.g., to set a 3x3 matrix to [3 0 0][0 2 0][0 0 1], one could say

     M.set_identity().scale_row(0,3).scale_column(1,2);

If the matrix is not square, anyhow set main diagonal to 1, the rest to 0.

Definition at line 918 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::set_row ( unsigned  i,
T const *  v 
) [inherited]

Set the elements of the i'th row to v[i] (No bounds checking).

Set row[row_index] to data at given address. No bounds check.

Definition at line 1069 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::set_row ( unsigned  i,
value 
) [inherited]

Set the elements of the i'th row to value, then return *this.

Set row[row_index] to given value.

Definition at line 1090 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::set_row ( unsigned  i,
vnl_vector< T > const &  v 
) [inherited]

Set the i-th row.

Set row[row_index] to given vector.

Definition at line 1078 of file vnl_matrix.txx.

template<class T >
bool vnl_matrix< T >::set_size ( unsigned  r,
unsigned  c 
) [inherited]

Resize to r rows by c columns. Old data lost.

Returns true if size changed.

Reimplemented in vnl_matrix_ref< T >.

Definition at line 409 of file vnl_matrix.txx.

template<class T>
unsigned vnl_matrix< T >::size ( ) const [inline, inherited]

Return number of elements.

This equals rows() * cols()

Definition at line 182 of file vnl_matrix.h.

template<class T>
void vnl_matrix< T >::swap ( vnl_matrix< T > &  that) [inherited]

Swap this matrix with that matrix.

Definition at line 1441 of file vnl_matrix.txx.

template<class T >
vnl_matrix< T > vnl_matrix< T >::transpose ( ) const [inherited]

Return transpose.

Returns new matrix with rows and columns transposed.

O(m*n).

Definition at line 741 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T > & vnl_matrix< T >::update ( vnl_matrix< T > const &  m,
unsigned  top = 0,
unsigned  left = 0 
) [inherited]

Set values of this matrix to those of M, starting at [top,left].

Replaces the submatrix of THIS matrix, starting at top left corner, by the elements of matrix m. O(m*n).

This is the reverse of extract().

Definition at line 766 of file vnl_matrix.txx.


Friends And Related Function Documentation

template<class T , unsigned int R, unsigned int C>
vnl_matrix_fixed< T, R, C > operator* ( vnl_matrix_fixed< T, R, C > const &  A,
vnl_diag_matrix_fixed< T, C > const &  D 
) [related]

Multiply a vnl_matrix by a vnl_diag_matrix_fixed. Just scales the columns - mn flops.

Definition at line 210 of file vnl_diag_matrix_fixed.h.

template<class T >
vnl_matrix< T > operator* ( vnl_matrix< T > const &  A,
vnl_diag_matrix< T > const &  D 
) [related]

Multiply a vnl_matrix by a vnl_diag_matrix. Just scales the columns - mn flops.

Definition at line 219 of file vnl_diag_matrix.h.

template<class T , unsigned int R, unsigned int C>
vnl_matrix_fixed< T, R, C > operator* ( vnl_diag_matrix_fixed< T, R > const &  D,
vnl_matrix_fixed< T, R, C > const &  A 
) [related]

Multiply a vnl_diag_matrix_fixed by a vnl_matrix. Just scales the rows - mn flops.

Definition at line 223 of file vnl_diag_matrix_fixed.h.

template<class T >
vnl_matrix< T > operator* ( vnl_diag_matrix< T > const &  D,
vnl_matrix< T > const &  A 
) [related]

Multiply a vnl_diag_matrix by a vnl_matrix. Just scales the rows - mn flops.

Definition at line 233 of file vnl_diag_matrix.h.

template<class T >
vnl_sparse_matrix< T > operator* ( T const &  value,
vnl_sparse_matrix< T > const &  m 
) [related]

Definition at line 315 of file vnl_sparse_matrix.h.

template<class T >
vnl_vector< T > operator* ( vnl_matrix< T > const &  m,
vnl_vector< T > const &  v 
) [related]

multiply matrix and (column) vector. O(m*n).

Definition at line 494 of file vnl_vector.h.

template<class T >
vnl_matrix< T > operator* ( T const &  value,
vnl_matrix< T > const &  m 
) [related]

Definition at line 732 of file vnl_matrix.h.

template<class T , unsigned int N>
vnl_matrix_fixed< T, N, N > operator+ ( vnl_matrix_fixed< T, N, N > const &  A,
vnl_diag_matrix_fixed< T, N > const &  D 
) [related]

Add a vnl_diag_matrix_fixed to a vnl_matrix. n adds, mn copies.

Definition at line 248 of file vnl_diag_matrix_fixed.h.

template<class T >
vnl_matrix< T > operator+ ( vnl_matrix< T > const &  A,
vnl_diag_matrix< T > const &  D 
) [related]

Add a vnl_diag_matrix to a vnl_matrix. n adds, mn copies.

Definition at line 260 of file vnl_diag_matrix.h.

template<class T , unsigned int N>
vnl_matrix_fixed< T, N, N > operator+ ( vnl_diag_matrix_fixed< T, N > const &  D,
vnl_matrix_fixed< T, N, N > const &  A 
) [related]

Add a vnl_matrix to a vnl_diag_matrix_fixed. n adds, mn copies.

Definition at line 261 of file vnl_diag_matrix_fixed.h.

template<class T >
vnl_matrix< T > operator+ ( vnl_diag_matrix< T > const &  D,
vnl_matrix< T > const &  A 
) [related]

Add a vnl_matrix to a vnl_diag_matrix. n adds, mn copies.

Definition at line 275 of file vnl_diag_matrix.h.

template<class T >
vnl_matrix< T > operator+ ( T const &  value,
vnl_matrix< T > const &  m 
) [related]

Definition at line 740 of file vnl_matrix.h.

template<class T , unsigned int N>
vnl_matrix_fixed< T, N, N > operator- ( vnl_matrix_fixed< T, N, N > const &  A,
vnl_diag_matrix_fixed< T, N > const &  D 
) [related]

Subtract a vnl_diag_matrix_fixed from a vnl_matrix. n adds, mn copies.

Definition at line 281 of file vnl_diag_matrix_fixed.h.

template<class T , unsigned int N>
vnl_matrix_fixed< T, N, N > operator- ( vnl_diag_matrix_fixed< T, N > const &  D,
vnl_matrix_fixed< T, N, N > const &  A 
) [related]

Subtract a vnl_matrix from a vnl_diag_matrix_fixed. n adds, mn copies.

Definition at line 294 of file vnl_diag_matrix_fixed.h.

template<class T >
vnl_matrix< T > operator- ( vnl_matrix< T > const &  A,
vnl_diag_matrix< T > const &  D 
) [related]

Subtract a vnl_diag_matrix from a vnl_matrix. n adds, mn copies.

Definition at line 296 of file vnl_diag_matrix.h.

template<class T >
vnl_matrix< T > operator- ( vnl_diag_matrix< T > const &  D,
vnl_matrix< T > const &  A 
) [related]

Subtract a vnl_matrix from a vnl_diag_matrix. n adds, mn copies.

Definition at line 311 of file vnl_diag_matrix.h.

template<class T >
bool operator< ( vnl_matrix< T > const &  lhs,
vnl_matrix< T > const &  rhs 
) [related]

Define a complete ordering on vnl_matrix.

This is useful to create a set, or map of matrices.

The ordering itself is implementation defined - so don't rely on the meaning of less here.

Definition at line 47 of file vnl_operators.h.

template<class T >
void swap ( vnl_matrix< T > &  A,
vnl_matrix< T > &  B 
) [related]

Swap two matrices.

Definition at line 748 of file vnl_matrix.h.

template<class T >
vnl_matrix< vcl_complex< T > > vnl_complexify ( vnl_matrix< T > const &  R) [related]

Return complexified version of real matrix R.

Definition at line 50 of file vnl_complex_ops.txx.

template<class T >
vnl_matrix< vcl_complex< T > > vnl_complexify ( vnl_matrix< T > const &  R,
vnl_matrix< T > const &  I 
) [related]

Return complex matrix R+j*I from two real matrices R and I.

Definition at line 58 of file vnl_complex_ops.txx.

template<class T >
T vnl_determinant ( vnl_matrix< T > const &  M,
bool  balance = false 
) [related]

evaluation using direct methods for sizes of 2x2, 3x3, and 4x4 or qr decomposition for other matrices.

template<class T >
vnl_matrix< T > vnl_imag ( vnl_matrix< vcl_complex< T > > const &  C) [related]

Matrix of imaginary parts of vnl_matrix<vcl_complex<T> >.

Definition at line 120 of file vnl_complex_ops.txx.

template<class T >
vnl_matrix< T > vnl_inverse ( vnl_matrix< T > const &  m) [related]

Calculates inverse of a small vnl_matrix_fixed (not using svd).

This allows you to write e.g.

x = vnl_inverse(A) * b;

Note that this function is inlined (except for the call to vnl_det()), which makes it much faster than the vnl_matrix_inverse class in vnl/algo since that one is using svd.

Definition at line 167 of file vnl_inverse.h.

template<class T >
vnl_matrix< T > vnl_inverse_transpose ( vnl_matrix< T > const &  m) [related]

Calculates transpose of the inverse of a small vnl_matrix_fixed (not using svd).

This allows you to write e.g.

x = vnl_inverse_transpose(A) * b;

Note that this function is inlined (except for the call to vnl_det()), which makes it much faster than the vnl_matrix_inverse class in vnl/algo since that one is using svd. This is also faster than using

x = vnl_inverse(A).transpose() * b;

Definition at line 335 of file vnl_inverse.h.

template<class T >
vcl_ostream & vnl_matlab_print ( vcl_ostream &  ,
vnl_matrix< T > const &  ,
char const *  variable_name = 0,
vnl_matlab_print_format  = vnl_matlab_print_format_default 
) [related]

print a vnl_matrix<T>.

template<class T >
void vnl_matrix_update ( vnl_matrix< T > &  M,
const vnl_vector< T > &  a,
const vnl_vector< T > &  b 
) [related]

Perform rank 1 update of M: M+=(a*b').

Requires a.size()==M.rows(), b.size()==M.columns()

Definition at line 17 of file vnl_matrix_update.h.

template<class T >
vnl_matrix< T > vnl_orthogonal_complement ( vnl_vector< T > const &  v) [related]

Return a matrix whose columns span is the orthogonal complement of v.

template<class T >
vnl_matrix< T > vnl_power ( vnl_matrix< T > const &  m,
int  n 
) [related]

Calculates nth power of a square vnl_matrix (not using svd).

This allows you to write e.g.

x = vnl_power(A,7) * vnl_power(B,-4) * b;

Note that this function is inlined (except for the call to vnl_inverse()), which makes it much faster than a full-fledged square matrix power implementation using svd, which belongs in vnl/algo.

Definition at line 59 of file vnl_power.h.

template<class T >
unsigned int vnl_rank ( vnl_matrix< T > const &  mat,
vnl_rank_type  = vnl_rank_both 
) [related]

Returns the rank of a matrix.

By default, the row rank of the matrix is determined. Specify vnl_rank_column to obtain the column rank.

template<class T >
vnl_matrix< T > vnl_rank_column_reduce ( vnl_matrix< T > const &  mat,
vnl_rank_pivot_type  = vnl_rank_pivot_all 
) [related]

Column reduce a matrix.

template<class T >
vnl_matrix< T > vnl_rank_row_column_reduce ( vnl_matrix< T > const &  mat,
vnl_rank_pivot_type  = vnl_rank_pivot_all 
) [related]

Row and column reduce a matrix.

Perform both row reduction and column reduction on a matrix. The resulting matrix will in general no longer span the same row space (or column space) as the original matrix, but the rank will not have changed, and the number of nonzero elements will be minimal (viz at most one per row and one per column).

template<class T >
vnl_matrix< T > vnl_rank_row_reduce ( vnl_matrix< T > const &  mat,
vnl_rank_pivot_type  = vnl_rank_pivot_all 
) [related]

Row reduce a matrix.

First try to use 1 or -1 as pivot element in each row, to avoid divisions; then use any nonzero element as candidate pivot. Repeat this process until the matrix does not change any more. At that point, the matrix spans the same row space as before and contains as many zeros as possible.

When specifying vnl_rank_pivot_one is given as second argument, only elements with value 1 or -1 are used as candidate pivot elements.

Note that for integer matrices, the resulting matrix is still integer, and is guaranteed to be row equivalent with the original matrix.

template<class T >
vnl_matrix< T > vnl_real ( vnl_matrix< vcl_complex< T > > const &  C) [related]

Matrix of real parts of vnl_matrix<vcl_complex<T> >.

Definition at line 89 of file vnl_complex_ops.txx.

template<class T>
vnl_matrix< double > vnl_rotation_matrix ( vnl_vector< double > const &  axis) [related]

Returns an orthogonal 3x3 matrix which is a rotation about the axis, by an angle equal to ||axis||.

Definition at line 85 of file vnl_rotation_matrix.cxx.

template<class T >
T vnl_trace ( vnl_matrix< T > const &  M) [related]

Calculate trace of a matrix.

Definition at line 24 of file vnl_trace.h.

template<class T >
void vsl_b_read ( vsl_b_istream &  is,
vnl_matrix< T > &  v 
) [related]

Binary load vnl_matrix from stream.

template<class T >
void vsl_b_write ( vsl_b_ostream &  os,
const vnl_matrix< T > &  v 
) [related]

Binary save vnl_matrix to stream.

template<class T >
void vsl_print_summary ( vcl_ostream &  os,
const vnl_matrix< T > &  b 
) [related]

Print human readable summary of object to a stream.

template<class T >
void x_write ( vcl_ostream &  os,
vnl_matrix< T > const &  v,
vcl_string  name = "vnl_matrix< T >" 
) [related]

XML save vnl_matrix to stream.

template<class T >
void x_write_tree ( vcl_ostream &  os,
vnl_matrix< T > const &  v,
vcl_string  name = "vnl_matrix< T >" 
) [related]

XML save vnl_matrix as a 3-level tree to stream.


Member Data Documentation

template<class T>
T** vnl_matrix< T >::data [protected, inherited]

Definition at line 657 of file vnl_matrix.h.

template<class T>
unsigned vnl_matrix< T >::num_cols [protected, inherited]

Definition at line 656 of file vnl_matrix.h.

template<class T>
unsigned vnl_matrix< T >::num_rows [protected, inherited]

Definition at line 655 of file vnl_matrix.h.

template<class T >
bool vnl_file_matrix< T >::ok_ [private]

Definition at line 35 of file vnl_file_matrix.h.

template<class T >
vnl_file_matrix< T >::VCL_SAFE_BOOL_DEFINE [private]

Definition at line 25 of file vnl_file_matrix.h.


The documentation for this class was generated from the following files: