Skip to content

Commit 4237ffb

Browse files
committed
minor fixes
1 parent 10757d1 commit 4237ffb

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

arrayfire/array.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ def __invert__(self):
10111011
out = Array()
10121012
safe_call(backend.get().af_not(c_pointer(out.arr), self.arr))
10131013
self = out
1014+
return self
10141015

10151016
def __nonzero__(self):
10161017
return self != 0

arrayfire/data.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -825,19 +825,23 @@ def lookup(a, idx, dim=0):
825825
---------
826826
827827
>>> import arrayfire as af
828-
>>> a = af.randu(3, 3)
829-
>>> af.display(a)
830-
[3 3 1 1]
831-
0.7269 0.3569 0.3341
832-
0.7104 0.1437 0.0899
833-
0.5201 0.4563 0.5363
828+
>>> arr = af.Array([1,0,3,4,5,6], (2,3))
829+
>>> af.display(arr)
830+
[2 3 1 1]
831+
1.0000 3.0000 5.0000
832+
0.0000 4.0000 6.0000
834833
835-
>>> idx = af.array([1, 2])
836-
>>> o = af.lookup()
837-
[2 1 1 1]
838-
0.7269 0.3569 0.3341
839-
0.7104 0.1437 0.0899
834+
>>> idx = af.array([0, 2])
835+
>>> af.lookup(arr, idx, 1)
836+
[2 2 1 1]
837+
1.0000 5.0000
838+
0.0000 6.0000
840839
840+
>>> idx = af.array([0])
841+
>>> af.lookup(arr, idx, 0)
842+
[2 1 1 1]
843+
0.0000
844+
2.0000
841845
"""
842846
out = Array()
843847
safe_call(backend.get().af_lookup(c_pointer(out.arr), a.arr, idx.arr, c_int_t(dim)))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy