|
CUV
0.9.201304091348
|
Class for diagonal matrices. More...
#include <dia_matrix.hpp>


Public Types | |
| typedef __value_type | value_type |
| Type of the entries of matrix. | |
| typedef const value_type | const_value_type |
| Type of the entries of matrix. | |
|
typedef matrix< __value_type, __index_type > | base_type |
| Basic matrix type. | |
| typedef __memory_space_type | memory_space_type |
| Whether this is a host or device matrix. | |
| typedef base_type::index_type | index_type |
| Type of indices. | |
|
typedef const tensor < value_type, memory_space_type > | const_vec_type |
| Basic vector type used. | |
|
typedef tensor< value_type, memory_space_type > | vec_type |
| Basic vector type used. | |
|
typedef tensor< int, memory_space_type > | intvec_type |
| Type of offsets for diagonals. | |
|
typedef dia_matrix< value_type, memory_space_type, index_type > | my_type |
| Type of this matix. | |
| typedef vec_type::pointer_type | ptr_type |
Public Types inherited from cuv::matrix< __value_type, __index_type > | |
| typedef __value_type | value_type |
| Type of the entries of matrix. | |
| typedef __index_type | index_type |
| Type of indices. | |
Public Member Functions | |
| ~dia_matrix () | |
| dia_matrix (const index_type &h, const index_type &w, const int &num_dia, const int &stride, int row_fact=1) | |
| Creates diagonal matrix of given size, with given number of diagonals and stride. | |
| void | dealloc () |
| std::vector< index_type > | shape () const |
| shape of a dia-matrix. | |
| void | alloc () |
| const vec_type & | vec () const |
| Return pointer to vector storing entries. | |
| vec_type & | vec () |
| Return pointer to vector storing entries. | |
| const vec_type * | vec_ptr () const |
| Return reference to vector storing entries. | |
| vec_type * | vec_ptr () |
| Return reference to vector storing entries. | |
| ptr_type | ptr () |
| Return reference to vector storing entries. | |
| const ptr_type | ptr () const |
| Return reference to vector storing entries. | |
| int | num_dia () const |
| Return number of diagonals. | |
| unsigned int | stride () const |
| Return stride of matrix. | |
| int | row_fact () const |
| Return steepness of diagonals. | |
| template<class T > | |
| void | set_offsets (T begin, const T &end) |
| Set the offsets of the diagonals in the DIA matrix This overload works with any iterator. | |
| template<class T > | |
| void | set_offsets (const std::vector< T > &v) |
| Set the offsets of the diagonals in the DIA matrix. | |
| void | post_update_offsets () |
| Update the internal reverse-mapping of diagonals to positions in the offset-array. | |
| void | set_offset (const index_type &idx, const index_type &val) |
| Set a single diagonal offset in the matrix. | |
| const_vec_type * | get_dia (const int &k) const |
| Return vector (view) containing specified diagonal. | |
| vec_type * | get_dia (const int &k) |
| Return a vector (view) on the specified diagonal. | |
| const intvec_type & | get_offsets () const |
| Return the vector of offsets. | |
| intvec_type & | get_offsets () |
| return the vector of offsets | |
| int | get_offset (const index_type &idx) const |
| < Return offset of specified diagonal | |
| void | set (const index_type &i, const index_type &j, const value_type &val) |
| value_type | operator() (const index_type &i, const index_type &j) const |
| < Return matrix entry (i,j) | |
| bool | has (const index_type &i, const index_type &j) const |
| < Return whether matrix entry is managed by sparse matrix | |
| my_type & | operator= (const my_type &o) |
| Assignment operator. | |
Public Member Functions inherited from cuv::matrix< __value_type, __index_type > | |
| matrix (const index_type &h, const index_type &w) | |
| Basic constructor: set width and height of matrix but do not allocate any memory. | |
| matrix (const matrix< value_type, index_type > &m) | |
| Copy Constructor. | |
| matrix< value_type, index_type > & | operator= (const matrix< value_type, index_type > &m) |
| assignment operator | |
| virtual | ~matrix () |
| void | resize (const index_type &h, const index_type &w) |
| Resizing matrix: changing width and height without changing memory layout. | |
| index_type | w () const |
| Return matrix width. | |
| index_type | h () const |
| Return matrix height. | |
| index_type | n () const |
| Return number of entries in matrix. | |
Public Attributes | |
| int | m_num_dia |
| number of diagonals stored | |
| unsigned int | m_stride |
| how long the stored diagonals are | |
| vec_type * | m_vec |
| stores the actual data | |
| intvec_type | m_offsets |
| stores the offsets of the diagonals | |
| std::map< int, index_type > | m_dia2off |
| maps a diagonal to an offset | |
| int | m_row_fact |
| factor by which to multiply a row index (allows matrices with "steep" diagonals) | |
Additional Inherited Members | |
Protected Attributes inherited from cuv::matrix< __value_type, __index_type > | |
| index_type | m_width |
| Width of matrix. | |
| index_type | m_height |
| Heigth of matrix. | |
Class for diagonal matrices.
Definition at line 58 of file dia_matrix.hpp.
|
inline |
< Destructor. Deallocates Matrix.
Definition at line 79 of file dia_matrix.hpp.
|
inline |
Creates diagonal matrix of given size, with given number of diagonals and stride.
| h | Height of matrix |
| w | Width of matrix |
| num_dia | Number of diagonals in matrix |
| stride | Stride of matrix |
| row_fact | Steepness of diagonals. Only 1 is supported at the moment. |
Definition at line 98 of file dia_matrix.hpp.
|
inline |
Assignment operator.
Assigns vector belonging to source to destination and sets source vector to NULL
| o | Source matrix |
Definition at line 260 of file dia_matrix.hpp.
|
inline |
Update the internal reverse-mapping of diagonals to positions in the offset-array.
Normally, you do not need to call this function, except when changing the diagonal offsets manually.
Definition at line 181 of file dia_matrix.hpp.
|
inline |
Set a single diagonal offset in the matrix.
The main diagonal has offset zero, lower diagonals are negative, higher diagonals are positive.
| idx | the (internal) index of the offset |
| val | the offset number |
Definition at line 193 of file dia_matrix.hpp.
|
inline |
Set the offsets of the diagonals in the DIA matrix This overload works with any iterator.
The main diagonal has offset zero, lower diagonals are negative, higher diagonals are positive.
| begin | start of sequence |
| end | one behind end of sequence |
Definition at line 157 of file dia_matrix.hpp.
|
inline |
Set the offsets of the diagonals in the DIA matrix.
This overload works with a vector. The main diagonal has offset zero, lower diagonals are negative, higher diagonals are positive.
| v | a vector containing all offsets |
Definition at line 171 of file dia_matrix.hpp.
|
inline |
shape of a dia-matrix.
This is quite inefficient ATM, mainly for compatibility with tensor.
Definition at line 123 of file dia_matrix.hpp.
1.8.1.2