Home > manopt > tools > grammatrix.m

grammatrix

PURPOSE ^

Computes the Gram matrix of tangent vectors in the Manopt framework.

SYNOPSIS ^

function G = grammatrix(M, x, vectors)

DESCRIPTION ^

 Computes the Gram matrix of tangent vectors in the Manopt framework.

 function G = grammatrix(M, x, vectors)

 M is a Manopt manifold structure obtained from a factory.
 x is a point on the manifold M.
 vectors is a cell containing n tangent vectors at x.

 G is an n-by-n symmetric positive semidefinite matrix such that G(i, j)
 is the inner product between vectors{i} and vectors{j}, with respect to
 the metric on the tangent space to M at x.

 See also: orthogonalize tangentorthobasis

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function G = grammatrix(M, x, vectors)
0002 % Computes the Gram matrix of tangent vectors in the Manopt framework.
0003 %
0004 % function G = grammatrix(M, x, vectors)
0005 %
0006 % M is a Manopt manifold structure obtained from a factory.
0007 % x is a point on the manifold M.
0008 % vectors is a cell containing n tangent vectors at x.
0009 %
0010 % G is an n-by-n symmetric positive semidefinite matrix such that G(i, j)
0011 % is the inner product between vectors{i} and vectors{j}, with respect to
0012 % the metric on the tangent space to M at x.
0013 %
0014 % See also: orthogonalize tangentorthobasis
0015 
0016 % This file is part of Manopt: www.manopt.org.
0017 % Original author: Nicolas Boumal, April 28, 2016.
0018 % Contributors:
0019 % Change log:
0020 
0021 
0022     n = numel(vectors);
0023     
0024     G = zeros(n);
0025     
0026     for i = 1 : n
0027         
0028         vi = vectors{i};
0029         
0030         G(i, i) = M.inner(x, vi, vi);
0031         
0032         for j = (i+1) : n
0033             
0034             vj = vectors{j};
0035             G(i, j) = M.inner(x, vi, vj);
0036             
0037             % Manopt is designed to work with real inner products,
0038             % but it does not hurt to allow for complex inner products
0039             % here by taking the conjugate.
0040             G(j, i) = G(i, j)';
0041             
0042         end
0043         
0044     end
0045 
0046 end

Generated on Fri 30-Sep-2022 13:18:25 by m2html © 2005