#pragma once #include #include #include #include #include #include #include namespace alpaqa { template ALPAQA_EXPORT std::string float_to_str(F value, int precision = std::numeric_limits::max_digits10); template ALPAQA_EXPORT std::ostream & print_csv_impl(std::ostream &os, const T &M, std::string_view sep = ",", std::string_view begin = "", std::string_view end = "\n"); template ALPAQA_EXPORT std::ostream &print_matlab_impl(std::ostream &os, const T &M, std::string_view end = ";\n"); template ALPAQA_EXPORT std::ostream &print_python_impl(std::ostream &os, const T &M, std::string_view end = "\n"); #define ALPAQA_PRINT_CSV_OVL_IMPL(type) \ inline std::ostream &print_csv( \ std::ostream &os, const Eigen::Ref> &M, \ std::string_view sep, std::string_view begin, std::string_view end) { \ return print_csv_impl(os, M, sep, begin, end); \ } \ inline std::ostream &print_csv( \ std::ostream &os, const Eigen::Ref> &M, \ std::string_view sep, std::string_view begin) { \ return print_csv_impl(os, M, sep, begin); \ } \ inline std::ostream &print_csv( \ std::ostream &os, const Eigen::Ref> &M, \ std::string_view sep) { \ return print_csv_impl(os, M, sep); \ } \ inline std::ostream &print_csv( \ std::ostream &os, const Eigen::Ref> &M) { \ return print_csv_impl(os, M); \ } #define ALPAQA_PRINT_OVL_IMPL(name, type) \ inline std::ostream &print_##name( \ std::ostream &os, const Eigen::Ref> &M, \ std::string_view end) { \ return print_##name##_impl(os, M, end); \ } \ inline std::ostream &print_##name( \ std::ostream &os, const Eigen::Ref> &M) { \ return print_##name##_impl(os, M); \ } #define ALPAQA_PRINT_OVL(type) \ ALPAQA_PRINT_CSV_OVL_IMPL(type) \ ALPAQA_PRINT_OVL_IMPL(matlab, type) \ ALPAQA_PRINT_OVL_IMPL(python, type) ALPAQA_PRINT_OVL(float) ALPAQA_PRINT_OVL(double) ALPAQA_PRINT_OVL(long double) #ifdef ALPAQA_WITH_QUAD_PRECISION ALPAQA_PRINT_OVL(__float128) #endif #undef ALPAQA_PRINT_OVL #undef ALPAQA_PRINT_OVL_IMPL #undef ALPAQA_PRINT_CSV_OVL_IMPL } // namespace alpaqa