13 #ifndef STXXL_CONTAINERS_MATRIX_HEADER
14 #define STXXL_CONTAINERS_MATRIX_HEADER
43 template <
typename ValueType,
unsigned BlockS
ideLength>
48 template <
typename ValueType>
55 using vector_type::size;
63 assert(size() == right.
size());
66 res[i] = (*
this)[i] + right[i];
72 assert(size() == right.
size());
75 res[i] = (*
this)[i] - right[i];
83 res[i] = (*
this)[i] * scalar;
89 assert(size() == right.
size());
91 (*
this)[i] += right[i];
97 assert(size() == right.
size());
99 (*
this)[i] -= right[i];
106 (*
this)[i] *= scalar;
119 template <
typename ValueType>
126 using vector_type::size;
134 assert(size() == right.
size());
137 res[i] = (*
this)[i] + right[i];
143 assert(size() == right.
size());
146 res[i] = (*
this)[i] - right[i];
154 res[i] = (*
this)[i] * scalar;
158 template <
unsigned BlockS
ideLength>
166 res += (*
this)[i] * right[i];
172 assert(size() == right.
size());
174 (*
this)[i] += right[i];
180 assert(size() == right.
size());
182 (*
this)[i] -= right[i];
189 (*
this)[i] *= scalar;
205 template <
typename ValueType,
unsigned BlockS
ideLength>
218 #pragma omp parallel for
221 for (int_type col = 0; col <
int_type(BlockSideLength); ++col)
222 data[row * BlockSideLength + col] = 0;
231 template <
typename ValueType,
unsigned BlockS
ideLength>
254 height_from_supermatrix,
264 {
return blocks[row * width + col]; }
270 height(height_in_blocks),
271 width(width_in_blocks),
272 height_from_supermatrix(0),
273 width_from_supermatrix(0),
274 blocks(height * width),
275 elements_in_blocks_transposed(transposed)
277 for (
size_type row = 0; row < height; ++row)
278 for (
size_type col = 0; col < width; ++col)
290 : bs(supermatrix.bs),
291 height(height_in_blocks),
292 width(width_in_blocks),
293 height_from_supermatrix(std::
min(supermatrix.height - from_row_in_blocks, height)),
294 width_from_supermatrix(std::
min(supermatrix.width - from_col_in_blocks, width)),
295 blocks(height * width),
296 elements_in_blocks_transposed(supermatrix.elements_in_blocks_transposed)
298 for (
size_type row = 0; row < height_from_supermatrix; ++row)
300 for (
size_type col = 0; col < width_from_supermatrix; ++col)
301 bl(row, col) = supermatrix.
block(row + from_row_in_blocks, col + from_col_in_blocks);
302 for (
size_type col = width_from_supermatrix; col < width; ++col)
303 bl(row, col) = bs.allocate_swappable_block();
305 for (
size_type row = height_from_supermatrix; row < height; ++row)
306 for (
size_type col = 0; col < width; ++col)
307 bl(row, col) = bs.allocate_swappable_block();
317 height(ul.height + dl.height),
318 width(ul.width + ur.width),
319 height_from_supermatrix(height),
320 width_from_supermatrix(width),
321 blocks(height * width),
322 elements_in_blocks_transposed(ul.elements_in_blocks_transposed)
327 bl(row, col) = ul.
block(row, col);
343 height(other.height),
345 height_from_supermatrix(0),
346 width_from_supermatrix(0),
347 blocks(height * width),
348 elements_in_blocks_transposed(false)
350 for (
size_type row = 0; row < height; ++row)
351 for (
size_type col = 0; col < width; ++col)
352 bl(row, col) = bs.allocate_swappable_block();
359 for (
size_type row = 0; row < height_from_supermatrix; ++row)
361 for (
size_type col = width_from_supermatrix; col < width; ++col)
362 bs.free_swappable_block(bl(row, col));
364 for (
size_type row = height_from_supermatrix; row < height; ++row)
365 for (
size_type col = 0; col < width; ++col)
366 bs.free_swappable_block(bl(row, col));
370 {
return index / BlockSideLength; }
373 {
return index % BlockSideLength; }
378 return (is_transposed())
379 ? row % BlockSideLength + col % BlockSideLength * BlockSideLength
380 : row % BlockSideLength * BlockSideLength + col % BlockSideLength;
385 {
return blocks[row * width + col]; }
389 {
return block(row, col); }
399 {
return elements_in_blocks_transposed; }
405 for (
size_type row = 0; row < height; ++row)
406 for (
size_type col = 0; col < width; ++col)
407 bn[col * height + row] = bl(row, col);
410 std::swap(height, width);
411 std::swap(height_from_supermatrix, width_from_supermatrix);
412 elements_in_blocks_transposed = ! elements_in_blocks_transposed;
417 for (
typename blocks_type::iterator it = blocks.begin(); it != blocks.end(); ++it)
418 bs.deinitialize(*it);
425 template <
typename ValueType,
unsigned BlockS
ideLength>
436 template <
typename VT,
unsigned BSL>
439 template <
typename VT,
unsigned BSL>
451 if (! current_iblock)
452 current_iblock = &m->data->bs.acquire(m->data->block(current_block_row, current_block_col));
459 m->data->bs.release(m->data->block(current_block_row, current_block_col),
true);
467 current_row(start_row),
468 current_col(start_col),
469 current_block_row(m->data->block_index_from_elem(start_row)),
470 current_block_col(m->data->block_index_from_elem(start_col)),
471 current_iblock(0) { }
478 current_block_row(-1),
479 current_block_col(-1),
480 current_iblock(0) { }
484 release_current_iblock();
487 current_block_row = -1;
488 current_block_col = -1;
494 current_row(other.current_row),
495 current_col(other.current_col),
496 current_block_row(other.current_block_row),
497 current_block_col(other.current_block_col),
501 acquire_current_iblock();
509 acquire_current_iblock();
514 { release_current_iblock(); }
518 const block_size_type new_block_row = m->data->block_index_from_elem(new_row);
519 if (new_block_row != current_block_row)
521 release_current_iblock();
522 current_block_row = new_block_row;
524 current_row = new_row;
529 const block_size_type new_block_col = m->data->block_index_from_elem(new_col);
530 if (new_block_col != current_block_col)
532 release_current_iblock();
533 current_block_col = new_block_col;
535 current_col = new_col;
540 const block_size_type new_block_row = m->data->block_index_from_elem(new_row),
541 new_block_col = m->data->block_index_from_elem(new_col);
542 if (new_block_col != current_block_col || new_block_row != current_block_row)
544 release_current_iblock();
545 current_block_row = new_block_row;
546 current_block_col = new_block_col;
548 current_row = new_row;
549 current_col = new_col;
552 void set_pos(
const std::pair<elem_size_type, elem_size_type> new_pos)
553 { set_pos(new_pos.first, new_pos.second); }
556 {
return current_row; }
559 {
return current_col; }
561 std::pair<elem_size_type, elem_size_type>
get_pos()
const
562 {
return std::make_pair(current_row, current_col); }
565 {
return current_row == -1 && current_col == -1; }
567 operator bool ()
const
568 {
return ! empty(); }
577 ValueType& operator * ()
579 acquire_current_iblock();
580 return (*current_iblock)[m->data->elem_index_in_block_from_elem(current_row, current_col)];
587 template <
typename ValueType,
unsigned BlockS
ideLength>
595 template <
typename VT,
unsigned BSL>
598 using matrix_iterator_type::m;
599 using matrix_iterator_type::set_empty;
617 if (get_col() + 1 < m->get_width())
619 set_col(get_col() + 1);
620 else if (get_row() + 1 < m->get_height())
622 set_pos(get_row() + 1, 0);
632 if (get_col() - 1 >= 0)
634 set_col(get_col() - 1);
635 else if (get_row() - 1 >= 0)
637 set_pos(get_row() - 1, m->get_width() - 1);
644 using matrix_iterator_type::get_row;
645 using matrix_iterator_type::get_col;
646 using matrix_iterator_type::set_col;
647 using matrix_iterator_type::set_pos;
653 template <
typename ValueType,
unsigned BlockS
ideLength>
661 template <
typename VT,
unsigned BSL>
664 using matrix_iterator_type::m;
665 using matrix_iterator_type::set_empty;
683 if (get_row() + 1 < m->get_height())
685 set_row(get_row() + 1);
686 else if (get_col() + 1 < m->get_width())
688 set_pos(0, get_col() + 1);
698 if (get_row() - 1 >= 0)
700 set_row(get_row() - 1);
701 else if (get_col() - 1 >= 0)
703 set_pos(m->get_height() - 1, get_col() - 1);
710 using matrix_iterator_type::get_row;
711 using matrix_iterator_type::get_col;
712 using matrix_iterator_type::set_row;
713 using matrix_iterator_type::set_pos;
719 template <
typename ValueType,
unsigned BlockS
ideLength>
730 template <
typename VT,
unsigned BSL>
742 if (! current_iblock)
743 current_iblock = &m->data->bs.acquire(m->data->block(current_block_row, current_block_col));
750 m->data->bs.release(m->data->block(current_block_row, current_block_col),
false);
758 current_row(start_row),
759 current_col(start_col),
760 current_block_row(m->data->block_index_from_elem(start_row)),
761 current_block_col(m->data->block_index_from_elem(start_col)),
762 current_iblock(0) { }
769 current_block_row(-1),
770 current_block_col(-1),
771 current_iblock(0) { }
775 release_current_iblock();
778 current_block_row = -1;
779 current_block_col = -1;
785 current_row(other.current_row),
786 current_col(other.current_col),
787 current_block_row(other.current_block_row),
788 current_block_col(other.current_block_col),
792 acquire_current_iblock();
797 current_row(other.current_row),
798 current_col(other.current_col),
799 current_block_row(other.current_block_row),
800 current_block_col(other.current_block_col),
804 acquire_current_iblock();
812 acquire_current_iblock();
817 { release_current_iblock(); }
821 const block_size_type new_block_row = m->data->block_index_from_elem(new_row);
822 if (new_block_row != current_block_row)
824 release_current_iblock();
825 current_block_row = new_block_row;
827 current_row = new_row;
832 const block_size_type new_block_col = m->data->block_index_from_elem(new_col);
833 if (new_block_col != current_block_col)
835 release_current_iblock();
836 current_block_col = new_block_col;
838 current_col = new_col;
843 const block_size_type new_block_row = m->data->block_index_from_elem(new_row),
844 new_block_col = m->data->block_index_from_elem(new_col);
845 if (new_block_col != current_block_col || new_block_row != current_block_row)
847 release_current_iblock();
848 current_block_row = new_block_row;
849 current_block_col = new_block_col;
851 current_row = new_row;
852 current_col = new_col;
855 void set_pos(
const std::pair<elem_size_type, elem_size_type> new_pos)
856 { set_pos(new_pos.first, new_pos.second); }
859 {
return current_row; }
862 {
return current_col; }
864 std::pair<elem_size_type, elem_size_type>
get_pos()
const
865 {
return std::make_pair(current_row, current_col); }
868 {
return current_row == -1 && current_col == -1; }
870 operator bool ()
const
871 {
return ! empty(); }
880 const ValueType& operator * ()
882 acquire_current_iblock();
883 return (*current_iblock)[m->data->elem_index_in_block_from_elem(current_row, current_col)];
890 template <
typename ValueType,
unsigned BlockS
ideLength>
898 template <
typename VT,
unsigned BSL>
901 using const_matrix_iterator_type::m;
902 using const_matrix_iterator_type::set_empty;
924 if (get_col() + 1 < m->get_width())
926 set_col(get_col() + 1);
927 else if (get_row() + 1 < m->get_height())
929 set_pos(get_row() + 1, 0);
939 if (get_col() - 1 >= 0)
941 set_col(get_col() - 1);
942 else if (get_row() - 1 >= 0)
944 set_pos(get_row() - 1, m->get_width() - 1);
951 using const_matrix_iterator_type::get_row;
952 using const_matrix_iterator_type::get_col;
953 using const_matrix_iterator_type::set_col;
954 using const_matrix_iterator_type::set_pos;
960 template <
typename ValueType,
unsigned BlockS
ideLength>
968 template <
typename VT,
unsigned BSL>
971 using const_matrix_iterator_type::m;
972 using const_matrix_iterator_type::set_empty;
994 if (get_row() + 1 < m->get_height())
996 set_row(get_row() + 1);
997 else if (get_col() + 1 < m->get_width())
999 set_pos(0, get_col() + 1);
1009 if (get_row() - 1 >= 0)
1011 set_row(get_row() - 1);
1012 else if (get_col() - 1 >= 0)
1014 set_pos(m->get_height() - 1, get_col() - 1);
1021 using const_matrix_iterator_type::get_row;
1022 using const_matrix_iterator_type::get_col;
1023 using const_matrix_iterator_type::set_row;
1024 using const_matrix_iterator_type::set_pos;
1037 template <
typename ValueType,
unsigned BlockS
ideLength>
1061 template <
typename VT,
unsigned BSL>
1064 template <
typename VT,
unsigned BSL>
1101 { Ops::recursive_matrix_from_vectors(*data, left, right); }
1151 std::swap(height, width);
1160 (data->bs,
div_ceil(height, BlockSideLength),
div_ceil(width, BlockSideLength));
1168 assert(height == right.
height && width == right.
width);
1176 assert(height == right.
height && width == right.
width);
1183 {
return multiply(right); }
1194 assert(height == right.
height && width == right.
width);
1202 assert(height == right.
height && width == right.
width);
1209 {
return *
this = operator * (right); }
1223 Ops::recursive_matrix_col_vector_multiply_and_add(*data, right, res);
1232 Ops::recursive_matrix_row_vector_multiply_and_add(left, *data, res);
1251 assert(width == right.
height);
1252 assert(&data->bs == &right.
data->
bs);
1255 if (scheduling_algorithm > 0)
1258 delete data->bs.switch_algorithm_to(
1261 switch (multiplication_algorithm)
1264 Ops::naive_multiply_and_add(*data, *right.
data, *res.
data);
1267 Ops::recursive_multiply_and_add(*data, *right.
data, *res.
data);
1270 Ops::strassen_winograd_multiply_and_add(*data, *right.
data, *res.
data);
1273 Ops::multi_level_strassen_winograd_multiply_and_add(*data, *right.
data, *res.
data);
1276 Ops::strassen_winograd_multiply(*data, *right.
data, *res.
data);
1279 Ops::strassen_winograd_multiply_and_add_interleaved(*data, *right.
data, *res.
data);
1282 Ops::multi_level_strassen_winograd_multiply_and_add_block_grained(*data, *right.
data, *res.
data);
1285 STXXL_ERRMSG(
"invalid multiplication-algorithm number");
1289 switch (scheduling_algorithm)
1292 delete data->bs.switch_algorithm_to(
1297 delete data->bs.switch_algorithm_to(
1302 delete data->bs.switch_algorithm_to(
1309 switch (multiplication_algorithm)
1312 Ops::naive_multiply_and_add(*data, *right.
data, *res.
data);
1315 Ops::recursive_multiply_and_add(*data, *right.
data, *res.
data);
1318 Ops::strassen_winograd_multiply_and_add(*data, *right.
data, *res.
data);
1321 Ops::multi_level_strassen_winograd_multiply_and_add(*data, *right.
data, *res.
data);
1324 Ops::strassen_winograd_multiply(*data, *right.
data, *res.
data);
1327 Ops::strassen_winograd_multiply_and_add_interleaved(*data, *right.
data, *res.
data);
1330 Ops::multi_level_strassen_winograd_multiply_and_add_block_grained(*data, *right.
data, *res.
data);
1333 STXXL_ERRMSG(
"invalid multiplication-algorithm number");
1336 delete data->bs.switch_algorithm_to(
1345 assert(width == right.
height);
1346 assert(&data->bs == &right.
data->
bs);
1349 if (scheduling_algorithm > 0)
1352 delete data->bs.switch_algorithm_to(
1355 multiply_internal(right, res);
1357 switch (scheduling_algorithm)
1360 delete data->bs.switch_algorithm_to(
1365 delete data->bs.switch_algorithm_to(
1370 delete data->bs.switch_algorithm_to(
1377 multiply_internal(right, res);
1378 delete data->bs.switch_algorithm_to(
1388 ValueType* A =
new ValueType[height * width];
1389 ValueType* B =
new ValueType[right.
height * right.
width];
1390 ValueType* C =
new ValueType[res.
height * res.
width];
1401 gemm_wrapper(height, width, res.
width,
1402 ValueType(1),
false, A,
1404 ValueType(0),
false, C);
1422 #endif // !STXXL_CONTAINERS_MATRIX_HEADER
matrix_col_major_iterator(const matrix_iterator_type &matrix_iterator)
convert from matrix_iterator
row-major const_iterator that points to single elements inside a matrix
const_matrix_col_major_iterator(const matrix_iterator< ValueType, BlockSideLength > &matrix_iterator)
convert from matrix_iterator
elem_size_type current_col
const_matrix_col_major_iterator< ValueType, BlockSideLength > const_col_major_iterator
void set_pos(const std::pair< elem_size_type, elem_size_type > new_pos)
const elem_size_type & get_col() const
const_iterator cend() const
block_size_type current_block_row
compat::remove_const< Integral >::type div_ceil(Integral n, Integral2 d)
swappable_block_matrix(const swappable_block_matrix &other)
void acquire_current_iblock()
matrix_iterator(matrix_type &matrix, const elem_size_type start_row, const elem_size_type start_col)
create iterator pointing to given row and col
std::pair< elem_size_type, elem_size_type > get_pos() const
general const_iterator type that points to single elements inside a matrix
void set_col(const elem_size_type new_col)
block_scheduler_type & bs
void set_row(const elem_size_type new_row)
external column-vector container for matrix multiplication
column_vector< ValueType > column_vector_type
vector_type::size_type size_type
SwappableBlockType::internal_block_type internal_block_type
swappable_block< ValueType, BlockSideLength *BlockSideLength >::internal_block_type internal_block_type
matrix_iterator_type::elem_size_type elem_size_type
const elem_size_type & get_width() const
matrix_col_major_iterator< ValueType, BlockSideLength > col_major_iterator
elem_size_type current_row
matrix_type::swappable_block_matrix_type swappable_block_matrix_type
general iterator type that points to single elements inside a matrix
const elem_size_type & get_col() const
swappable_block_matrix_type::block_scheduler_type block_scheduler_type
matrix_iterator_type::elem_size_type elem_size_type
External container for a (sub)matrix. Not intended for direct use.
Provides reference counting abilities for use with counting_ptr with mutex locking.
static uint_pair min()
return an uint_pair instance containing the smallest value possible
const_matrix_col_major_iterator(const matrix_type &matrix, const elem_size_type start_row, const elem_size_type start_col)
create iterator pointing to given row and col
elem_size_type current_row
matrix_type::swappable_block_matrix_type swappable_block_matrix_type
matrix_type::elem_size_type elem_size_type
size_type size() const
return the size of the vector.
blocks_type blocks
the matrice's blocks in row-major
const swappable_block_identifier_type & block(const size_type row, const size_type col) const
get identifier of the block at (row, col)
const_matrix_iterator< ValueType, BlockSideLength > const_iterator
External vector container. Introduction to vector container: see STXXL Vector tutorial. Design and Internals of vector container: see Vector.
Virtualization of a block of data. Holds information for allocating and swapping. To use in cooperati...
const_matrix_row_major_iterator(const matrix_type &matrix, const elem_size_type start_row, const elem_size_type start_col)
create iterator pointing to given row and col
matrix_row_major_iterator(matrix_type &matrix, const elem_size_type start_row, const elem_size_type start_col)
create iterator pointing to given row and col
const size_type & get_height() const
bool is_simulating() const
Returns if simulation mode is on, i.e. if a prediction sequence is being recorded.
matrix_row_major_iterator(const matrix_iterator_type &matrix_iterator)
convert from matrix_iterator
matrix_row_major_iterator(matrix_type &matrix)
create empty iterator
Block scheduling algorithm caching via the least recently used policy (offline), and prefetching in a...
uint_pair & operator++()
prefix increment operator (directly manipulates the integer parts)
const_matrix_col_major_iterator(const const_matrix_iterator_type &matrix_iterator)
convert from matrix_iterator
matrix_local::matrix_operations< ValueType, BlockSideLength > Ops
static size_type block_index_from_elem(elem_size_type index)
void release_current_iblock()
void set_row(const elem_size_type new_row)
row_vector< ValueType > row_vector_type
const_matrix_iterator(const matrix_iterator< ValueType, BlockSideLength > &other)
Block scheduling algorithm caching via the least recently used policy (online).
block_scheduler< matrix_swappable_block< ValueType, BlockSideLength > > block_scheduler_type
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.
const bool & is_transposed() const
if the elements inside the blocks are in transposed order i.e. column-major
block_scheduler_type::swappable_block_identifier_type swappable_block_identifier_type
const_matrix_iterator< ValueType, BlockSideLength > const_matrix_iterator_type
matrix_iterator< ValueType, BlockSideLength > iterator
column-major const_iterator that points to single elements inside a matrix
uint_pair & operator+=(const uint_pair &b)
addition operator (uses 64-bit arithmetic)
matrix_col_major_iterator(matrix_type &matrix, const elem_size_type start_row, const elem_size_type start_col)
create iterator pointing to given row and col
const_matrix_iterator(const const_matrix_iterator &other)
swappable_block_identifier_type & bl(const size_type row, const size_type col)
get identifier of the block at (row, col)
vector< ValueType > vector_type
~swappable_block_matrix()
counting_ptr< swappable_block_matrix_type > swappable_block_matrix_pointer_type
swappable_block_matrix_pointer_type data
External matrix container. Introduction to matrix container: see STXXL Matrix tutorial. Design and Internals of matrix container: see Matrix.
matrix_row_major_iterator< ValueType, BlockSideLength > row_major_iterator
const_matrix_iterator(const matrix_type &matrix, const elem_size_type start_row, const elem_size_type start_col)
create iterator pointing to given row and col
swappable_block_matrix(block_scheduler_type &bs, const size_type height_in_blocks, const size_type width_in_blocks, const bool transposed=false)
Create an empty swappable_block_matrix of given dimensions.
choose_int_types< my_pointer_size >::int_type int_type
const elem_size_type & get_height() const
block_size_type current_block_row
size_type height
height of the matrix in blocks
matrix(block_scheduler_type &bs, const column_vector_type &left, const row_vector_type &right)
swappable_block_matrix(const swappable_block_matrix &ul, const swappable_block_matrix &ur, const swappable_block_matrix &dl, const swappable_block_matrix &dr)
Create swappable_block_matrix that represents the combination matrix ul ur dl dr. ...
matrix_local::matrix_operations< ValueType, BlockSideLength > Ops
block_scheduler_type::internal_block_type internal_block_type
matrix_iterator_type::matrix_type matrix_type
const_matrix_row_major_iterator(const const_matrix_row_major_iterator &matrix_iterator)
convert from matrix_iterator
swappable_block_identifier_type allocate_swappable_block()
Allocate an uninitialized swappable_block.
matrix< ValueType, BlockSideLength > matrix_type
const size_type & get_width() const
Pseudo block scheduling algorithm only recording the request sequence.
#define STXXL_BEGIN_NAMESPACE
std::vector< SwappableBlockType >::size_type swappable_block_identifier_type
block_scheduler_type::internal_block_type internal_block_type
uint_pair & operator--()
prefix decrement operator (directly manipulates the integer parts)
static int_type elem_index_in_block_from_elem(elem_size_type index)
matrix_type::block_size_type block_size_type
matrix_type::block_size_type block_size_type
vector_type::size_type size_type
column-major iterator that points to single elements inside a matrix
matrix_type::block_scheduler_type block_scheduler_type
matrix_iterator< ValueType, BlockSideLength > matrix_iterator_type
External vector iterator, model of ext_random_access_iterator concept.
const_matrix_iterator_type::elem_size_type elem_size_type
void set_pos(const elem_size_type new_row, const elem_size_type new_col)
const_matrix_iterator(const matrix_type &matrix)
create empty iterator
const_matrix_iterator< ValueType, BlockSideLength > const_matrix_iterator_type
const_matrix_iterator_type::matrix_type matrix_type
vector< ValueType > vector_type
const_iterator end() const
size_type width
width of the matrix in blocks
size_type width_from_supermatrix
width copied from supermatrix in blocks
matrix_iterator_type::matrix_type matrix_type
row_vector_type multiply_from_left(const row_vector_type &left) const
int_type elem_index_in_block_from_elem(elem_size_type row, elem_size_type col) const
column_vector(size_type n=0)
Block scheduling algorithm caching via the longest forward distance policy (offline).
matrix_iterator< ValueType, BlockSideLength > matrix_iterator_type
matrix_swappable_block< ValueType, BlockSideLength > swappable_block_type
const_matrix_row_major_iterator< ValueType, BlockSideLength > const_row_major_iterator
void set_pos(const std::pair< elem_size_type, elem_size_type > new_pos)
matrix_type::elem_size_type elem_size_type
bool elements_in_blocks_transposed
if the elements in each block are in col-major instead of row-major
internal_block_type * current_iblock
matrix_type::block_scheduler_type block_scheduler_type
matrix< ValueType, BlockSideLength > matrix_type
void set_col(const elem_size_type new_col)
void multiply_internal(const matrix_type &right, matrix_type &res) const
SizeType size_type
an unsigned 64-bit integral type
std::vector< swappable_block_identifier_type > blocks_type
const_matrix_row_major_iterator(const const_matrix_iterator_type &matrix_iterator)
convert from matrix_iterator
internal_block_type * current_iblock
external row-vector container for matrix multiplication
matrix_type multiply(const matrix_type &right, const int_type multiplication_algorithm=1, const int_type scheduling_algorithm=2) const
multiply with another matrix
Schedules swapping of blocks and provides blocks for temporary storage.
row-major iterator that points to single elements inside a matrix
const elem_size_type & get_row() const
matrix_iterator(matrix_type &matrix)
create empty iterator
matrix< ValueType, BlockSideLength > matrix_type
Specialized swappable_block that interprets uninitialized as containing zeros.
const_iterator begin() const
void acquire_current_iblock()
const elem_size_type & get_row() const
const_matrix_row_major_iterator(const matrix_type &matrix)
create empty iterator
swappable_block_matrix(const swappable_block_matrix &supermatrix, const size_type height_in_blocks, const size_type width_in_blocks, const size_type from_row_in_blocks, const size_type from_col_in_blocks)
Create swappable_block_matrix of given dimensions that represents the submatrix of supermatrix starti...
const_matrix_iterator_type::elem_size_type elem_size_type
elem_size_type current_col
const_matrix_col_major_iterator(const matrix_type &matrix)
create empty iterator
void release_current_iblock()
matrix_col_major_iterator(matrix_type &matrix)
create empty iterator
swappable_block_matrix< ValueType, BlockSideLength > swappable_block_matrix_type
swappable_block_matrix_type::size_type block_size_type
const_matrix_iterator_type::matrix_type matrix_type
row_vector(size_type n=0)
std::pair< elem_size_type, elem_size_type > get_pos() const
swappable_block_matrix_type::elem_size_type elem_size_type
bool operator==(const uint_pair &b) const
equality checking operator
matrix_iterator(const matrix_iterator &other)
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.
#define STXXL_END_NAMESPACE
void set_pos(const elem_size_type new_row, const elem_size_type new_col)
const_iterator cbegin() const