Skip to content

Commit

Permalink
Make cmaes a bit faster
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bata committed Dec 11, 2023
1 parent 07d26c9 commit 6ef7f35
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmaes/_cma.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,13 @@ def tell(self, solutions: list[tuple[np.ndarray, float]]) -> None:

# (eq.47)
rank_one = np.outer(self._pc, self._pc)

rank_mu = np.sum(
np.array([w * np.outer(y, y) for w, y in zip(w_io, y_k)]), axis=0
w_io.reshape(-1, 1, 1) * np.einsum("...i,...j->...ij", y_k, y_k), axis=0
)
# The above line is equivalent to:
# rank_mu = np.sum(np.array([w * np.outer(y, y) for w, y in zip(w_io, y_k)]), axis=0)

self._C = (
(
1
Expand Down

0 comments on commit 6ef7f35

Please sign in to comment.