CheckDerivs: Difference between revisions
From TomWiki
Jump to navigationJump to search
(Created page with "==Purpose== TOMLAB routine for verifying derivatives of user supplied routines. ==Calling Syntax== <syntaxhighlight lang="matlab"> [exitFlag,output] = checkDerivs(Prob, x k, ...") |
No edit summary |
||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
TOMLAB | TOMLAB routine for verifying derivatives of user supplied routines. | ||
==Calling Syntax== | ==Calling Syntax== | ||
<syntaxhighlight lang="matlab"> | <syntaxhighlight lang="matlab"> | ||
[exitFlag,output] = checkDerivs(Prob, | [exitFlag,output] = checkDerivs(Prob, x_k, PriLev, ObjDerLev, ConsDerLev, AbsTol) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 16: | Line 16: | ||
|''Prob''||Problem structure created with assign routine. | |''Prob''||Problem structure created with assign routine. | ||
|- | |- | ||
|''x_k''||Point the check derivatives for. Default | |''x_k''||Point the check derivatives for. Default x_0 or (''x<sub>L</sub> ''+ ''x<sub>U</sub> '')''/''2. x_L and x_U have to be within 1e5. | ||
1e5. | |||
|- | |- | ||
|''PriLev''||Print Level, default 1. (0-1 valid). | |''PriLev''||Print Level, default 1. (0-1 valid). | ||
|-valign="top" | |||
|''ObjDerLev''||Depth for objective derivative check, 1 - checks gradient, 2 checks gradient and Hessian. Default 2 or level of derivatives supplied. | |||
|-valign="top" | |||
|''ConsDerLev''||Depth for constraint derivative check, 1 - checks Jacobian, 2 checks Jacobian and 2nd part of the Hessian to the Lagrangian function. Default 2 or level of derivatives supplied. | |||
|- | |- | ||
|'' | |''AbsTol''||Absolute tolerance for errors. Default [1e-5 1e-3 1e-4 1e-3 1e-4] (g H dc d2c J). | ||
|} | |||
==Outputs== | |||
{| class="wikitable" | |||
!Output||Description | |||
|- | |- | ||
|'' | |-valign="top" | ||
|''exitFlag''||If exitFlag = 0 a problem exist. See output for more information. Binary indicates where problem is: 01011. 1 + 2 + 8 = 13. Problems everywhere but 'dc', 'J'. 11111 = 'J' 'd2c' 'dc' 'H' 'g'. | |||
|-valign="top" | |||
|''output''||Structure containing analysis information. | |||
g,H,dc,d2c,J Structure with results. | |||
minErr: The smallest error. | |||
avgErr: The average error. | |||
maxErr: The largest error. | |||
idx: Index for elements with errors. | |||
exitFlag: 1 if problem with the function. | |||
|} | |} | ||
===See Also=== | |||
*[[runtest]] |
Revision as of 06:39, 22 July 2011
Purpose
TOMLAB routine for verifying derivatives of user supplied routines.
Calling Syntax
[exitFlag,output] = checkDerivs(Prob, x_k, PriLev, ObjDerLev, ConsDerLev, AbsTol)
Inputs
Input | Description |
---|---|
Prob | Problem structure created with assign routine. |
x_k | Point the check derivatives for. Default x_0 or (xL + xU )/2. x_L and x_U have to be within 1e5. |
PriLev | Print Level, default 1. (0-1 valid). |
ObjDerLev | Depth for objective derivative check, 1 - checks gradient, 2 checks gradient and Hessian. Default 2 or level of derivatives supplied. |
ConsDerLev | Depth for constraint derivative check, 1 - checks Jacobian, 2 checks Jacobian and 2nd part of the Hessian to the Lagrangian function. Default 2 or level of derivatives supplied. |
AbsTol | Absolute tolerance for errors. Default [1e-5 1e-3 1e-4 1e-3 1e-4] (g H dc d2c J). |
Outputs
Output | Description |
---|---|
exitFlag | If exitFlag = 0 a problem exist. See output for more information. Binary indicates where problem is: 01011. 1 + 2 + 8 = 13. Problems everywhere but 'dc', 'J'. 11111 = 'J' 'd2c' 'dc' 'H' 'g'. |
output | Structure containing analysis information.
g,H,dc,d2c,J Structure with results. minErr: The smallest error. avgErr: The average error. maxErr: The largest error. idx: Index for elements with errors. exitFlag: 1 if problem with the function. |