I need to calculate the Jacobian matrix of a subroutine F(U). Both F and U are of size $N(=O(10^5))$. Using Tapenade, I differentiated the routine in tangent mode. I cannot calculate the full Jacobian directly because of the large memory requirement.
There are AD (automatic differentiation) software packages that can do this calculation; I know DAEPACK can, because it came out of my PhD advisor's group. It appears that Tapenade does not have sparsity analysis capabilities.
- Is there a package that I can use to parse the differentiated FORTRAN routines to get the sparsity pattern? preferably in python.
My intuition is that it probably doesn't exist, because it would require a lot of static analysis. A cursory Google search backs that up.
- I plan to naively construct the Jacobian matrix using N tangent calculations, using sparsity pattern to reduce the memory usage. Is there a better way of doing this?
Probably. It really depends on what you want to do with the Jacobian matrix. If you mostly want to solve linear systems that are relatively well-conditioned or are amenable to preconditioning, I'd suggest instead considering matrix-free approaches, which would allow you to make use of the tangents you calculate. A Jacobian-free Newton-Krylov approach might even be viable, which would make AD unnecessary.
However, if you really need the entire Jacobian matrix, I'd suggest sparse AD instead.