PetaVision  Alpha
NormalizeContrastZeroMean.hpp
1 /*
2  * NormalizeContrastZeroMean.hpp
3  *
4  * Created on: Apr 8, 2013
5  * Author: pschultz
6  */
7 
8 #ifndef NORMALIZECONTRASTZEROMEAN_HPP_
9 #define NORMALIZECONTRASTZEROMEAN_HPP_
10 
11 #include "NormalizeBase.hpp"
12 
13 namespace PV {
14 
16  // Member functions
17  public:
18  NormalizeContrastZeroMean(const char *name, HyPerCol *hc);
19  virtual ~NormalizeContrastZeroMean();
20 
21  virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
22  virtual int normalizeWeights() override;
23 
24  protected:
26  int initialize(const char *name, HyPerCol *hc);
27 
28  virtual void ioParam_minSumTolerated(enum ParamsIOFlag ioFlag);
29  virtual void ioParam_normalizeFromPostPerspective(enum ParamsIOFlag ioFlag);
30 
31  static void subtractOffsetAndNormalize(
32  float *dataStartPatch,
33  int weightsPerPatch,
34  float offset,
35  float normalizer);
36  int accumulateSumAndSumSquared(
37  float *dataPatchStart,
38  int weights_in_patch,
39  float *sum,
40  float *sumsq);
41 
42  private:
43  int initialize_base();
44 
45  // Member variables
46  protected:
47  float minSumTolerated; // Error if abs(sum(weights)) in any patch is less than this amount.
48 }; // class NormalizeContrastZeroMean
49 
50 } /* namespace PV */
51 #endif /* NORMALIZECONTRASTZEROMEAN_HPP_ */
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override