problem of set up options.maxiter in manopt

24 views
Skip to first unread message

hxc...@case.edu

unread,
Oct 4, 2018, 4:09:07 PM10/4/18
to Manopt
Dear all,

I try to overwrite the options.maxiter=1000 by the following code.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function [] = testmanOpt()
Asize = 20; R = 5;
A = rand(20,5);
W = rand(20,40);
A1{1} = rand(20,5);
A1{2} = rand(20,5);
alpha = 1;
rho = 1;
manifold = grassmannfactory(Asize, R);
problem.M = manifold;

problem.cost = @cost;
problem.egrad = @egrad;

options.maxiter=100;

[A, Acost, ~, ~] = conjugategradient(problem, options);


function f = cost(A)
f = -1 * norm( A' * W, 'fro')^2 ;

end


function gr = egrad(A)
gr = -2 * W * W' * A ;

end
end
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


However, It gives me the following error:

===================================================================
Undefined operator '*' for input arguments of type 'struct'.

Error in testmanOpt/cost (line 23)
f = -1 * norm( A' * W, 'fro')^2 ;

Error in getCost (line 59)
cost = problem.cost(x);

Error in getCostGrad (line 89)
cost = getCost(problem, x, storedb, key);

Error in conjugategradient (line 200)
[cost, grad] = getCostGrad(problem, x, storedb, key);

Error in testmanOpt (line 19)
[A, Acost, ~, ~] = conjugategradient(problem, options);
===================================================================

My equation is how to set the maxiter in manopt.

Thanks so much

Nicolas Boumal

unread,
Oct 4, 2018, 4:21:35 PM10/4/18
to Manopt
Hello,

The issue is here:

 conjugategradient(problem, options);

The second input to a solver is the initial guess. Options are the third input. If you do not want to specify an initial guess, do this:

 conjugategradient(problem, [], options);

Please let me know if this solves the issue.

Best,
Nicolas

hxc...@case.edu

unread,
Oct 4, 2018, 4:38:07 PM10/4/18
to Manopt
Thanks so much.
Reply all
Reply to author
Forward
0 new messages