Skip to main content
22 events
when toggle format what by license comment
Mar 1, 2021 at 11:13 comment added Kvothe Actually running the exact code in your answer in Mathematica I can't manage to correctly decode anything. Could you include an example.
Mar 1, 2021 at 11:02 comment added Kvothe When I try to decode a compressed string in python (using data = data if isinstance(data, bytes) else data.encode('utf-8') zlib.decompress(data) ) I get the error zlib.error: Error -3 while decompressing data: incorrect header check. I have tried with the leading 1: and without it. What am I doing wrong?
Apr 24, 2018 at 11:13 history edited Andy C. CC BY-SA 3.0
deleted 2 characters in body
Apr 13, 2017 at 12:56 history edited CommunityBot
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Aug 21, 2016 at 7:03 comment added Andy C. @HristoVrigazov Presumably the same way you do it in any language: you look at documentation, experiment and figure it out. The answer you're commenting on literally tells you how the binary format works, and in case you understand JavaScript, my parser comes with full source code. I'm not sure what else I can do to help.
Aug 18, 2016 at 17:14 comment added Hristo Vrigazov How can I do that with Python?
Aug 18, 2016 at 17:13 comment added Andy C. @HristoVrigazov That won't work; the first step is to convert whatever you're trying to compress into Mathematica's binary format.
Aug 17, 2016 at 9:29 comment added Hristo Vrigazov How do I simulate Compress? I am trying base64.b64encode(zlib.compress('string'))
Jul 30, 2016 at 15:18 comment added Andy C. Uh, my bad. It should work now.
Jul 20, 2016 at 6:22 comment added vapor It's not uncompressing Compress[-1] correctly
Jan 25, 2016 at 19:17 history edited Andy C. CC BY-SA 3.0
updated to add link to JS implementation
Jan 25, 2016 at 14:07 comment added Szabolcs I tried to capture some MathLink traffic with tcpflow. It's not the same as what you decode from Compress.
Jan 25, 2016 at 13:19 comment added Andy C. @Szabolcs Even ridiculously huge integer arrays (just tried RandomInteger[100, {250, 250}]) serialize to nested lists.
Jan 25, 2016 at 11:08 comment added Szabolcs Here's a tool for decoding this data without python: mathematica.stackexchange.com/q/75517/12 (function at the end of post)
Jan 24, 2016 at 22:30 comment added Szabolcs There isn't a separate representation for integer arrays? Can you try compressing a packed integer array, e.g. RandomInteger[100, {10, 5}]? This is interesting also because it is likely some sort of serialization of MathLink data (potentially even the exact same thing MathLink uses). It would be interesting to investigate that too (i.e. capture what MathLink is sending through the network when using TCP/IP).
Jan 24, 2016 at 21:46 history edited Andy C. CC BY-SA 3.0
added 33 characters in body
Jan 24, 2016 at 17:42 comment added Mark Adler The "1:" may be a version and/or endianess indicator. Oleksandr is correct in that calling those "reversed" is just a personal bias on your part. They are in the correct and proper little-endian order. (Note that the use of "correct and proper" is a personal bias on my part.)
Jan 24, 2016 at 9:39 comment added Andy C. @OleksandrR. The format should be platform-independent - as mentioned in the question, it's used in notebook files to store 3D graphics.
Jan 24, 2016 at 7:05 comment added Oleksandr R. I think all of the reversed quantities are not "reversed" as such, but just stored in little-endian format. Probably on other platforms a big-endian coding would have been used instead.
Jan 24, 2016 at 0:46 history edited Andy C. CC BY-SA 3.0
Added the "e" encoding used for large real matrices
Jan 23, 2016 at 22:01 history edited Andy C. CC BY-SA 3.0
added 1 character in body
Jan 23, 2016 at 17:02 history answered Andy C. CC BY-SA 3.0