Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TODO] Make CR equal to 1 instead of 0.x (such as 0.9 or 0.8) #26

Open
jxybb opened this issue Nov 5, 2022 · 3 comments
Open

[TODO] Make CR equal to 1 instead of 0.x (such as 0.9 or 0.8) #26

jxybb opened this issue Nov 5, 2022 · 3 comments

Comments

@jxybb
Copy link

jxybb commented Nov 5, 2022

Thanks for open source this awesome compressor!
I tried the Python compression API, but it seems the compressor didn't work for 1-D FP32 numpy array.
I tested eb_mode=1 on an array with a lot of zeros, but the compressor seems just compressed it to 120 bytes no matter what eb_rel value I use.
And Interestly, the compressor works after I covert the array to FP64.
Could someone help to look into this? Thanks!

@ayzk
Copy link
Collaborator

ayzk commented Jan 5, 2023

@jz0909 1D FP32 array works on my side. Could you share your data with me so I could dig into it? Thanks.

@jxybb
Copy link
Author

jxybb commented Apr 14, 2023

Thanks @ayzk , looks the issue is not limited to Python. I also see it with C++.
For an 1D float array with 1000 elements on N(0, 1) distribution, when I set eb_rel to 1e-3, the compressed size is larger than uncompressed size. I tried to increase the array size to 5000, and I saw the same issue when eb_rel is 1e-4.

@ayzk
Copy link
Collaborator

ayzk commented May 14, 2023

@jz0909 Thanks for pointing out the problem. The size of 1000 is extremely small and SZ3 is not optimized for such cases yet. I verified the error control is correct. We will make the compressed size equal to 1 in an updated version.

A larger data is more suitable for SZ3. The following code will output a compression ratio around 1.9

data = np.random.normal(0, 1, 5000).astype(np.float32)
data_cmpr, cmpr_ratio = sz.compress(data, 1, 0, 1e-3, 0)

@ayzk ayzk changed the title Python API doesn't work for 1D FP32 array [TODO] Make CR equal to 1 instead of 0.x (such as 0.9 or 0.8) May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants