> On Oct 22, 2015, at 9:20 AM, Marco Zocca <[email protected]> wrote:
> 
> The signature of SNESSetJacobian is 
> 
> PetscErrorCode  SNESSetJacobian(SNES snes,Mat Amat,Mat Pmat,PetscErrorCode 
> (*J)(SNES,Vec,Mat,Mat,void*),void *ctx)         
> 
> however it would seem redundant to supply both a constant matrix and a 
> function to compute the Jacobian.
> The manual says of J "(if NULL then SNES retains any previously set value": 
> this would only apply to linear functions, is this correct?
> 
> Why then are there not two monomorphic "SetJacobian" functions, one for 
> linear maps that wouldn't require recomputation and one for every other case 
> ? 

  For the linear case you can just pass in a function J that simply returns 
without changing the matrices.

  Barry

> 
> Coming from a functional background, I find reasoning with "NULL" to be very 
> error-prone.

   Agreed. Limitation of C and the style of API we selected of trying to 
minimize the number of different functions in the interface.

> 
> Thank you,
> Marco

Reply via email to