[petsc-dev] TAO method selection (was "coding style")

Jed Brown jed at jedbrown.org
Fri Aug 19 18:08:30 CDT 2016

"Oxberry, Geoffrey Malcolm" <oxberry1 at llnl.gov> writes:
> Something similar can be used for quadratics.  Here you evaluate
> the Hessian at two random points.  You really want to calculate
> the distance between the matrices.  I did not find that method
> in the PETSc documentation.  Therefore, I would compare the
> values of Hessian vector products, H1*y - H2*y where y is
> a random vector.
> You could call MatNorm (http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatNorm.html), and use it to determine if, say, the infinity-norm of the difference between the matrices is small.

It's rather onerous to require MatAXPY() and MatNorm() for this (the
Hessian is often defined via MatShell) but one can use MatMultEqual()
for a probabilistic comparison.  If the matrix has the same action on a
few random vectors, it is very likely to be identical.  And I can't
think of a use case in which this test needs to be robust to "attack"
(e.g., predicting the random vectors and making the matrices behave
identically in that subspace while actually being different), it just
needs to catch the common mistake of using an inappropriate solver.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160819/65d92a69/attachment.sig>

More information about the petsc-dev mailing list