Skip to content

Commit 70f1294

Browse files
authored
[MAINT] Fix CI (#60)
* Update setup.cfg * Update setup.cfg * Update covariances.py
1 parent 3e23d55 commit 70f1294

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

meegkit/utils/covariances.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def nonlinear_eigenspace(L, k, alpha=1):
444444
import pymanopt
445445
from pymanopt import Problem
446446
from pymanopt.manifolds import Grassmann
447-
from pymanopt.solvers import TrustRegions
447+
from pymanopt.optimizers import TrustRegions
448448

449449
n = L.shape[0]
450450
assert L.shape[1] == n, 'L must be square.'
@@ -454,26 +454,26 @@ def nonlinear_eigenspace(L, k, alpha=1):
454454
manifold._dimension = 1 # hack
455455

456456
# A solver that involves the hessian (check if correct TODO)
457-
solver = TrustRegions()
457+
solver = TrustRegions(verbosity=0)
458458

459459
# Cost function evaluation
460-
@pymanopt.function.Callable
460+
@pymanopt.function.numpy(manifold)
461461
def cost(X):
462462
rhoX = np.sum(X ** 2, 1, keepdims=True) # diag(X*X')
463463
val = 0.5 * np.trace(X.T @ (L * X)) + \
464464
(alpha / 4) * (rhoX.T @ mldivide(L, rhoX))
465465
return val
466466

467467
# Euclidean gradient evaluation
468-
@pymanopt.function.Callable
468+
@pymanopt.function.numpy(manifold)
469469
def egrad(X):
470470
rhoX = np.sum(X ** 2, 1, keepdims=True) # diag(X*X')
471471
g = L @ X + alpha * np.diagflat(mldivide(L, rhoX)) @ X
472472
return g
473473

474474
# Euclidean Hessian evaluation
475475
# Note: Manopt automatically converts it to the Riemannian counterpart.
476-
@pymanopt.function.Callable
476+
@pymanopt.function.numpy(manifold)
477477
def ehess(X, U):
478478
rhoX = np.sum(X ** 2, 1, keepdims=True) # np.diag(X * X')
479479
rhoXdot = 2 * np.sum(X.dot(U), 1)
@@ -493,8 +493,8 @@ def ehess(X, U):
493493
# Call manoptsolve to automatically call an appropriate solver.
494494
# Note: it calls the trust regions solver as we have all the required
495495
# ingredients, namely, gradient and Hessian, information.
496-
problem = Problem(manifold=manifold, cost=cost, egrad=egrad, ehess=ehess,
497-
verbosity=0)
498-
Xsol = solver.solve(problem, U0)
496+
problem = Problem(manifold=manifold, cost=cost, euclidean_gradient=egrad,
497+
euclidean_hessian=ehess)
498+
Xsol = solver.run(problem, initial_point=U0)
499499

500-
return S0, Xsol
500+
return S0, Xsol.point

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ all_files = 1
1919
upload-dir = doc/_build/html
2020

2121
[options.extras_require]
22-
extra = pymanopt @ git+https://github.com/pymanopt/pymanopt@master
22+
extra = pymanopt
2323

0 commit comments

Comments
 (0)