bh107 / bohrium

Automatic parallelization of Python/NumPy, C, and C++ codes on Linux and MacOSX
http://www.bh107.org
Apache License 2.0
220 stars 31 forks source link

bh107: Can't multiply from the left #632

Open jamesavery opened 4 years ago

jamesavery commented 4 years ago

Binary operations with scalars are implemented only when the scalar is on the right. Negation isn't working either.

Example:

import numpy as np
import bh107 as bh

xs = bh.array(np.linspace(0,10,100)) # Oh, linspace is also missing
g = bh.exp(-xs**2)       # Unsupported operand
g = bh.exp((xs**2)*-1) # Works, is pretty awkward
f = 0.5*g                      # Unsupported operand
f = g*0.5                      # Works
h = 1+f                        # Unsupported operand
h = f+1                        # Works, you get the picture

It's pretty grueling to change this everywhere when I want to test with bh107. It should be easy to fix, but I don't know where to do it.

dionhaefner commented 4 years ago

It's fixed in my PR. I can clean it up and we can merge that part.