Co-authored-by: Jules Pénuchot <jules@penuchot.com> Co-authored-by: Joel FALCOU <jfalcou@codereckons.com> See merge request oss/rotgen!41
35 lines
918 B
C++
35 lines
918 B
C++
//==================================================================================================
|
|
/*
|
|
ROTGEN - Runtime Overlay for Eigen
|
|
Copyright : CODE RECKONS
|
|
SPDX-License-Identifier: BSL-1.0
|
|
*/
|
|
//==================================================================================================
|
|
#pragma once
|
|
|
|
#include <rotgen/config.hpp>
|
|
#include <rotgen/concepts.hpp>
|
|
#include <Eigen/Core>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace rotgen
|
|
{
|
|
using ioformat = Eigen::IOFormat;
|
|
|
|
template<typename M> struct format
|
|
{
|
|
format(M const& m, ioformat const& f) : matrix_(m), format_(f) {}
|
|
|
|
M const& matrix_;
|
|
ioformat const& format_;
|
|
};
|
|
|
|
template<typename M>
|
|
std::ostream& operator<<(std::ostream& os, format<M> const& f)
|
|
{
|
|
if constexpr (concepts::eigen_compatible<M>)
|
|
return os << f.matrix_.format(f.format_);
|
|
else return os << f.matrix_.base().format(f.format_);
|
|
}
|
|
}
|