Skip to content

Commit

Permalink
tick one vs tick vector
Browse files Browse the repository at this point in the history
  • Loading branch information
LemurPwned committed Dec 27, 2023
1 parent b87d788 commit 615a18b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 706 deletions.
9 changes: 3 additions & 6 deletions core/junction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ enum SolverMode
HEUN = 3
};

// seems to be the faster so far.
// static std::mt19937 generator((std::random_device{}()));

template <typename T = double>
class Layer
{
Expand Down Expand Up @@ -173,7 +170,7 @@ class Layer
Reference referenceType = NONE;

// the distribution is binded for faster generation
// is also shared between 1f and Gaussian noise.
// is also shared between 1/f and Gaussian noise.
std::function<T()> distribution = std::bind(std::normal_distribution<T>(0, 1), std::mt19937(std::random_device{}()));

CVector<T> dWn, dWn2; // one for thermal, one for OneF
Expand Down Expand Up @@ -908,7 +905,7 @@ class Layer
const T getStochasticOneFNoise(T time) {
if (!this->pinkNoiseSet)
return 0;
else if (this->noiseParams.scaleNoise != 0){
else if (this->noiseParams.scaleNoise != 0) {
// use buffered noise if available
return this->bfn->tick();
}
Expand Down Expand Up @@ -1016,7 +1013,7 @@ class Layer
CVector<T> dW2 = CVector<T>(this->distribution);
if (this->noiseParams.scaleNoise != 0)
{
dW2 = this->bfn->tick();
dW2 = this->bfn->tickVector();
}
dW.normalize();
dW2.normalize();
Expand Down
12 changes: 11 additions & 1 deletion core/noise.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class VectorAlphaNoise {
this->components_y = std::unique_ptr<BufferedAlphaNoise<T>>(new BufferedAlphaNoise<T>(bufferSize, alpha, std, 1.));
this->components_z = std::unique_ptr<BufferedAlphaNoise<T>>(new BufferedAlphaNoise<T>(bufferSize, alpha, std, 1.));
}
CVector<T> tick() {
CVector<T> tickVector() {
this->prevSample = this->currentSample;
this->currentSample = CVector<T>(
this->components_x->tick(),
Expand All @@ -244,6 +244,16 @@ class VectorAlphaNoise {
this->currentSample.normalize();
return this->currentSample;
}

T tick(){
return this->components_x->tick();
}


CVector<T> getPrevSample() {
return this->prevSample;
}

T getScale() {
return this->scale;
}
Expand Down
699 changes: 0 additions & 699 deletions examples/sb-optimisation/optim2.ipynb

This file was deleted.

0 comments on commit 615a18b

Please sign in to comment.