New to nim and ran into a problem with creating arrays.
I have a proc which takes two arrays - one, 2dimensional, and another 3dimensional. Inside of the proc I'm trying to create a new array which is also 3-dimensional and has about 7+million values in it - the same as the lt array that I pass as a parameter. I'm able to create the array outside of the proc just fine, however inside of the proc it leads to a runtime error.
Below is the code I have at the moment, it compiles fine and only crashes when I instantiate the array inside of the proc. Also if I change the values a little so that the array is smaller ~1million values then it works.
I can't find any information about why this might be the case in the documentation, so any help would be nice.
type
Matrix[W, H, D: static[int]] =
array[W, array[H, array[D, float]]]
proc response_given_stimuli[T, N](p: T, lt: N) : var Matrix[num_models, stimuli_range.len, response_range.len] =
echo "prob_rx function"
var rgs : Matrix[num_models, stimuli_range.len, response_range.len]
echo rgs.len
for m in 0 .. num_models-1:
for s in 0 .. stimuli_range.len-1:
for r in 0 .. response_range.len-1:
rgs[m][s][r] = lt[m][s][r] * p[m][3]
return rgs