Stxxl  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
stxxl::matrix< ValueType, BlockSideLength > Class Template Reference

External matrix container. More...

#include <matrix.h>

Collaboration diagram for stxxl::matrix< ValueType, BlockSideLength >:
Collaboration graph
[legend]

List of all members.

Public Types

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

Public Member Functions

 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.
 matrix (block_scheduler_type &bs, const column_vector_type &left, const row_vector_type &right)
 ~matrix ()
const elem_size_typeget_height () const
const elem_size_typeget_width () const
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)
void transpose ()
void set_zero ()
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
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.

Protected Types

typedef matrix< ValueType,
BlockSideLength > 
matrix_type
typedef swappable_block_matrix
< ValueType, BlockSideLength > 
swappable_block_matrix_type
typedef shared_object_pointer
< swappable_block_matrix_type
swappable_block_matrix_pointer_type
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_operations
< ValueType, BlockSideLength > 
Ops
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

elem_size_type height
elem_size_type width
swappable_block_matrix_pointer_type data

Detailed Description

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

External matrix container.

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:
containers/test_matrix.cpp.

Definition at line 1019 of file matrix.h.


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 1025 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 1026 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 1035 of file matrix.h.

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

Definition at line 1038 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 1037 of file matrix.h.

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

Definition at line 1033 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 1036 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 1027 of file matrix.h.

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

Definition at line 1032 of file matrix.h.

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

Definition at line 1022 of file matrix.h.

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

Definition at line 1028 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 1034 of file matrix.h.

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

Definition at line 1039 of file matrix.h.

template<typename ValueType, unsigned BlockSideLength>
typedef shared_object_pointer<swappable_block_matrix_type> stxxl::matrix< ValueType, BlockSideLength >::swappable_block_matrix_pointer_type [protected]

Definition at line 1024 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 1023 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 1029 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:
heightheight of the created matrix
widthwidth of the created matrix

Definition at line 1053 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 1060 of file matrix.h.

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

Definition at line 1067 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 1080 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 1090 of file matrix.h.

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

Definition at line 1069 of file matrix.h.

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

Definition at line 1072 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:
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 1202 of file matrix.h.

References stxxl::swappable_block_matrix< ValueType, BlockSideLength >::bs, stxxl::matrix< ValueType, BlockSideLength >::data, stxxl::matrix< ValueType, BlockSideLength >::height, 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>
void stxxl::matrix< ValueType, BlockSideLength >::multiply_internal ( const matrix_type right,
matrix_type res 
) const [inline, protected]
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 1095 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 1098 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 1136 of file matrix.h.

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

Definition at line 1139 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 1162 of file matrix.h.

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

Definition at line 1165 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 1111 of file matrix.h.

References stxxl::div_ceil().

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

Definition at line 1104 of file matrix.h.

References std::swap().


Member Data Documentation

template<typename ValueType, unsigned BlockSideLength>
swappable_block_matrix_pointer_type stxxl::matrix< ValueType, BlockSideLength >::data [protected]
template<typename ValueType, unsigned BlockSideLength>
elem_size_type stxxl::matrix< ValueType, BlockSideLength >::height [protected]
template<typename ValueType, unsigned BlockSideLength>
elem_size_type stxxl::matrix< ValueType, BlockSideLength >::width [protected]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines