Checks whether the partial gradient can be computed for a given problem. function candoit = canGetPartialGradient(problem) Returns true if the partial gradient of the cost function can be computed given the problem description, false otherwise. See also: getPartialGradient canGetPartialEuclideanGradient
0001 function candoit = canGetPartialGradient(problem) 0002 % Checks whether the partial gradient can be computed for a given problem. 0003 % 0004 % function candoit = canGetPartialGradient(problem) 0005 % 0006 % Returns true if the partial gradient of the cost function can be computed 0007 % given the problem description, false otherwise. 0008 % 0009 % See also: getPartialGradient canGetPartialEuclideanGradient 0010 0011 % This file is part of Manopt: www.manopt.org. 0012 % Original author: Nicolas Boumal, June 28, 2016. 0013 % Contributors: 0014 % Change log: 0015 0016 candoit = (isfield(problem, 'partialgrad') && isfield(problem, 'ncostterms')) || ... 0017 canGetPartialEuclideanGradient(problem); 0018 0019 if isfield(problem, 'partialgrad') && ~isfield(problem, 'ncostterms') 0020 warning('manopt:partialgrad', ... 0021 ['If problem.partialgrad is specified, indicate the number n\n' ... 0022 'of terms in the cost function with problem.ncostterms = n.']); 0023 end 0024 0025 end