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

ArrayAdapter equality #21

Closed bjlittle closed 11 years ago

bjlittle commented 11 years ago

Shouldn't the following two ArrayAdapter instances be equal? My expectation was that they should be.

>>> import biggus
>>> import numpy as np
>>> array = np.arange(12).reshape(3, 4)
>>> print array
[[ 0  1  2  3]
 [ 4  5  6  7]
 [ 8  9 10 11]]
>>> a = biggus.ArrayAdapter(array, ((1, 2), (1, 2)))
>>> a
<ArrayAdapter shape=(2, 2) dtype=dtype('int64')>
>>> a.ndarray()
array([[ 5,  6],
       [ 9, 10]])
>>> b = biggus.ArrayAdapter(np.array([5, 6, 9, 10]).reshape(2, 2))
>>> b
<ArrayAdapter shape=(2, 2) dtype=dtype('int64')>
>>> b.ndarray()
array([[ 5,  6],
       [ 9, 10]])
>>> a == b
False
rhattersley commented 11 years ago

Shouldn't the following two ArrayAdapter instances be equal?

That's a fair point!

But I confess I'm not really sure why equality is defined at all.

  1. I can't see any code that uses it.
  2. It's not getting exercised by the tests.
  3. The current implementation wouldn't work for large data sources anyway.

So perhaps we should just get rid of it?

bjlittle commented 11 years ago

I'm inclined to agree with you. I suspect that when you were prototyping it made sense to have equality, perhaps for some sort of testing? However, since it's not used and it's implementation is incomplete, we should purge it sooner rather than later.

I'll do the honours ... simple stuff comes easy to me!

rhattersley commented 11 years ago

Closed by #32.