Home > manopt > tools > tangentspacefactory.m

tangentspacefactory

PURPOSE ^

Returns a manifold structure representing the tangent space to M at x.

SYNOPSIS ^

function N = tangentspacefactory(M, x)

DESCRIPTION ^

 Returns a manifold structure representing the tangent space to M at x.

 N = tangentspacefactory(M, x)

 N defines a (linear) manifold that is the tangent space to M at x. Points
 are represented as tangent vectors to M at x. Tangent vectors are also
 represented as tangent vectors to M at x.

 This is chiefly useful to solve optimization problems involving tangent
 vectors to M at x, which notably comes up when solving linear systems
 involving, for example, the Hessian of the cost on M at x. The Riemannian
 (actually, Euclidean) structure on N is that of the tangent space to M,
 that is, the inner product is inherited.

 See also: preconhessiansolve

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function N = tangentspacefactory(M, x)
0002 % Returns a manifold structure representing the tangent space to M at x.
0003 %
0004 % N = tangentspacefactory(M, x)
0005 %
0006 % N defines a (linear) manifold that is the tangent space to M at x. Points
0007 % are represented as tangent vectors to M at x. Tangent vectors are also
0008 % represented as tangent vectors to M at x.
0009 %
0010 % This is chiefly useful to solve optimization problems involving tangent
0011 % vectors to M at x, which notably comes up when solving linear systems
0012 % involving, for example, the Hessian of the cost on M at x. The Riemannian
0013 % (actually, Euclidean) structure on N is that of the tangent space to M,
0014 % that is, the inner product is inherited.
0015 %
0016 % See also: preconhessiansolve
0017 
0018 % This file is part of Manopt: www.manopt.org.
0019 % Original author: Nicolas Boumal, April 9, 2015.
0020 % Contributors:
0021 % Change log:
0022 
0023     % N is the manifold we build. y will be a point on N, thus also a
0024     % tangent vector to M at x. This is a typical Euclidean space, hence it
0025     % will be easy to describe in terms of the tools available for M.
0026     N = struct();
0027     
0028     % u, u1 and u2 will be tangent vectors to N at y. The tangent space to
0029     % N at y is the tangent space to M at x, thus u, u1 and u2 are also
0030     % tangent vectors to M at x.
0031     
0032     N.dim   = @() M.dim();
0033     N.inner = @(y, u1, u2) M.inner(x, u1, u2);
0034     N.norm  = @(y, u) M.norm(x, u);
0035     N.proj  = M.proj;
0036     N.typicaldist = @() N.dim();
0037     N.tangent = @(y, u) u;
0038     N.egrad2rgrad = @(x, g) g;
0039     N.ehess2rhess = @(x, eg, eh, d) eh;
0040     N.exp = @exponential;
0041     N.retr = @exponential;
0042     N.log = @(y1, y2) M.lincomb(x, 1, y2, -1, y1);
0043     N.pairmean = @(y1, y2) M.lincomb(x, 0.5, y1, 0.5, y2);
0044     N.rand = @() M.randvec(x);
0045     N.randvec = @(y) M.randvec(x);
0046     N.zerovec = M.zerovec;
0047     N.lincomb = M.lincomb;
0048     N.transp = @(y1, y2, u) u;
0049     N.hash = @(y) ['z' hashmd5(M.vec(x, y))];
0050     
0051     % In a Euclidean space, the exponential is merely the sum: y + tu.
0052     function yy = exponential(y, u, t)
0053         if nargin == 2
0054             t = 1;
0055         end
0056         yy = M.lincomb(x, 1, y, t, u);
0057     end
0058     
0059 end

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