PetaVision  Alpha
InitCocircWeights.hpp
1 /*
2  * InitCocircWeights.hpp
3  *
4  * Created on: Aug 8, 2011
5  * Author: kpeterson
6  */
7 
8 #ifndef INITCOCIRCWEIGHTS_HPP_
9 #define INITCOCIRCWEIGHTS_HPP_
10 
11 #include "InitGauss2DWeights.hpp"
12 
13 namespace PV {
14 
16  protected:
17  virtual void ioParam_sigmaCocirc(enum ParamsIOFlag ioFlag);
18  virtual void ioParam_sigmaKurve(enum ParamsIOFlag ioFlag);
19  virtual void ioParam_cocircSelf(enum ParamsIOFlag ioFlag);
20  virtual void ioParam_deltaRadiusCurvature(enum ParamsIOFlag ioFlag);
21 
22  public:
23  InitCocircWeights(char const *name, HyPerCol *hc);
24  virtual ~InitCocircWeights();
25 
26  virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
27 
28  virtual void calcWeights(int patchIndex, int arborId) override;
29 
30  protected:
32  int initialize(char const *name, HyPerCol *hc);
33 
34  private:
35  float calcKurvePostAndSigmaKurvePost(int kfPost);
36  float calcKurveAndSigmaKurve(
37  int kf,
38  int &nKurve,
39  float &sigma_kurve_temp,
40  float &kurve_tmp,
41  bool &iPosKurve,
42  bool &iSaddle);
43  void initializeDistChordCocircKurvePreAndKurvePost();
44  bool calcDistChordCocircKurvePreNKurvePost(float xDelta, float yDelta, int kfPost, float thPost);
45  void addToGDist(float inc);
46  bool checkSameLoc(int kfPost);
47  void updateCocircNChord(
48  float thPost,
49  float dyP_shift,
50  float dxP,
51  float cocircKurve_shift,
52  float d2_shift);
53  bool checkFlags(float dyP_shift, float dxP);
54  void updategKurvePreNgKurvePost(float cocircKurve_shift);
55  float calculateWeight();
56  void cocircCalcWeights(float *dataStart);
57 
58  private:
59  float mSigmaCocirc = 0.5f * PI;
60  float mSigmaKurve = 1.0f; // fraction of delta_radius_curvature
61  float mCocircSelf = false;
62  float mDeltaRadiusCurvature = 1.0f; // 1 = minimum radius of curvature
63  float mMinWeight = 0.0f; // read in as param
64  bool mPosKurveFlag = false; // handle pos and neg curvature separately
65  bool mSaddleFlag = false; // handle saddle points separately
66 
67  // calculated parameters:
68  int mNKurvePre;
69  bool mIPosKurvePre;
70  bool mISaddlePre;
71  float mKurvePre;
72  int mNKurvePost;
73  bool mIPosKurvePost;
74  bool mISaddlePost;
75  float mKurvePost;
76  float mSigmaKurvePre;
77  float mSigmaKurvePre2;
78  float mSigmaKurvePost;
79  float mSigmaKurvePost2;
80 
81  // used for calculating weights:
82  float mGDist;
83  float mGCocirc;
84  float mGKurvePre;
85  float mGKurvePost;
86 
87 }; // class InitCocircWeights
88 
89 } /* namespace PV */
90 #endif /* INITCOCIRCWEIGHTS_HPP_ */
virtual void calcWeights() override
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override