From b0560c6cffce4a49acd444fc7c75d5e61d4e03ab Mon Sep 17 00:00:00 2001 From: syurkevi Date: Fri, 24 Jul 2020 01:53:27 -0400 Subject: [PATCH] adds missing logical operations on Array --- arrayfire/array.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arrayfire/array.py b/arrayfire/array.py index 50db2a9a8..1b71db2c7 100644 --- a/arrayfire/array.py +++ b/arrayfire/array.py @@ -1093,6 +1093,30 @@ def __invert__(self): safe_call(backend.get().af_bitnot(c_pointer(out.arr), self.arr)) return out + def logical_not(self): + """ + Return ~self + """ + out = Array() + safe_call(backend.get().af_not(c_pointer(out.arr), self.arr)) + return out + + def logical_and(self, other): + """ + Return self && other. + """ + out = Array() + safe_call(backend.get().af_and(c_pointer(out.arr), self.arr, other.arr)) #TODO: bcast var? + return out + + def logical_or(self, other): + """ + Return self || other. + """ + out = Array() + safe_call(backend.get().af_or(c_pointer(out.arr), self.arr, other.arr)) #TODO: bcast var? + return out + def __nonzero__(self): return self != 0