Path: news.mathworks.com!not-for-mail
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$1@fred.mathworks.com>
References: <205a603e-cc38-4088-8d39-5d5b8464abf7@d34g2000vbl.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1270240326 26111 172.30.248.38 (2 Apr 2010 20:32:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 2 Apr 2010 20:32:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:623014

Luna Moon <lunamoonmoon@gmail.com> wrote in message <205a603e-cc38-4088-8d39-5d5b8464abf7@d34g2000vbl.googlegroups.com>...
> 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