|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Records the Shannon entropy of the state distribution. More...
#include <ca-observer.H>
Public Member Functions | |
| Entropy_Observer ()=default | |
| Construct an empty entropy observer. | |
| const Array< double > & | entropy () const noexcept |
| Return the entropy time series. | |
| std::size_t | size () const noexcept |
| Return the number of entropy samples. | |
| void | reset () noexcept |
| Clear all entropy samples. | |
| template<typename Lattice > | |
| void | on_step_begin (const std::size_t step, const Lattice &frame) |
| Record entropy of the initial frame. | |
| template<typename Lattice > | |
| void | on_step_end (const std::size_t step, const Lattice &frame) |
| Record entropy after a completed step. | |
Private Attributes | |
| Array< double > | entropy_ |
| bool | seeded_ = false |
Records the Shannon entropy of the state distribution.
Computes the entropy in nats over the integer states in [0, MaxState). Pushes one sample per step (including the initial frame).
| MaxState | exclusive upper bound on the state values. |
Definition at line 548 of file ca-observer.H.
|
default |
Construct an empty entropy observer.
| This | function does not throw. |
|
inlinenoexcept |
Return the entropy time series.
| This | function does not throw. |
Definition at line 563 of file ca-observer.H.
References Aleph::CA::Entropy_Observer< MaxState >::entropy_.
|
inline |
Record entropy of the initial frame.
| Lattice | lattice type. |
| [in] | step | step index about to run. |
| [in] | frame | frame before the step. |
| std::bad_alloc | if appending the sample allocates. |
Definition at line 596 of file ca-observer.H.
References Aleph::and, Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Entropy_Observer< MaxState >::entropy_, Aleph::CA::Entropy_Observer< MaxState >::seeded_, and Aleph::CA::shannon_entropy().
|
inline |
Record entropy after a completed step.
| Lattice | lattice type. |
| [in] | step | completed step index, ignored. |
| [in] | frame | frame after the step. |
| std::bad_alloc | if appending the sample allocates. |
Definition at line 612 of file ca-observer.H.
References Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Entropy_Observer< MaxState >::entropy_, and Aleph::CA::shannon_entropy().
|
inlinenoexcept |
Clear all entropy samples.
| This | function does not throw. |
Definition at line 583 of file ca-observer.H.
References Aleph::Array< T >::clear(), Aleph::CA::Entropy_Observer< MaxState >::entropy_, and Aleph::CA::Entropy_Observer< MaxState >::seeded_.
|
inlinenoexcept |
Return the number of entropy samples.
| This | function does not throw. |
Definition at line 572 of file ca-observer.H.
References Aleph::CA::Entropy_Observer< MaxState >::entropy_, and Aleph::Array< T >::size().
|
private |
Definition at line 550 of file ca-observer.H.
Referenced by Aleph::CA::Entropy_Observer< MaxState >::entropy(), Aleph::CA::Entropy_Observer< MaxState >::on_step_begin(), Aleph::CA::Entropy_Observer< MaxState >::on_step_end(), Aleph::CA::Entropy_Observer< MaxState >::reset(), and Aleph::CA::Entropy_Observer< MaxState >::size().
|
private |
Definition at line 551 of file ca-observer.H.
Referenced by Aleph::CA::Entropy_Observer< MaxState >::on_step_begin(), and Aleph::CA::Entropy_Observer< MaxState >::reset().