24#ifndef MORPHEUS_DIA_PRINT_IMPL_HPP
25#define MORPHEUS_DIA_PRINT_IMPL_HPP
27#include <Morpheus_FormatTags.hpp>
28#include <impl/Morpheus_Utils.hpp>
37template <
typename Pr
intable,
typename Stream>
38void print(
const Printable& p, Stream& s,
39 typename std::enable_if<
40 Morpheus::is_dia_matrix_format_container_v<Printable>>::type* =
42 using size_type =
typename Printable::size_type;
43 using index_type =
typename Printable::index_type;
44 using value_type =
typename Printable::value_type;
45 const size_type ndiag = p.cvalues().ncols();
47 print_matrix_header(p, s);
49 for (size_type i = 0; i < ndiag; i++) {
50 const index_type k = p.cdiagonal_offsets(i);
52 const size_type i_start = std::max<size_type>(0, -k);
53 const size_type j_start = std::max<size_type>(0, k);
56 const size_type N = std::min(p.nrows() - i_start, p.ncols() - j_start);
58 for (size_type n = 0; n < N; n++) {
59 value_type temp = p.cvalues(i_start + n, i);
60 if (temp != value_type(0)) {
61 s <<
" " << std::setw(14) << i;
62 s <<
" " << std::setw(14) << i_start + n;
63 s <<
" " << std::setw(14) << j_start + n;
64 s <<
" " << std::setprecision(4) << std::setw(8) <<
"(" << temp
Generic Morpheus interfaces.
Definition: dummy.cpp:24