Re: [petsc-users] Element by element comparison of matrices

2025-01-02 Thread Barry Smith
> -snes_test_jacobian -snes_test_jacobian_view > On Jan 2, 2025, at 5:34 PM, Hammond, Glenn E wrote: > > I need to element info (which row/col combo) to pinpoint which crossterm may > be defective. This is important when debugging analytical derivatives for > chemical reactions. I will look

Re: [petsc-users] Element by element comparison of matrices

2025-01-02 Thread Hammond, Glenn E via petsc-users
I need to element info (which row/col combo) to pinpoint which crossterm may be defective. This is important when debugging analytical derivatives for chemical reactions. I will look into thr SNES approach. Thanks, Glenn On Jan 2, 2025, at 2:25 PM, Barry Smith wrote:  Check twice before you

Re: [petsc-users] Element by element comparison of matrices

2025-01-02 Thread Barry Smith
We also have support for this built into SNES. For example, you provide the analytic to SNES which then compute via differencing, mostly to check if the analytic implementation was correct. You can run an entire set of SNESSolve with this turned on and it will check at all vectors the Jacobi

Re: [petsc-users] Element by element comparison of matrices

2025-01-02 Thread Stefano Zampini
MatAXPY for the difference, MatNorm for the relative error On Thu, Jan 2, 2025, 22:32 Hammond, Glenn E via petsc-users < petsc-users@mcs.anl.gov> wrote: > PETSc Users, > > > > I want to compare two Jacobians matrices (one with derivatives calculated > analytically; the other numerically). I want

[petsc-users] Element by element comparison of matrices

2025-01-02 Thread Hammond, Glenn E via petsc-users
PETSc Users, I want to compare two Jacobians matrices (one with derivatives calculated analytically; the other numerically). I want to apply relatives and/or absolute tolerances. Does anyone know if such capability is built into PETSc? I cannot find anything other the MatEqual() with compares d