<commit_before>/*
 * HMaxSimple.cpp
 *
 *  Created on: Nov 20, 2008
 *      Author: bjt
 */

#include "HMaxSimple.hpp"

namespace PV {

HMaxSimple::HMaxSimple(const char * name, HyPerCol * hc) : HyPerLayer(name, hc)
{
   initialize(TypeGeneric);
}

int HMaxSimple::recvSynapticInput(HyPerConn * conn, PVLayerCube * activity, int neighbor)
{
   pv_debug_info("[%d]: HMaxSimple::recvSynapticInput: layer %d from %d)",
                 clayer->columnId,
                 conn->preSynapticLayer()->clayer->layerId, clayer->layerId);

   // use implementation in base class
   HyPerLayer::recvSynapticInput(conn, activity, neighbor);

   return 0;
}

int HMaxSimple::updateState(float time, float dt)
{
   pv_debug_info("[%d]: HMaxSimple::updateState:", clayer->columnId);

   // just copy accumulation buffer to membrane potential
   // and activity buffer (nonspiking)

   pvdata_t * phi = clayer->phi[0];
   pvdata_t * activity = clayer->activity->data;

   // make sure activity in border is zero
   //
   // TODO - set numActive and active list?
   int numActive = 0;
   for (int k = 0; k < clayer->numExtended; k++) {
      activity[k] = 0.0;
   }

   for (int k = 0; k < clayer->numNeurons; k++) {
      int kPhi = kIndexExtended(k, clayer->loc.nx, clayer->loc.ny, clayer->numFeatures,
                                   clayer->loc.nPad);
      clayer->V[k] = phi[kPhi];
      activity[k] = phi[kPhi];
      phi[kPhi] = 0.0;     // reset accumulation buffer
   }

   return 0;<commit_msg>Started top down connection orientation.<commit_after>/*
 * HMaxSimple.cpp
 *
 *  Created on: Nov 20, 2008
 *      Author: bjt
 */

#include "HMaxSimple.hpp"

namespace PV {

HMaxSimple::HMaxSimple(const char * name, HyPerCol * hc) : HyPerLayer(name, hc)
{
   initialize(TypeGeneric);
}

int HMaxSimple::recvSynapticInput(HyPerConn * conn, PVLayerCube * activity, int neighbor)
{
   pv_debug_info("[%d]: HMaxSimple::recvSynapticInput: layer %d from %d)",
                 clayer->columnId,
                 conn->preSynapticLayer()->clayer->layerId, clayer->layerId);

   // use implementation in base class
   //HyPerLayer::recvSynapticInput(conn, activity, neighbor);

   PVLayer * lPre  = conn->preSynapticLayer() ->clayer;
   PVLayer * lPost = conn->postSynapticLayer()->clayer;

   const PVLayerLoc locPost = lPost->loc;

   const int nxPost = locPost.nx;
   const int nyPost = locPost.ny;
   const int nfPost = lPost->numFeatures;

   const int nxPreEx = lPre->loc.nx;
   const int nyPreEx = lPre->loc.ny;
   const int nfPre   = lPre->numFeatures;
   const int nPadPre = lPre->loc.nPad;

   const int aStrideX = nfPre;
   const int aStrideY = nfPre * (nxPreEx + 2*nPadPre);

   KernelConn * kConn = dynamic_cast<KernelConn*>(conn);

#ifdef FORTRAN
   int iKernel = 0;  // TODO - fix for multiple orientations
   PVPatch * weights = kConn->getKernelPatch(iKernel);

   pvdata_t * w = weights->data;
   pvdata_t * V = lPost->V;

   const int nxp = weights->nx;
   const int nyp = weights->ny;

   call convolve(nx)


#endif

   return 0;
}

int HMaxSimple::updateState(float time, float dt)
{
   pv_debug_info("[%d]: HMaxSimple::updateState:", clayer->columnId);

   // just copy accumulation buffer to membrane potential
   // and activity buffer (nonspiking)

   pvdata_t * phi = clayer->phi[0];
   pvdata_t * activity = clayer->activity->data;

   // make sure activity in border is zero
   //
   // TODO - set numActive and active list?
   int numActive = 0;
   for (int k = 0; k < clayer->numExtended; k++) {
      activity[k] = 0.0;
   }

   for (int k = 0; k < clayer->numNeurons; k++) {
      int kPhi = kIndexExtended(k, clayer->loc.nx, clayer->loc.ny, clayer->numFeatures,
                                   clayer->loc.nPad);
      clayer->V[k] = phi[kPhi];
      activity[k] = phi[kPhi];
      phi[kPhi] = 0.0;     // reset accumulation buffer
   }

   return 0;
{'fraction_non_alphanumeric': 0.13414318945463943, 'fraction_numerical': 0.008787800465236495, 'mean_word_length': 2.909090909090909, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4979518', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1310, 'n_words': 329}