Skip to content

Commit

Permalink
Code crashes on mapsize[0] * mapsize[1]
Browse files Browse the repository at this point in the history
This needs to be changed to self.mapsize[0]* self.mapsize[1] 
If one value is passed to the mapsize eg: mapsize[1000], this indicates the number of nodes

_size = [1, mapsize[0]] this creates a new array , [1,1000]
 self.mapsize = _size assigns newarray to self.mapsize.

self.nnodes = mapsize[0]*mapsize[1].. here mapsize is still the old array that was passed as a parameter [1000] * outof bound index, throws error
  • Loading branch information
businessglitch authored Nov 1, 2018
1 parent 76b60eb commit f4e5518
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sompy/codebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, mapsize, lattice='rect'):
"Mapsize is expected to be a 2 element list or a single int")

self.mapsize = _size
self.nnodes = mapsize[0]*mapsize[1]
self.nnodes = self.mapsize[0]*self.mapsize[1]
self.matrix = np.asarray(self.mapsize)
self.initialized = False

Expand Down

0 comments on commit f4e5518

Please sign in to comment.