Changeset 932 for cpp/frams/neuro/neuroimpl.cpp
- Timestamp:
- 05/28/20 18:00:45 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/neuro/neuroimpl.cpp
r896 r932 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-20 18Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2020 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 46 46 , ChannelSpace *ch 47 47 #endif 48 48 ) 49 49 :mod(model), config(conf), 50 50 isbuilt(1), errorcount(0) … … 69 69 for (i = 0; n = mod.getNeuro(i); i++) 70 70 { 71 ni = conf.factory->createNeuroImpl(n );71 ni = conf.factory->createNeuroImpl(n, mod.getShapeType()); 72 72 n->userdata[mytags_id] = ni; 73 73 if (!ni) … … 85 85 for (i = 0; n = mod.getNeuro(i); i++) 86 86 { 87 n->state += (rndDouble(1) - 0.5) *config.randominit;87 n->state += (rndDouble(1) - 0.5) * config.randominit; 88 88 ni = (NeuroImpl*)n->userdata[mytags_id]; 89 89 if (!ni) continue; … … 98 98 ni->status = NeuroImpl::InitOk; 99 99 int order = ni->getSimOrder(); 100 if (order < 0) order = 0; else if (order >2) order = 2;100 if (order < 0) order = 0; else if (order > 2) order = 2; 101 101 if (order < minorder) minorder = order; 102 102 if (order > maxorder) maxorder = order; … … 189 189 double NeuroImpl::getNewState(int channel) 190 190 { 191 if (neuro->flags &Neuro::HoldState) return getState(channel);191 if (neuro->flags & Neuro::HoldState) return getState(channel); 192 192 if (channel >= channels) channel = channels - 1; 193 193 if (channel <= 0) { return newstate; } … … 204 204 void NeuroImpl::commit() 205 205 { 206 if (!(neuro->flags &Neuro::HoldState))206 if (!(neuro->flags & Neuro::HoldState)) 207 207 { 208 208 if (channels > 1) … … 211 211 if (owner->getConfig().nnoise > 0.0) 212 212 { 213 neuro->state += RndGen.GaussStd() *owner->getConfig().nnoise;213 neuro->state += RndGen.GaussStd() * owner->getConfig().nnoise; 214 214 if (channels > 1) 215 215 for (int i = 0; i < chstate.size(); i++) 216 chstate(0) += RndGen.GaussStd() *owner->getConfig().nnoise;216 chstate(0) += RndGen.GaussStd() * owner->getConfig().nnoise; 217 217 } 218 218 } … … 270 270 double w; 271 271 while (inp = neuro->getInput(startwith++, w)) 272 sum += inp->state *w;272 sum += inp->state * w; 273 273 return sum; 274 274 }
Note: See TracChangeset
for help on using the changeset viewer.