STXXL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::matrix< ValueType, BlockSideLength > Class Template Reference

Detailed Description

template<typename ValueType, unsigned BlockSideLength>
class stxxl::matrix< ValueType, BlockSideLength >

External matrix container.
Introduction to matrix container: see STXXL Matrix tutorial.
Design and Internals of matrix container: see Matrix.

Template Parameters
ValueTypetype of contained objects (POD with no references to internal memory)
BlockSideLengthside length of a matrix block

Divides the matrix in square submatrices (blocks). Blocks can be swapped individually to and from external memory. They are only swapped if necessary to minimize I/O.

Examples:
examples/containers/matrix1.cpp.

Definition at line 44 of file matrix.h.

+ Collaboration diagram for stxxl::matrix< ValueType, BlockSideLength >:

Public Types

typedef
matrix_col_major_iterator
< ValueType, BlockSideLength > 
col_major_iterator
 
typedef column_vector< ValueType > column_vector_type
 
typedef
const_matrix_col_major_iterator
< ValueType, BlockSideLength > 
const_col_major_iterator
 
typedef const_matrix_iterator
< ValueType, BlockSideLength > 
const_iterator
 
typedef
const_matrix_row_major_iterator
< ValueType, BlockSideLength > 
const_row_major_iterator
 
typedef matrix_iterator
< ValueType, BlockSideLength > 
iterator
 
typedef
matrix_row_major_iterator
< ValueType, BlockSideLength > 
row_major_iterator
 
typedef row_vector< ValueType > row_vector_type
 

Public Member Functions

Constructors/Destructors
 matrix (block_scheduler_type &bs, const elem_size_type height, const elem_size_type width)
 Creates a new matrix of given dimensions. Elements' values are set to zero. More...
 
 matrix (block_scheduler_type &bs, const column_vector_type &left, const row_vector_type &right)
 
 ~matrix ()
 
Capacity
const elem_size_typeget_height () const
 
const elem_size_typeget_width () const
 
Iterators
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
const_iterator operator() (const elem_size_type row, const elem_size_type col) const
 
iterator operator() (const elem_size_type row, const elem_size_type col)
 
Modifiers
void transpose ()
 
void set_zero ()
 
Operations
matrix_type operator+ (const matrix_type &right) const
 
matrix_type operator- (const matrix_type &right) const
 
matrix_type operator* (const matrix_type &right) const
 
matrix_type operator* (const ValueType scalar) const
 
matrix_typeoperator+= (const matrix_type &right)
 
matrix_typeoperator-= (const matrix_type &right)
 
matrix_typeoperator*= (const matrix_type &right)
 
matrix_typeoperator*= (const ValueType scalar)
 
column_vector_type operator* (const column_vector_type &right) const
 
row_vector_type multiply_from_left (const row_vector_type &left) const
 
matrix_type multiply (const matrix_type &right, const int_type multiplication_algorithm=1, const int_type scheduling_algorithm=2) const
 multiply with another matrix More...
 
matrix_type multiply_internal (const matrix_type &right, const int_type scheduling_algorithm=2) const
 Use internal memory multiplication. Designated for testing. May exceed memory limitations. More...
 

Protected Types

typedef
swappable_block_matrix_type::block_scheduler_type 
block_scheduler_type
 
typedef
swappable_block_matrix_type::size_type 
block_size_type
 
typedef
swappable_block_matrix_type::elem_size_type 
elem_size_type
 
typedef matrix< ValueType,
BlockSideLength > 
matrix_type
 
typedef
matrix_local::matrix_operations
< ValueType, BlockSideLength > 
Ops
 
typedef counting_ptr
< swappable_block_matrix_type
swappable_block_matrix_pointer_type
 
typedef swappable_block_matrix
< ValueType, BlockSideLength > 
swappable_block_matrix_type
 
typedef matrix_swappable_block
< ValueType, BlockSideLength > 
swappable_block_type
 

Protected Member Functions

void multiply_internal (const matrix_type &right, matrix_type &res) const
 

Protected Attributes

swappable_block_matrix_pointer_type data
 
elem_size_type height
 
elem_size_type width
 

Member Typedef Documentation

template<typename ValueType, unsigned BlockSideLength>
typedef swappable_block_matrix_type::block_scheduler_type stxxl::matrix< ValueType, BlockSideLength >::block_scheduler_type
protected

Definition at line 1044 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef swappable_block_matrix_type::size_type stxxl::matrix< ValueType, BlockSideLength >::block_size_type
protected

Definition at line 1045 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef matrix_col_major_iterator<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::col_major_iterator

Definition at line 1054 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef column_vector<ValueType> stxxl::matrix< ValueType, BlockSideLength >::column_vector_type

Definition at line 1057 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef const_matrix_col_major_iterator<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::const_col_major_iterator

Definition at line 1056 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef const_matrix_iterator<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::const_iterator

Definition at line 1052 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef const_matrix_row_major_iterator<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::const_row_major_iterator

Definition at line 1055 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef swappable_block_matrix_type::elem_size_type stxxl::matrix< ValueType, BlockSideLength >::elem_size_type
protected

Definition at line 1046 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef matrix_iterator<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::iterator

Definition at line 1051 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef matrix<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::matrix_type
protected

Definition at line 1041 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef matrix_local::matrix_operations<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::Ops
protected

Definition at line 1047 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef matrix_row_major_iterator<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::row_major_iterator

Definition at line 1053 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef row_vector<ValueType> stxxl::matrix< ValueType, BlockSideLength >::row_vector_type

Definition at line 1058 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef counting_ptr<swappable_block_matrix_type> stxxl::matrix< ValueType, BlockSideLength >::swappable_block_matrix_pointer_type
protected

Definition at line 1043 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef swappable_block_matrix<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::swappable_block_matrix_type
protected

Definition at line 1042 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef matrix_swappable_block<ValueType, BlockSideLength> stxxl::matrix< ValueType, BlockSideLength >::swappable_block_type
protected

Definition at line 1048 of file matrix.h.

Constructor & Destructor Documentation

template<typename ValueType, unsigned BlockSideLength>
stxxl::matrix< ValueType, BlockSideLength >::matrix ( block_scheduler_type bs,
const elem_size_type  height,
const elem_size_type  width 
)
inline

Creates a new matrix of given dimensions. Elements' values are set to zero.

Parameters
bsblock scheduler used
heightheight of the created matrix
widthwidth of the created matrix

Definition at line 1079 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
stxxl::matrix< ValueType, BlockSideLength >::matrix ( block_scheduler_type bs,
const column_vector_type left,
const row_vector_type right 
)
inline

Definition at line 1091 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
stxxl::matrix< ValueType, BlockSideLength >::~matrix ( )
inline

Definition at line 1103 of file matrix.h.

Member Function Documentation

template<typename ValueType, unsigned BlockSideLength>
iterator stxxl::matrix< ValueType, BlockSideLength >::begin ( )
inline
template<typename ValueType, unsigned BlockSideLength>
const_iterator stxxl::matrix< ValueType, BlockSideLength >::begin ( ) const
inline

Definition at line 1122 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
const_iterator stxxl::matrix< ValueType, BlockSideLength >::cbegin ( ) const
inline
template<typename ValueType, unsigned BlockSideLength>
const_iterator stxxl::matrix< ValueType, BlockSideLength >::cend ( ) const
inline
template<typename ValueType, unsigned BlockSideLength>
iterator stxxl::matrix< ValueType, BlockSideLength >::end ( )
inline
template<typename ValueType, unsigned BlockSideLength>
const_iterator stxxl::matrix< ValueType, BlockSideLength >::end ( ) const
inline

Definition at line 1131 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
const elem_size_type& stxxl::matrix< ValueType, BlockSideLength >::get_height ( ) const
inline

Definition at line 1108 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
const elem_size_type& stxxl::matrix< ValueType, BlockSideLength >::get_width ( ) const
inline

Definition at line 1111 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
matrix_type stxxl::matrix< ValueType, BlockSideLength >::multiply ( const matrix_type right,
const int_type  multiplication_algorithm = 1,
const int_type  scheduling_algorithm = 2 
) const
inline

multiply with another matrix

Parameters
rightmatrix to multiply with
multiplication_algorithmallows to choose the applied algorithm
scheduling_algorithmallows to choose the applied algorithm

Available algorithms are:
0: naive_multiply_and_add (I/O inefficient, slow)
1: recursive_multiply_and_add (recommended, default, stable time and I/O complexity)
2: strassen_winograd_multiply_and_add (sometimes fast but unstable time and I/O complexity)
3: multi_level_strassen_winograd_multiply_and_add (sometimes fast but unstable time and I/O complexity)
4: strassen_winograd_multiply, optimized pre- and postadditions (sometimes fast but unstable time and I/O complexity)
5: strassen_winograd_multiply_and_add_interleaved, optimized preadditions (sometimes fast but unstable time and I/O complexity)
6: multi_level_strassen_winograd_multiply_and_add_block_grained (sometimes fast but unstable time and I/O complexity)

Definition at line 1249 of file matrix.h.

References stxxl::swappable_block_matrix< ValueType, BlockSideLength >::bs, stxxl::matrix< ValueType, BlockSideLength >::data, stxxl::matrix< ValueType, BlockSideLength >::height, STXXL_ERRMSG, and stxxl::matrix< ValueType, BlockSideLength >::width.

template<typename ValueType, unsigned BlockSideLength>
row_vector_type stxxl::matrix< ValueType, BlockSideLength >::multiply_from_left ( const row_vector_type left) const
inline
template<typename ValueType, unsigned BlockSideLength>
matrix_type stxxl::matrix< ValueType, BlockSideLength >::multiply_internal ( const matrix_type right,
const int_type  scheduling_algorithm = 2 
) const
inline
template<typename ValueType, unsigned BlockSideLength>
const_iterator stxxl::matrix< ValueType, BlockSideLength >::operator() ( const elem_size_type  row,
const elem_size_type  col 
) const
inline

Definition at line 1135 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
iterator stxxl::matrix< ValueType, BlockSideLength >::operator() ( const elem_size_type  row,
const elem_size_type  col 
)
inline

Definition at line 1138 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
matrix_type stxxl::matrix< ValueType, BlockSideLength >::operator* ( const matrix_type right) const
inline

Definition at line 1182 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
matrix_type stxxl::matrix< ValueType, BlockSideLength >::operator* ( const ValueType  scalar) const
inline

Definition at line 1185 of file matrix.h.

References stxxl::matrix< ValueType, BlockSideLength >::data.

template<typename ValueType, unsigned BlockSideLength>
column_vector_type stxxl::matrix< ValueType, BlockSideLength >::operator* ( const column_vector_type right) const
inline
template<typename ValueType, unsigned BlockSideLength>
matrix_type& stxxl::matrix< ValueType, BlockSideLength >::operator*= ( const matrix_type right)
inline

Definition at line 1208 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
matrix_type& stxxl::matrix< ValueType, BlockSideLength >::operator*= ( const ValueType  scalar)
inline

Definition at line 1211 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
matrix_type stxxl::matrix< ValueType, BlockSideLength >::operator+ ( const matrix_type right) const
inline
template<typename ValueType, unsigned BlockSideLength>
matrix_type& stxxl::matrix< ValueType, BlockSideLength >::operator+= ( const matrix_type right)
inline
template<typename ValueType, unsigned BlockSideLength>
matrix_type stxxl::matrix< ValueType, BlockSideLength >::operator- ( const matrix_type right) const
inline
template<typename ValueType, unsigned BlockSideLength>
matrix_type& stxxl::matrix< ValueType, BlockSideLength >::operator-= ( const matrix_type right)
inline
template<typename ValueType, unsigned BlockSideLength>
void stxxl::matrix< ValueType, BlockSideLength >::set_zero ( )
inline

Definition at line 1154 of file matrix.h.

References stxxl::div_ceil().

template<typename ValueType, unsigned BlockSideLength>
void stxxl::matrix< ValueType, BlockSideLength >::transpose ( )
inline

Definition at line 1147 of file matrix.h.

Member Data Documentation


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