Neural Network

So I've ported this code: http://robotics.hobbizine.com/arduinoann.html
To run on my computer, It compile fine but when run gives "Bus error: 10"

Any help is appreciated :)

heres my code: http://studioeighteen.net/pdf/output.pdf
(it was too long to post on here, sorry..)
Maybe someone could help you to debug it if you provide a .c or .cpp file (instead of a PDF)
$ gdb a.out
Program received signal SIGSEGV, Segmentation fault.
0x00000000004013d6 in main () at ANN.cpp:181
181						Accum += Input[p][j] * HiddenWeights[j][i] ;
(gdb) print p
$1 = 566


p = RandomizedIndex[q]; //172
RandomizedIndex is filled from 0 to size-1 and then shuffled, however your shuffle
1
2
3
4
5
6
7
		for( p = 0 ; p < PatternCount ; p++) {
			q = rand() % PatternCount + 1; //¿why +1? Range [1;size]
			//q = random(PatternCount);
			r = RandomizedIndex[p] ; 
			RandomizedIndex[p] = RandomizedIndex[q] ; //possible out of bounds
			RandomizedIndex[q] = r ;
		}

http://en.cppreference.com/w/cpp/algorithm/random_shuffle
Last edited on
Thanks! that worked a treat :D
Topic archived. No new replies allowed.