mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 13:21:10 +01:00
Move methods out from the anonymous namespace.
This commit is contained in:
parent
5beae4d5dc
commit
9f190ca13c
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace {
|
|
||||||
// Normalize a vector so the sum of its elements is equal to 1.0f
|
// Normalize a vector so the sum of its elements is equal to 1.0f
|
||||||
void normalize(Vector<double> &v) {
|
void WaveFormCollapse::normalize(Vector<double> &v) {
|
||||||
double sum_weights = 0.0;
|
double sum_weights = 0.0;
|
||||||
int size = v.size();
|
int size = v.size();
|
||||||
const double *vpr = v.ptr();
|
const double *vpr = v.ptr();
|
||||||
@ -20,7 +19,7 @@ void normalize(Vector<double> &v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return distribution * log(distribution).
|
// Return distribution * log(distribution).
|
||||||
Vector<double> get_plogp(const Vector<double> &distribution) {
|
Vector<double> WaveFormCollapse::get_plogp(const Vector<double> &distribution) {
|
||||||
Vector<double> plogp;
|
Vector<double> plogp;
|
||||||
|
|
||||||
for (int i = 0; i < distribution.size(); i++) {
|
for (int i = 0; i < distribution.size(); i++) {
|
||||||
@ -31,7 +30,7 @@ Vector<double> get_plogp(const Vector<double> &distribution) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return min(v) / 2.
|
// Return min(v) / 2.
|
||||||
double get_min_abs_half(const Vector<double> &v) {
|
double WaveFormCollapse::get_min_abs_half(const Vector<double> &v) {
|
||||||
double min_abs_half = std::numeric_limits<double>::infinity();
|
double min_abs_half = std::numeric_limits<double>::infinity();
|
||||||
|
|
||||||
for (int i = 0; i < v.size(); i++) {
|
for (int i = 0; i < v.size(); i++) {
|
||||||
@ -41,8 +40,6 @@ double get_min_abs_half(const Vector<double> &v) {
|
|||||||
return min_abs_half;
|
return min_abs_half;
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace
|
|
||||||
|
|
||||||
bool WaveFormCollapse::get_eriodic_output() const {
|
bool WaveFormCollapse::get_eriodic_output() const {
|
||||||
return is_impossible;
|
return is_impossible;
|
||||||
}
|
}
|
||||||
@ -339,7 +336,6 @@ WaveFormCollapse::WaveFormCollapse() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WaveFormCollapse::~WaveFormCollapse() {
|
WaveFormCollapse::~WaveFormCollapse() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveFormCollapse::bind_methods() {
|
void WaveFormCollapse::bind_methods() {
|
||||||
|
@ -107,6 +107,10 @@ public:
|
|||||||
propagating.push_back(PropagatingEntry(y, x, pattern));
|
propagating.push_back(PropagatingEntry(y, x, pattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void normalize(Vector<double> &v);
|
||||||
|
Vector<double> get_plogp(const Vector<double> &distribution);
|
||||||
|
double get_min_abs_half(const Vector<double> &v);
|
||||||
|
|
||||||
void propagate();
|
void propagate();
|
||||||
|
|
||||||
void initialize();
|
void initialize();
|
||||||
|
Loading…
Reference in New Issue
Block a user