|
FML
|
Dense results by default; COMPACT stores one slot per canonical tuple. More...
#include <PolyspectrumBinning.h>
Public Types | |
| enum | BinningType { LINEAR_SPACING , LOG_SPACING } |
| using | Configuration = std::array<int, ORDER> |
Public Member Functions | |
| void | set_configurations (std::vector< Configuration > configurations) |
| Empty restores all configurations. Inputs are canonicalized and deduplicated. | |
| std::vector< Configuration > | configurations () |
| void | prepare_storage () |
| Allocate compact results only when needed. No dense tensor is constructed. | |
| const std::vector< Configuration > & | stored_configurations () const |
| size_t | result_storage_bytes () const |
| size_t | metadata_storage_bytes () const |
| bool | valid_storage () const |
| PolyspectrumBinning< N, ORDER, false > | to_dense () |
| Explicit dense allocation and symmetry expansion; never used by estimators. | |
| bool | has_bincount (int nmesh) |
| void | mark_bincount_computed (int nmesh) |
| PolyspectrumBinning ()=default | |
| PolyspectrumBinning (double _kmin, double _kmax, int nbins, int bin_type=LINEAR_SPACING) | |
| PolyspectrumBinning (int nbins, int Nmesh, int bin_type=LINEAR_SPACING) | |
| void | scale (const double boxsize) |
| To physical units: k *= 1/boxsize and P *= boxsize^((ORDER-1) NDIM) | |
| void | reset () |
| Clears the arrays. | |
| void | free () |
| Release result arrays/canonical slots, retaining shell metadata and selection. | |
| double | get_spectrum (const std::array< int, ORDER > &ik) |
| Get the polyspectra at (k[ik1], k[ik2], ...) | |
| double | get_spectrum (int i, int j) |
| For ORDER = 2 get the monospectum P(i,j) with i,j index of bin in [0,nbins) | |
| double | get_spectrum (int i, int j, int k) |
| For ORDER = 3 get the bispectum B(i,j,k) with i,j,k index of bin in [0,nbins) | |
| double | get_spectrum (int i, int j, int k, int l) |
| For ORDER = 4 get the trispectum T(i,j,k,l) with i,j,k,l index of bin in [0,nbins) | |
| double | get_reduced_spectrum (const std::array< int, ORDER > &ik) |
| Get the reduced polyspectrum: P / fac where fac = sqrt(P(k1)P(k2)) for order=2 and P(k1)P(k2) + cyc for ORDER=3,4. | |
| double | get_reduced_spectrum (int i, int j) |
| double | get_reduced_spectrum (int i, int j, int k) |
| double | get_reduced_spectrum (int i, int j, int k, int l) |
| double | get_bincount (const std::array< int, ORDER > &ik) |
| Returns the volume factor N123. | |
| double | get_bincount (int i, int j) |
| double | get_bincount (int i, int j, int k) |
| double | get_bincount (int i, int j, int k, int l) |
| void | set_bincount (const std::vector< double > &N123_external) |
| Copy over the volume factor N123 (useful to save computations if we do many calculations with the same setup) | |
| void | set_bincount (const std::vector< double > &counts, int nmesh) |
| Import with an explicit mesh identity (preferred to the legacy overload). | |
| void | combine (PolyspectrumBinning &rhs) |
| This is just to make it easier to add binning of several spectra... just for testing. | |
| std::array< int, ORDER > | get_coord_from_index (size_t index) |
| The coord (k1,k2,...) corresponding to a given index in the P123 and N123 array These methods determine how the data is stored and fetched. | |
| size_t | get_index_from_coord (const std::array< int, ORDER > &ik) |
| bool | compute_this_configuration (const std::array< int, ORDER > &ik) |
| Symmetry: we only need to compute ik1 <= ik2 <= ... This function tells algorithms which configurations to compute and which to set by using symmetry from the configs we have computed. | |
Static Public Member Functions | |
| static size_t | dense_entries (int nbins) |
Data Fields | |
| int | n {0} |
| Number of bins. | |
| int | bin_type {LINEAR_SPACING} |
| Type of bins (LINEAR_SPACING or LOG_SPACING) | |
| double | kmin {0.0} |
| The minimum k to bin from (should be 0!) | |
| double | kmax {0.0} |
| The maximum k to bin to. | |
| bool | subtract_shotnoise {true} |
| Subtract shotnoise? Algorithms (compute_polyspectrum) using this class checks this value. | |
| std::vector< double > | P123 |
| The polyspectrum. | |
| std::vector< double > | N123 |
| The volume (number of generalized triangles) of each bin. | |
| std::vector< double > | pofk |
| The power-spectrum. | |
| std::vector< double > | kbin |
| kbin is center of bin | |
| std::vector< double > | klow |
| klow is lower bin edge | |
| std::vector< double > | khigh |
| khigh is higher bin edge | |
| std::vector< double > | kmean |
| kmean is the mean of wavenumbers added to the bin | |
| bool | bincount_is_set {false} |
| If we have precomputed the volume factor (N123) or not and have it available for algorithms to use. | |
| bool | dealias {true} |
| True integer-wavevector closure. | |
| PolyspectrumOptions | options |
| PolyspectrumStatistics | statistics |
| int | nbinnings {0} |
Static Public Attributes | |
| static constexpr bool | compact_storage = COMPACT |
Friends | |
| template<int , int , bool > | |
| class | PolyspectrumBinning |
Dense results by default; COMPACT stores one slot per canonical tuple.
Definition at line 44 of file PolyspectrumBinning.h.
| using FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::Configuration = std::array<int, ORDER> |
Definition at line 84 of file PolyspectrumBinning.h.
| enum FML::CORRELATIONFUNCTIONS::PolyspectrumBinning::BinningType |
| Enumerator | |
|---|---|
| LINEAR_SPACING | |
| LOG_SPACING | |
Definition at line 47 of file PolyspectrumBinning.h.
|
default |
| FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::PolyspectrumBinning | ( | double | _kmin, |
| double | _kmax, | ||
| int | nbins, | ||
| int | bin_type = LINEAR_SPACING ) |
Definition at line 283 of file PolyspectrumBinning.h.
| FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::PolyspectrumBinning | ( | int | nbins, |
| int | Nmesh, | ||
| int | bin_type = LINEAR_SPACING ) |
Definition at line 279 of file PolyspectrumBinning.h.
| void FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::combine | ( | PolyspectrumBinning< N, ORDER, COMPACT > & | rhs | ) |
This is just to make it easier to add binning of several spectra... just for testing.
Definition at line 576 of file PolyspectrumBinning.h.
| bool FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::compute_this_configuration | ( | const std::array< int, ORDER > & | ik | ) |
Symmetry: we only need to compute ik1 <= ik2 <= ... This function tells algorithms which configurations to compute and which to set by using symmetry from the configs we have computed.
Definition at line 366 of file PolyspectrumBinning.h.
|
inline |
Definition at line 107 of file PolyspectrumBinning.h.
|
inlinestatic |
Definition at line 155 of file PolyspectrumBinning.h.
| void FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::free | ( | ) |
Release result arrays/canonical slots, retaining shell metadata and selection.
Definition at line 421 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_bincount | ( | const std::array< int, ORDER > & | ik | ) |
Returns the volume factor N123.
Definition at line 545 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_bincount | ( | int | i, |
| int | j ) |
Definition at line 555 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_bincount | ( | int | i, |
| int | j, | ||
| int | k ) |
Definition at line 562 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_bincount | ( | int | i, |
| int | j, | ||
| int | k, | ||
| int | l ) |
Definition at line 569 of file PolyspectrumBinning.h.
| std::array< int, ORDER > FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_coord_from_index | ( | size_t | index | ) |
The coord (k1,k2,...) corresponding to a given index in the P123 and N123 array These methods determine how the data is stored and fetched.
Definition at line 339 of file PolyspectrumBinning.h.
| size_t FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_index_from_coord | ( | const std::array< int, ORDER > & | ik | ) |
Definition at line 351 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_reduced_spectrum | ( | const std::array< int, ORDER > & | ik | ) |
Get the reduced polyspectrum: P / fac where fac = sqrt(P(k1)P(k2)) for order=2 and P(k1)P(k2) + cyc for ORDER=3,4.
Definition at line 514 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_reduced_spectrum | ( | int | i, |
| int | j ) |
Definition at line 490 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_reduced_spectrum | ( | int | i, |
| int | j, | ||
| int | k ) |
Definition at line 498 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_reduced_spectrum | ( | int | i, |
| int | j, | ||
| int | k, | ||
| int | l ) |
Definition at line 506 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_spectrum | ( | const std::array< int, ORDER > & | ik | ) |
Get the polyspectra at (k[ik1], k[ik2], ...)
Definition at line 480 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_spectrum | ( | int | i, |
| int | j ) |
For ORDER = 2 get the monospectum P(i,j) with i,j index of bin in [0,nbins)
Definition at line 459 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_spectrum | ( | int | i, |
| int | j, | ||
| int | k ) |
For ORDER = 3 get the bispectum B(i,j,k) with i,j,k index of bin in [0,nbins)
Definition at line 466 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::get_spectrum | ( | int | i, |
| int | j, | ||
| int | k, | ||
| int | l ) |
For ORDER = 4 get the trispectum T(i,j,k,l) with i,j,k,l index of bin in [0,nbins)
Definition at line 473 of file PolyspectrumBinning.h.
|
inline |
Definition at line 174 of file PolyspectrumBinning.h.
|
inline |
Definition at line 182 of file PolyspectrumBinning.h.
|
inline |
Definition at line 146 of file PolyspectrumBinning.h.
|
inline |
Allocate compact results only when needed. No dense tensor is constructed.
Definition at line 132 of file PolyspectrumBinning.h.
| void FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::reset | ( | ) |
Clears the arrays.
Definition at line 410 of file PolyspectrumBinning.h.
|
inline |
Definition at line 145 of file PolyspectrumBinning.h.
| void FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::scale | ( | const double | boxsize | ) |
To physical units: k *= 1/boxsize and P *= boxsize^((ORDER-1) NDIM)
Definition at line 386 of file PolyspectrumBinning.h.
|
inline |
Import with an explicit mesh identity (preferred to the legacy overload).
Definition at line 258 of file PolyspectrumBinning.h.
| void FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::set_bincount | ( | const std::vector< double > & | N123_external | ) |
Copy over the volume factor N123 (useful to save computations if we do many calculations with the same setup)
Definition at line 600 of file PolyspectrumBinning.h.
|
inline |
Empty restores all configurations. Inputs are canonicalized and deduplicated.
Definition at line 87 of file PolyspectrumBinning.h.
|
inline |
Definition at line 144 of file PolyspectrumBinning.h.
| PolyspectrumBinning< N, ORDER, false > FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::to_dense | ( | ) |
Explicit dense allocation and symmetry expansion; never used by estimators.
Definition at line 621 of file PolyspectrumBinning.h.
|
inline |
Definition at line 167 of file PolyspectrumBinning.h.
|
friend |
Definition at line 193 of file PolyspectrumBinning.h.
| int FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::bin_type {LINEAR_SPACING} |
Type of bins (LINEAR_SPACING or LOG_SPACING)
Definition at line 52 of file PolyspectrumBinning.h.
| bool FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::bincount_is_set {false} |
If we have precomputed the volume factor (N123) or not and have it available for algorithms to use.
Definition at line 78 of file PolyspectrumBinning.h.
|
staticconstexpr |
Definition at line 46 of file PolyspectrumBinning.h.
| bool FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::dealias {true} |
True integer-wavevector closure.
False retains legacy modulo-grid closure. Nonlinear estimates exclude even-mesh Nyquist planes when enabled.
Definition at line 81 of file PolyspectrumBinning.h.
| std::vector<double> FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::kbin |
kbin is center of bin
Definition at line 69 of file PolyspectrumBinning.h.
| std::vector<double> FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::khigh |
khigh is higher bin edge
Definition at line 73 of file PolyspectrumBinning.h.
| std::vector<double> FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::klow |
klow is lower bin edge
Definition at line 71 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::kmax {0.0} |
| std::vector<double> FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::kmean |
kmean is the mean of wavenumbers added to the bin
Definition at line 75 of file PolyspectrumBinning.h.
| double FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::kmin {0.0} |
The minimum k to bin from (should be 0!)
Definition at line 54 of file PolyspectrumBinning.h.
| int FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::n {0} |
| std::vector<double> FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::N123 |
The volume (number of generalized triangles) of each bin.
Definition at line 64 of file PolyspectrumBinning.h.
| int FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::nbinnings {0} |
Definition at line 265 of file PolyspectrumBinning.h.
| PolyspectrumOptions FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::options |
Definition at line 82 of file PolyspectrumBinning.h.
| std::vector<double> FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::P123 |
The polyspectrum.
Definition at line 62 of file PolyspectrumBinning.h.
| std::vector<double> FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::pofk |
The power-spectrum.
Definition at line 66 of file PolyspectrumBinning.h.
| PolyspectrumStatistics FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::statistics |
Definition at line 83 of file PolyspectrumBinning.h.
| bool FML::CORRELATIONFUNCTIONS::PolyspectrumBinning< N, ORDER, COMPACT >::subtract_shotnoise {true} |
Subtract shotnoise? Algorithms (compute_polyspectrum) using this class checks this value.
Definition at line 59 of file PolyspectrumBinning.h.