105#include "observables/Observable.hpp"
106#include "system/System.hpp"
110#include <boost/multi_array.hpp>
111#include <boost/serialization/access.hpp>
131 using obs_ptr = std::shared_ptr<Observables::Observable>;
132 void initialize_operations();
133 void initialize_buffers();
135 initialize_operations();
136 initialize_buffers();
162 double tau_max, std::string compress1_, std::string compress2_,
163 std::string corr_operation, obs_ptr obs1, obs_ptr obs2,
166 m_correlation_args_input(correlation_args_),
167 m_correlation_args(correlation_args_), m_tau_lin(
tau_lin),
168 m_dt(system->get_time_step() * static_cast<double>(
delta_N)),
169 m_tau_max(
tau_max), compressA_name(std::move(compress1_)),
170 compressB_name(std::move(compress2_)),
171 corr_operation_name(std::move(corr_operation)), A_obs(std::move(obs1)),
172 B_obs(std::move(obs2)) {
187 void update(boost::mpi::communicator
const &comm)
override;
192 int finalize(boost::mpi::communicator
const &comm);
197 return m_tau_lin + 1 + (m_tau_lin + 1) / 2 * (m_hierarchy_depth - 1);
199 std::vector<std::size_t>
shape()
const override {
200 std::vector<std::size_t>
shape = m_shape;
205 return {n_sweeps.begin(), n_sweeps.end()};
211 double dt()
const {
return m_dt; }
215 m_correlation_args = args;
218 std::string
const &
compress1()
const {
return compressA_name; }
219 std::string
const &
compress2()
const {
return compressB_name; }
221 return corr_operation_name;
231 Utils::Vector3d m_correlation_args_input;
232 Utils::Vector3d m_correlation_args;
236 int m_hierarchy_depth;
238 std::
size_t m_dim_corr;
243 using multi_array_index_type =
boost::multi_array<
double, 2>::index;
245 std::
string compressA_name;
246 std::
string compressB_name;
247 std::
string corr_operation_name;
252 std::vector<
int> tau;
253 boost::multi_array<std::vector<
double>, 2> A;
254 boost::multi_array<std::vector<
double>, 2> B;
256 boost::multi_array<
double, 2> result;
259 std::vector<std::
size_t> n_sweeps;
261 std::vector<
long> n_vals;
263 std::vector<
long> newest;
265 std::vector<
double> A_accumulated_average;
266 std::vector<
double> B_accumulated_average;
271 std::vector<std::
size_t> m_shape;
273 using correlation_operation_type = std::vector<
double> (*)(
274 std::vector<
double> const &, std::vector<
double> const &,
275 Utils::Vector3d const &);
277 correlation_operation_type corr_operation;
279 using compression_function = std::vector<
double> (*)(
280 std::vector<
double> const &A1, std::vector<
double> const &A2);
283 compression_function compressA;
284 compression_function compressB;
Vector implementation and trait types for boost qvm interoperability.
The main correlator class.
std::size_t n_values() const
std::string get_internal_state() const final
Correlator(::System::System const *system, int delta_N, int tau_lin, double tau_max, std::string compress1_, std::string compress2_, std::string corr_operation, obs_ptr obs1, obs_ptr obs2, Utils::Vector3d correlation_args_={})
The initialization procedure for the correlation object.
std::string const & correlation_operation() const
std::vector< int > get_samples_sizes() const
std::string const & compress1() const
Utils::Vector3d const & correlation_args() const
void set_internal_state(std::string const &) final
std::vector< std::size_t > shape() const override
void set_correlation_args(Utils::Vector3d const &args)
std::vector< double > get_lag_times() const
int finalize(boost::mpi::communicator const &comm)
At the end of data collection, go through the whole hierarchy and correlate data left there.
std::vector< double > get_correlation()
Return correlation result.
std::string const & compress2() const
void update(boost::mpi::communicator const &comm) override
The function to process a new datapoint of A and B.