arrayfire.index module¶
Index and Seq classes used in indexing operations.
- class arrayfire.index.Index(idx)[source]¶
Bases:
Structure
- Attributes:
- idx
- isBatch
- isSeq
- idx¶
Structure/Union member
- isBatch¶
Structure/Union member
- isSeq¶
Structure/Union member
- class arrayfire.index.ParallelRange(start, stop=None, step=None)[source]¶
Bases:
Seq
Class used to parallelize for loop.
Inherits from Seq.
- Parameters:
- start: number
Beginning of parallel range.
- stopnumber
End of parallel range.
- stepnumber
Step size for parallel range.
Examples
>>> import arrayfire as af >>> a = af.randu(3, 3) >>> b = af.randu(3, 1) >>> c = af.constant(0, 3, 3) >>> for ii in af.ParallelRange(3): ... c[:, ii] = a[:, ii] + b ... >>> af.display(a) [3 3 1 1] 0.4107 0.1794 0.3775 0.8224 0.4198 0.3027 0.9518 0.0081 0.6456
>>> af.display(b) [3 1 1 1] 0.7269 0.7104 0.5201
>>> af.display(c) [3 3 1 1] 1.1377 0.9063 1.1045 1.5328 1.1302 1.0131 1.4719 0.5282 1.1657
- Attributes:
- S: slice
Methods
next
()Function called by the iterator in Python 2