The optimization on Stiefel Manifold by Manopt

51 views
Skip to first unread message

ying...@gmail.com

unread,
Apr 9, 2018, 10:01:26 PM4/9/18
to Manopt
Has anyone used Manopt to solve the following optimization on Stiefel Manifold:

minimize_X -tr(X A X^T B), subject to X^T X=I,

where X belongs to R^{n x m}, A and B belong to R^{m x m}, and R^{n x n}, respectively.


I found the toolbox Manopt works if n=m, otherwise the MATLAB shows


“Subscripted assignment dimension mismatch.

Error in stiefelfactory/random (line 130)
X(:, :, i) = Q;

Error in checkgradient (line 60)
x = problem.M.rand();

Error in Solver_stiefel_Manifold (line 20)
checkgradient(problem);”

It will be appreciated if anyone would like to provide suggestions to fix this problem. Thanks.

Nicolas Boumal

unread,
Apr 9, 2018, 10:22:00 PM4/9/18
to Manopt
Hello,

Thanks for posting your question here.

Just in case: can you please check that n >= m ? (Otherwise the manifold is empty.)

If that's correct, can you please show your code? There might be just a small issue somewhere.

Best,
Nicolas

ying...@gmail.com

unread,
Apr 9, 2018, 10:58:39 PM4/9/18
to Manopt
在 2018年4月10日星期二 UTC+8上午10:22:00,Nicolas Boumal写道:
Dear Nicolas,

Yes. Please find the codes as follows:

m=8;
n=10;
a=randn(m,m);
A=a*a';
b=randn(n,n);
B=b*b';
x = Solver_stiefel_Manifold(A,B);


function x = Solver_stiefel_Manifold(A,B)

% Create the problem structure.

m=size(A,1);
n=size(B,1);
manifold=stiefelfactory(m, n);
problem.M = manifold;

% Define the problem cost function and its gradient.
problem.cost = @(X) -trace(X*A*X'*B);
problem.egrad = @(X) -B'*X*A'-B*X*A;

% Numerically check gradient and Hessian consistency.
figure;
checkgradient(problem);

% Solve.
[x, xcost, info] = trustregions(problem);

% Display some statistics.
figure;
semilogy([info.iter], [info.gradnorm], '.-');
xlabel('Iteration #');
ylabel('Gradient norm');
title('Convergence of the trust-regions algorithm on the sphere');

Best,
Jiaxi

Nicolas Boumal

unread,
Apr 10, 2018, 10:11:40 AM4/10/18
to Manopt
Hello Jiaxi,

I think the issue is just that stiefelfactory takes inputs (n, m) instead of (m, n) -- different authors use different conventions for this which is confusing; the logic here is that this follows Matlab's convention in terms of matrix size: stiefelfactory(n, m) works with matrices of size n x m (and the columns are orthonormal).

I hope this fixes the issue.

Best,
Nicolas

ying...@gmail.com

unread,
Apr 12, 2018, 8:59:08 AM4/12/18
to Manopt
在 2018年4月10日星期二 UTC+8下午10:11:40,Nicolas Boumal写道:
Hi Nicolas,

Oh, yes. I can't believe that I didn't find this point. Thanks.

Best,
Jiaxi
Reply all
Reply to author
Forward
0 new messages