Problem with convergence using complexcircle manifold with complex inputs in manopt

38 views
Skip to first unread message

sarvendranath R

unread,
Sep 1, 2020, 6:55:04 AM9/1/20
to Manopt
Hi all,
I am new to manifold optimization and manopt. I was trying to play around with manopt introduction script to learn.

I am facing problem with convergence of manopt with complexcircle manifold and complex inputs.
Basically I checking the slope of the gradient with checkgradient(problem);

It works fine with real inputs.
It also works fine with sphere manifold (for both real and complex inputs).

Initially I thought problem could be with gradient. However, same expression works with spehre manifold and complex input.

Here is the code I used for testing. Please point out the mistake.

%matlab code

close all

% Generate random problem data.
    n = 10;

% Create the problem structure.
 %manifold = spherefactory(n);
 manifold = complexcirclefactory(n)
problem.M = manifold;
     
    
%     A = randn(n);
    A =  2*eye(n)
    A = .5*(A+A.');
    b = 2*ones(n,1);

    problem.cost  = @(x) (norm(A*x -b))^2;
    problem.egrad = @(x) 2 * A' *A*x  - A' * b - A * conj(b) ;      % notice the 'e' in 'egrad' for Euclidean
     
    % Numerically check gradient consistency (optional).
    checkgradient(problem);
     
    % Solve.
    [x, xcost, info, options] = trustregions(problem);
     
    x
    norm(x)
    
    % Display some statistics.
    figure;
    semilogy([info.iter], [info.gradnorm], '.-');
    xlabel('Iteration number');
    ylabel('Norm of the gradient of f');
    
    %complex input
    A =  2*eye(n) + 4i * eye(n);
    A = .5*(A+A.');
%          b = 2*ones(n,1) + 1i * 2*ones(n,1);
     b = [1:10]' +  [1:10]'  *1i;
    problem.cost  = @(x) (norm(A*x -b))^2;
    problem.egrad = @(x) 2 * A' *A*x  - A' * b - A * conj(b);      % notice the 'e' in 'egrad' for Euclidean
     
    % Numerically check gradient consistency (optional).
    figure
    checkgradient(problem);
     
    % Solve.
    [x, xcost, info, options] = trustregions(problem);
     
    x
    norm(x)

        % Display some statistics.
    figure;
    semilogy([info.iter], [info.gradnorm], '.-');
    xlabel('Iteration number');
    ylabel('Norm of the gradient of f');
manopt_conversation.m

sarvendranath R

unread,
Sep 1, 2020, 8:19:44 AM9/1/20
to Manopt

Check gradient plot with real inputs

Check gradient plot with complex inputs

Nicolas Boumal

unread,
Sep 2, 2020, 8:15:45 AM9/2/20
to Manopt
Hello,

Your formula for the gradient doesn't seem quite right. Can you try with the following?

problem.cost  = @(x) norm(A*x-b)^2;
problem.egrad = @(x) 2*A'*(A*x - b);

I expect this should work fine for complex inputs.

You can learn more about computing gradients for matrix functions by looking at some of the posts in this forum (certain posts are specifically about the complex case), and also by checking out Section 4.7 in my book: http://www.nicolasboumal.net/book.

I hope this helps,
Nicolas

Reply all
Reply to author
Forward
0 new messages