alpaqa 1.0.0a19
Nonconvex constrained optimization
Loading...
Searching...
No Matches
csv.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <alpaqa/export.h>
5#include <concepts>
6#include <iosfwd>
7#include <stdexcept>
8#include <vector>
9
10namespace alpaqa::csv {
11
12struct ALPAQA_EXPORT read_error : std::runtime_error {
13 using std::runtime_error::runtime_error;
14};
15
16template <class F>
17 requires(std::floating_point<F> || std::integral<F>)
18void ALPAQA_EXPORT read_row_impl(std::istream &is,
19 Eigen::Ref<Eigen::VectorX<F>> v,
20 char sep = ',');
21
22template <class F>
23 requires(std::floating_point<F> || std::integral<F>)
24std::vector<F> ALPAQA_EXPORT read_row_std_vector(std::istream &is,
25 char sep = ',');
26
27#define ALPAQA_READ_ROW_OVL(type) \
28 inline void read_row(std::istream &is, Eigen::Ref<Eigen::VectorX<type>> v, \
29 char sep) { \
30 return read_row_impl<type>(is, v, sep); \
31 } \
32 inline void read_row(std::istream &is, \
33 Eigen::Ref<Eigen::VectorX<type>> v) { \
34 return read_row_impl<type>(is, v); \
35 }
36
41#ifdef ALPAQA_WITH_QUAD_PRECISION
43#endif
44
45#undef ALPAQA_READ_ROW_OVL
46
47#ifdef DOXYGEN
48/// Read one line of comma-separated values from @p is and write it to the
49/// vector @p v. Lines that start with a `#` are skipped.
50inline void read_row(std::istream &is, Eigen::Ref<Eigen::VectorX<type>> v,
51 char sep = ',');
52#endif
53
54} // namespace alpaqa::csv
#define ALPAQA_READ_ROW_OVL(type)
Definition csv.hpp:27
std::vector< F > read_row_std_vector(std::istream &is, char sep)
Definition csv.tpp:163
void read_row(std::istream &is, Eigen::Ref< Eigen::VectorX< Eigen::Index > > v, char sep)
Definition csv.hpp:37
void read_row_impl(std::istream &is, Eigen::Ref< Eigen::VectorX< F > > v, char sep)
Definition csv.tpp:152
constexpr const auto inf
Definition config.hpp:112