8 #include "GaussianRandomV.hpp" 9 #include "columns/GaussianRandom.hpp" 10 #include "columns/HyPerCol.hpp" 14 GaussianRandomV::GaussianRandomV() { initialize_base(); }
16 GaussianRandomV::GaussianRandomV(
char const *name, HyPerCol *hc) {
21 GaussianRandomV::~GaussianRandomV() {}
23 int GaussianRandomV::initialize_base() {
return PV_SUCCESS; }
25 int GaussianRandomV::initialize(
char const *name, HyPerCol *hc) {
26 int status = BaseInitV::initialize(name, hc);
38 parent->parameters()->ioParamValue(ioFlag, name,
"meanV", &meanV, meanV);
42 parent->parameters()->ioParamValue(ioFlag, name,
"maxV", &sigmaV, sigmaV);
45 void GaussianRandomV::calcV(
float *V,
PVLayerLoc const *loc) {
50 const int nxny = flatLoc.nx * flatLoc.ny;
51 for (
int b = 0; b < loc->nbatch; b++) {
52 float *VBatch = V + b * loc->nx * loc->ny * loc->nf;
53 #ifdef PV_USE_OPENMP_THREADS 54 #pragma omp parallel for 56 for (
int xy = 0; xy < nxny; xy++) {
57 for (
int f = 0; f < loc->nf; f++) {
58 int index = kIndex(xy, 0, f, nxny, 1, loc->nf);
59 VBatch[index] = randState.gaussianDist(xy, meanV, sigmaV);
virtual void ioParam_sigmaV(enum ParamsIOFlag ioFlag)
sigmaV: The standard deviation of the random distribution
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual void ioParam_meanV(enum ParamsIOFlag ioFlag)
meanV: The mean of the random distribution
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override