vnl_matrix< T > Class Template Reference

#include <vnl_matrix.h>

Inheritance diagram for vnl_matrix< T >:

Inheritance graph
[legend]

List of all members.


Detailed Description

template<class T>
class vnl_matrix< T >

An ordinary mathematical matrix.

The vnl_matrix<T> class implements two-dimensional arithmetic matrices for a user-specified numeric data type. Using the parameterized types facility of C++, it is possible, for example, for the user to create a matrix of rational numbers by parameterizing the vnl_matrix class over the Rational class. The only requirement for the type is that it supports the basic arithmetic operators.

Note: Unlike the other sequence classes, the vnl_matrix<T> class is fixed-size. It will not grow once the size has been specified to the constructor or changed by the assignment or multiplication operators. The vnl_matrix<T> class is row-based with addresses of rows being cached, and elements accessed as m[row][col].

Note: The matrix can, however, be resized using the set_size(nr,nc) function.

Note: Indexing of the matrix is zero-based, so the top-left element is M(0,0).

Note: Inversion of matrix M, and other operations such as solving systems of linear equations are handled by the matrix decomposition classes in vnl/algo, such as matrix_inverse, svd, qr etc.

Note: Use a vnl_vector<T> with these matrices.

Definition at line 83 of file vnl_matrix.h.


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_matrix ()
 Default constructor creates an empty matrix of size 0,0.
 vnl_matrix (unsigned r, unsigned c)
 Construct a matrix of size r rows by c columns.
 vnl_matrix (unsigned r, unsigned c, T const &v0)
 Construct a matrix of size r rows by c columns, and all emelemnts equal to v0.
 vnl_matrix (unsigned r, unsigned c, vnl_matrix_type t)
 Construct a matrix of size r rows by c columns, with a special type.
 vnl_matrix (unsigned r, unsigned c, unsigned n, T const values[])
 Construct a matrix of size r rows by c columns, initialised by an automatic array.
 vnl_matrix (T const *data_block, unsigned r, unsigned c)
 Construct a matrix of size r rows by c columns, initialised by a memory block.
 vnl_matrix (vnl_matrix< T > const &)
 Copy construct a matrix.
 vnl_matrix (vnl_matrix< T > const &, vnl_matrix< T > const &, vnl_tag_add)
 vnl_matrix (vnl_matrix< T > const &, vnl_matrix< T > const &, vnl_tag_sub)
 vnl_matrix (vnl_matrix< T > const &, T, vnl_tag_mul)
 vnl_matrix (vnl_matrix< T > const &, T, vnl_tag_div)
 vnl_matrix (vnl_matrix< T > const &, T, vnl_tag_add)
 vnl_matrix (vnl_matrix< T > const &, T, vnl_tag_sub)
 vnl_matrix (vnl_matrix< T > const &, vnl_matrix< T > const &, vnl_tag_mul)
 vnl_matrix (vnl_matrix< T > &that, vnl_tag_grab)
 ~vnl_matrix ()
 Matrix destructor.
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.
void fill (T const &)
 Set all elements of matrix to specified value.
void fill_diagonal (T const &)
 Set all diagonal elements of matrix to specified value.
void copy_in (T const *)
 Fill (laminate) this matrix with the given data.
void set (T const *d)
 Fill (laminate) this matrix with the given data.
void copy_out (T *) const
 Fill the given array with this matrix.
vnl_matrix< T > & operator= (T const &v)
 Set all elements to value v.
vnl_matrix< T > & operator= (vnl_matrix< T > const &)
 Copies all elements of rhs matrix into lhs matrix.
vnl_matrix< T > & operator+= (T value)
 Add rhs to each element of lhs matrix in situ.
vnl_matrix< T > & operator-= (T value)
 Subtract rhs from each element of lhs matrix in situ.
vnl_matrix< T > & operator*= (T value)
 Scalar multiplication in situ of lhs matrix by rhs.
vnl_matrix< T > & operator/= (T value)
 Scalar division of lhs matrix in situ by rhs.
vnl_matrix< T > & operator+= (vnl_matrix< T > const &)
 Add rhs to lhs matrix in situ.
vnl_matrix< T > & operator-= (vnl_matrix< T > const &)
 Subtract rhs from lhs matrix in situ.
vnl_matrix< T > & operator*= (vnl_matrix< T > const &rhs)
 Multiply lhs matrix in situ by rhs.
vnl_matrix< T > operator- () const
 Negate all elements of 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- (T const &v) const
 Subtract rhs from each element of 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/ (T const &v) const
 Scalar division of lhs matrix by rhs 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- (vnl_matrix< T > const &rhs) const
 Matrix subtract rhs from lhs 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 > 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].
void set_column (unsigned i, T const *v)
 Set the elements of the i'th column to v[j] (No bounds checking).
void set_column (unsigned i, T value)
 Set the elements of the i'th column to value.
void set_column (unsigned j, vnl_vector< T > const &v)
 Set j-th column to v.
void set_columns (unsigned starting_column, vnl_matrix< T > const &M)
 Set columns to those in M, starting at starting_column.
void set_row (unsigned i, T const *v)
 Set the elements of the i'th row to v[j] (No bounds checking).
void set_row (unsigned i, T value)
 Set the elements of the i'th row to value.
void set_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.
void set_identity ()
 Set this matrix to an identity matrix.
void inplace_transpose ()
 Transpose this matrix efficiently.
void flipud ()
 Reverse order of rows.
void fliplr ()
 Reverse order of columns.
void normalize_rows ()
 Normalize each row so it is a unit vector.
void normalize_columns ()
 Normalize each column so it is a unit vector.
void scale_row (unsigned row, T value)
 Scale elements in given row by a factor of T.
void scale_column (unsigned col, T value)
 Scale elements in given column by a factor of T.
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_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.
iterator end ()
 Iterator pointing to element beyond end of data.
const_iterator begin () const
 Iterator pointing to start 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

Related Functions

(Note that these are not member functions.)

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 > 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>
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>
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 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, 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, 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.
vcl_vector< unsigned > vnl_hungarian_algorithm (vnl_matrix< double > const &cost)
 Find the best column to row assignment given a cost matrix.
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>
vnl_matrix< T > operator* (T const &value, vnl_matrix< T > const &m)
template<class T>
vnl_matrix< T > operator+ (T const &value, vnl_matrix< T > const &m)
template<class T>
void swap (vnl_matrix< T > &A, vnl_matrix< T > &B)
 Swap two matrices.
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>
vnl_vector< T > operator* (vnl_matrix< T > const &m, vnl_vector< T > const &v)
 multiply matrix and (column) vector. O(m*n).

Member Typedef Documentation

template<class T>
typedef vnl_c_vector<T>::abs_t vnl_matrix< T >::abs_t

Type def for norms.

Definition at line 370 of file vnl_matrix.h.

template<class T>
typedef T vnl_matrix< T >::element_type

Definition at line 483 of file vnl_matrix.h.

template<class T>
typedef T* vnl_matrix< T >::iterator

Iterators.

Definition at line 486 of file vnl_matrix.h.

template<class T>
typedef T const* vnl_matrix< T >::const_iterator

Const iterators.

Definition at line 493 of file vnl_matrix.h.


Constructor & Destructor Documentation

template<class T>
vnl_matrix< T >::vnl_matrix (  )  [inline]

Default constructor creates an empty matrix of size 0,0.

Definition at line 87 of file vnl_matrix.h.

template<class T>
vnl_matrix< T >::vnl_matrix ( unsigned  rowz,
unsigned  colz 
) [inline]

Construct a matrix of size r rows by c columns.

Creates a matrix with given number of rows and columns.

Contents are unspecified. Complexity $O(1)$

Elements are not initialized. O(m*n).

Definition at line 141 of file vnl_matrix.txx.

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

Construct a matrix of size r rows by c columns, and all emelemnts equal to v0.

Creates a matrix with given number of rows and columns, and initialize all elements to value. O(m*n).

Complexity $O(r.c)$

Definition at line 150 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( unsigned  r,
unsigned  c,
vnl_matrix_type  t 
) [inline]

Construct a matrix of size r rows by c columns, with a special type.

r rows, c cols, special type. Currently implements "identity" and "null".

Contents are specified by t Complexity $O(r.c)$

Definition at line 161 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( unsigned  r,
unsigned  c,
unsigned  n,
T const   values[] 
) [inline]

Construct a matrix of size r rows by c columns, initialised by an automatic array.

Creates a matrix with given dimension (rows, cols) and initialize first n elements, row-wise, to values. O(m*n).

The first n elements, are initialised row-wise, to values. Complexity $O(n)$

Definition at line 187 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( T const *  datablck,
unsigned  rowz,
unsigned  colz 
) [inline]

Construct a matrix of size r rows by c columns, initialised by a memory block.

Creates a matrix from a block array of data, stored row-wise.

The values are initialise row wise from the data. Complexity $O(r.c)$

O(m*n).

Definition at line 203 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( vnl_matrix< T > const &  from  )  [inline]

Copy construct a matrix.

Creates a new matrix and copies all the elements.

Complexity $O(r.c)$

O(m*n).

Definition at line 218 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( vnl_matrix< T > const &  A,
vnl_matrix< T > const &  B,
vnl_tag_add   
) [inline]

Definition at line 239 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( vnl_matrix< T > const &  A,
vnl_matrix< T > const &  B,
vnl_tag_sub   
) [inline]

Definition at line 259 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( vnl_matrix< T > const &  M,
s,
vnl_tag_mul   
) [inline]

Definition at line 279 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( vnl_matrix< T > const &  M,
s,
vnl_tag_div   
) [inline]

Definition at line 293 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( vnl_matrix< T > const &  M,
s,
vnl_tag_add   
) [inline]

Definition at line 307 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( vnl_matrix< T > const &  M,
s,
vnl_tag_sub   
) [inline]

Definition at line 321 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( vnl_matrix< T > const &  A,
vnl_matrix< T > const &  B,
vnl_tag_mul   
) [inline]

Definition at line 335 of file vnl_matrix.txx.

template<class T>
vnl_matrix< T >::vnl_matrix ( vnl_matrix< T > &  that,
vnl_tag_grab   
) [inline]

Definition at line 133 of file vnl_matrix.h.

template<class T>
vnl_matrix< T >::~vnl_matrix (  )  [inline]

Matrix destructor.

Definition at line 362 of file vnl_matrix.txx.


Member Function Documentation

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

Return number of rows.

Definition at line 145 of file vnl_matrix.h.

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

Return number of columns.

A synonym for cols()

Definition at line 149 of file vnl_matrix.h.

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

Return number of columns.

A synonym for columns()

Definition at line 153 of file vnl_matrix.h.

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

Return number of elements.

This equals rows() * cols()

Definition at line 157 of file vnl_matrix.h.

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

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 592 of file vnl_matrix.h.

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

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 577 of file vnl_matrix.h.

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

return pointer to given row.

No boundary checking here.

Definition at line 167 of file vnl_matrix.h.

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

return pointer to given row.

No boundary checking here.

Definition at line 171 of file vnl_matrix.h.

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

Access an element for reading or writing.

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

Definition at line 175 of file vnl_matrix.h.

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

Access an element for reading.

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

Definition at line 186 of file vnl_matrix.h.

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

Set all elements of matrix to specified value.

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

Complexity $O(r.c)$

Definition at line 424 of file vnl_matrix.txx.

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

Set all diagonal elements of matrix to specified value.

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

Complexity $O(\min(r,c))$

Definition at line 434 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::copy_in ( T const *  p  )  [inline]

Fill (laminate) this matrix with the given data.

Fill this matrix with the given data.

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

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

Definition at line 866 of file vnl_matrix.txx.

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

Fill (laminate) this matrix with the given data.

A synonym for copy_in()

Definition at line 212 of file vnl_matrix.h.

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

Fill the given array with this matrix.

We assume that p 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 877 of file vnl_matrix.txx.

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

Set all elements to value v.

Complexity $O(r.c)$

Definition at line 222 of file vnl_matrix.h.

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

Copies all elements of rhs matrix into lhs matrix.

Copies all elements of rhs matrix into lhs matrix. O(m*n).

Complexity $O(\min(r,c))$

If needed, the arrays in lhs matrix are freed up, and new arrays are allocated to match the dimensions of the rhs matrix.

Reimplemented in vnl_int_matrix.

Definition at line 458 of file vnl_matrix.txx.

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

Add rhs to each element of lhs matrix in situ.

Definition at line 517 of file vnl_matrix.txx.

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

Subtract rhs from each element of lhs matrix in situ.

Definition at line 526 of file vnl_matrix.txx.

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

Scalar multiplication in situ of lhs matrix by rhs.

Definition at line 535 of file vnl_matrix.txx.

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

Scalar division of lhs matrix in situ by rhs.

Definition at line 544 of file vnl_matrix.txx.

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

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 557 of file vnl_matrix.txx.

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

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 578 of file vnl_matrix.txx.

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

Multiply lhs matrix in situ by rhs.

Definition at line 249 of file vnl_matrix.h.

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

Negate all elements of matrix.

Returns new matrix which is the negation of THIS matrix.

O(m*n).

Definition at line 636 of file vnl_matrix.txx.

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

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

Definition at line 256 of file vnl_matrix.h.

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

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

Definition at line 259 of file vnl_matrix.h.

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

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

Definition at line 262 of file vnl_matrix.h.

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

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

Definition at line 265 of file vnl_matrix.h.

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

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

Definition at line 268 of file vnl_matrix.h.

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

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

Definition at line 270 of file vnl_matrix.h.

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

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

Definition at line 272 of file vnl_matrix.h.

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

Make a new matrix by applying function to each element.

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

Definition at line 697 of file vnl_matrix.txx.

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

Make a new matrix by applying function to each element.

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

Definition at line 688 of file vnl_matrix.txx.

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

Return transpose.

Returns new matrix with rows and columns transposed.

O(m*n).

Definition at line 710 of file vnl_matrix.txx.

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

Return conjugate transpose.

Definition at line 722 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 
) [inline]

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 735 of file vnl_matrix.txx.

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

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

Set column[column_index] to data at given address.

Definition at line 1059 of file vnl_matrix.txx.

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

Set the elements of the i'th column to value.

Set column[column_index] to given value.

Definition at line 1078 of file vnl_matrix.txx.

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

Set j-th column to v.

Set column[column_index] to given vector.

Definition at line 1067 of file vnl_matrix.txx.

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

Set columns to those in M, starting at starting_column.

Set columns starting at starting_column to given matrix.

Definition at line 1087 of file vnl_matrix.txx.

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

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

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

Definition at line 1030 of file vnl_matrix.txx.

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

Set the elements of the i'th row to value.

Set row[row_index] to given value.

Definition at line 1049 of file vnl_matrix.txx.

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

Set the i-th row.

Set row[row_index] to given vector.

Definition at line 1038 of file vnl_matrix.txx.

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

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 756 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 [inline]

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 764 of file vnl_matrix.txx.

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

Get a vector equal to the given row.

Create a vector out of row[row_index].

Definition at line 998 of file vnl_matrix.txx.

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

Get a vector equal to the given column.

Create a vector out of column[column_index].

Definition at line 1013 of file vnl_matrix.txx.

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

Get n rows beginning at rowstart.

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

Definition at line 969 of file vnl_matrix.txx.

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

Get n columns beginning at colstart.

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

Definition at line 982 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::set_identity (  )  [inline]

Set this matrix to an identity matrix.

Fill this matrix with a row*row identity matrix.

Abort if the matrix is not square

Definition at line 887 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::inplace_transpose (  )  [inline]

Transpose this matrix efficiently.

Transpose matrix M in place.

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

Definition at line 1576 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::flipud (  )  [inline]

Reverse order of rows.

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

Definition at line 1386 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::fliplr (  )  [inline]

Reverse order of columns.

Definition at line 1405 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::normalize_rows (  )  [inline]

Normalize each row so it is a unit vector.

Make each row of the matrix have unit norm.

Zero rows are ignored

All-zero rows are ignored.

Definition at line 904 of file vnl_matrix.txx.

template<class T>
void vnl_matrix< T >::normalize_columns (  )  [inline]

Normalize each column so it is a unit vector.

Make each column of the matrix have unit norm.

Zero columns are ignored

All-zero columns are ignored.

Definition at line 925 of file vnl_matrix.txx.

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

Scale elements in given row by a factor of T.

Multiply row[row_index] by value.

Definition at line 945 of file vnl_matrix.txx.

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

Scale elements in given column by a factor of T.

Multiply column[column_index] by value.

Definition at line 957 of file vnl_matrix.txx.

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

Swap this matrix with that matrix.

Definition at line 1377 of file vnl_matrix.txx.

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

Return sum of absolute values of elements.

Definition at line 373 of file vnl_matrix.h.

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

Return square root of sum of squared absolute element values.

Definition at line 376 of file vnl_matrix.h.

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

Return largest absolute element value.

Definition at line 379 of file vnl_matrix.h.

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

Return sum of absolute values of elements.

Definition at line 382 of file vnl_matrix.h.

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

Return largest absolute value.

Definition at line 385 of file vnl_matrix.h.

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

Definition at line 1425 of file vnl_matrix.txx.

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

Definition at line 1442 of file vnl_matrix.txx.

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

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

Definition at line 394 of file vnl_matrix.h.

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

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

Definition at line 397 of file vnl_matrix.h.

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

Return RMS of all elements.

Definition at line 400 of file vnl_matrix.h.

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

Return minimum value of elements.

Definition at line 403 of file vnl_matrix.h.

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

Return maximum value of elements.

Definition at line 406 of file vnl_matrix.h.

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

Return location of minimum value of elements.

Definition at line 409 of file vnl_matrix.h.

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

Return location of maximum value of elements.

Definition at line 412 of file vnl_matrix.h.

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

Return mean of all matrix elements.

Definition at line 415 of file vnl_matrix.h.

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

Return true iff the size is zero.

Definition at line 420 of file vnl_matrix.h.

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

Return true if all elements equal to identity.

Definition at line 1128 of file vnl_matrix.txx.

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

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 1143 of file vnl_matrix.txx.

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

Return true if all elements equal to zero.

Definition at line 1157 of file vnl_matrix.txx.

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

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

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

Definition at line 1170 of file vnl_matrix.txx.

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

Return true if finite.

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

Definition at line 1194 of file vnl_matrix.txx.

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

Return true if matrix contains NaNs.

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

Definition at line 1182 of file vnl_matrix.txx.

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

abort if size is not as expected.

This function does or tests nothing if NDEBUG is defined

Definition at line 442 of file vnl_matrix.h.

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

abort if matrix contains any INFs or NANs.

This function does or tests nothing if NDEBUG is defined

Definition at line 450 of file vnl_matrix.h.

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

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 1369 of file vnl_matrix.txx.

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

Read a vnl_matrix from an ascii vcl_istream.

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

Definition at line 1244 of file vnl_matrix.txx.

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

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

1d array, row-major order.

Definition at line 469 of file vnl_matrix.h.

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

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

1d array, row-major order.

Definition at line 473 of file vnl_matrix.h.

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

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

2d array, [row][column].

Definition at line 477 of file vnl_matrix.h.

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

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

2d array, [row][column].

Definition at line 481 of file vnl_matrix.h.

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

Iterator pointing to start of data.

Definition at line 488 of file vnl_matrix.h.

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

Iterator pointing to element beyond end of data.

Definition at line 490 of file vnl_matrix.h.

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

Iterator pointing to start of data.

Definition at line 495 of file vnl_matrix.h.

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

Iterator pointing to element beyond end of data.

Definition at line 497 of file vnl_matrix.h.

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

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 503 of file vnl_matrix.h.

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

Return a reference to this.

Definition at line 506 of file vnl_matrix.h.

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

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 1111 of file vnl_matrix.txx.

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

Equality operator.

Definition at line 514 of file vnl_matrix.h.

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

Inequality operator.

Definition at line 517 of file vnl_matrix.h.

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

Print matrix to os in some hopefully sensible format.

Definition at line 476 of file vnl_matrix.txx.

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

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

Definition at line 382 of file vnl_matrix.txx.

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

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

Returns true if size changed.

Reimplemented in vnl_matrix_ref< T >.

Definition at line 397 of file vnl_matrix.txx.

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

Abort unless M has the given size.

Definition at line 1232 of file vnl_matrix.txx.

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

Abort if any element of M is inf or nan.

Definition at line 1206 of file vnl_matrix.txx.

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

Delete data.

Frees up the dynamic storage used by matrix.

O(m*n).

Definition at line 376 of file vnl_matrix.txx.

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

Definition at line 509 of file vnl_matrix.txx.


Friends And Related Function Documentation

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.

Definition at line 63 of file vnl_determinant.txx.

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.

Definition at line 11 of file vnl_orthogonal_complement.txx.

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

Binary save vnl_matrix to stream.

Definition at line 16 of file vnl_io_matrix.txx.

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

Binary load vnl_matrix from stream.

Definition at line 31 of file vnl_io_matrix.txx.

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.

Definition at line 69 of file vnl_io_matrix.txx.

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>
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 210 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]

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

Definition at line 224 of file vnl_diag_matrix.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 251 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]

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

Definition at line 266 of file vnl_diag_matrix.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 287 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 302 of file vnl_diag_matrix.h.

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 201 of file vnl_diag_matrix_fixed.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 214 of file vnl_diag_matrix_fixed.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 239 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]

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

Definition at line 252 of file vnl_diag_matrix_fixed.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 272 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 285 of file vnl_diag_matrix_fixed.h.

template<class T>
vcl_vector< unsigned > vnl_hungarian_algorithm ( vnl_matrix< double > const &  cost  )  [related]

Find the best column to row assignment given a cost matrix.

This is an implementation of the Hungarian algorithm (also known as the Munkres algorithm). It finds the minimum cost assignment of the rows of the cost matrix cost (workers) to the columns (jobs).

Parameters:
cost An N x M cost matrix. The costs cannot be -Infinity.
Returns:
A vector v of size N such that v[i] = j means that row i should be assigned to column j. v[i] = unsigned(-1) means that row i was not assigned to any column. If N > M, then every column will be assigned to some row. If N < M then every row will be assigned to some column.

Definition at line 15 of file vnl_hungarian_algorithm.cxx.

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>.

Definition at line 68 of file vnl_matlab_print.txx.

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

Definition at line 609 of file vnl_matrix.h.

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

Definition at line 617 of file vnl_matrix.h.

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

Swap two matrices.

Definition at line 625 of file vnl_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>
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.

Definition at line 185 of file vnl_rank.txx.

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.

Definition at line 8 of file vnl_rank.txx.

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.

Definition at line 57 of file vnl_rank.txx.

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).

Definition at line 106 of file vnl_rank.txx.

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>
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 490 of file vnl_vector.h.


Member Data Documentation

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

Definition at line 532 of file vnl_matrix.h.

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

Definition at line 533 of file vnl_matrix.h.

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

Definition at line 534 of file vnl_matrix.h.


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

Generated on Sun Nov 22 06:17:22 2009 for core/vnl by  doxygen 1.5.5