Skip to content
Snippets Groups Projects
Commit 0826f8bf authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[MaL] Use full precision for Eigen matrix output (fmt/spdlog)

parent 5874c268
No related branches found
No related tags found
No related merge requests found
/**
* \file
* \copyright
* Copyright (c) 2012-2024, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "FormattingUtils.h"
namespace MathLib
{
Eigen::IOFormat const EigenIOFormat::full_precision{
Eigen::FullPrecision, 0, " ", "\n", "", "", "", "", ' '};
} // namespace MathLib
......@@ -15,8 +15,21 @@
#include <Eigen/Core>
#include <concepts>
namespace MathLib
{
struct EigenIOFormat
{
static const Eigen::IOFormat full_precision;
};
} // namespace MathLib
template <typename T>
requires std::derived_from<T, Eigen::DenseBase<T>>
struct fmt::formatter<T> : fmt::ostream_formatter
{
auto format(T const& value, fmt::format_context& ctx) const
{
return fmt::ostream_formatter::format(
value.format(MathLib::EigenIOFormat::full_precision), ctx);
}
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment