Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.41 KB

xio.rst

File metadata and controls

60 lines (39 loc) · 1.41 KB

xio: pretty printing

Defined in xtensor/xio.hpp

This file defines functions for pretty printing xexpressions. It defines appropriate overloads for the << operator for std::ostreams and xexpressions.

#include <xtensor/xio.hpp>
#include <xtensor/xarray.hpp>

int main()
{
    xt::xarray<double> a = {{1,2,3}, {4,5,6}};
    std::cout << a << std::endl;
    return 0;
}

Will print

{{ 1., 2., 3.},
 { 4., 5., 6.}}

With the following functions, the global print options can be set:

.. doxygenfunction:: xt::print_options::set_line_width
   :project: xtensor

.. doxygenfunction:: xt::print_options::set_threshold
   :project: xtensor

.. doxygenfunction:: xt::print_options::set_edge_items
   :project: xtensor

.. doxygenfunction:: xt::print_options::set_precision
   :project: xtensor

On can also locally overwrite the print options with io manipulators:

.. doxygenclass:: xt::print_options::line_width
   :project: xtensor

.. doxygenclass:: xt::print_options::threshold
   :project: xtensor

.. doxygenclass:: xt::print_options::edge_items
   :project: xtensor

.. doxygenclass:: xt::print_options::precision
   :project: xtensor