Thanks for the prompt reply!
Still I believe I'm missing something about arg and res. Before your reply, as in my application inputs are always dense column vectors, I was allocating arg as an array of n_in pointers to double,
each of which was then allocated as an array of size f.size1_in(i). Same story for the results, except I have a number n_out of pointers to double, each of which points to a location f.sparsity_out(i).nnz() large
(outputs can be sparse in my application)
Roughly:
double** arg = new double*[f.n_in()];
for(int i = 0; i < f.n_in(); ++i)
arg[i] = new double[f.size1_in(i)];
double** res = new double*[f.n_out()];
for(int i = 0; i < f.n_out(); ++i)
res[i] = new double[f.sparsity_out(i).nnz()];
Now I understood that sz_arg and sz_res can be larger than what I provide. However, what should be the length of the trailing arrays, as f.size1_in(i) or f.sparsity_out(i) can't be called
for i >= n_in ?
Last thing, what is the purpose of the checkout/release mechanism? Should I call release every time I call the function (after consuming its output maybe)?