Functions | |
| void | CheckConstraintEvalNonsymbolic (const Constraint &constraint, const Eigen::Ref< const AutoDiffVecXd > &x_autodiff, double tol) |
| Compare the result between Eval<double>() and Eval<AutoDiffXd>(). More... | |
| void | CheckGradientSparsityPattern (const EvaluatorBase &evaluator, const AutoDiffVecXd &x_ad, bool strict=false) |
Checks the gradient sparsity pattern, by evaluating evaluator at x_ad, and compare whether the gradient matches with evaluator.gradient_sparsity_pattern(). More... | |
| void drake::solvers::test::CheckConstraintEvalNonsymbolic | ( | const Constraint & | constraint, |
| const Eigen::Ref< const AutoDiffVecXd > & | x_autodiff, | ||
| double | tol | ||
| ) |
Compare the result between Eval<double>() and Eval<AutoDiffXd>().
Also compare the gradient in Eval<AutoDiffXd>() with a finite difference approximation.
| constraint | The constraint object to test. |
| x_autodiff | The point at which the Eval() methods are tested. |
| tol | Tolerance on the comparison of the results from Eval<double>() and Eval<AutoDiffXd>(). The tolerance on the comparison between the autodiff gradient and the finite difference approximation is sqrt(tolerance) to account for approximation error. |
| void drake::solvers::test::CheckGradientSparsityPattern | ( | const EvaluatorBase & | evaluator, |
| const AutoDiffVecXd & | x_ad, | ||
| bool | strict = false |
||
| ) |
Checks the gradient sparsity pattern, by evaluating evaluator at x_ad, and compare whether the gradient matches with evaluator.gradient_sparsity_pattern().
Notice that evaluator.gradients_sparsity_pattern() contains all the (row, col) indices where the gradient might be non-zero, so evaluator.gradients_sparsity_pattern() is a superset of all the non-zero gradient indices. If strict=true, then we check if evaluator.gradients_sparsity_pattern() is exactly the set of all the non-zero gradient_indices.