Skip to content

Commit b824c01

Browse files
committed
Convert ROL interface to use AbstractReducedFunctional
We recover the original behaviour by applying the Riesz map when returning the derivative or Hessian actions.
1 parent a3ec0aa commit b824c01

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pyadjoint/optimization/rol_solver.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ def value(self, x, tol):
2020
return self._val
2121

2222
def gradient(self, g, x, tol):
23-
opts = {"riesz_representation": x.inner_product}
24-
self.deriv = self.rf.derivative(options=opts)
23+
self.deriv = self.rf.derivative(apply_riesz=True)
2524
g.dat = Enlist(self.deriv)
2625

2726
def hessVec(self, hv, v, x, tol):
28-
opts = {"riesz_representation": x.inner_product}
29-
hessian_action = self.rf.hessian(v.dat, options=opts)
27+
hessian_action = self.rf.hessian(v.dat, apply_riesz=True)
3028
hv.dat = Enlist(hessian_action)
3129

3230
def update(self, x, flag, iteration):
@@ -78,9 +76,8 @@ def scale(self, alpha):
7876

7977
def riesz_map(self, derivs):
8078
dat = []
81-
opts = {"riesz_representation": self.inner_product}
8279
for deriv in Enlist(derivs):
83-
dat.append(deriv._ad_convert_type(deriv, options=opts))
80+
dat.append(deriv.riesz_representation(riesz_map=self.inner_product)
8481
return dat
8582

8683
def dot(self, yy):

0 commit comments

Comments
 (0)