Computes a linear combination of tangent vectors in the Manopt framework. vec = lincomb(M, x, vecs, coeffs) M is a Manopt manifold structure obtained from a factory. x is a point on the manifold M. vecs is a cell containing n tangent vectors at x. coeffs is a vector of length n vec is a tangent vector at x obtained as the linear combination vec = coeffs(1)*vecs{1} + ... + coeffs(n)*vecs{n} If vecs is an orthonormal basis, then tangent2vec is the inverse of lincomb. See also: grammatrix orthogonalize tangentorthobasis tangent2vec
0001 function vec = lincomb(M, x, vecs, coeffs) 0002 % Computes a linear combination of tangent vectors in the Manopt framework. 0003 % 0004 % vec = lincomb(M, x, vecs, coeffs) 0005 % 0006 % M is a Manopt manifold structure obtained from a factory. 0007 % x is a point on the manifold M. 0008 % vecs is a cell containing n tangent vectors at x. 0009 % coeffs is a vector of length n 0010 % 0011 % vec is a tangent vector at x obtained as the linear combination 0012 % 0013 % vec = coeffs(1)*vecs{1} + ... + coeffs(n)*vecs{n} 0014 % 0015 % If vecs is an orthonormal basis, then tangent2vec is the inverse of 0016 % lincomb. 0017 % 0018 % See also: grammatrix orthogonalize tangentorthobasis tangent2vec 0019 0020 % This file is part of Manopt: www.manopt.org. 0021 % Original author: Nicolas Boumal, April 28, 2016. 0022 % Contributors: 0023 % Change log: 0024 0025 0026 n = numel(vecs); 0027 assert(numel(coeffs) == n); 0028 0029 switch n 0030 0031 case 0 0032 0033 vec = M.zerovec(x); 0034 0035 case 1 0036 0037 vec = M.lincomb(x, coeffs(1), vecs{1}); 0038 0039 otherwise 0040 0041 vec = M.lincomb(x, coeffs(1), vecs{1}, coeffs(2), vecs{2}); 0042 0043 for k = 3 : n 0044 0045 vec = M.lincomb(x, 1, vec, coeffs(k), vecs{k}); 0046 0047 end 0048 0049 end 0050 0051 0052 end