[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
#include <vigra/matrix.hxx>
Matrix class.
This is the basic class for all linear algebra computations. Matrices are stored in a column-major format, i.e. the row index is varying fastest. This is the same format as in the lapack and gmm++ libraries, so it will be easy to interface these libraries. In fact, if you need optimized high performance code, you should use them. The VIGRA linear algebra functionality is provided for smaller problems and rapid prototyping (no one wants to spend half the day installing a new library just to discover that the new algorithm idea didn't work anyway).
See also:
#include <vigra/matrix.hxx> or
#include <vigra/linear_algebra.hxx>
Namespaces: vigra and vigra::linalg
construct with given allocator
|
explicit |
construct with given shape and init all elements with zero. Note that the order of the axes is difference_type(rows, columns)
which is the opposite of the usual VIGRA convention.
Matrix | ( | difference_type_1 | rows, |
difference_type_1 | columns, | ||
ALLOC const & | alloc = allocator_type() |
||
) |
construct with given shape and init all elements with zero. Note that the order of the axes is (rows, columns)
which is the opposite of the usual VIGRA convention.
Matrix | ( | const difference_type & | aShape, |
const_reference | init, | ||
allocator_type const & | alloc = allocator_type() |
||
) |
construct with given shape and init all elements with the constant init. Note that the order of the axes is difference_type(rows, columns)
which is the opposite of the usual VIGRA convention.
Matrix | ( | difference_type_1 | rows, |
difference_type_1 | columns, | ||
const_reference | init, | ||
allocator_type const & | alloc = allocator_type() |
||
) |
construct with given shape and init all elements with the constant init. Note that the order of the axes is (rows, columns)
which is the opposite of the usual VIGRA convention.
Matrix | ( | const difference_type & | shape, |
const_pointer | init, | ||
RawArrayMemoryLayout | layout = RowMajor , |
||
allocator_type const & | alloc = allocator_type() |
||
) |
construct with given shape and copy data from C-style array init. Unless layout is ColumnMajor
, the elements in this array are assumed to be given in row-major order (the C standard order) and will automatically be converted to the required column-major format. Note that the order of the axes is difference_type(rows, columns)
which is the opposite of the usual VIGRA convention.
Matrix | ( | difference_type_1 | rows, |
difference_type_1 | columns, | ||
const_pointer | init, | ||
RawArrayMemoryLayout | layout = RowMajor , |
||
allocator_type const & | alloc = allocator_type() |
||
) |
construct with given shape and copy data from C-style array init. Unless layout is ColumnMajor
, the elements in this array are assumed to be given in row-major order (the C standard order) and will automatically be converted to the required column-major format. Note that the order of the axes is (rows, columns)
which is the opposite of the usual VIGRA convention.
copy constructor. Allocates new memory and copies tha data.
construct from temporary matrix, which looses its data.
This operation is equivalent to
Matrix | ( | const MultiArrayView< 2, U, C > & | rhs | ) |
construct from a MultiArrayView. Allocates new memory and copies tha data. rhs is assumed to be in column-major order already.
assignment. If the size of rhs is the same as the matrix's old size, only the data are copied. Otherwise, new storage is allocated, which invalidates all objects (array views, iterators) depending on the matrix.
assign a temporary matrix. If the shapes of the two matrices match, only the data are copied (in order to not invalidate views and iterators depending on this matrix). Otherwise, the memory is swapped between the two matrices, so that all depending objects (array views, iterators) ar invalidated.
assignment from arbitrary 2-dimensional MultiArrayView.
If the size of rhs is the same as the matrix's old size, only the data are copied. Otherwise, new storage is allocated, which invalidates all objects (array views, iterators) depending on the matrix. rhs is assumed to be in column-major order already.
assignment from scalar.
Equivalent to Matrix::init(v).
void reshape | ( | difference_type_1 | rows, |
difference_type_1 | columns | ||
) |
reshape to the given shape and initialize with zero.
void reshape | ( | difference_type_1 | rows, |
difference_type_1 | columns, | ||
const_reference | init | ||
) |
reshape to the given shape and initialize with init.
reshape to the given shape and initialize with zero.
reshape to the given shape and initialize with init.
view_type rowVector | ( | difference_type_1 | d | ) | const |
Create a matrix view that represents the row vector of row d.
view_type columnVector | ( | difference_type_1 | d | ) | const |
Create a matrix view that represents the column vector of column d.
number of rows (height) of the matrix.
number of columns (width) of the matrix.
number of elements (width*height) of the matrix.
check whether the matrix is symmetric.
sums over the matrix.
TemporaryMatrix< T > sum | ( | difference_type_1 | d | ) | const |
sums over dimension d of the matrix.
sums over the matrix.
TemporaryMatrix< T > mean | ( | difference_type_1 | d | ) | const |
calculates mean over dimension d of the matrix.
value_type & operator() | ( | difference_type_1 | row, |
difference_type_1 | column | ||
) |
read/write access to matrix element (row, column)
. Note that the order of the argument is the opposite of the usual VIGRA convention due to column-major matrix order.
value_type operator() | ( | difference_type_1 | row, |
difference_type_1 | column | ||
) | const |
read access to matrix element (row, column)
. Note that the order of the argument is the opposite of the usual VIGRA convention due to column-major matrix order.
NormTraits< Matrix >::SquaredNormType squaredNorm | ( | ) | const |
squared Frobenius norm. Sum of squares of the matrix elements.
Frobenius norm. Root of sum of squares of the matrix elements.
MultiArrayView< 2, vluae_type, StridedArrayTag > transpose | ( | ) | const |
create a transposed view of this matrix. No data are copied. If you want to transpose this matrix permanently, you have to assign the transposed view:
add other to this (sizes must match).
subtract other from this (sizes must match).
multiply other element-wise with this matrix (sizes must match).
divide this matrix element-wise by other (sizes must match).
add other to each element of this matrix
subtract other from each element of this matrix
scalar multiply this with other
scalar divide this by other
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |