* add modulo operator * fix module loops * add in-place modulo operator * update readme * add test files, update documentation
26 lines
574 B
Python
26 lines
574 B
Python
try:
|
|
from ulab import numpy as np
|
|
except:
|
|
import numpy as np
|
|
|
|
|
|
dtypes = (np.uint8, np.int8, np.uint16, np.int16, np.float)
|
|
|
|
for dtype1 in dtypes:
|
|
x1 = np.array(range(6), dtype=dtype1).reshape((2, 3))
|
|
for dtype2 in dtypes:
|
|
x2 = np.array(range(1, 4), dtype=dtype2)
|
|
print(x1 % x2)
|
|
|
|
print()
|
|
print('=' * 30)
|
|
print('inplace modulo')
|
|
print('=' * 30)
|
|
print()
|
|
|
|
for dtype1 in dtypes:
|
|
x1 = np.array(range(6), dtype=dtype1).reshape((2, 3))
|
|
for dtype2 in dtypes:
|
|
x2 = np.array(range(1, 4), dtype=dtype2)
|
|
x1 %= x2
|
|
print(x1)
|