Skip to content

Commit

Permalink
fix copy-paste errors
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnaceBleukx committed Jul 4, 2024
1 parent e159fd6 commit b413991
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cpmpy/expressions/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def prod(self, axis=None, out=None):
if out is not None:
raise NotImplementedError()

if axis is None: # simple case where we want the maximum over the whole array
if axis is None: # simple case where we want the product over the whole array
return reduce(lambda a, b: a * b, self.flatten())

# TODO: is there a better way? This does pairwise multiplication still
Expand All @@ -514,7 +514,7 @@ def min(self, axis=None, out=None):
if out is not None:
raise NotImplementedError()

if axis is None: # simple case where we want the maximum over the whole array
if axis is None: # simple case where we want the minimum over the whole array
return cpm_min(self)

return cpm_array(np.apply_along_axis(cpm_min, axis=axis, arr=self))
Expand All @@ -523,15 +523,15 @@ def any(self, axis=None, out=None):
"""
overwrite np.any(NDVarArray)
"""
from .python_builtins import max as cpm_any
from .python_builtins import any as cpm_any

if any(not is_boolexpr(x) for x in self.flat):
raise TypeError("Cannot call .any() in an array not consisting only of bools")

if out is not None:
raise NotImplementedError()

if axis is None: # simple case where we want the maximum over the whole array
if axis is None: # simple case where we want a disjunction over the whole array
return cpm_any(self)

return cpm_array(np.apply_along_axis(cpm_any, axis=axis, arr=self))
Expand All @@ -542,15 +542,15 @@ def all(self, axis=None, out=None):
overwrite np.any(NDVarArray)
"""

from .python_builtins import max as cpm_all
from .python_builtins import all as cpm_all

if any(not is_boolexpr(x) for x in self.flat):
raise TypeError("Cannot call .any() in an array not consisting only of bools")

if out is not None:
raise NotImplementedError()

if axis is None: # simple case where we want the maximum over the whole array
if axis is None: # simple case where we want a conjunction over the whole array
return cpm_all(self)

return cpm_array(np.apply_along_axis(cpm_all, axis=axis, arr=self))
Expand Down

0 comments on commit b413991

Please sign in to comment.