guanaqo 1.0.0-alpha.27
Utilities for scientific software
Loading...
Searching...
No Matches
IO & Printing

Detailed Description

CSV reading and matrix/array printing utilities.

Files

file  callback-streambuf.hpp
 Stream buffer and redirector for capturing ostream output.
file  csv.hpp
 Reading matrices and vectors from CSV files.
file  print.hpp
 Matrix/vector printing helpers and float formatting.

Classes

class  guanaqo::callback_streambuf
 An implementation of a std::streambuf that calls the given callback function with the characters that are written. More...
class  guanaqo::scoped_ostream_redirect
 Temporarily replaces the rdbuf of the given ostream. More...
struct  guanaqo::io::csv_read_error
class  guanaqo::PrintMatrixView< T >
struct  guanaqo::PrintOpts

Functions

template<class F>
void guanaqo::io::csv_read_row (std::istream &is, std::span< F > v, char sep)
template<class F, size_t E>
void guanaqo::io::csv_read_row (std::istream &is, std::span< F, E > v, char sep=',')
template<class F>
void guanaqo::io::csv_read (std::istream &is, MatrixView< F, ptrdiff_t, ptrdiff_t > v, char sep)
template<class F, class I, class S>
void guanaqo::io::csv_read (std::istream &is, MatrixView< F, I, S > M, char sep=',')
template<class F>
std::vector< F > guanaqo::io::csv_read_row_std_vector (std::istream &is, char sep)
template<std::floating_point F>
std::string_view guanaqo::float_to_str_vw (std::span< char > buf, F value, int precision=std::numeric_limits< F >::max_digits10)
template<std::floating_point F>
std::string guanaqo::float_to_str (F value, int precision)
template<class T, std::size_t E>
std::ostream & guanaqo::print_csv (std::ostream &os, std::span< T, E > x, PrintOpts opts={})
template<class T, class I, class S, StorageOrder O>
std::ostream & guanaqo::print_csv (std::ostream &os, MatrixView< T, I, S, O > X, PrintOpts opts={})
template<class T, std::size_t E>
std::ostream & guanaqo::print_matlab (std::ostream &os, std::span< T, E > x, std::string_view end=";\n")
template<class T, class I, class S, StorageOrder O>
std::ostream & guanaqo::print_matlab (std::ostream &os, MatrixView< T, I, S, O > X, std::string_view end=";\n")
template<class T, std::size_t E>
std::ostream & guanaqo::print_python (std::ostream &os, std::span< T, E > x, std::string_view end="\n", bool squeeze=true)
template<class T, class I, class S, StorageOrder O>
std::ostream & guanaqo::print_python (std::ostream &os, MatrixView< T, I, S, O > X, std::string_view end="\n", bool squeeze=true)

Class Documentation

◆ guanaqo::PrintOpts

struct guanaqo::PrintOpts
Collaboration diagram for guanaqo::PrintOpts:
Class Members
int precision = 0
string_view delimiter = ","
string_view line_start = {}
string_view line_end = "\n"
string_view start = {}
string_view end = "\n"
unsigned indent = 0
char indent_char = ' '
bool column_vector_as_1d = true
bool row_vector_as_1d = true

Function Documentation

◆ csv_read_row() [1/2]

template<class F>
void guanaqo::io::csv_read_row ( std::istream & is,
std::span< F > v,
char sep )

#include <guanaqo/implementation/io/csv.tpp>

Definition at line 157 of file csv.tpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csv_read_row() [2/2]

template<class F, size_t E>
void guanaqo::io::csv_read_row ( std::istream & is,
std::span< F, E > v,
char sep = ',' )

#include <guanaqo/io/csv.hpp>

Definition at line 32 of file csv.hpp.

Here is the call graph for this function:

◆ csv_read() [1/2]

template<class F>
void guanaqo::io::csv_read ( std::istream & is,
MatrixView< F, ptrdiff_t, ptrdiff_t > v,
char sep )

#include <guanaqo/implementation/io/csv.tpp>

Definition at line 167 of file csv.tpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csv_read() [2/2]

template<class F, class I, class S>
void guanaqo::io::csv_read ( std::istream & is,
MatrixView< F, I, S > M,
char sep = ',' )

#include <guanaqo/io/csv.hpp>

Definition at line 45 of file csv.hpp.

Here is the call graph for this function:

◆ csv_read_row_std_vector()

template<class F>
template std::vector< long double > guanaqo::io::csv_read_row_std_vector ( std::istream & is,
char sep )

#include <guanaqo/implementation/io/csv.tpp>

Definition at line 180 of file csv.tpp.

Here is the call graph for this function:

◆ float_to_str_vw()

template<std::floating_point F>
std::string_view guanaqo::float_to_str_vw ( std::span< char > buf,
F value,
int precision = std::numeric_limits<F>::max_digits10 )

#include <guanaqo/print.hpp>

Definition at line 77 of file print.cpp.

Here is the caller graph for this function:

◆ float_to_str()

template<std::floating_point F>
std::string guanaqo::float_to_str ( F value,
int precision )

#include <guanaqo/implementation/print.tpp>

Definition at line 15 of file print.tpp.

Here is the call graph for this function:

◆ print_csv() [1/2]

template<class T, std::size_t E>
std::ostream & guanaqo::print_csv ( std::ostream & os,
std::span< T, E > x,
PrintOpts opts = {} )

#include <guanaqo/print.hpp>

Definition at line 120 of file print.hpp.

◆ print_csv() [2/2]

template<class T, class I, class S, StorageOrder O>
std::ostream & guanaqo::print_csv ( std::ostream & os,
MatrixView< T, I, S, O > X,
PrintOpts opts = {} )

#include <guanaqo/print.hpp>

Definition at line 127 of file print.hpp.

◆ print_matlab() [1/2]

template<class T, std::size_t E>
std::ostream & guanaqo::print_matlab ( std::ostream & os,
std::span< T, E > x,
std::string_view end = ";\n" )

#include <guanaqo/print.hpp>

Definition at line 134 of file print.hpp.

Here is the call graph for this function:

◆ print_matlab() [2/2]

template<class T, class I, class S, StorageOrder O>
std::ostream & guanaqo::print_matlab ( std::ostream & os,
MatrixView< T, I, S, O > X,
std::string_view end = ";\n" )

#include <guanaqo/print.hpp>

Definition at line 141 of file print.hpp.

Here is the call graph for this function:

◆ print_python() [1/2]

template<class T, std::size_t E>
std::ostream & guanaqo::print_python ( std::ostream & os,
std::span< T, E > x,
std::string_view end = "\n",
bool squeeze = true )

#include <guanaqo/print.hpp>

Definition at line 148 of file print.hpp.

Here is the call graph for this function:

◆ print_python() [2/2]

template<class T, class I, class S, StorageOrder O>
std::ostream & guanaqo::print_python ( std::ostream & os,
MatrixView< T, I, S, O > X,
std::string_view end = "\n",
bool squeeze = true )

#include <guanaqo/print.hpp>

Definition at line 155 of file print.hpp.

Here is the call graph for this function: