<commit_before>/*
 * InitWeightsParams.hpp
 *
 *  Created on: Aug 10, 2011
 *      Author: kpeterson
 */

#ifndef INITWEIGHTSPARAMS_HPP_
#define INITWEIGHTSPARAMS_HPP_

#include "../include/pv_common.h"
#include "../include/pv_types.h"
#include "../io/PVParams.hpp"
#include "../layers/HyPerLayer.hpp"
#include "../connections/HyPerConn.hpp"
#include <stdlib.h>
#include <string.h>

namespace PV {
class HyPerConn;

class InitWeightsParams {
public:
   InitWeightsParams();
   InitWeightsParams(HyPerConn * pConn);
   virtual ~InitWeightsParams();

   virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag);
   virtual int communicateParamsInfo();

   //get-set methods:
   inline const char * getName()                {return name;}
   inline void setName(const char * name)    {free(this->name); this->name = strdup(name);}
   inline HyPerCol * getParent()                {return parent;}
   inline HyPerLayer * getPre()                 {return pre;}
   inline HyPerLayer * getPost()                {return post;}
   inline HyPerConn * getParentConn()           {return parentConn;}
   inline ChannelType getChannel()              {return channel;}
   inline const char * getFilename()            {return filename;}
   inline bool getUseListOfArborFiles()         {return useListOfArborFiles;}
   inline bool getCombineWeightFiles()          {return combineWeightFiles;}
   inline int getNumWeightFiles()               {return numWeightFiles;}

   virtual void calcOtherParams(int patchIndex);
   float calcYDelta(int jPost);
   float calcXDelta(int iPost);
   float calcDelta(int post, float dPost, float distHeadPreUnits);

   //get/set:
   int getnfPatch();
   int getnyPatch();
   int getnxPatch();
   int getPatchSize();
   int getsx();
   int getsy();
   int getsf();

protected:
   int initialize_base();
   int initialize(HyPerConn * pConn);


   char * name; //this is actually the Connection name
   HyPerLayer     * pre;
   HyPerLayer     * post;
   HyPerCol       * parent;
   HyPerConn      * parentConn;
   ChannelType channel;    // which channel of the post to update (e.g. inhibit)
   char * filename;
   bool useListOfArborFiles;
   bool combineWeightFiles;
   int numWeightFiles;

   void getcheckdimensionsandstrides();
   int kernelIndexCalculations(int patchIndex);
   virtual void ioParam_initWeightsFile(enum ParamsIOFlag ioFlag);
   virtual void ioParam_useListOfArborFiles(enum ParamsIOFlag ioFlag);
   virtual void ioParam_combineWeightFiles(enum ParamsIOFlag ioFlag);
   virtual void ioParam_numWeightFiles(enum ParamsIOFlag ioFlag);
   //more get/set
   inline float getxDistHeadPreUnits()        {return xDistHeadPreUnits;}
   inline float getyDistHeadPreUnits()        {return yDistHeadPreUnits;}
   inline float getdyPost()        {return dyPost;}
   inline float getdxPost()        {return dxPost;}

public:
   float dxPost;
   float dyPost;
   float xDistHeadPreUnits;
   float yDistHeadPreUnits;

};

} /* namespace PV */
#endif /* INITWEIGHTSPARAMS_HPP_ */<commit_msg>Converting to pvwdata_t for weights.<commit_after>/*
 * InitWeightsParams.hpp
 *
 *  Created on: Aug 10, 2011
 *      Author: kpeterson
 */

#ifndef INITWEIGHTSPARAMS_HPP_
#define INITWEIGHTSPARAMS_HPP_

#include "../include/pv_common.h"
#include "../include/pv_types.h"
#include "../io/PVParams.hpp"
#include "../layers/HyPerLayer.hpp"
#include "../connections/HyPerConn.hpp"
#include <stdlib.h>
#include <string.h>

namespace PV {
class HyPerConn;

class InitWeightsParams {
public:
   InitWeightsParams();
   InitWeightsParams(HyPerConn * pConn);
   virtual ~InitWeightsParams();

   virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag);
   virtual int communicateParamsInfo();

   //get-set methods:
   inline const char * getName()                {return name;}
   inline void setName(const char * name)    {free(this->name); this->name = strdup(name);}
   inline HyPerCol * getParent()                {return parent;}
   inline HyPerLayer * getPre()                 {return pre;}
   inline HyPerLayer * getPost()                {return post;}
   inline HyPerConn * getParentConn()           {return parentConn;}
   inline ChannelType getChannel()              {return channel;}
   inline const char * getFilename()            {return filename;}
   inline bool getUseListOfArborFiles()         {return useListOfArborFiles;}
   inline bool getCombineWeightFiles()          {return combineWeightFiles;}
   inline int getNumWeightFiles()               {return numWeightFiles;}

   virtual void calcOtherParams(int patchIndex);
   float calcYDelta(int jPost);
   float calcXDelta(int iPost);
   float calcDelta(int post, float dPost, float distHeadPreUnits);

   //get/set:
   int getnfPatch();
   int getnyPatch();
   int getnxPatch();
   int getPatchSize();
   int getsx();
   int getsy();
   int getsf();

   float getwMin();     // minimum allowed weight value
   float getwMax();     // maximum allowed weight value

protected:
   int initialize_base();
   int initialize(HyPerConn * pConn);

   char * name; //this is actually the Connection name
   HyPerLayer     * pre;
   HyPerLayer     * post;
   HyPerCol       * parent;
   HyPerConn      * parentConn;
   ChannelType channel;    // which channel of the post to update (e.g. inhibit)
   char * filename;
   bool useListOfArborFiles;
   bool combineWeightFiles;
   int numWeightFiles;

   void getcheckdimensionsandstrides();
   int kernelIndexCalculations(int patchIndex);
   virtual void ioParam_initWeightsFile(enum ParamsIOFlag ioFlag);
   virtual void ioParam_useListOfArborFiles(enum ParamsIOFlag ioFlag);
   virtual void ioParam_combineWeightFiles(enum ParamsIOFlag ioFlag);
   virtual void ioParam_numWeightFiles(enum ParamsIOFlag ioFlag);
   //more get/set
   inline float getxDistHeadPreUnits()   {return xDistHeadPreUnits;}
   inline float getyDistHeadPreUnits()   {return yDistHeadPreUnits;}
   inline float getdyPost()              {return dyPost;}
   inline float getdxPost()              {return dxPost;}

   float dxPost;
   float dyPost;
   float xDistHeadPreUnits;
   float yDistHeadPreUnits;
};

} /* namespace PV */
#endif /* INITWEIGHTSPARAMS_HPP_ */
{'fraction_non_alphanumeric': 0.0963855421686747, 'fraction_numerical': 0.0019537609899055682, 'mean_word_length': 3.3018207282913163, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2747911', 'n_tokens_mistral': 1860, 'n_tokens_neox': 1817, 'n_words': 499}