function [x, info, kappa] = alm_subproblem(f, h, beta, mu, x0)

    % This uses Manopt (go to Manopt.org), but could use fmincon.
    
    problem.M = euclideanfactory(size(x0));
    problem.cost = @(x) f(x) + mu*h(x) + (beta/2)*h(x)^2;
    problem = manoptAD(problem);

    options.tolgradnorm = 1e-8;
    options.verbosity = 0;
    [x, ~, info] = steepestdescent(problem, x0, options);

    kappa = cond(hessianmatrix(problem, x));

end
