Move methods out from the anonymous namespace.

This commit is contained in:
Relintai 2022-04-21 23:33:21 +02:00
parent 5beae4d5dc
commit 9f190ca13c
2 changed files with 7 additions and 7 deletions

View File

@ -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() {

View File

@ -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();