Skip to content

Commit

Permalink
Further pylint/style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
timweiland committed Jul 11, 2023
1 parent 8629250 commit f0a8da8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/linpde_gp/randprocs/covfuncs/linfunctls/_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@ def _(self, k: covfuncs.StackCovarianceFunction, /, *, argnum: int = 0):
from ...crosscov import ( # pylint: disable=import-outside-toplevel
StackedProcessVectorCrossCovariance,
)

L_covfuncs = np.copy(k.covfuncs)
for idx, covfunc in np.ndenumerate(L_covfuncs):
L_covfuncs[idx] = self(covfunc, argnum=argnum)

return StackedProcessVectorCrossCovariance(
L_covfuncs
)
return StackedProcessVectorCrossCovariance(L_covfuncs)


@linfunctls.LinearFunctional.__call__.register # pylint: disable=no-member
Expand Down
8 changes: 4 additions & 4 deletions src/linpde_gp/randprocs/crosscov/_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def _evaluate(self, x: np.ndarray) -> np.ndarray:
res[(..., *idx)] = eval_at_idx
else:
res = np.zeros(self._pv_crosscovs.shape + batch_shape + self.randvar_shape)
for idx, eval in np.ndenumerate(evals):
res[(*idx, ...)] = eval
for idx, eval_at_idx in np.ndenumerate(evals):
res[(*idx, ...)] = eval_at_idx
# Move entire batch shape to the front
res = np.moveaxis(
res,
Expand All @@ -86,8 +86,8 @@ def _evaluate_jax(self, x: jnp.ndarray) -> jnp.ndarray:

if self.reverse:
res = jnp.zeros(self.randvar_shape + batch_shape + self._pv_crosscovs.shape)
for idx, eval in np.ndenumerate(evals):
res.at[(..., *idx)].set(eval)
for idx, eval_at_idx in np.ndenumerate(evals):
res.at[(..., *idx)].set(eval_at_idx)
else:
res = jnp.zeros(self._pv_crosscovs.shape + batch_shape + self.randvar_shape)
for idx, eval_at_idx in np.ndenumerate(evals):
Expand Down

0 comments on commit f0a8da8

Please sign in to comment.