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 (think of the
 Newton equations.) 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 (think of the
0013 % Newton equations.) The Riemannian (actually, Euclidean) structure on N is
0014 % that of the tangent space to M, 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 %   Jan. 25, 2017 (NB):
0024 %       Following a comment by Jesus Briales on the Manopt forum, the
0025 %       functions N.egrad2rgrad, N.ehess2rhess and N.tangent now include a
0026 %       projection (they were formerly identities.)
0027 %
0028 %   Feb. 2, 2017 (NB):
0029 %       Following a comment by Jesus Briales on the Manopt forum, the
0030 %       function N.proj now calls M.proj(x, .) instead of M.proj(y, .).
0031 %       Furthermore, N.ehess2rhess was corrected in the same way.
0032 
0033     % N is the manifold we build. y will be a point on N, thus also a
0034     % tangent vector to M at x. This is a typical Euclidean space, hence it
0035     % will be easy to describe in terms of the tools available for M.
0036     N = struct();
0037     
0038     % u, u1 and u2 will be tangent vectors to N at y. The tangent space to
0039     % N at y is the tangent space to M at x, thus u, u1 and u2 are also
0040     % tangent vectors to M at x.
0041     
0042     N.dim   = @() M.dim();
0043     N.inner = @(y, u1, u2) M.inner(x, u1, u2);
0044     N.norm  = @(y, u) M.norm(x, u);
0045     N.proj  = @(y, u) M.proj(x, u);
0046     N.typicaldist = @() sqrt(N.dim());
0047     N.tangent = N.proj;
0048     N.egrad2rgrad = N.proj;
0049     N.ehess2rhess = @(y, eg, eh, d) M.proj(x, eh);
0050     N.exp = @exponential;
0051     N.retr = @exponential;
0052     N.log = @(y1, y2) M.lincomb(x, 1, y2, -1, y1);
0053     N.pairmean = @(y1, y2) M.lincomb(x, 0.5, y1, 0.5, y2);
0054     N.rand = @() M.randvec(x);
0055     N.randvec = @(y) M.randvec(x);
0056     N.zerovec = M.zerovec;
0057     N.lincomb = M.lincomb;
0058     N.transp = @(y1, y2, u) u;
0059     N.hash = @(y) ['z' hashmd5(M.vec(x, y))];
0060     
0061     % In a Euclidean space, the exponential is merely the sum: y + tu.
0062     function yy = exponential(y, u, t)
0063         if nargin == 2
0064             t = 1;
0065         end
0066         yy = M.lincomb(x, 1, y, t, u);
0067     end
0068     
0069 end

Generated on Fri 08-Sep-2017 12:43:19 by m2html © 2005