OGS
EigenMatrix.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "EigenMatrix.h"
5
6#include <fstream>
7
8namespace MathLib
9{
10
12void EigenMatrix::write(const std::string& filename) const
13{
14 std::ofstream of(filename);
15 if (of)
16 {
17 write(of);
18 }
19}
20
22void EigenMatrix::write(std::ostream& os) const
23{
24 for (int k = 0; k < mat_.outerSize(); ++k)
25 {
26 for (RawMatrixType::InnerIterator it(mat_, k); it; ++it)
27 {
28 os << it.row() << " " << it.col() << " " << it.value() << "\n";
29 }
30 }
31 os << std::endl;
32}
33} // namespace MathLib
void write(const std::string &filename) const
printout this matrix for debugging
RawMatrixType mat_