Home > manopt > tools > orthogonalize.m

orthogonalize

PURPOSE ^

Orthonormalizes a basis of tangent vectors in the Manopt framework.

SYNOPSIS ^

function [orthobasis, L] = orthogonalize(M, x, basis)

DESCRIPTION ^

 Orthonormalizes a basis of tangent vectors in the Manopt framework.

 function [orthobasis, L] = orthogonalize(M, x, basis)

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

 orthobasis is a cell of same size as basis which contains an orthonormal
 basis for the same subspace as that spanned by basis. Orthonormality is
 assessed with respect to the metric on the tangent space to M at x.
 L is upper triangular of size n x n if basis has n vectors, such that,
 basis{k} = sum_j=1^k orthobasis{j} * L(j, k) (akin to R in a QR
 factorization.)

 See also: grammatrix tangentorthobasis

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [orthobasis, L] = orthogonalize(M, x, basis)
0002 % Orthonormalizes a basis of tangent vectors in the Manopt framework.
0003 %
0004 % function [orthobasis, L] = orthogonalize(M, x, basis)
0005 %
0006 % M is a Manopt manifold structure obtained from a factory.
0007 % x is a point on the manifold M.
0008 % basis is a cell containing n linearly independent tangent vectors at x.
0009 %
0010 % orthobasis is a cell of same size as basis which contains an orthonormal
0011 % basis for the same subspace as that spanned by basis. Orthonormality is
0012 % assessed with respect to the metric on the tangent space to M at x.
0013 % L is upper triangular of size n x n if basis has n vectors, such that,
0014 % basis{k} = sum_j=1^k orthobasis{j} * L(j, k) (akin to R in a QR
0015 % factorization.)
0016 %
0017 % See also: grammatrix tangentorthobasis
0018 
0019 % This file is part of Manopt: www.manopt.org.
0020 % Original author: Nicolas Boumal, April 28, 2016.
0021 % Contributors:
0022 % Change log:
0023 
0024 
0025     n = numel(basis);
0026     orthobasis = cell(size(basis));
0027     
0028     % Build the Gram matrix of the basis vectors.
0029     G = grammatrix(M, x, basis);
0030     
0031     % If the vectors in 'basis' were the columns of V, and the inner
0032     % product were the classical dot product, then G = V'*V. We are looking
0033     % for R, an invertible matrix such that V*R is orthogonal. Thus, R
0034     % satisfies R'*V'*V*R = eye(n); equivalently:
0035     %  G = inv(R)'*inv(R).
0036     % Computing a Cholesky factorization of G yields L such that G = L'*L.
0037     % Thus, R = inv(L). Each column of R states exactly which linear
0038     % combinations of the vectors in 'basis' must be computed to produce
0039     % the orthonormal basis.
0040     %
0041     % Of course, in that formalism, we could directly take a qr of V, but
0042     % in the actual setting V is not available; the only simple object
0043     % available is G.
0044     %
0045     % If this simple code turns out not to be satisfactory (most likely
0046     % because of numerical instability), it may be good to consider
0047     % implementing a modified Gram-Schmidt algorithm instead, and even to
0048     % provide a helper function which calls it twice.
0049     L = chol(G);
0050     R = inv(L);
0051     
0052     % Note that R is upper triangular.
0053     % We now compute the n linear combinations.
0054     
0055     for k = 1 : n
0056         
0057         orthobasis{k} = lincomb(M, x, basis(1:k), R(1:k, k));
0058         
0059     end
0060 
0061 end

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