I’m trying to build a lateral inhibition and SOM neural network based on spatial distance, Created a NeuronGroup with 98×98 or 998×998 neurons, When assigning each neuron a spatial location, I found that in the C++ standalone mode the location will be changed, and this situation only occurs in 98,998 ,maybe more(49,98,103,107,161,187,196,197,206,214,237,239,249,253,…), is something wrong?
Hi @ansuz, many thanks for the report, this seems indeed to be a bug! This looks very much like a floating point issue, i.e. something like int(0.3/(3*0.1)) being 0 (since the argument of the int function is 0.999…). But then of course, in your case you are dividing integers, so it shouldn’t use floating point operations in the first place. I will look into this in more detail soon, but until then you can use one of the following workarounds:
Pre-calculate the positions, instead of using Brian’s code generation mechanism, i.e. use:
Hi, @mstimberg,Thank you sincerely for your response and suggestions, which’s effectively solved the problem that confused me, and also wish you could find the way to fix it smoothly.