update boost
This commit is contained in:
@@ -43,6 +43,13 @@ namespace impl
|
||||
return this->cnt;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & cnt;
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t cnt;
|
||||
};
|
||||
|
||||
@@ -152,6 +152,13 @@ namespace impl
|
||||
return this->cov_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & cov_;
|
||||
}
|
||||
|
||||
private:
|
||||
result_type cov_;
|
||||
};
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <boost/accumulators/statistics/count.hpp>
|
||||
#include <boost/accumulators/statistics/max.hpp>
|
||||
#include <boost/accumulators/statistics/min.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
@@ -184,6 +186,20 @@ namespace impl
|
||||
return make_iterator_range(this->histogram);
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO split to save/load and check on parameters provided in ctor
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & cache_size;
|
||||
ar & cache;
|
||||
ar & num_bins;
|
||||
ar & samples_in_bin;
|
||||
ar & bin_positions;
|
||||
ar & histogram;
|
||||
ar & is_dirty;
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t cache_size; // number of cached samples
|
||||
array_type cache; // cache to store the first cache_size samples
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <boost/accumulators/statistics_fwd.hpp>
|
||||
#include <boost/accumulators/statistics/count.hpp>
|
||||
#include <boost/accumulators/statistics/times2_iterator.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
@@ -236,6 +237,19 @@ namespace impl
|
||||
);
|
||||
}
|
||||
|
||||
public:
|
||||
// make this accumulator serializeable
|
||||
// TODO: do we need to split to load/save and verify that the parameters did not change?
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & probabilities;
|
||||
ar & heights;
|
||||
ar & actual_positions;
|
||||
ar & desired_positions;
|
||||
ar & positions_increments;
|
||||
}
|
||||
|
||||
private:
|
||||
array_type probabilities; // the quantile probabilities
|
||||
array_type heights; // q_i
|
||||
|
||||
@@ -76,6 +76,7 @@ namespace impl
|
||||
boost::begin(args[extended_p_square_probabilities])
|
||||
, boost::end(args[extended_p_square_probabilities])
|
||||
)
|
||||
, probability()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -185,6 +186,17 @@ namespace impl
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
// make this accumulator serializeable
|
||||
// TODO: do we need to split to load/save and verify that the parameters did not change?
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & probabilities;
|
||||
ar & probability;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
array_type probabilities;
|
||||
|
||||
@@ -63,6 +63,10 @@ namespace impl
|
||||
* ( accumulators::moment<2>(args) - mean(args) * mean(args) )
|
||||
) - 3.;
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
@@ -48,6 +48,13 @@ namespace impl
|
||||
return this->max_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & max_;
|
||||
}
|
||||
|
||||
private:
|
||||
Sample max_;
|
||||
};
|
||||
|
||||
@@ -41,6 +41,10 @@ namespace impl
|
||||
extractor<SumFeature> sum;
|
||||
return numeric::fdiv(sum(args), count(args));
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
template<typename Sample, typename Tag>
|
||||
@@ -71,6 +75,12 @@ namespace impl
|
||||
return this->mean;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & mean;
|
||||
}
|
||||
|
||||
private:
|
||||
result_type mean;
|
||||
};
|
||||
|
||||
@@ -48,6 +48,10 @@ namespace impl
|
||||
{
|
||||
return p_square_quantile_for_median(args);
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// with_density_median_impl
|
||||
@@ -105,6 +109,16 @@ namespace impl
|
||||
return this->median;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sum;
|
||||
ar & is_dirty;
|
||||
ar & median;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
mutable float_type sum;
|
||||
mutable bool is_dirty;
|
||||
@@ -160,6 +174,15 @@ namespace impl
|
||||
|
||||
return this->median;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & is_dirty;
|
||||
ar & median;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
mutable bool is_dirty;
|
||||
|
||||
@@ -48,6 +48,13 @@ namespace impl
|
||||
return this->min_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & min_;
|
||||
}
|
||||
|
||||
private:
|
||||
Sample min_;
|
||||
};
|
||||
|
||||
@@ -75,6 +75,13 @@ namespace impl
|
||||
return numeric::fdiv(this->sum, count(args));
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sum;
|
||||
}
|
||||
|
||||
private:
|
||||
Sample sum;
|
||||
};
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <boost/accumulators/framework/parameters/sample.hpp>
|
||||
#include <boost/accumulators/statistics_fwd.hpp>
|
||||
#include <boost/accumulators/statistics/count.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
@@ -204,6 +206,20 @@ namespace impl
|
||||
//return histogram;
|
||||
return make_iterator_range(this->histogram);
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO split to save/load and check on parameters provided in ctor
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & num_cells;
|
||||
ar & heights;
|
||||
ar & actual_positions;
|
||||
ar & desired_positions;
|
||||
ar & positions_increments;
|
||||
ar & histogram;
|
||||
ar & is_dirty;
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t num_cells; // number of cells b
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#ifndef BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012
|
||||
#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) && !defined(__clang__) || defined(__DMC__)
|
||||
# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp")
|
||||
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
|
||||
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) || defined(__BORLANDC__)
|
||||
# warning "This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <boost/accumulators/statistics_fwd.hpp>
|
||||
#include <boost/accumulators/statistics/count.hpp>
|
||||
#include <boost/accumulators/statistics/parameters/quantile_probability.hpp>
|
||||
#include <boost/serialization/boost_array.hpp>
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
@@ -61,7 +62,7 @@ namespace impl
|
||||
|
||||
template<typename Args>
|
||||
p_square_quantile_impl(Args const &args)
|
||||
: p(is_same<Impl, for_median>::value ? 0.5 : args[quantile_probability | 0.5])
|
||||
: p(is_same<Impl, for_median>::value ? float_type(0.5) : args[quantile_probability | float_type(0.5)])
|
||||
, heights()
|
||||
, actual_positions()
|
||||
, desired_positions()
|
||||
@@ -69,20 +70,21 @@ namespace impl
|
||||
{
|
||||
for(std::size_t i = 0; i < 5; ++i)
|
||||
{
|
||||
this->actual_positions[i] = i + 1.;
|
||||
this->actual_positions[i] = i + float_type(1.);
|
||||
}
|
||||
|
||||
this->desired_positions[0] = 1.;
|
||||
this->desired_positions[1] = 1. + 2. * this->p;
|
||||
this->desired_positions[2] = 1. + 4. * this->p;
|
||||
this->desired_positions[3] = 3. + 2. * this->p;
|
||||
this->desired_positions[4] = 5.;
|
||||
this->desired_positions[0] = float_type(1.);
|
||||
this->desired_positions[1] = float_type(1.) + float_type(2.) * this->p;
|
||||
this->desired_positions[2] = float_type(1.) + float_type(4.) * this->p;
|
||||
this->desired_positions[3] = float_type(3.) + float_type(2.) * this->p;
|
||||
this->desired_positions[4] = float_type(5.);
|
||||
|
||||
this->positions_increments[0] = 0.;
|
||||
this->positions_increments[1] = this->p / 2.;
|
||||
|
||||
this->positions_increments[0] = float_type(0.);
|
||||
this->positions_increments[1] = this->p / float_type(2.);
|
||||
this->positions_increments[2] = this->p;
|
||||
this->positions_increments[3] = (1. + this->p) / 2.;
|
||||
this->positions_increments[4] = 1.;
|
||||
this->positions_increments[3] = (float_type(1.) + this->p) / float_type(2.);
|
||||
this->positions_increments[4] = float_type(1.);
|
||||
}
|
||||
|
||||
template<typename Args>
|
||||
@@ -156,7 +158,7 @@ namespace impl
|
||||
float_type hp = (this->heights[i + 1] - this->heights[i]) / dp;
|
||||
float_type hm = (this->heights[i - 1] - this->heights[i]) / dm;
|
||||
|
||||
if((d >= 1. && dp > 1.) || (d <= -1. && dm < -1.))
|
||||
if((d >= float_type(1.) && dp > float_type(1.)) || (d <= float_type(-1.) && dm < float_type(-1.)))
|
||||
{
|
||||
short sign_d = static_cast<short>(d / std::abs(d));
|
||||
|
||||
@@ -171,11 +173,11 @@ namespace impl
|
||||
else
|
||||
{
|
||||
// use linear formula
|
||||
if(d > 0)
|
||||
if(d > float_type(0))
|
||||
{
|
||||
this->heights[i] += hp;
|
||||
}
|
||||
if(d < 0)
|
||||
if(d < float_type(0))
|
||||
{
|
||||
this->heights[i] -= hm;
|
||||
}
|
||||
@@ -191,6 +193,18 @@ namespace impl
|
||||
return this->heights[2];
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO: do we need to split to load/save and verify that P did not change?
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & p;
|
||||
ar & heights;
|
||||
ar & actual_positions;
|
||||
ar & desired_positions;
|
||||
ar & positions_increments;
|
||||
}
|
||||
|
||||
private:
|
||||
float_type p; // the quantile probability p
|
||||
array_type heights; // q_i
|
||||
|
||||
@@ -181,6 +181,21 @@ namespace impl
|
||||
return this->fit_parameters_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO: do we need to split to load/save and verify that threshold did not change?
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & Nu_;
|
||||
ar & mu_;
|
||||
ar & sigma2_;
|
||||
ar & threshold_;
|
||||
ar & get<0>(fit_parameters_);
|
||||
ar & get<1>(fit_parameters_);
|
||||
ar & get<2>(fit_parameters_);
|
||||
ar & is_dirty_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t Nu_; // number of samples larger than threshold
|
||||
mutable float_type mu_; // mean of Nu_ largest samples
|
||||
@@ -291,6 +306,20 @@ namespace impl
|
||||
return this->fit_parameters_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO: do we need to split to load/save and verify that threshold did not change?
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & mu_;
|
||||
ar & sigma2_;
|
||||
ar & threshold_probability_;
|
||||
ar & get<0>(fit_parameters_);
|
||||
ar & get<1>(fit_parameters_);
|
||||
ar & get<2>(fit_parameters_);
|
||||
ar & is_dirty_;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable float_type mu_; // mean of samples above threshold u
|
||||
mutable float_type sigma2_; // variance of samples above threshold u
|
||||
|
||||
@@ -80,6 +80,13 @@ namespace impl
|
||||
, -xi_hat
|
||||
) - 1.));
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sign_;
|
||||
}
|
||||
|
||||
private:
|
||||
short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result
|
||||
|
||||
@@ -90,6 +90,14 @@ namespace impl
|
||||
is_same<LeftRight, left>::value ? args[quantile_probability] : 1. - args[quantile_probability]
|
||||
, -xi_hat);
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sign_;
|
||||
}
|
||||
|
||||
private:
|
||||
short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result
|
||||
};
|
||||
|
||||
@@ -40,6 +40,10 @@ namespace impl
|
||||
{
|
||||
return static_cast<std::size_t>(rolling_window_plus1(args).size()) - is_rolling_window_plus1_full(args);
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
@@ -43,6 +43,10 @@ namespace boost { namespace accumulators
|
||||
{
|
||||
return numeric::fdiv(rolling_sum(args), rolling_count(args));
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -67,12 +71,18 @@ namespace boost { namespace accumulators
|
||||
{
|
||||
if(is_rolling_window_plus1_full(args))
|
||||
{
|
||||
mean_ += numeric::fdiv(args[sample]-rolling_window_plus1(args).front(),rolling_count(args));
|
||||
if (rolling_window_plus1(args).front() > args[sample])
|
||||
mean_ -= numeric::fdiv(rolling_window_plus1(args).front()-args[sample],rolling_count(args));
|
||||
else if (rolling_window_plus1(args).front() < args[sample])
|
||||
mean_ += numeric::fdiv(args[sample]-rolling_window_plus1(args).front(),rolling_count(args));
|
||||
}
|
||||
else
|
||||
{
|
||||
result_type prev_mean = mean_;
|
||||
mean_ += numeric::fdiv(args[sample]-prev_mean,rolling_count(args));
|
||||
if (prev_mean > args[sample])
|
||||
mean_ -= numeric::fdiv(prev_mean-args[sample],rolling_count(args));
|
||||
else if (prev_mean < args[sample])
|
||||
mean_ += numeric::fdiv(args[sample]-prev_mean,rolling_count(args));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +91,13 @@ namespace boost { namespace accumulators
|
||||
{
|
||||
return mean_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & mean_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -176,4 +193,4 @@ namespace boost { namespace accumulators
|
||||
};
|
||||
}} // namespace boost::accumulators
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -58,6 +58,13 @@ namespace impl
|
||||
return numeric::fdiv(this->sum_, rolling_count(args));
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sum_;
|
||||
}
|
||||
|
||||
private:
|
||||
result_type sum_;
|
||||
};
|
||||
|
||||
@@ -51,6 +51,13 @@ namespace impl
|
||||
return this->sum_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sum_;
|
||||
}
|
||||
|
||||
private:
|
||||
Sample sum_;
|
||||
};
|
||||
|
||||
@@ -62,6 +62,10 @@ namespace impl
|
||||
if (nr_samples < 2) return result_type();
|
||||
return nr_samples*(rolling_moment<2>(args) - mean*mean)/(nr_samples-1);
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
//! Iterative calculation of the rolling variance.
|
||||
@@ -138,6 +142,14 @@ namespace impl
|
||||
if (nr_samples < 2) return result_type();
|
||||
return numeric::fdiv(sum_of_squares_,(nr_samples-1));
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & previous_mean_;
|
||||
ar & sum_of_squares_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -21,6 +21,45 @@
|
||||
#include <boost/accumulators/framework/parameters/accumulator.hpp>
|
||||
#include <boost/accumulators/numeric/functional.hpp>
|
||||
#include <boost/accumulators/statistics_fwd.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
|
||||
namespace boost { namespace serialization {
|
||||
|
||||
// implement serialization for boost::circular_buffer
|
||||
template <class Archive, class T>
|
||||
void save(Archive& ar, const circular_buffer<T>& b, const unsigned int /* version */)
|
||||
{
|
||||
typename circular_buffer<T>::size_type size = b.size();
|
||||
ar << b.capacity();
|
||||
ar << size;
|
||||
const typename circular_buffer<T>::const_array_range one = b.array_one();
|
||||
const typename circular_buffer<T>::const_array_range two = b.array_two();
|
||||
ar.save_binary(one.first, one.second*sizeof(T));
|
||||
ar.save_binary(two.first, two.second*sizeof(T));
|
||||
}
|
||||
|
||||
template <class Archive, class T>
|
||||
void load(Archive& ar, circular_buffer<T>& b, const unsigned int /* version */)
|
||||
{
|
||||
typename circular_buffer<T>::capacity_type capacity;
|
||||
typename circular_buffer<T>::size_type size;
|
||||
ar >> capacity;
|
||||
b.set_capacity(capacity);
|
||||
ar >> size;
|
||||
b.clear();
|
||||
const typename circular_buffer<T>::pointer buff = new T[size*sizeof(T)];
|
||||
ar.load_binary(buff, size*sizeof(T));
|
||||
b.insert(b.begin(), buff, buff+size);
|
||||
delete[] buff;
|
||||
}
|
||||
|
||||
template<class Archive, class T>
|
||||
inline void serialize(Archive & ar, circular_buffer<T>& b, const unsigned int version)
|
||||
{
|
||||
split_free(ar, b, version);
|
||||
}
|
||||
|
||||
} } // end namespace boost::serialization
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
@@ -83,6 +122,12 @@ namespace impl
|
||||
return result_type(this->buffer_.begin(), this->buffer_.end());
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int version)
|
||||
{
|
||||
ar & buffer_;
|
||||
}
|
||||
|
||||
private:
|
||||
circular_buffer<Sample> buffer_;
|
||||
};
|
||||
@@ -112,6 +157,10 @@ namespace impl
|
||||
{
|
||||
return rolling_window_plus1(args).advance_begin(is_rolling_window_plus1_full(args));
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
@@ -65,6 +65,10 @@ namespace impl
|
||||
* std::sqrt( accumulators::moment<2>(args) - mean(args) * mean(args) )
|
||||
);
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
@@ -51,8 +51,13 @@ namespace impl
|
||||
return this->sum;
|
||||
}
|
||||
|
||||
private:
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sum;
|
||||
}
|
||||
|
||||
private:
|
||||
Sample sum;
|
||||
};
|
||||
|
||||
|
||||
@@ -66,6 +66,14 @@ struct sum_kahan_impl
|
||||
return this->sum;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sum;
|
||||
ar & compensation;
|
||||
}
|
||||
|
||||
private:
|
||||
Sample sum;
|
||||
Sample compensation;
|
||||
|
||||
@@ -268,6 +268,17 @@ namespace impl
|
||||
std::vector<Sample> const &samples;
|
||||
};
|
||||
|
||||
public:
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & is_sorted;
|
||||
ar & indices;
|
||||
ar & samples;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable bool is_sorted;
|
||||
mutable std::vector<std::size_t> indices;
|
||||
std::vector<Sample> samples;
|
||||
|
||||
@@ -88,6 +88,10 @@ namespace impl
|
||||
- numeric::fdiv(n, count(args))
|
||||
);
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -159,6 +163,10 @@ namespace impl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
@@ -98,6 +98,10 @@ namespace impl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
} // namespace impl
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <boost/accumulators/framework/depends_on.hpp>
|
||||
#include <boost/accumulators/statistics_fwd.hpp>
|
||||
#include <boost/accumulators/statistics/tail.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
@@ -69,6 +70,14 @@ namespace impl
|
||||
);
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & variates;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<VariateType> variates;
|
||||
};
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <boost/accumulators/statistics/tail_variate.hpp>
|
||||
#include <boost/accumulators/statistics/tail_mean.hpp>
|
||||
#include <boost/accumulators/statistics/parameters/quantile_probability.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
@@ -145,6 +146,13 @@ namespace impl
|
||||
return make_iterator_range(this->tail_means_);
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & tail_means_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
mutable array_type tail_means_;
|
||||
|
||||
@@ -53,6 +53,10 @@ namespace impl
|
||||
result_type tmp = mean(args);
|
||||
return accumulators::moment<2>(args) - tmp * tmp;
|
||||
}
|
||||
|
||||
// serialization is done by accumulators it depends on
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version) {}
|
||||
};
|
||||
|
||||
//! Iterative calculation of variance.
|
||||
@@ -113,6 +117,13 @@ namespace impl
|
||||
return this->variance;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & variance;
|
||||
}
|
||||
|
||||
private:
|
||||
result_type variance;
|
||||
};
|
||||
|
||||
@@ -97,6 +97,13 @@ namespace impl
|
||||
return this->cov_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & cov_;
|
||||
}
|
||||
|
||||
private:
|
||||
result_type cov_;
|
||||
};
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <boost/accumulators/statistics/max.hpp>
|
||||
#include <boost/accumulators/statistics/min.hpp>
|
||||
#include <boost/accumulators/statistics/density.hpp> // for named parameters density_cache_size and density_num_bins
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
@@ -171,6 +173,20 @@ namespace impl
|
||||
return make_iterator_range(this->histogram);
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO split to save/load and check on parameters provided in ctor
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & cache_size;
|
||||
ar & cache;
|
||||
ar & num_bins;
|
||||
ar & samples_in_bin;
|
||||
ar & bin_positions;
|
||||
ar & histogram;
|
||||
ar & is_dirty;
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t cache_size; // number of cached samples
|
||||
histogram_type cache; // cache to store the first cache_size samples with their weights as std::pair
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <boost/accumulators/statistics/sum.hpp>
|
||||
#include <boost/accumulators/statistics/times2_iterator.hpp>
|
||||
#include <boost/accumulators/statistics/extended_p_square.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
|
||||
namespace boost { namespace accumulators
|
||||
{
|
||||
@@ -251,6 +252,17 @@ namespace impl
|
||||
);
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO: do we need to split to load/save and verify that the parameters did not change?
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & probabilities;
|
||||
ar & heights;
|
||||
ar & actual_positions;
|
||||
ar & desired_positions;
|
||||
}
|
||||
|
||||
private:
|
||||
array_type probabilities; // the quantile probabilities
|
||||
array_type heights; // q_i
|
||||
|
||||
@@ -97,6 +97,13 @@ namespace impl
|
||||
return this->mean;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & mean;
|
||||
}
|
||||
|
||||
private:
|
||||
result_type mean;
|
||||
};
|
||||
|
||||
@@ -106,6 +106,15 @@ namespace impl
|
||||
return this->median;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sum;
|
||||
ar & is_dirty;
|
||||
ar & median;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable float_type sum;
|
||||
mutable bool is_dirty;
|
||||
@@ -162,6 +171,15 @@ namespace impl
|
||||
|
||||
return this->median;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & is_dirty;
|
||||
ar & median;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable bool is_dirty;
|
||||
mutable float_type median;
|
||||
|
||||
@@ -60,6 +60,13 @@ namespace impl
|
||||
return numeric::fdiv(this->sum, sum_of_weights(args));
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sum;
|
||||
}
|
||||
|
||||
private:
|
||||
weighted_sample sum;
|
||||
};
|
||||
|
||||
@@ -221,6 +221,19 @@ namespace impl
|
||||
return make_iterator_range(this->histogram);
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO split to save/load and check on parameters provided in ctor
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & num_cells;
|
||||
ar & heights;
|
||||
ar & actual_positions;
|
||||
ar & desired_positions;
|
||||
ar & histogram;
|
||||
ar & is_dirty;
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t num_cells; // number of cells b
|
||||
array_type heights; // q_i
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#ifndef BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012
|
||||
#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) && !defined(__clang__) || defined(__DMC__)
|
||||
# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp")
|
||||
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
|
||||
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) || defined(__BORLANDC__)
|
||||
# warning "This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -208,6 +208,17 @@ namespace impl {
|
||||
return this->heights[2];
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO split to save/load and check on parameters provided in ctor
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & p;
|
||||
ar & heights;
|
||||
ar & actual_positions;
|
||||
ar & desired_positions;
|
||||
}
|
||||
|
||||
private:
|
||||
float_type p; // the quantile probability p
|
||||
array_type heights; // q_i
|
||||
|
||||
@@ -109,6 +109,19 @@ namespace impl
|
||||
return this->fit_parameters_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
// TODO: do we need to split to load/save and verify that threshold did not change?
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & sign_;
|
||||
ar & mu_;
|
||||
ar & sigma2_;
|
||||
ar & threshold_;
|
||||
ar & fit_parameters_;
|
||||
ar & is_dirty_;
|
||||
}
|
||||
|
||||
private:
|
||||
short sign_; // for left tail fitting, mirror the extreme values
|
||||
mutable float_type mu_; // mean of samples above threshold
|
||||
|
||||
@@ -55,6 +55,13 @@ namespace impl
|
||||
return this->weighted_sum_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & weighted_sum_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
weighted_sample weighted_sum_;
|
||||
|
||||
@@ -68,6 +68,14 @@ namespace impl
|
||||
return this->weighted_sum_;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & weighted_sum_;
|
||||
ar & compensation;
|
||||
}
|
||||
|
||||
private:
|
||||
weighted_sample weighted_sum_;
|
||||
weighted_sample compensation;
|
||||
|
||||
@@ -179,6 +179,13 @@ namespace impl
|
||||
return make_iterator_range(this->tail_means_);
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & tail_means_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
mutable array_type tail_means_;
|
||||
|
||||
@@ -103,6 +103,13 @@ namespace impl
|
||||
return this->weighted_variance;
|
||||
}
|
||||
|
||||
// make this accumulator serializeable
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & weighted_variance;
|
||||
}
|
||||
|
||||
private:
|
||||
result_type weighted_variance;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user