# [ADOL-C] sparse jacobian: inf's and nan's in non-zeros values array

Kshitij Kulshreshtha kshitij at math.upb.de
Tue Mar 26 13:15:08 EDT 2013

```Hello,

Are the inf's and nan's happening at the same evaluation point as the
taping point?

Since the number of dependents in your function are quite small you may
try to invoke the vector reverse mode for computing the dense jacobian.
It will require as seed matrix the identity matrix of 5x5 size. If this
still gives you inf's and nan's there is something inherently wrong in
the function which is doing invalid operations like division by zero.
Once the first inf occurs, any further computation will create nan's.

There are ways to stop the evaluation in a debugger whenever an invalid
arithmetic operation occurs. This will lead you to the first occurance
of an inf or nan.

However if the dense jacobian is correct and free of inf's and nan's,
try to print out the seed matrix used for sparse jacobian computation
and see if it has any inf's or nan's.

If all else fails, we'll need to look at your code (or any example that
reproduces the problem).

Best
Kshitij.

As on 22.03.2013 15:21h, Antoine De Blois did write:
> Hi everyone,
>
>
>
> I created a ticket on the trac system, but I don’t know which is the
> preferred way (trac or mailing list) please advise. Here is my problem:
>
>
>
> I am trying to solve the jacobian of a residual function in my
> structured  CFD solver. In my application, I have 5 dependent variables
> and roughly
>
> 1700 independent variables. The number of non-zero values in the
> jacobian  matrix is roughly 200, hence the usage of the sparse_jac driver.
>
>
>
> The jacobian driver works perfectly fine, but I obtain inf's and nan's
> in  the non-zeros values array. Note that the row and column index
> arrays are  fine when compared to the entire matrix output of the
> jacobian driver. I  tried changing the option array without success.
>
>
>
> I was using version 2.3.0 and recently upgraded to 4.3.1 with the same
> behavior. I am using colpack version 1.0.9.
>
>
>
>
> Thank you for your time,
>
> Antoine
>
>
>
> _______________________________________________

--
Dr. Kshitij Kulshreshtha

Institut für Mathematik,