Home > manopt > tools > tangentorthobasis.m

tangentorthobasis

PURPOSE ^

Returns an orthonormal basis of tangent vectors in the Manopt framework.

SYNOPSIS ^

function orthobasis = tangentorthobasis(M, x, n)

DESCRIPTION ^

 Returns an orthonormal basis of tangent vectors in the Manopt framework.

 function orthobasis = tangentorthobasis(M, x)
 function orthobasis = tangentorthobasis(M, x, n)

 M is a Manopt manifold structure obtained from a factory.
 x is a point on the manifold M.
 n (optional) is the dimension of the random subspace to span; by default,
   n = M.dim() so that the returned basis spans the whole tangent space.

 orthobasis is a cell of n tangent vectors at x.
 With high probability, they form an orthonormal basis of the tangent
 space at x. If necessary, this can be checked by calling
   G = grammatrix(M, x, orthobasis)
 and verifying that norm(G - eye(size(G))) is close to zero.

 Note: if extra accuracy is required, it may help to re-orthogonalize the
 basis returned by this function once, as follows:
  B = tangentorthobasis(M, x, n);
  B = orthogonalize(M, x, B);

 See also: grammatrix orthogonalize lincomb plotprofile

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function orthobasis = tangentorthobasis(M, x, n)
0002 % Returns an orthonormal basis of tangent vectors in the Manopt framework.
0003 %
0004 % function orthobasis = tangentorthobasis(M, x)
0005 % function orthobasis = tangentorthobasis(M, x, n)
0006 %
0007 % M is a Manopt manifold structure obtained from a factory.
0008 % x is a point on the manifold M.
0009 % n (optional) is the dimension of the random subspace to span; by default,
0010 %   n = M.dim() so that the returned basis spans the whole tangent space.
0011 %
0012 % orthobasis is a cell of n tangent vectors at x.
0013 % With high probability, they form an orthonormal basis of the tangent
0014 % space at x. If necessary, this can be checked by calling
0015 %   G = grammatrix(M, x, orthobasis)
0016 % and verifying that norm(G - eye(size(G))) is close to zero.
0017 %
0018 % Note: if extra accuracy is required, it may help to re-orthogonalize the
0019 % basis returned by this function once, as follows:
0020 %  B = tangentorthobasis(M, x, n);
0021 %  B = orthogonalize(M, x, B);
0022 %
0023 % See also: grammatrix orthogonalize lincomb plotprofile
0024 
0025 % This file is part of Manopt: www.manopt.org.
0026 % Original author: Nicolas Boumal, April 28, 2016.
0027 % Contributors:
0028 % Change log:
0029 
0030     dim = M.dim();
0031     if ~exist('n', 'var') || isempty(n)
0032         n = dim;
0033     end
0034     assert(n >= 0 && n <= dim && n == round(n), ...
0035            'n must be an integer between 0 and M.dim().');
0036     
0037     basis = cell(n, 1);
0038     
0039     % With high probability, n vectors taken at random in the tangent space
0040     % are linearly independent.
0041     for k = 1 : n
0042         basis{k} = M.randvec(x);
0043     end
0044     
0045     % The Gram-Schmidt process transforms any n linearly independent
0046     % vectors into n orthonormal vectors spanning the same subspace.
0047     orthobasis = orthogonalize(M, x, basis);
0048     
0049 end

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