Home > manopt > manifolds > euclidean > shapefitfactory.m

# shapefitfactory

## PURPOSE

Linear manifold structure for optimization over the ShapeFit search space

## SYNOPSIS

function M = shapefitfactory(VJt)

## DESCRIPTION

``` Linear manifold structure for optimization over the ShapeFit search space

function M = shapefitfactory(VJt)

Input: VJt is a matrix of size dxn, such that VJt * ones(n, 1) = 0.

Returns M, a structure describing the Euclidean space of d-by-n matrices
equipped with the standard Frobenius distance and associated trace inner
product, as a manifold for Manopt. Matrices on M, denoted by T, have size
dxn and obey T*ones(n, 1) = 0 (centered columns) and <VJt, T> = 1, where
<A, B> = Trace(A' * B).

See this paper: http://arxiv.org/abs/1506.01437
ShapeFit: Exact location recovery from corrupted pairwise directions, 2015
Paul Hand, Choongbum Lee, Vladislav Voroninski

## CROSS-REFERENCE INFORMATION

This function calls:
• hashmd5 Computes the MD5 hash of input data.
• matrixlincomb Linear combination function for tangent vectors represented as matrices.
This function is called by:
• shapefit_smoothed ShapeFit formulation for sensor network localization from pair directions

## SOURCE CODE

```0001 function M = shapefitfactory(VJt)
0002 % Linear manifold structure for optimization over the ShapeFit search space
0003 %
0004 % function M = shapefitfactory(VJt)
0005 %
0006 % Input: VJt is a matrix of size dxn, such that VJt * ones(n, 1) = 0.
0007 %
0008 % Returns M, a structure describing the Euclidean space of d-by-n matrices
0009 % equipped with the standard Frobenius distance and associated trace inner
0010 % product, as a manifold for Manopt. Matrices on M, denoted by T, have size
0011 % dxn and obey T*ones(n, 1) = 0 (centered columns) and <VJt, T> = 1, where
0012 % <A, B> = Trace(A' * B).
0013 %
0014 % See this paper: http://arxiv.org/abs/1506.01437
0015 % ShapeFit: Exact location recovery from corrupted pairwise directions, 2015
0016 % Paul Hand, Choongbum Lee, Vladislav Voroninski
0017 %
0019
0020 % This file is part of Manopt: www.manopt.org.
0021 % Original author: Nicolas Boumal, June 18, 2015.
0022 % Contributors:
0023 % Change log:
0024 %
0025 %   Jan. 25, 2017 (NB):
0026 %       M.tangent = M.proj now, instead of being identity. This is notably
0027 %       necessary so that checkgradient will pick up on gradients that do
0028 %       not lie in the appropriate tangent space.
0029
0030     [d, n] = size(VJt);
0031
0032     M.name = @() sprintf('ShapeFit space of size %d x %d', d, n);
0033
0034     M.dim = @() d*n - d - 1;
0035
0036     M.inner = @(x, d1, d2) d1(:).'*d2(:);
0037
0038     M.norm = @(x, d) norm(d, 'fro');
0039
0040     M.dist = @(x, y) norm(x-y, 'fro');
0041
0042     M.typicaldist = @() sqrt(d*n);
0043
0044     M.proj = @(T, U) projection(U);
0045     VJt_normed = VJt / norm(VJt, 'fro');
0046     function PU = projection(U)
0047         % Center the columns
0048         PU = bsxfun(@minus, U, mean(U, 2));
0049         % Remove component along VJt
0050         % Note: these two actions can be executed separately, without
0051         % interference, owing to VJt having centered columns itself.
0052         PU = PU - (VJt_normed(:)'*U(:))*VJt_normed;
0053     end
0054
0056
0057     M.ehess2rhess = @(x, eg, eh, d) projection(eh);
0058
0059     M.tangent = M.proj;
0060
0061     M.exp = @exp;
0062     function y = exp(x, d, t)
0063         if nargin == 3
0064             y = x + t*d;
0065         else
0066             y = x + d;
0067         end
0068     end
0069
0070     M.retr = M.exp;
0071
0072     M.log = @(x, y) y-x;
0073
0074     M.hash = @(x) ['z' hashmd5(x(:))];
0075
0076     M.randvec = @(x) randvec();
0077     function u = randvec()
0078         u = projection(randn(d, n));
0079         u = u / norm(u, 'fro');
0080     end
0081
0082     % We exploit the fact that VJt_normed belongs to the manifold
0083     M.rand = @() VJt_normed + randn(1) * randvec();
0084
0085     M.lincomb = @matrixlincomb;
0086
0087     M.zerovec = @(x) zeros(d, n);
0088
0089     M.transp = @(x1, x2, d) d;
0090
0091     M.pairmean = @(x1, x2) .5*(x1+x2);
0092
0093     M.vec = @(x, u_mat) u_mat(:);
0094     M.mat = @(x, u_vec) reshape(u_vec, [d, n]);
0095     M.vecmatareisometries = @() true;
0096
0097 end```

Generated on Mon 10-Sep-2018 11:48:06 by m2html © 2005