Home > manopt > core > canGetGradient.m

## PURPOSE

Checks whether the gradient can be computed for a problem structure.

## DESCRIPTION

``` Checks whether the gradient can be computed for a problem structure.

Returns true if the gradient of the cost function can be computed given
the problem description, false otherwise.

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:
• canGetDirectionalDerivative Checks whether dir. derivatives can be computed for a problem structure.
• canGetSubgradient Checks whether a subgradient can be computed for a problem structure.
• getDirectionalDerivative Computes the directional derivative of the cost function at x along d.
• getSubgradient Computes a subgradient of the cost function at x, up to a tolerance
• arc Adaptive regularization by cubics (ARC) minimization algorithm for Manopt
• barzilaiborwein Riemannian Barzilai-Borwein solver with non-monotone line-search.
• rlbfgs Riemannian limited memory BFGS solver for smooth objective functions.
• approxhessianFD Hessian approx. fnctn handle based on finite differences of the gradient.
• steepestdescent Steepest descent (gradient descent) minimization algorithm for Manopt.
• trustregions Riemannian trust-regions solver for optimization on manifolds.
• checkdiff Checks the consistency of the cost function and directional derivatives.
• checkgradient Checks the consistency of the cost function and the gradient.
• checkhessian Checks the consistency of the cost function and the Hessian.
• hessianextreme Compute an extreme eigenvector / eigenvalue of the Hessian of a problem.
• hessianspectrum Returns the eigenvalues of the (preconditioned) Hessian at x.
• manoptsolve Gateway helper function to call a Manopt solver, chosen in the options.

## SOURCE CODE

```0001 function candoit = canGetGradient(problem)
0002 % Checks whether the gradient can be computed for a problem structure.
0003 %
0004 % function candoit = canGetGradient(problem)
0005 %
0006 % Returns true if the gradient of the cost function can be computed given
0007 % the problem description, false otherwise.
0008 %
0010
0011 % This file is part of Manopt: www.manopt.org.
0012 % Original author: Nicolas Boumal, Dec. 30, 2012.
0013 % Contributors:
0014 % Change log:
0015 %
0016 %   June 28, 2016 (NB):
0018 %
0019 %   Nov. 1, 2016 (NB):
0021
0025               ... % Check if directional derivatives can be obtained, since
0026               ... % it is possible to compute the gradient from directional
0027               ... % derivatives (expensively). Here, it is not possible to
0028               ... % call canGetDirectionalDerivative, because that function
0029               ... % would then potentially call canGetGradient, thus
0030               ... % starting an infinite loop. As a result, we have some
0031               ... % code redundancy: the check below needs to be kept
0032               ... % equivalent to the check in canGetDirectionalDerivative.
0033               isfield(problem, 'diff');
0034
0035 end```

Generated on Mon 10-Sep-2018 11:48:06 by m2html © 2005