@@ -33,33 +33,6 @@ namespace TiledArray {
3333
3434namespace detail {
3535
36- class NumberRounder {
37- public:
38- NumberRounder (int precision) noexcept : precision_{precision} {}
39-
40- [[nodiscard]] auto round (std::floating_point auto val) const noexcept {
41- return std::abs (val) <
42- (0.5 * std::pow (static_cast <decltype (val)>(10 ), -precision_))
43- ? 0
44- : val;
45- }
46-
47- template <typename T>
48- requires detail::is_complex_v<T> && std::floating_point<typename T::value_type>
49- [[nodiscard]] auto round (T const & val) const noexcept {
50- using std::imag;
51- using std::real;
52- return T{round (real (val)), round (imag (val))};
53- }
54-
55- template <typename T>
56- requires (!(std::floating_point<T> || detail::is_complex_v<T>))
57- [[nodiscard]] auto round (T const & val) const noexcept { return val; }
58-
59- private:
60- int precision_;
61- };
62-
6336// Class to print n-dimensional arrays in NumPy style but with curly braces
6437template <typename T, typename Index, typename Char, typename CharTraits>
6538void NDArrayPrinter::printArray (const T* data, const std::size_t order,
@@ -75,11 +48,9 @@ void NDArrayPrinter::printArray(const T* data, const std::size_t order,
7548 os << std::basic_string<Char, CharTraits>(extra_indentation, ' ' );
7649 os << " {" ;
7750
78- auto rounder = NumberRounder{precision};
79-
8051 for (size_t i = 0 ; i < extents[level]; ++i) {
8152 if (level == order - 1 ) {
82- auto value = rounder. round (data[offset + i * strides[level]]);
53+ auto value = truncate_ (data[offset + i * strides[level]]);
8354 // At the deepest level, print the actual values
8455 os << std::fixed << std::setprecision (precision) << std::setw (width) << std::setfill (Char (' ' )) << value;
8556 if (i < extents[level] - 1 ) {
0 commit comments