Home > manopt > manifolds > oblique > obliquecomplexfactory.m

obliquecomplexfactory

PURPOSE ^

Returns a manifold struct defining complex matrices w/ unit-norm columns.

SYNOPSIS ^

function M = obliquecomplexfactory(n, m, transposed)

DESCRIPTION ^

 Returns a manifold struct defining complex matrices w/ unit-norm columns.

 function M = obliquecomplexfactory(n, m)
 function M = obliquecomplexfactory(n, m, transposed)

 Oblique manifold: deals with complex matrices of size n x m such that
 each column has unit 2-norm, i.e., is a point on the unit sphere in C^n.
 The geometry is a product geometry of m unit spheres in C^n. For the
 metric, C^n is treated as R^(2n), so that the real part and imaginary
 parts are treated separately as 2n real coordinates. As such, the complex
 oblique manifold is a Riemannian submanifold of (R^2)^(n x m), with the
 usual metric <u, v> = real(u'*v).
 
 If transposed is set to true (it is false by default), then the matrices
 are transposed: a point Y on the manifold is a matrix of size m x n and
 each row has unit 2-norm. It is the same geometry, just a different
 representation.

 In transposed form, a point Y is such that Y*Y' is a Hermitian, positive
 semidefinite matrix of size m and of rank at most n, such that all the
 diagonal entries are equal to 1.

 Note: obliquecomplexfactory(1, n, true) is equivalent to (but potentially
 slower than) complexcirclefactory(n).

 See also: spherecomplexfactory complexcirclefactory obliquefactory

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function M = obliquecomplexfactory(n, m, transposed)
0002 % Returns a manifold struct defining complex matrices w/ unit-norm columns.
0003 %
0004 % function M = obliquecomplexfactory(n, m)
0005 % function M = obliquecomplexfactory(n, m, transposed)
0006 %
0007 % Oblique manifold: deals with complex matrices of size n x m such that
0008 % each column has unit 2-norm, i.e., is a point on the unit sphere in C^n.
0009 % The geometry is a product geometry of m unit spheres in C^n. For the
0010 % metric, C^n is treated as R^(2n), so that the real part and imaginary
0011 % parts are treated separately as 2n real coordinates. As such, the complex
0012 % oblique manifold is a Riemannian submanifold of (R^2)^(n x m), with the
0013 % usual metric <u, v> = real(u'*v).
0014 %
0015 % If transposed is set to true (it is false by default), then the matrices
0016 % are transposed: a point Y on the manifold is a matrix of size m x n and
0017 % each row has unit 2-norm. It is the same geometry, just a different
0018 % representation.
0019 %
0020 % In transposed form, a point Y is such that Y*Y' is a Hermitian, positive
0021 % semidefinite matrix of size m and of rank at most n, such that all the
0022 % diagonal entries are equal to 1.
0023 %
0024 % Note: obliquecomplexfactory(1, n, true) is equivalent to (but potentially
0025 % slower than) complexcirclefactory(n).
0026 %
0027 % See also: spherecomplexfactory complexcirclefactory obliquefactory
0028 
0029 % This file is part of Manopt: www.manopt.org.
0030 % Original author: Nicolas Boumal, Sep. 3, 2014.
0031 % Contributors:
0032 % Change log:
0033 %
0034 %   Oct. 21, 2016 (NB)
0035 %       Formatted for inclusion in Manopt release.
0036 
0037     
0038     if ~exist('transposed', 'var') || isempty(transposed)
0039         transposed = false;
0040     end
0041     
0042     if transposed
0043         trnsp = @(X) X.';
0044     else
0045         trnsp = @(X) X;
0046     end
0047 
0048     M.name = @() sprintf('Complex oblique manifold COB(%d, %d)', n, m);
0049     
0050     M.dim = @() (2*n-1)*m;
0051     
0052     M.inner = @(x, d1, d2) real(d1(:)'*d2(:));
0053     
0054     M.norm = @(x, d) norm(d(:));
0055     
0056     M.dist = @(x, y) norm(real(acos(sum(real(conj(trnsp(x)).*trnsp(y)), 1))));
0057     
0058     M.typicaldist = @() pi*sqrt(m);
0059     
0060     M.proj = @(X, U) trnsp(projection(trnsp(X), trnsp(U)));
0061     
0062     M.tangent = M.proj;
0063     
0064     % For Riemannian submanifolds, converting a Euclidean gradient into a
0065     % Riemannian gradient amounts to an orthogonal projection.
0066     M.egrad2rgrad = M.proj;
0067     
0068     M.ehess2rhess = @ehess2rhess;
0069     function rhess = ehess2rhess(X, egrad, ehess, U)
0070         X = trnsp(X);
0071         egrad = trnsp(egrad);
0072         ehess = trnsp(ehess);
0073         U = trnsp(U);
0074         
0075         PXehess = projection(X, ehess);
0076         inners = sum(real(conj(X).*egrad), 1);
0077         rhess = PXehess - bsxfun(@times, U, inners);
0078         
0079         rhess = trnsp(rhess);
0080     end
0081     
0082     M.exp = @exponential;
0083     % Exponential on the complex oblique manifold
0084     function y = exponential(x, d, t)
0085         x = trnsp(x);
0086         d = trnsp(d);
0087         
0088         if nargin == 2
0089             % t = 1;
0090             td = d;
0091         else
0092             td = t*d;
0093         end
0094 
0095         nrm_td = sqrt(sum(real(td).^2 + imag(td).^2, 1));
0096 
0097         y = bsxfun(@times, x, cos(nrm_td)) + ...
0098             bsxfun(@times, td, sin(nrm_td) ./ nrm_td);
0099         
0100         % For those columns where the step is 0, replace y by x
0101         exclude = (nrm_td == 0);
0102         y(:, exclude) = x(:, exclude);
0103 
0104         y = trnsp(y);
0105     end
0106 
0107     M.log = @logarithm;
0108     function v = logarithm(x1, x2)
0109         x1 = trnsp(x1);
0110         x2 = trnsp(x2);
0111         
0112         v = projection(x1, x2 - x1);
0113         dists = real(acos(sum(real(conj(x1).*x2), 1)));
0114         norms = sqrt(sum(real(v).^2 + imag(v).^2, 1));
0115         factors = dists./norms;
0116         % For very close points, dists is almost equal to norms, but
0117         % because they are both almost zero, the division above can return
0118         % NaN's. To avoid that, we force those ratios to 1.
0119         factors(dists <= 1e-6) = 1;
0120         v = bsxfun(@times, v, factors);
0121         
0122         v = trnsp(v);
0123     end
0124 
0125     M.retr = @retraction;
0126     % Retraction on the oblique manifold
0127     function y = retraction(x, d, t)
0128         x = trnsp(x);
0129         d = trnsp(d);
0130         
0131         if nargin < 3
0132             td = d;
0133         else
0134             td = t*d;
0135         end
0136 
0137         y = normalize_columns(x + td);
0138         
0139         y = trnsp(y);
0140     end
0141 
0142     M.hash = @(x) ['z' hashmd5([real(x(:)) ; imag(x(:))])];
0143     
0144     M.rand = @() trnsp(random(n, m));
0145     
0146     M.randvec = @(x) trnsp(randomvec(n, m, trnsp(x)));
0147     
0148     M.lincomb = @matrixlincomb;
0149     
0150     M.zerovec = @(x) trnsp(zeros(n, m));
0151     
0152     M.transp = @(x1, x2, d) M.proj(x2, d);
0153     
0154     M.pairmean = @pairmean;
0155     function y = pairmean(x1, x2)
0156         y = trnsp(x1+x2);
0157         y = normalize_columns(y);
0158         y = trnsp(y);
0159     end
0160 
0161     % vec returns a vector representation of an input tangent vector which
0162     % is represented as a matrix. mat returns the original matrix
0163     % representation of the input vector representation of a tangent
0164     % vector. vec and mat are thus inverse of each other. They are
0165     % furthermore isometries between a subspace of R^2nm and the tangent
0166     % space at x.
0167     vect = @(X) X(:);
0168     M.vec = @(x, u_mat) [vect(real(trnsp(u_mat))) ; ...
0169                          vect(imag(trnsp(u_mat)))];
0170     M.mat = @(x, u_vec)    trnsp(reshape(u_vec(1:(n*m)),     [n, m])) + ...
0171                         1i*trnsp(reshape(u_vec((n*m+1):end), [n, m]));
0172     M.vecmatareisometries = @() true;
0173 
0174 end
0175 
0176 % Given a matrix X, returns the same matrix but with each column scaled so
0177 % that they have unit 2-norm.
0178 function X = normalize_columns(X)
0179     norms = sqrt(sum(real(X).^2 + imag(X).^2, 1));
0180     X = bsxfun(@times, X, 1./norms);
0181 end
0182 
0183 % Orthogonal projection of the ambient vector H onto the tangent space at X
0184 function PXH = projection(X, H)
0185 
0186     % Compute the inner product between each vector H(:, i) with its root
0187     % point X(:, i), that is, real(X(:, i)' * H(:, i)).
0188     % Returns a row vector.
0189     inners = real(sum(conj(X).*H, 1));
0190     
0191     % Subtract from H the components of the H(:, i)'s that are parallel to
0192     % the root points X(:, i).
0193     PXH = H - bsxfun(@times, X, inners);
0194 
0195 end
0196 
0197 % Uniform random sampling on the sphere.
0198 function x = random(n, m)
0199 
0200     x = normalize_columns(randn(n, m) + 1i*randn(n, m));
0201 
0202 end
0203 
0204 % Random normalized tangent vector at x.
0205 function d = randomvec(n, m, x)
0206 
0207     d = randn(n, m) + 1i*randn(n, m);
0208     d = projection(x, d);
0209     d = d / norm(d(:));
0210 
0211 end

Generated on Sat 12-Nov-2016 14:11:22 by m2html © 2005