yat
0.20.3pre
|
Interface to GSL matrix_view. More...
#include <yat/utility/MatrixView.h>
Public Types | |
typedef double & | reference |
typedef Container2DIterator< MatrixMutable, double, double & > | iterator |
typedef StrideIterator< double * > | column_iterator |
typedef StrideIterator< double * > | row_iterator |
typedef double | value_type |
typedef const double & | const_reference |
typedef Container2DIterator< const MatrixBase, const double, const double & > | const_iterator |
typedef StrideIterator< const double * > | const_column_iterator |
typedef StrideIterator< const double * > | const_row_iterator |
typedef MatrixBase | derived_type |
Public Member Functions | |
MatrixView (void) | |
MatrixView (MatrixView &other) | |
MatrixView (MatrixMutable &other) | |
MatrixView (MatrixMutable &other, size_t row_offset, size_t col_offset, size_t rows, size_t columns) | |
MatrixView (gsl_matrix *m) | |
MatrixView (double *p, size_t rows, size_t cols) | |
MatrixView (double *p, size_t rows, size_t cols, size_t tda) | |
~MatrixView (void) | |
Destructor. | |
gsl_matrix * | gsl_matrix_p (void) |
const gsl_matrix * | gsl_matrix_p (void) const |
MatrixView & | operator= (const MatrixView &other) |
MatrixView (proxy p) | |
create a MatrixView from an internal proxy class. | |
operator proxy () | |
MatrixMutable & | operator= (const MatrixMutable &other) |
The assignment operator. More... | |
MatrixMutable & | operator= (const MatrixBase &other) |
The assignment operator. | |
template<class T > | |
MatrixMutable & | operator= (const MatrixExpression< T > &rhs) |
MatrixMutable & | operator= (MatrixMutable &&other) |
Move assignment operator. | |
template<class T > | |
MatrixMutable & | operator= (MatrixExpression< T > &&rhs) |
void | all (const double value) |
iterator | begin (void) |
const_iterator | begin (void) const |
const_iterator | begin (void) const |
column_iterator | begin_column (size_t i) |
const_column_iterator | begin_column (size_t i) const |
const_column_iterator | begin_column (size_t i) const |
row_iterator | begin_row (size_t i) |
const_row_iterator | begin_row (size_t i) const |
const_row_iterator | begin_row (size_t i) const |
VectorView | column_view (size_t i) |
void | div (const MatrixBase &b) |
iterator | end (void) |
const_iterator | end (void) const |
const_iterator | end (void) const |
column_iterator | end_column (size_t i) |
const_column_iterator | end_column (size_t i) const |
const_column_iterator | end_column (size_t i) const |
row_iterator | end_row (size_t i) |
const_row_iterator | end_row (size_t i) const |
const_row_iterator | end_row (size_t i) const |
virtual const gsl_matrix * | gsl_matrix_p (void) const=0 |
void | mul (const MatrixBase &b) |
VectorView | row_view (size_t) |
void | swap_columns (const size_t i, const size_t j) |
Swap columns i and j. More... | |
void | swap_rowcol (const size_t i, const size_t j) |
Swap row i and column j. More... | |
void | swap_rows (const size_t i, const size_t j) |
Swap rows i and j. More... | |
double & | operator() (size_t row, size_t column) |
Element access operator. More... | |
const double & | operator() (size_t row, size_t column) const |
Element access operator. More... | |
const MatrixMutable & | operator+= (const MatrixBase &b) |
Add and assign operator. More... | |
template<class T > | |
MatrixMutable & | operator+= (const MatrixExpression< T > &rhs) |
Addition and assign operator. More... | |
const MatrixMutable & | operator+= (const double d) |
Add and assign operator. More... | |
const MatrixMutable & | operator-= (const MatrixBase &) |
Subtract and assign operator. More... | |
template<class T > | |
MatrixMutable & | operator-= (const MatrixExpression< T > &rhs) |
Subtraction and assign operator. More... | |
const MatrixMutable & | operator-= (const double d) |
Subtract and assign operator. More... | |
const MatrixMutable & | operator*= (double d) |
Multiply and assignment operator. More... | |
const VectorConstView | column_const_view (size_t) const |
size_t | columns (void) const |
bool | equal (const MatrixBase &, const double precision=0) const |
Check whether matrices are equal within a user defined precision, set by precision. More... | |
size_t | rows (void) const |
const VectorConstView | row_const_view (size_t) const |
bool | operator== (const MatrixBase &other) const |
Comparison operator. Takes squared time. More... | |
bool | operator!= (const MatrixBase &other) const |
Comparison operator. Takes squared time. More... | |
Protected Member Functions | |
void | copy_assign (const gsl_matrix *rhs) |
void | move_assign (MatrixMutable &&rhs) |
void | move_assign (gsl_matrix *&&rhs) |
void | copy_assign (const MatrixBase &other) |
Behaves like operator=(const MatrixBase&) | |
virtual void | copy_assign (const gsl_matrix *rhs)=0 |
Behaves like operator=(const MatrixBase&) | |
void | copy_assign (const MatrixBase &other) |
Behaves like operator=(const MatrixBase&) | |
gsl_matrix * | create_gsl_matrix_copy (void) const |
Create a new copy of the internal GSL matrix. More... | |
Protected Attributes | |
gsl_matrix * | blas_result_ |
Related Functions | |
(Note that these are not member functions.) | |
void | swap (MatrixMutable &, MatrixMutable &) |
Exchange all elements between the matrices by copying. More... | |
void | minmax_index (const MatrixBase &M, std::pair< size_t, size_t > &min, std::pair< size_t, size_t > &max) |
Locate the maximum and minimum element in the matrix, M. More... | |
std::ostream & | operator<< (std::ostream &s, const MatrixBase &) |
The output operator for the MatrixBase class. | |
Interface to GSL matrix_view.
Class provides a way to have a mutable view into a Matrix. See GSL documentation (gsl_matrix_view) for design details. A view can be a view of the entire Matrix or a contiguous sub-matrix defined by the left- and right columns as well as the upper and lower rows.
The semantics of the class is very much like a mutable reference. That means that assignment implies that the underlying data is changed and in the assignment operators and the size of left and tight-hand-side must be the same. It is not possible to reassign which Matrix the MatrixView views into, again similar to how a reference cannot be reassigned to reference another object.
|
inherited |
Mutable iterator that iterates over one column
|
inherited |
Read-only iterator that iterates over one column
|
inherited |
Read-only iterator that iterates over all elements
|
inherited |
const_reference type is const double&
|
inherited |
Read-only iterator that iterates over one row
|
inherited |
Class that inherits from BasicMatrix
|
inherited |
Mutable iterator that iterates over all elements
|
inherited |
reference type is double&
|
inherited |
Mutable iterator that iterates over one row
|
inherited |
value_type is double
theplu::yat::utility::MatrixView::MatrixView | ( | void | ) |
Default constructor. Constructed view behaves like viewing into an empty Matrix.
theplu::yat::utility::MatrixView::MatrixView | ( | MatrixView & | other | ) |
|
explicit |
Create a view into a matrix other
.
theplu::yat::utility::MatrixView::MatrixView | ( | MatrixMutable & | other, |
size_t | row_offset, | ||
size_t | col_offset, | ||
size_t | rows, | ||
size_t | columns | ||
) |
for (size_t i=0; i<matrix.rows(); ++i)
Create view into sub-matrix into other
.
view(0,) will view into other(row_offset, col_offset) and have dimension row x column.
|
explicit |
Create a view into m
.
theplu::yat::utility::MatrixView::MatrixView | ( | double * | p, |
size_t | rows, | ||
size_t | cols | ||
) |
Create a view with rows
rows and cols
columns. Data are stored in row-major order such that p[1] correspond to view(0,1).
theplu::yat::utility::MatrixView::MatrixView | ( | double * | p, |
size_t | rows, | ||
size_t | cols, | ||
size_t | tda | ||
) |
Create a view with rows
rows and cols
columns. The physical row dimension is tda
, i.e., the first element on the second row is p[tda].
|
inherited |
Set all elements to value.
|
inherited |
Iterator iterates along a row. When end of row is reached it jumps to beginning of next row.
|
inherited |
Iterator iterates along a row. When end of row is reached it jumps to beginning of next row.
|
inherited |
Iterator iterates along a row. When end of row is reached it jumps to beginning of next row.
|
inherited |
Iterator iterates along a column.
|
inherited |
Iterator iterates along a column.
|
inherited |
Iterator iterates along a column.
|
inherited |
Iterator iterates along a row.
|
inherited |
Iterator iterates along a row.
|
inherited |
Iterator iterates along a row.
|
inherited |
|
inherited |
|
inherited |
|
protectedvirtual |
Copy values in rhs
into this. Dimensions must agree. It's safe to call this function when data of rhs and gsl_matrix_p() overlap.
Implements theplu::yat::utility::MatrixMutable.
|
protectedinherited |
Create a new copy of the internal GSL matrix.
Necessary memory for the new GSL matrix is allocated and the caller is responsible for freeing the allocated memory.
GSL_error | if memory cannot be allocated for the new copy, or if dimensions mismatch. |
|
inherited |
Elementwise division of the elements of the calling matrix by the elements of matrix b, . The result is stored into the calling matrix.
GSL_error | if dimensions mismatch. |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Check whether matrices are equal within a user defined precision, set by precision.
|
virtual |
Implements theplu::yat::utility::MatrixMutable.
|
virtual |
Implements theplu::yat::utility::MatrixMutable.
|
inherited |
|
protectedvirtual |
Copy values in rhs
into this
Reimplemented from theplu::yat::utility::MatrixMutable.
|
protectedvirtual |
Same behaviour as copy_assign(const gsl_matrix*).
Implements theplu::yat::utility::MatrixMutable.
|
inherited |
theplu::yat::utility::MatrixView::operator proxy | ( | ) |
Conversion operator to a private proxy class.
|
inherited |
Comparison operator. Takes squared time.
Checks are performed with exact matching, i.e., rounding off effects may destroy comparison. Use the equal function for comparing elements within a user defined precision.
|
inherited |
Element access operator.
If | GSL range checks are enabled in the underlying GSL library a GSL_error exception is thrown if either index is out of range. |
|
inherited |
Element access operator.
If | GSL range checks are enabled in the underlying GSL library a GSL_error exception is thrown if either index is out of range. |
|
inherited |
|
inherited |
|
inlineinherited |
Addition and assign operator.
|
inherited |
Add and assign operator.
Add the scalar value d to the left hand side Matrix, .
|
inherited |
|
inlineinherited |
Subtraction and assign operator.
|
inherited |
Subtract and assign operator.
Subtract the scalar value d to the left hand side Matrix, .
|
inline |
Move assignment from a matrix expression. A matrix expression is the result of operator+
, operator-
, and operator*, or combinations of them.
A typical usage looks like
where B, C, and D are all instances of class Matrix.
Invalidates references, iterators, and views.
MatrixMutable& theplu::yat::utility::MatrixMutable::operator= |
The assignment operator.
|
inline |
Assignment from a matrix expression. A matrix expression is the result of operator+
, operator-
, and operator*, or combinations of them.
A typical usage looks like
where A, B, C, and D are all instances of class Matrix.
Typically MatrixExpression only exists as rvalue, and this operator is not called but the rvalue version, operator=(MatrixExpression<T>&&)
Invalidates, references, iterators and views.
MatrixView& theplu::yat::utility::MatrixView::operator= | ( | const MatrixView & | other | ) |
Assign values in other to left-hand side. Dimensions of left-hand and right-hand sides must agree.
|
inherited |
Comparison operator. Takes squared time.
Checks are performed with exact matching, i.e., rounding off effects may destroy comparison. Use the equal function for comparing elements within a user defined precision.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Swap columns i and j.
GSL_error | if either index is out of bounds. |
|
inherited |
|
inherited |
Swap rows i and j.
GSL_error | if either index is out of bounds. |
|
related |
Locate the maximum and minimum element in the matrix, M.
The indices to the element with the minimum and maximum values of the matrix are returned through parameters min and max, respectively.
|
related |
Exchange all elements between the matrices by copying.
This function swaps element by element and matrices must have the same size. References and iterators are not invalidated.
If you do not care about iterators and references, std::swap is typically faster (only swapping a couple of pointers).
GSL_error | if sizes are not equal. |
|
protectedinherited |
blas_result_ is used to temporarily store result in BLAS calls. Memory is not allocated for blas_result_ until it is needed.