Forms a matrix representing a linear operator between two tangent spaces function [A, Bx, By] = operator2matrix(M, x, y, F) function [A, Bx, By] = operator2matrix(Mx, x, y, F, [], [], My) function [A, Bx, By] = operator2matrix(M, x, y, F, Bx, By) function [A, Bx, By] = operator2matrix(Mx, x, y, F, Bx, By, My) Given a manifold structure M, two points x and y on that manifold, and a function F encoding a linear operator from the tangent space T_x M to the tangent space T_y M, this tool generates two random orthonormal bases (one for T_x M, and one for T_y M), and forms the matrix A which represents the operator F in those bases. In particular, the singular values of A are equal to the singular values of F. If two manifold structures are passed, then x is a point on Mx and y is a point on My. If Bx and By are supplied (as cells containing orthonormal vectors in T_x M and T_y M respectively), then these bases are used, and the matrix A represents the linear operator F restricted to the span of Bx, composed with orthogonal projection to the span of By. Of course, if Bx and By are orthonormal bases of T_x M and T_y M, then this is simply a representation of F. Same comment if two manifolds are passed. See also: tangentorthobasis hessianmatrix
0001 function [A, Bx, By] = operator2matrix(Mx, x, y, F, Bx, By, My) 0002 % Forms a matrix representing a linear operator between two tangent spaces 0003 % 0004 % function [A, Bx, By] = operator2matrix(M, x, y, F) 0005 % function [A, Bx, By] = operator2matrix(Mx, x, y, F, [], [], My) 0006 % function [A, Bx, By] = operator2matrix(M, x, y, F, Bx, By) 0007 % function [A, Bx, By] = operator2matrix(Mx, x, y, F, Bx, By, My) 0008 % 0009 % Given a manifold structure M, two points x and y on that manifold, and a 0010 % function F encoding a linear operator from the tangent space T_x M to the 0011 % tangent space T_y M, this tool generates two random orthonormal bases 0012 % (one for T_x M, and one for T_y M), and forms the matrix A which 0013 % represents the operator F in those bases. In particular, the singular 0014 % values of A are equal to the singular values of F. If two manifold 0015 % structures are passed, then x is a point on Mx and y is a point on My. 0016 % 0017 % If Bx and By are supplied (as cells containing orthonormal vectors in 0018 % T_x M and T_y M respectively), then these bases are used, and the matrix 0019 % A represents the linear operator F restricted to the span of Bx, composed 0020 % with orthogonal projection to the span of By. Of course, if Bx and By are 0021 % orthonormal bases of T_x M and T_y M, then this is simply a 0022 % representation of F. Same comment if two manifolds are passed. 0023 % 0024 % See also: tangentorthobasis hessianmatrix 0025 0026 % This file is part of Manopt: www.manopt.org. 0027 % Original author: Nicolas Boumal, Sep. 13, 2019. 0028 % Contributors: 0029 % Change log: 0030 0031 % By default, the two points are on the same manifold 0032 if ~exist('My', 'var') || isempty(My) 0033 My = Mx; 0034 end 0035 0036 if ~exist('Bx', 'var') || isempty(Bx) 0037 Bx = tangentorthobasis(Mx, x); 0038 end 0039 if ~exist('By', 'var') || isempty(By) 0040 By = tangentorthobasis(My, y); 0041 end 0042 0043 assert(iscell(Bx) && iscell(By), 'Bx and By should be cells.'); 0044 0045 n_in = numel(Bx); 0046 n_out = numel(By); 0047 0048 A = zeros(n_out, n_in); 0049 0050 for k = 1 : n_in 0051 A(:, k) = tangent2vec(My, y, By, F(Bx{k})); 0052 end 0053 0054 end