SciTools / biggus

:no_entry: [DEPRECATED] Virtual large arrays and lazy evaluation.
http://biggus.readthedocs.io/
GNU Lesser General Public License v3.0
54 stars 27 forks source link

Document somewhere that the order of the operations matter #152

Closed ocefpaf closed 9 years ago

ocefpaf commented 9 years ago

This took almost 2 hours of my afternoon yesterday:

import numpy as np
import biggus
arr = biggus.NumpyArrayAdapter(np.array([1, 2, 3.]))

1 + arr

TypeError: unsupported operand type(s) for +: 'int' and 'NumpyArrayAdapter'

But biggus is OK with this:

arr + 1
<_Elementwise shape=(3) dtype=dtype('float64')>

(arr + 1).ndarray()
array([ 2.,  3.,  4.])
ocefpaf commented 9 years ago

Similar problem here:

import numpy as np

import biggus

arrb = biggus.NumpyArrayAdapter(np.array([1, 2, 3.]))

arrn = np.array([1, 2, 3.])

arrn + arrb

array([ 2.,  4.,  6.])

but,

arrb + arrn

<_Elementwise shape=(3) dtype=dtype('float64')>

I was expecting that all operation with a biggus array would return another biggus array.

pelson commented 9 years ago

@ocefpaf - sounds like a bug, not a documentation thing...

ocefpaf commented 9 years ago

@ocefpaf - sounds like a bug, not a documentation thing...

It depends on the order of your reading :wink: (Sorry I could not resist.)