Page 1 of 1

Declare a matrix in NMODL

Posted: Tue Mar 06, 2012 12:04 pm
by redarrow
Hi,

I was wondering whether it is possible to declare a matrix in NMODL, without having to use VERBATIM blocks. I tried to use the same syntax as for arrays, but the compilation failed.

Thank you for your help,
Daniele

Re: Declare a matrix in NMODL

Posted: Tue Mar 06, 2012 5:10 pm
by hines
I'm afraid nmodl does not support multidimensional arrays. You have to map it into a fixed size 1-d array.
That is often unacceptable and so many mod files use VERBATIM to wrap hoc Vector using
extern int vector_capacity(Vect*);
extern void vector_resize(Vect*, int);
extern double* vector_vec(Vect*);
extern Vect* vector_arg(int);
extern bool is_vector_arg(int);
See nrn/src/nrnoc/pattern.mod or (simpler) nrn/share/examples/nrniv/netcon/vecevent.mod for examples.