Fixed size stack-stored vnl_matrix. More...
#include <vnl_matrix_fixed_ref.h>
Public Types | |
typedef T const * | const_iterator |
Const iterators. | |
typedef const T | element_type |
Type defs for iterators. | |
typedef const T * | iterator |
Type defs for iterators. | |
typedef vnl_c_vector< T >::abs_t | abs_t |
Type def for norms. | |
Public Member Functions | |
vnl_matrix_fixed_ref_const (const vnl_matrix_fixed< T, num_rows, num_cols > &rhs) | |
vnl_matrix_fixed_ref_const (const T *dataptr) | |
vnl_matrix_fixed_ref_const (const vnl_matrix_fixed_ref_const< T, num_rows, num_cols > &rhs) | |
vnl_vector_fixed< T, num_rows > | get_row (unsigned row_index) const |
Get j-th row. | |
vnl_vector_fixed< T, num_cols > | get_column (unsigned column_index) const |
Get j-th column. | |
vnl_vector< T > | get_diagonal () const |
Return a vector with the content of the (main) diagonal. | |
const T * | data_block () const |
const_iterator | begin () const |
Iterator pointing to start of data. | |
const_iterator | end () const |
Iterator pointing to element beyond end of data. | |
T const & | operator() (unsigned r, unsigned c) const |
T const * | operator[] (unsigned r) const |
return pointer to given row. | |
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 | print (vcl_ostream &os) const |
Print matrix to os in some hopefully sensible format. | |
void | copy_out (T *) const |
vnl_matrix_fixed< T, num_rows, num_cols > | apply (T(*f)(T)) const |
Make a new matrix by applying function to each element. | |
vnl_matrix_fixed< T, num_rows, num_cols > | apply (T(*f)(T const &)) const |
Make a new matrix by applying function to each element. | |
vnl_matrix_fixed< T, num_cols, num_rows > | transpose () const |
Return transpose. | |
vnl_matrix_fixed< T, num_cols, num_rows > | conjugate_transpose () const |
Return conjugate transpose. | |
vnl_matrix< T > | extract (unsigned rowz, unsigned colz, unsigned top=0, unsigned left=0) const |
Extract a sub-matrix of size rows x cols, starting at (top,left). | |
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. | |
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. | |
T | min_value () const |
Return minimum value of elements. | |
T | 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. | |
T | 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 rowz, unsigned colz) const |
abort if size is not as expected. | |
void | assert_finite () const |
abort if matrix contains any INFs or NANs. | |
Static Public Member Functions | |
static void | add (const T *a, const T *b, T *r) |
static void | add (const T *a, T b, T *r) |
static void | sub (const T *a, const T *b, T *r) |
static void | sub (const T *a, T b, T *r) |
static void | sub (T a, const T *b, T *r) |
static void | mul (const T *a, const T *b, T *r) |
static void | mul (const T *a, T b, T *r) |
static void | div (const T *a, const T *b, T *r) |
static void | div (const T *a, T b, T *r) |
static bool | equal (const T *a, const T *b) |
Protected Attributes | |
const T * | data_ |
Private Member Functions | |
const vnl_matrix_fixed_ref_const< T, num_rows, num_cols > & | operator= (const vnl_matrix_fixed_ref_const< T, num_rows, num_cols > &) const |
void | assert_finite_internal () const |
Abort if any element of M is inf or nan. | |
void | assert_size_internal (unsigned, unsigned) const |
Abort unless M has the given size. |
Fixed size stack-stored vnl_matrix.
vnl_matrix_fixed_ref is a fixed-size vnl_matrix for which the data space has been supplied externally. This is useful for two main tasks:
(a) Treating some row-based "C" matrix as a vnl_matrix in order to perform vnl_matrix operations on it.
(b) Declaring a vnl_matrix that uses entirely stack-based storage for the matrix.
The big warning is that returning a vnl_matrix_fixed_ref pointer will free non-heap memory if deleted through a vnl_matrix pointer. This should be very difficult though, as vnl_matrix_fixed_ref objects may not be constructed using operator new. This in turn is plausible as the point is to avoid such calls.
Definition at line 168 of file vnl_matrix_fixed_ref.h.
typedef vnl_c_vector<T>::abs_t vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::abs_t |
Type def for norms.
Definition at line 279 of file vnl_matrix_fixed_ref.h.
typedef T const* vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::const_iterator |
Const iterators.
Definition at line 209 of file vnl_matrix_fixed_ref.h.
typedef const T vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::element_type |
Type defs for iterators.
Reimplemented in vnl_matrix_fixed_ref< T, num_rows, num_cols >.
Definition at line 216 of file vnl_matrix_fixed_ref.h.
typedef const T* vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::iterator |
Type defs for iterators.
Reimplemented in vnl_matrix_fixed_ref< T, num_rows, num_cols >.
Definition at line 218 of file vnl_matrix_fixed_ref.h.
vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::vnl_matrix_fixed_ref_const | ( | const vnl_matrix_fixed< T, num_rows, num_cols > & | rhs | ) | [inline] |
Definition at line 173 of file vnl_matrix_fixed_ref.h.
vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::vnl_matrix_fixed_ref_const | ( | const T * | dataptr | ) | [inline, explicit] |
Definition at line 177 of file vnl_matrix_fixed_ref.h.
vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::vnl_matrix_fixed_ref_const | ( | const vnl_matrix_fixed_ref_const< T, num_rows, num_cols > & | rhs | ) | [inline] |
Definition at line 181 of file vnl_matrix_fixed_ref.h.
abs_t vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::absolute_value_max | ( | ) | const [inline] |
Return largest absolute value.
Definition at line 294 of file vnl_matrix_fixed_ref.h.
abs_t vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::absolute_value_sum | ( | ) | const [inline] |
Return sum of absolute values of elements.
Definition at line 291 of file vnl_matrix_fixed_ref.h.
static void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::add | ( | const T * | a, |
const T * | b, | ||
T * | r | ||
) | [inline, static] |
Definition at line 366 of file vnl_matrix_fixed_ref.h.
static void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::add | ( | const T * | a, |
T | b, | ||
T * | r | ||
) | [inline, static] |
Definition at line 367 of file vnl_matrix_fixed_ref.h.
vnl_matrix_fixed< T, nrows, ncols > vnl_matrix_fixed_ref_const< T, nrows, ncols >::apply | ( | T(*)(T) | f | ) | const |
Make a new matrix by applying function to each element.
Definition at line 174 of file vnl_matrix_fixed_ref.txx.
vnl_matrix_fixed< T, nrows, ncols > vnl_matrix_fixed_ref_const< T, nrows, ncols >::apply | ( | T(*)(T const &) | f | ) | const |
Make a new matrix by applying function to each element.
Definition at line 165 of file vnl_matrix_fixed_ref.txx.
unsigned vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::arg_max | ( | ) | const [inline] |
Return location of maximum value of elements.
Definition at line 321 of file vnl_matrix_fixed_ref.h.
unsigned vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::arg_min | ( | ) | const [inline] |
Return location of minimum value of elements.
Definition at line 318 of file vnl_matrix_fixed_ref.h.
abs_t vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::array_inf_norm | ( | ) | const [inline] |
Return largest absolute element value.
Definition at line 288 of file vnl_matrix_fixed_ref.h.
abs_t vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::array_one_norm | ( | ) | const [inline] |
Return sum of absolute values of elements.
Definition at line 282 of file vnl_matrix_fixed_ref.h.
abs_t vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::array_two_norm | ( | ) | const [inline] |
Return square root of sum of squared absolute element values.
Definition at line 285 of file vnl_matrix_fixed_ref.h.
void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::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 359 of file vnl_matrix_fixed_ref.h.
void vnl_matrix_fixed_ref_const< T, nrows, ncols >::assert_finite_internal | ( | ) | const [private] |
Abort if any element of M is inf or nan.
Definition at line 609 of file vnl_matrix_fixed_ref.txx.
void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::assert_size | ( | unsigned | rowz, |
unsigned | colz | ||
) | const [inline] |
abort if size is not as expected.
This function does or tests nothing if NDEBUG is defined
Definition at line 351 of file vnl_matrix_fixed_ref.h.
void vnl_matrix_fixed_ref_const< T, nrows, ncols >::assert_size_internal | ( | unsigned | rs, |
unsigned | cs | ||
) | const [private] |
Abort unless M has the given size.
Definition at line 637 of file vnl_matrix_fixed_ref.txx.
const_iterator vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::begin | ( | ) | const [inline] |
Iterator pointing to start of data.
Reimplemented in vnl_matrix_fixed_ref< T, num_rows, num_cols >.
Definition at line 211 of file vnl_matrix_fixed_ref.h.
unsigned vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::cols | ( | ) | const [inline] |
Return number of columns.
A synonym for columns()
Definition at line 242 of file vnl_matrix_fixed_ref.h.
unsigned vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::columns | ( | ) | const [inline] |
Return number of columns.
A synonym for cols()
Definition at line 238 of file vnl_matrix_fixed_ref.h.
vnl_matrix_fixed< T, ncols, nrows > vnl_matrix_fixed_ref_const< T, nrows, ncols >::conjugate_transpose | ( | ) | const |
Return conjugate transpose.
Definition at line 197 of file vnl_matrix_fixed_ref.txx.
void vnl_matrix_fixed_ref_const< T, nrows, ncols >::copy_out | ( | T * | p | ) | const |
Definition at line 257 of file vnl_matrix_fixed_ref.txx.
const T* vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::data_block | ( | ) | const [inline] |
Reimplemented in vnl_matrix_fixed_ref< T, num_rows, num_cols >.
Definition at line 206 of file vnl_matrix_fixed_ref.h.
static void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::div | ( | const T * | a, |
const T * | b, | ||
T * | r | ||
) | [inline, static] |
Definition at line 373 of file vnl_matrix_fixed_ref.h.
static void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::div | ( | const T * | a, |
T | b, | ||
T * | r | ||
) | [inline, static] |
Definition at line 374 of file vnl_matrix_fixed_ref.h.
bool vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::empty | ( | ) | const [inline] |
Return true iff the size is zero.
Definition at line 329 of file vnl_matrix_fixed_ref.h.
const_iterator vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::end | ( | ) | const [inline] |
Iterator pointing to element beyond end of data.
Reimplemented in vnl_matrix_fixed_ref< T, num_rows, num_cols >.
Definition at line 213 of file vnl_matrix_fixed_ref.h.
static bool vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::equal | ( | const T * | a, |
const T * | b | ||
) | [inline, static] |
Definition at line 376 of file vnl_matrix_fixed_ref.h.
vnl_matrix< T > vnl_matrix_fixed_ref_const< T, nrows, ncols >::extract | ( | unsigned | rowz, |
unsigned | colz, | ||
unsigned | top = 0 , |
||
unsigned | left = 0 |
||
) | const |
Extract a sub-matrix of size rows x cols, starting at (top,left).
Thus it contains elements [top,top+rows-1][left,left+cols-1]
Definition at line 227 of file vnl_matrix_fixed_ref.txx.
abs_t vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::fro_norm | ( | ) | const [inline] |
Return Frobenius norm of matrix (sqrt of sum of squares of its elements).
Definition at line 306 of file vnl_matrix_fixed_ref.h.
abs_t vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::frobenius_norm | ( | ) | const [inline] |
Return Frobenius norm of matrix (sqrt of sum of squares of its elements).
Definition at line 303 of file vnl_matrix_fixed_ref.h.
vnl_vector_fixed<T,num_cols> vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::get_column | ( | unsigned | column_index | ) | const [inline] |
Get j-th column.
Definition at line 195 of file vnl_matrix_fixed_ref.h.
vnl_vector< T > vnl_matrix_fixed_ref_const< T, nrows, ncols >::get_diagonal | ( | ) | const |
Return a vector with the content of the (main) diagonal.
Definition at line 424 of file vnl_matrix_fixed_ref.txx.
vnl_matrix< T > vnl_matrix_fixed_ref_const< T, nrows, ncols >::get_n_columns | ( | unsigned | colstart, |
unsigned | n | ||
) | const |
Get n columns beginning at colstart.
Definition at line 374 of file vnl_matrix_fixed_ref.txx.
vnl_matrix< T > vnl_matrix_fixed_ref_const< T, nrows, ncols >::get_n_rows | ( | unsigned | rowstart, |
unsigned | n | ||
) | const |
Get n rows beginning at rowstart.
Returns a copy of n rows, starting from "row".
Definition at line 361 of file vnl_matrix_fixed_ref.txx.
vnl_vector_fixed<T,num_rows> vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::get_row | ( | unsigned | row_index | ) | const [inline] |
Get j-th row.
Definition at line 186 of file vnl_matrix_fixed_ref.h.
bool vnl_matrix_fixed_ref_const< T, nrows, ncols >::has_nans | ( | ) | const |
Return true if matrix contains NaNs.
Definition at line 584 of file vnl_matrix_fixed_ref.txx.
bool vnl_matrix_fixed_ref_const< T, nrows, ncols >::is_finite | ( | ) | const |
Return true if finite.
Definition at line 596 of file vnl_matrix_fixed_ref.txx.
bool vnl_matrix_fixed_ref_const< T, nrows, ncols >::is_identity | ( | ) | const |
Return true if all elements equal to identity.
Definition at line 526 of file vnl_matrix_fixed_ref.txx.
bool vnl_matrix_fixed_ref_const< T, nrows, ncols >::is_identity | ( | double | tol | ) | const |
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 543 of file vnl_matrix_fixed_ref.txx.
bool vnl_matrix_fixed_ref_const< T, nrows, ncols >::is_zero | ( | ) | const |
Return true if all elements equal to zero.
Definition at line 559 of file vnl_matrix_fixed_ref.txx.
bool vnl_matrix_fixed_ref_const< T, nrows, ncols >::is_zero | ( | double | tol | ) | const |
Return true if all elements equal to zero, within given tolerance.
Definition at line 572 of file vnl_matrix_fixed_ref.txx.
T vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::max_value | ( | ) | const [inline] |
Return maximum value of elements.
Definition at line 315 of file vnl_matrix_fixed_ref.h.
T vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::mean | ( | ) | const [inline] |
Return mean of all matrix elements.
Definition at line 324 of file vnl_matrix_fixed_ref.h.
T vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::min_value | ( | ) | const [inline] |
Return minimum value of elements.
Definition at line 312 of file vnl_matrix_fixed_ref.h.
static void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::mul | ( | const T * | a, |
const T * | b, | ||
T * | r | ||
) | [inline, static] |
Definition at line 371 of file vnl_matrix_fixed_ref.h.
static void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::mul | ( | const T * | a, |
T | b, | ||
T * | r | ||
) | [inline, static] |
Definition at line 372 of file vnl_matrix_fixed_ref.h.
T const& vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::operator() | ( | unsigned | r, |
unsigned | c | ||
) | const [inline] |
Reimplemented in vnl_matrix_fixed_ref< T, num_rows, num_cols >.
Definition at line 220 of file vnl_matrix_fixed_ref.h.
const vnl_matrix_fixed_ref_const<T,num_rows,num_cols>& vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::operator= | ( | const vnl_matrix_fixed_ref_const< T, num_rows, num_cols > & | ) | const [inline, private] |
Reimplemented in vnl_matrix_fixed_ref< T, num_rows, num_cols >.
Definition at line 379 of file vnl_matrix_fixed_ref.h.
T const* vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::operator[] | ( | unsigned | r | ) | const [inline] |
return pointer to given row.
No boundary checking here.
Reimplemented in vnl_matrix_fixed_ref< T, num_rows, num_cols >.
Definition at line 231 of file vnl_matrix_fixed_ref.h.
vnl_matrix_fixed_ref_const< T, nrows, ncols >::abs_t vnl_matrix_fixed_ref_const< T, nrows, ncols >::operator_inf_norm | ( | ) | const |
Definition at line 718 of file vnl_matrix_fixed_ref.txx.
vnl_matrix_fixed_ref_const< T, nrows, ncols >::abs_t vnl_matrix_fixed_ref_const< T, nrows, ncols >::operator_one_norm | ( | ) | const |
Definition at line 702 of file vnl_matrix_fixed_ref.txx.
void vnl_matrix_fixed_ref_const< T, nrows, ncols >::print | ( | vcl_ostream & | os | ) | const |
Print matrix to os in some hopefully sensible format.
Definition at line 151 of file vnl_matrix_fixed_ref.txx.
abs_t vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::rms | ( | ) | const [inline] |
Return RMS of all elements.
Definition at line 309 of file vnl_matrix_fixed_ref.h.
unsigned vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::rows | ( | ) | const [inline] |
Return number of rows.
Definition at line 234 of file vnl_matrix_fixed_ref.h.
unsigned vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::size | ( | ) | const [inline] |
Return number of elements.
Definition at line 246 of file vnl_matrix_fixed_ref.h.
static void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::sub | ( | const T * | a, |
const T * | b, | ||
T * | r | ||
) | [inline, static] |
Definition at line 368 of file vnl_matrix_fixed_ref.h.
static void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::sub | ( | const T * | a, |
T | b, | ||
T * | r | ||
) | [inline, static] |
Definition at line 369 of file vnl_matrix_fixed_ref.h.
static void vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::sub | ( | T | a, |
const T * | b, | ||
T * | r | ||
) | [inline, static] |
Definition at line 370 of file vnl_matrix_fixed_ref.h.
vnl_matrix_fixed< T, ncols, nrows > vnl_matrix_fixed_ref_const< T, nrows, ncols >::transpose | ( | ) | const |
Return transpose.
Definition at line 186 of file vnl_matrix_fixed_ref.txx.
const T* vnl_matrix_fixed_ref_const< T, num_rows, num_cols >::data_ [protected] |
Definition at line 171 of file vnl_matrix_fixed_ref.h.