diff options
author | epapoutsellis <epapoutsellis@gmail.com> | 2019-05-13 18:31:10 +0100 |
---|---|---|
committer | epapoutsellis <epapoutsellis@gmail.com> | 2019-05-13 18:31:10 +0100 |
commit | f1960b9d0f04b834fa069a016ad148140c8fefae (patch) | |
tree | 78044fbcf5cc1b3d9517abc0ee54e85f66ac0dd4 | |
parent | 68d8228799f5c823200340afb67a7bcf4ac34180 (diff) | |
download | framework-f1960b9d0f04b834fa069a016ad148140c8fefae.tar.gz framework-f1960b9d0f04b834fa069a016ad148140c8fefae.tar.bz2 framework-f1960b9d0f04b834fa069a016ad148140c8fefae.tar.xz framework-f1960b9d0f04b834fa069a016ad148140c8fefae.zip |
add minimum
-rwxr-xr-x | Wrappers/Python/ccpi/framework/BlockDataContainer.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Wrappers/Python/ccpi/framework/BlockDataContainer.py b/Wrappers/Python/ccpi/framework/BlockDataContainer.py index 166014b..670e214 100755 --- a/Wrappers/Python/ccpi/framework/BlockDataContainer.py +++ b/Wrappers/Python/ccpi/framework/BlockDataContainer.py @@ -251,6 +251,18 @@ class BlockDataContainer(object): elif isinstance(other, list) or isinstance(other, numpy.ndarray): return type(self)(*[ el.maximum(ot, *args, **kwargs) for el,ot in zip(self.containers,other)], shape=self.shape) return type(self)(*[ el.maximum(ot, *args, **kwargs) for el,ot in zip(self.containers,other.containers)], shape=self.shape) + + + def minimum(self,other, *args, **kwargs): + if not self.is_compatible(other): + raise ValueError('Incompatible for maximum') + out = kwargs.get('out', None) + if isinstance(other, Number): + return type(self)(*[ el.minimum(other, *args, **kwargs) for el in self.containers], shape=self.shape) + elif isinstance(other, list) or isinstance(other, numpy.ndarray): + return type(self)(*[ el.minimum(ot, *args, **kwargs) for el,ot in zip(self.containers,other)], shape=self.shape) + return type(self)(*[ el.minimum(ot, *args, **kwargs) for el,ot in zip(self.containers,other.containers)], shape=self.shape) + ## unary operations def abs(self, *args, **kwargs): |