Home > manopt > tools > lincomb.m

lincomb

PURPOSE ^

Computes a linear combination of tangent vectors in the Manopt framework.

SYNOPSIS ^

function vec = lincomb(M, x, vecs, coeffs)

DESCRIPTION ^

 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}

 See also: grammatrix orthogonalize tangentorthobasis

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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 % See also: grammatrix orthogonalize tangentorthobasis
0016 
0017 % This file is part of Manopt: www.manopt.org.
0018 % Original author: Nicolas Boumal, April 28, 2016.
0019 % Contributors:
0020 % Change log:
0021 
0022 
0023     n = numel(vecs);
0024     assert(numel(coeffs) == n);
0025     
0026     switch n
0027        
0028         case 0
0029             
0030             vec = M.zerovec(x);
0031             
0032         case 1
0033             
0034             vec = M.lincomb(x, coeffs(1), vecs{1});
0035             
0036         otherwise
0037             
0038             vec = M.lincomb(x, coeffs(1), vecs{1}, coeffs(2), vecs{2});
0039             
0040             for k = 3 : n
0041                 
0042                 vec = M.lincomb(x, 1, vec, coeffs(k), vecs{k});
0043                 
0044             end
0045         
0046     end
0047         
0048 
0049 end

Generated on Sat 12-Nov-2016 14:11:22 by m2html © 2005