Linear combination function for tangent vectors represented as matrices. function v = lincomb(x, a1, d1) function v = lincomb(x, a1, d1, a2, d2) Given a point x, two tangent vectors d1 and d2 at x, and two real coefficients a1 and a2, returns a tangent vector at x representing a1*d1 + a2*d2, if d1 and d2 are represented as matrices (or more generally as arrays in Matlab). If a2 and d2 are omitted, the returned tangent vector is a1*d1. The input x is actually unused. This function is a helper to define manifolds in Manopt.
0001 function v = matrixlincomb(x, a1, d1, a2, d2) %#ok<INUSL> 0002 % Linear combination function for tangent vectors represented as matrices. 0003 % 0004 % function v = lincomb(x, a1, d1) 0005 % function v = lincomb(x, a1, d1, a2, d2) 0006 % 0007 % Given a point x, two tangent vectors d1 and d2 at x, and two real 0008 % coefficients a1 and a2, returns a tangent vector at x representing 0009 % a1*d1 + a2*d2, if d1 and d2 are represented as matrices (or more 0010 % generally as arrays in Matlab). 0011 % 0012 % If a2 and d2 are omitted, the returned tangent vector is a1*d1. 0013 % 0014 % The input x is actually unused. 0015 % 0016 % This function is a helper to define manifolds in Manopt. 0017 0018 % This file is part of Manopt: www.manopt.org. 0019 % Original author: Nicolas Boumal, July 2, 2015. 0020 % Contributors: 0021 % Change log: 0022 0023 if nargin == 3 0024 v = a1*d1; 0025 elseif nargin == 5 0026 v = a1*d1 + a2*d2; 0027 else 0028 error('matrixlincomb takes either 3 or 5 inputs.'); 0029 end 0030 0031 end