-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathconstantfactory.m
More file actions
69 lines (45 loc) · 1.6 KB
/
constantfactory.m
File metadata and controls
69 lines (45 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function M = constantfactory(A)
% Returns a manifold struct representing the singleton.
%
% function M = constantfactory(A)
%
% Given an array A, returns M: a structure describing the singleton {A} as
% a zero-dimensional manifold suitable for Manopt. The only point on M is
% the array A, and the only tangent vector at A is the zero-array of the
% same size as A.
%
% This is a helper factory which can be used to fix certain values in an
% optimization problem, in conjunction with productmanifold.
%
% See also: productmanifold euclideanfactory
% This file is part of Manopt: www.manopt.org.
% Original author: Nicolas Boumal, March 15, 2018.
% Contributors:
% Change log:
% July 2, 2024 (NB)
% Added M.retr2, so productmanifold can use it.
M.name = @() 'Singleton manifold';
M.dim = @() 0;
M.inner = @(x, d1, d2) 0;
M.norm = @(x, d) 0;
M.dist = @(x, y) 0;
M.typicaldist = @() 0;
M.proj = @(x, d) zeros(size(A));
M.egrad2rgrad = @(x, g) zeros(size(A));
M.ehess2rhess = @(x, eg, eh, d) zeros(size(A));
M.tangent = M.proj;
M.exp = @(x, d, t) A;
M.retr = M.exp;
M.retr2 = M.exp;
M.log = @(x, y) zeros(size(A));
M.hash = @(x) 'z1';
M.rand = @() A;
M.randvec = @(x) zeros(size(A));
M.lincomb = @matrixlincomb;
M.zerovec = @(x) zeros(size(A));
M.transp = @(x1, x2, d) zeros(size(A));
M.pairmean = @(x1, x2) A;
M.vec = @(x, u_mat) u_mat(:);
M.mat = @(x, u_vec) reshape(u_vec, dimensions_vec);
M.vecmatareisometries = @() true;
end