From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How do I compress an array of floating numbers in Matlab?
Date: Fri, 2 Apr 2010 20:32:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <hp5k86$pfv$>
References: <>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1270240326 26111 (2 Apr 2010 20:32:06 GMT)
NNTP-Posting-Date: Fri, 2 Apr 2010 20:32:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:623014

Luna Moon <> wrote in message <>...
> Hi all,
> I have a vector of real numbers in Matlab. How do I compress them?  Of
> course this has to be lossless, since I need to be able to recover
> them.
> The goal is to study the Shannon rate and entropy of these real
> numbers, so I decide to compress them and see how much compression
> ratio I can have.
> I don't need to write the result into compressed files, so those
> headers, etc. are just overhead for me which affect me calculating the
> Entropy... so I just need a bare version of the compress ratio...
> Any pointers?
> Thanks a lot!

  Unless your vector has many repetitions or consists of quantities with many trailing zeros in their binary floating point form, (or is of astronomically large size,) I would not expect lossless compression to have much success.  Usually the 53-bit significands of a collection of non-integer floating point numbers are mostly different and the only area where compression is likely to succeed lies in their 11 bits of exponent which tend to be concentrated in a limited area of the 2048 possibilities.

Roger Stafford