( byte ) type,
( float ) synWei ) );
if(index>=0)
{
final MutableSynapse synapseMut = ( MutableSynapse )
axons.get(fromIndex).branches[(int)(sid.id)].synapses[index];
synapseMut.setWeight ( ( float ) synWei );
}
else
{
throw new RuntimeException("modify none existing synapse");
}
}
}
}
}
}
}
else //divergent // change it into convergent
{
conn = FunUtil.lRotate90(trans);
if(t_xmulti<0&&f_xmulti>0)
{
numX = f_xmulti;
denomX = 1;
}
else if(t_xmulti<0&&f_xmulti<0)
{
numX = 1;
denomX = 1;
}
else if(t_xmulti>0&&f_xmulti>0)
{
numX = f_xmulti;
denomX = t_xmulti;
}
else if(t_xmulti>0&&f_xmulti<0)
{
numX = 1;
denomX = t_xmulti;
}
if(t_ymulti<0&&f_ymulti>0)
{
numY = f_ymulti;
denomY = 1;
}
else if(t_ymulti<0&&f_ymulti<0)
{
numY = 1;
denomY = 1;
}
else if(t_ymulti>0&&f_ymulti>0)
{
numY = f_ymulti;
denomY = t_ymulti;
}
else if(t_ymulti>0&&f_ymulti<0)
{
numY = 1;
denomY = t_ymulti;
}
for(int iterx=xOri_tt;iterx<xresosize_tt;iterx+=xstep_tt)
{
for(int itery=yOri_tt;itery<yresosize_tt;itery+=ystep_tt)
{
int neuronID=cellmap_slow(t_pre,t_suf,iterx,itery);
xy=closePoint((int)((double)numX/(double)denomX*iterx),(int)((double)numY/(double)denomY*itery), f_pre, f_suf);
newx=xy[0];
newy=xy[1];
for(int itxx=newx-((int)((double)(conn.length/2)*(((double)numX/(double)denomX*(double)t_xstep/(double)f_xstep)))+1)*(f_xstep);itxx<=newx+((int)((double)(((conn.length%2)==0?conn.length-1:conn.length)/2)*(((double)numX/(double)denomX*(double)t_xstep/(double)f_xstep))))*(f_xstep);itxx+=f_xstep) // if matrix is even, the center is center+0.5, if matrix is odd, center is center
{
for(int ityy=newy-((int)((double)(conn[0].length/2)*(((double)numY*(double)t_ystep/(double)denomY/(double)f_ystep)))+1)*(f_ystep);ityy<=newy+((int)((double)(((conn[0].length%2)==0?conn[0].length-1:conn[0].length)/2)*(((double)numY*(double)t_ystep/(double)denomY/(double)f_ystep))))*(f_ystep);ityy+=f_ystep)
{
if(periodic)
{
xborder = itxx % f_xresosize;
yborder = ityy % f_yresosize;
if(xborder<0) xborder+=f_xresosize;
if(yborder<0) yborder+=f_yresosize;
}
else
{
if(itxx >= f_xresosize || itxx < 0 || ityy >= f_yresosize || ityy<0) // out of boundary
{
continue;
}
else //within boundary
{
xborder = itxx;
yborder = ityy;
}
}
int fromIndex = cellmap_slow(f_pre,f_suf,xborder,yborder);
int maX = (int)((((double)itxx)/(double)numX*(double)denomX)-iterx)/t_xstep+(((conn.length%2)==0?conn.length-1:conn.length)/2);
int maY = (int)((((double)ityy)/(double)numY*(double)denomY)-itery)/t_ystep+(((conn[0].length%2)==0?conn[0].length-1:conn[0].length)/2);
if(maX>=0 && maX < conn.length && maY>=0 && maY < conn[0].length )
{
if(Math.abs(conn[maX][maY])!=0)
{
double synWei = stre*conn[maX][maY];
if(Math.abs(synWei) > SIFNeuron.maxWeight)
{
if( Math.abs(synWei) / SIFNeuron.maxWeight > maxOutput) maxOutput = Math.abs(synWei) / SIFNeuron.maxWeight;
}
SizeID sid = scaffold.get(fromIndex).get(String.valueOf(delay));
int index = Arrays.binarySearch (
axons.get(fromIndex).branches[(int)(sid.id)].synapses,
modelFactory.createSynapse (
neuronID,
( byte ) type,
( float ) synWei ) );
if(index>=0)
{
final MutableSynapse synapseMut = ( MutableSynapse )
axons.get(fromIndex).branches[(int)(sid.id)].synapses[index];
synapseMut.setWeight ( ( float ) synWei );
}
else
{
throw new RuntimeException("modify none existing synapse");
}