-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransforms.hpp
More file actions
32 lines (24 loc) · 868 Bytes
/
transforms.hpp
File metadata and controls
32 lines (24 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include <span>
#include <vector>
namespace gnuplotpp {
/** @brief Rolling mean transform. */
std::vector<double> transform_rolling_mean(std::span<const double> y, std::size_t window);
/** @brief Z-score normalization transform. */
std::vector<double> transform_zscore(std::span<const double> y);
/** @brief Clamp values into [vmin, vmax]. */
std::vector<double> transform_clip(std::span<const double> y, double vmin, double vmax);
/**
* @brief Simple transform pipeline for 1D vectors.
*/
class TransformPipeline {
public:
TransformPipeline& set_input(std::vector<double> input);
TransformPipeline& rolling_mean(std::size_t window);
TransformPipeline& zscore();
TransformPipeline& clip(double vmin, double vmax);
const std::vector<double>& values() const noexcept;
private:
std::vector<double> data_{};
};
} // namespace gnuplotpp