Applies the square root of the Hessian preconditioner at x along d. function sqrtPd = getSqrtPrecon(problem, x, d) function sqrtPd = getSqrtPrecon(problem, x, d, storedb) function sqrtPd = getSqrtPrecon(problem, x, d, storedb, key) Returns as sqrtPd the result of applying the square root of the Hessian preconditioner to the tangent vector d at point x. The preconditioner is supposed to be a symmetric, positive definite approximation of the inverse of the Hessian. Its square root must thus be symmetric and positive definite itself. If no square root of preconditioner is available, sqrtPd = d (identity). Note that this may be incompatible with the preconditioner, if that one is supplied in the problem description. Always check with canGetPrecon and canGetSqrtPrecon. storedb is a StoreDB object, key is the StoreDB key to point x. See also: getPrecon canGetPrecon canGetSqrtPrecon getHessian
0001 function sqrtPd = getSqrtPrecon(problem, x, d, storedb, key) 0002 % Applies the square root of the Hessian preconditioner at x along d. 0003 % 0004 % function sqrtPd = getSqrtPrecon(problem, x, d) 0005 % function sqrtPd = getSqrtPrecon(problem, x, d, storedb) 0006 % function sqrtPd = getSqrtPrecon(problem, x, d, storedb, key) 0007 % 0008 % Returns as sqrtPd the result of applying the square root of the Hessian 0009 % preconditioner to the tangent vector d at point x. The preconditioner is 0010 % supposed to be a symmetric, positive definite approximation of the 0011 % inverse of the Hessian. Its square root must thus be symmetric and 0012 % positive definite itself. 0013 % 0014 % If no square root of preconditioner is available, sqrtPd = d (identity). 0015 % Note that this may be incompatible with the preconditioner, if that one 0016 % is supplied in the problem description. Always check with canGetPrecon 0017 % and canGetSqrtPrecon. 0018 % 0019 % storedb is a StoreDB object, key is the StoreDB key to point x. 0020 % 0021 % See also: getPrecon canGetPrecon canGetSqrtPrecon getHessian 0022 0023 % This file is part of Manopt: www.manopt.org. 0024 % Original author: Nicolas Boumal, April 3, 2015. 0025 % Contributors: 0026 % Change log: 0027 0028 % Allow omission of the key, and even of storedb. 0029 if ~exist('key', 'var') 0030 if ~exist('storedb', 'var') 0031 storedb = StoreDB(); 0032 end 0033 key = storedb.getNewKey(); 0034 end 0035 0036 0037 if isfield(problem, 'sqrtprecon') 0038 %% Apply sqrtprecon for the square root of the preconditioner 0039 0040 % Check whether this function wants to deal with storedb or not. 0041 switch nargin(problem.sqrtprecon) 0042 case 2 0043 sqrtPd = problem.sqrtprecon(x, d); 0044 case 3 0045 % Obtain, pass along, and save the store for x. 0046 store = storedb.getWithShared(key); 0047 [sqrtPd, store] = problem.sqrtprecon(x, d, store); 0048 storedb.setWithShared(store, key); 0049 case 4 0050 % Pass along the whole storedb (by reference), with key. 0051 sqrtPd = problem.sqrtprecon(x, d, storedb, key); 0052 otherwise 0053 up = MException('manopt:getSqrtPrecon:badsqrtprecon', ... 0054 'sqrtprecon should accept 2, 3 or 4 inputs.'); 0055 throw(up); 0056 end 0057 0058 else 0059 %% No preconditioner square root provided, so just use the identity. 0060 0061 sqrtPd = d; 0062 0063 end 0064 0065 end