16 #ifndef dealii_block_sparse_matrix_ez_h
17 #define dealii_block_sparse_matrix_ez_h
39 template <
typename Number>
60 template <
typename Number>
79 const unsigned int block_cols);
135 block(
const unsigned int row,
const unsigned int column);
143 block(
const unsigned int row,
const unsigned int column)
const;
205 template <
typename somenumber>
214 template <
typename somenumber>
223 template <
typename somenumber>
233 template <
typename somenumber>
244 template <
class StreamType>
271 template <
typename Number>
275 return row_indices.size();
280 template <
typename Number>
284 return column_indices.size();
289 template <
typename Number>
292 const unsigned int column)
297 return blocks[row][column];
302 template <
typename Number>
305 const unsigned int column)
const
310 return blocks[row][column];
315 template <
typename Number>
319 return row_indices.total_size();
324 template <
typename Number>
328 return column_indices.total_size();
333 template <
typename Number>
341 const std::pair<size_type, size_type> row_index =
342 row_indices.global_to_local(i),
344 column_indices.global_to_local(j);
345 block(row_index.first, col_index.first)
346 .set(row_index.second, col_index.second,
value);
351 template <
typename Number>
359 const std::pair<unsigned int, size_type> row_index =
360 row_indices.global_to_local(i),
362 column_indices.global_to_local(j);
363 block(row_index.first, col_index.first)
364 .add(row_index.second, col_index.second,
value);
368 template <
typename Number>
369 template <
typename somenumber>
381 for (
unsigned int row = 0; row < n_block_rows(); ++row)
382 for (
unsigned int col = 0; col < n_block_cols(); ++col)
383 block(row, col).vmult_add(dst.
block(row), src.
block(col));
388 template <
typename Number>
389 template <
typename somenumber>
399 for (
unsigned int row = 0; row < n_block_rows(); ++row)
400 for (
unsigned int col = 0; col < n_block_cols(); ++col)
401 block(row, col).vmult_add(dst.
block(row), src.
block(col));
406 template <
typename Number>
407 template <
typename somenumber>
419 for (
unsigned int row = 0; row < n_block_rows(); ++row)
420 for (
unsigned int col = 0; col < n_block_cols(); ++col)
421 block(row, col).Tvmult_add(dst.
block(col), src.
block(row));
426 template <
typename Number>
427 template <
typename somenumber>
438 for (
unsigned int row = 0; row < n_block_rows(); ++row)
439 for (
unsigned int col = 0; col < n_block_cols(); ++col)
440 block(row, col).Tvmult_add(dst.
block(col), src.
block(row));
444 template <
typename number>
445 template <
class StreamType>
452 std::vector<size_type> used_by_line_total;
457 std::vector<size_type> used_by_line;
459 for (
size_type i = 0; i < n_block_rows(); ++i)
460 for (
size_type j = 0; j < n_block_cols(); ++j)
462 used_by_line.clear();
463 out <<
"block:\t" << i <<
'\t' << j << std::endl;
464 block(i, j).compute_statistics(
465 used, allocated, reserved, used_by_line, full);
467 out <<
"used:" << used << std::endl
468 <<
"allocated:" << allocated << std::endl
469 <<
"reserved:" << reserved << std::endl;
472 allocated_total += allocated;
473 reserved_total += reserved;
477 used_by_line_total.resize(used_by_line.size());
478 for (
size_type i = 0; i < used_by_line.size(); ++i)
479 if (used_by_line[i] != 0)
481 out <<
"row-entries\t" << i <<
"\trows\t" << used_by_line[i]
483 used_by_line_total[i] += used_by_line[i];
487 out <<
"Total" << std::endl
488 <<
"used:" << used_total << std::endl
489 <<
"allocated:" << allocated_total << std::endl
490 <<
"reserved:" << reserved_total << std::endl;
491 for (
size_type i = 0; i < used_by_line_total.size(); ++i)
492 if (used_by_line_total[i] != 0)
494 out <<
"row-entries\t" << i <<
"\trows\t" << used_by_line_total[i]
502 #endif // dealii_block_sparse_matrix_ez_h