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