Skip to content
Prev 332 / 696 Next

[R-sig-dyn-mod] lsodes with jacobian

Hi Karline,
On Mo, 2014-07-07 at 08:09 +0000, Karline Soetaert wrote:
I am glad that you respond :-)
I had a look at the documentation of sparsetype="sparsejan". I don't
understand why "ian" should have n+1 elements. Let's assume the jacobian
matrix

0 1 0
0 0 1
1 1 1

Then, I have

jan = c(3, 1, 3, 2, 3) #third element in column 1, first and third
element in column 2, ...

ian = c(1, 2, 4) #column1 starts at element 1 of jan, column2 starts at
element 2 of jan, column3 starts at element 4 of jan.

In case, I did not understand the documentation correctly. Could you
tell me "jan" and "ian" for the above example?
I tried to run my exmample with verbose=TRUE. However, when specifying
jacvec, I get the following error:

-------------------- 
Integration method 
--------------------
 
Error in cat(message, "\n") : object 'txt' not found
I have one more question about the correct arguments of jacvec in the C
code. In the fortran code (odepack.f from
http://people.sc.fsu.edu/~jburkardt/f77_src/odepack/odepack.f) I find
the specifications

SUBROUTINE JAC (NEQ, T, Y, J, IAN, JAN, PDJ)
DOUBLE PRECISION T, Y(*), IAN(*), JAN(*), PDJ(*)

In contrast, in the deSolve package in the file "call_lsoda.c", I find

static void C_jac_vec (int *neq, double *t, double *y, int *j,
            int *ian, int *jan, double *pdj, double *yout, int *iout)

My point is, that IAN and JAN are double in fortran and integers in C.
Is this a contradiction?

Sorry for so many questions.

Best regards,
Daniel