danpovey / lilcom

Small compression utility
Other
33 stars 10 forks source link

lilcom fails to compress Fortran contiguous arrays. #31

Closed videodanchik closed 3 years ago

videodanchik commented 3 years ago

Hi, it seems that lilcom fails to compress Fortran contiguous arrays and it's probably ok, as numpy preserves C contiguity in the majority operations, but some of the common operators like numpy.transpose() changes the contiguity.

To reproduce:

>>> import lilcom
>>> import numpy as np
>>> value = np.array([[0.1, 0.2], [0.3, 0.4]])
>>> lilcom.compress(value)
b'L\x00g\xc2\x0f\x13\x08\xc0\x04\x02\x10\x8dd2\x9b\x01'
>>> lilcom.compress(value.T)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/videodanchik/anaconda3/lib/python3.8/site-packages/lilcom/lilcom_interface.py", line 38, in compress
    raise RuntimeError("Something went wrong in compression, return value was ",
RuntimeError: ('Something went wrong in compression, return value was ', None)

Just in case, this error I got in the following environment:

Python 3.8.3 (default, Jul  2 2020, 16:21:59) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
danpovey commented 3 years ago

Resolved via #32