A user here at UCI is starting to delve into ncap2/GSL, and who has
run into questions that I can't answer.
The first is can ncap2 use pass array elements by reference?
For example, in passing GSL parameters whose values are to be returned
she would like to do this:
gsl_fit_linear(time,1,snc(area_idx,exp_idx,:),1,$time.size, &c0(area_idx,exp_idx), &tc1, &cov00, &cov01,&cov11,&sumsq);
The fourth parameter, &c0(area_idx,exp_idx), is intended to be a
reference to an array element. But this does not seem to work.
Instead she has to pass a reference to a scalar, &tc0:
and then manually copy the returned value into the array element that
she wished to pass. Is this because the GSL routine wants a full
variable? Or…? What is the best strategy for allowing this?
e.g., can we overload these GSL prototypes to accept different types
of references, i.e., references to simple "data slots" (float *) as
well as refereces to full variables (var *)? Thoughts?
Also, with regards to
she noted that the variables cov00 and cov01 did not contain the
covariances on return. they contained something, just not the
covariances. is it possible that the NCO prototype was somehow
mangles? she was able to manually compute the covariances with
she also noted that the gsl_stats_covariance() and correlation
functions have slightly different prototypes than the GSL functions
themselves. Apparently the NCO versions require extra parameters to
specify the size of the input arrays, whereas the GSL routines figure
that out automatically aor make assumptions.