opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
series.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <string>
7#include <tuple>
8#include <vector>
9
10namespace opyn
11{
13 class Series final {
14 public:
15 using value_type = double;
16 using size_type = size_t;
18 using const_iterator = const value_type*;
19
22
24 Series(std::string name, std::vector<double> values);
25
28
30 std::tuple<size_t> shape() const;
31
33 [[nodiscard]] bool empty() const;
34
36 size_type size() const;
37
40
43
46
50 const double* data() const;
51
53 std::vector<double> to_list() const;
54
57 Series map_elements(const std::function<double(double)>& f) const;
58 private:
59 friend bool operator==(const Series&, const Series&);
60 friend Series operator*(double, const Series&);
61 friend Series operator*(const Series&, double);
62
63 class Impl;
65 };
66
72 bool operator==(const Series& lhs, const Series& rhs);
73
76 Series operator*(double lhs, const Series& rhs);
77
80 Series operator*(const Series& lhs, double rhs);
81}
Represents a single column of a DataFrame.
Definition series.h:13
Series()
Constructs an unnamed empty Series.
Series map_elements(const std::function< double(double)> &f) const
size_type size() const
Returns the number of rows in this Series.
Series(std::string name, std::vector< double > values)
Constructs a Series with name and associated values.
const_iterator end() const
Returns an iterator past the last value in *this.
friend Series operator*(const Series &, double)
bool empty() const
Returns true if this Series contains no rows.
friend bool operator==(const Series &, const Series &)
size_t size_type
Definition series.h:16
const_iterator begin() const
Returns an iterator to the first value in *this.
osc::CStringView name() const
Returns the name of this Series.
std::vector< double > to_list() const
Converts this Series into a std::vector of its values.
const_reference operator[](size_type pos) const
Returns a reference to the element at the specified position pos.
double value_type
Definition series.h:15
const double * data() const
const value_type * const_iterator
Definition series.h:18
std::tuple< size_t > shape() const
Returns the shape (rows) of this Series.
const value_type & const_reference
Definition series.h:17
friend Series operator*(double, const Series &)
Definition c_string_view.h:12
Definition copy_on_upd_ptr.h:22
Definition component_registry.h:14
bool operator==(const Series &lhs, const Series &rhs)
Series operator*(double lhs, const Series &rhs)