Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
DenseMatrix/Morpheus_Print_Impl.hpp
1
24#ifndef MORPHEUS_DENSEMATRIX_PRINT_IMPL_HPP
25#define MORPHEUS_DENSEMATRIX_PRINT_IMPL_HPP
26
27#include <Morpheus_FormatTags.hpp>
28#include <impl/Morpheus_Utils.hpp>
29
30#include <iostream>
31#include <iomanip> // setw, setprecision
32
33namespace Morpheus {
34namespace Impl {
35
36template <typename Printable, typename Stream>
37void print(const Printable& p, Stream& s,
38 typename std::enable_if<
39 Morpheus::is_dense_matrix_format_container_v<Printable>>::type* =
40 nullptr) {
41 using size_type = typename Printable::size_type;
42 print_matrix_header(p, s);
43
44 for (size_type i = 0; i < p.nrows(); i++) {
45 for (size_type j = 0; j < p.ncols(); j++) {
46 s << " " << std::setw(14) << i;
47 s << " " << std::setw(14) << j;
48 s << " " << std::setprecision(12) << std::setw(12) << "(" << p(i, j)
49 << ")\n";
50 }
51 }
52}
53
54} // namespace Impl
55} // namespace Morpheus
56
57#endif // MORPHEUS_DENSEMATRIX_PRINT_IMPL_HPP
Generic Morpheus interfaces.
Definition: dummy.cpp:24