Skip to content

Commit

Permalink
MAINT: make sure the constraint is a vector
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfaff committed Feb 8, 2024
1 parent 496fd87 commit 2972a0d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scipy/optimize/_differentialevolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,8 @@ def fun(x):
# x either has shape (N, S) or (N)
# (M, N) x (N, S) --> (M, S)
# (M, N) x (N,) --> (M,)
# However, if (M, N) is a matrix then:
# (M, N) * (N,) --> (M, 1), we need this to be (M,)
if x.ndim == 1 and res.ndim == 2:
# deal with case that constraint.A is an np.matrix
# see gh20041
Expand Down

0 comments on commit 2972a0d

Please sign in to comment.