Class prob_dens_mdim_amr (o2scl)¶
-
template<class vec_t = std::vector<double>, class mat_t = const_matrix_view_table<vec_t>>
class prob_dens_mdim_amr : public o2scl::prob_dens_mdim<std::vector<double>>¶ Probability distribution from an adaptive mesh created using a matrix of points.
Todo
Future: The storage required by the mesh is larger than necessary, and could be replaced by a tree-like structure which uses less storage, but that might demand longer lookup times.
Note
This class is experimental.
Dimension choice setting
-
int dim_choice¶
Method for choosing dimension to slice.
-
bool allow_resampling¶
If true, allow resampling in operator() (default true)
-
size_t n_dim¶
Number of dimensions.
-
int verbose¶
Verbosity parameter.
-
static const int max_variance = 1¶
Choose dimension with maximum variance.
-
static const int user_scale = 2¶
Choose dimension with maximum variance with user-specified scale.
-
static const int random = 3¶
Choose randomly.
-
inline virtual int write_generic(std::ostream &fout)¶
Write the output to a generic output stream.
-
inline void two_indices_to_density(size_t i, size_t j, table3d &t3d, std::string slice)¶
Convert two indices to a density in a o2scl::table3d object.
This function presumes that the o2scl::table3d grid has already been created and uses it to create the density. Note that this function will not warn you if the grid refers to points outside the limits of the o2scl::prob_dens_mdim_amr object, instead it will just give zero for those points.
-
inline void clear()¶
Clear everything and set the dimensionality to zero.
-
inline void clear_mesh()¶
Clear the mesh, leaving the lower and upper limits and the scales unchanged.
-
inline void copy_to_vectors(size_t &nd, size_t &dc, size_t &ms, std::vector<double> &data, std::vector<size_t> &insides)¶
Copy the object data to three size_t numbers and two vectors.
Note
This function is used for HDF5 I/O
-
inline void set_from_vectors(size_t &nd, size_t &dc, size_t &ms, const std::vector<double> &data, const std::vector<size_t> &insides)¶
Set the object from data specified as three size_t numbers and a set of two vectors.
Note
This function is used for HDF5 I/O
-
inline void set(vec_t &l, vec_t &h)¶
Set the mesh limits.
This function is called by the constructor.
Note
Calling this function automatically clears the mesh and the scales.
-
inline void insert(size_t ir, mat_t &m, bool log_mode = false)¶
Insert point at row
ir
, creating a new hypercube for the new point.
-
inline void initial_parse(mat_t &m, bool log_mode = false)¶
Parse the matrix
m
, creating a new hypercube for every point.
-
inline void initial_parse_new(mat_t &m)¶
Parse the matrix
m
, creating a new hypercube for every point, ensuring hypercubes are more optimally arranged.This algorithm is slower, but may result in more balanced meshes, particularly when dim_choice is not equal to
random
.- Idea for Future:
This method computes distances twice, once here and once in the insert() function. There is likely a faster approach.
-
inline void weight_is_inv_volume()¶
Set the weight in each hypercube equal to the inverse of the volume (the density)
-
inline double total_volume()¶
Check the total volume by adding up the fractional part of the volume in each hypercube.
-
inline double total_weighted_volume()¶
Check the total volume by adding up the fractional part of the volume in each hypercube.
-
inline const hypercube &find_hc(const vec_t &x) const¶
Return a reference to the hypercube containing the specified point.
-
inline virtual double max_weight() const¶
Return the maximum weight over all hypercubes in the mesh.
-
inline virtual double max_frac_vol() const¶
Return the maximum fractional volume over all hypercubes in the mesh.
-
inline virtual double max_weighted_vol() const¶
Return the maximum fractional volume times weight over all hypercubes in the mesh.
Public Functions
-
inline prob_dens_mdim_amr()¶
Create an empty probability distribution.
-
class hypercube¶
A hypercube class for o2scl::prob_dens_mdim_amr.
-
int dim_choice¶