# SNESDefaultMatrixFreeSetParameters2

Sets the parameters for the approximation of matrix-vector products using finite differences.

### Synopsis

    #include "petscsnes.h"
    PetscErrorCode PETSCSNES_DLLEXPORT SNESDefaultMatrixFreeSetParameters2(Mat mat,PetscReal error,PetscReal umin,PetscReal h)

          J(u)*a = [J(u+h*a) - J(u)]/h where

either the user sets h directly here, or this parameter is computed via

           h = error_rel*u'a/||a||^2                        if  |u'a| > umin*||a||_{1}

             = error_rel*umin*sign(u'a)*||a||_{1}/||a||^2   else

### Input Parameters

| mat | - the matrix
| error_rel | - relative error (should be set to the square root of the relative error in the function evaluations)
| umin | - minimum allowable u-value
| h | - differencing parameter

### Notes

If the user sets the parameter h directly, then this value will be used instead of the default computation indicated above.

### Keywords

SNES, matrix-free, parameters

### See Also

MatCreateSNESMF()

Level:advanced
Location: src/snes/interface/noise/snesmfj2.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages