Prev: Please help - Problem in Calling Matlab functions from C++
Next: How to get back data using Calllib to DLL
From: Bruno Luong on 26 Feb 2010 13:22 As Steve pointed out, the compression kicks in when saving on disc. Most of the compression algorithms look at similar "pattern" between consecutive elements. Matlab stores the array running down the column. If your matrix has similar pattern on rows but random in column, the compressor will do a better job, resulting smaller size on disc. Bruno
From: us on 26 Feb 2010 13:25 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hm9358$l44$1(a)fred.mathworks.com>... > "us " <us(a)neurol.unizh.ch> wrote in message <hm92m4$ks8$1(a)fred.mathworks.com>... > > > again... > > here (r2009b), this behavior cannot be reproduced... > > > > s=sprandn(1000,1000,.25); > > st=s.'; > > save foo1 s; > > save foo2 st; > > dd=dir('foo*.mat'); > > disp([{dd.name}.',num2cell([dd.bytes].')]); > > %{ > > 'foo1.mat' [2658624] > > 'foo2.mat' [2658624] > > %} > > > urs - this is not a representative example because your sparse matrix is square. It is only when the number of rows and number of columns are very different that you will see the memory footprint difference. thanks, matt... however, the difference is/seems really small... s=sprandn(1000,10,.25); st=s.'; save foo1 s; save foo2 st; dd=dir('foo*.mat'); whos s*; %{ s 1000x10 26588 double sparse st 10x1000 30548 double sparse %} disp([{dd.name}.',num2cell([dd.bytes].')]); %{ 'foo1.mat' [53134] 'foo2.mat' [53135] % <- one byte... %} us
From: Bruno Luong on 26 Feb 2010 13:36 Here is an example to convince us: n = 1000; m = 1e5; i=ceil(n*rand(1,m)); j=ceil(n*rand(1,m)); si = sparse(i,j,i); sj = si'; % <- sparse(j,i,i); "pattern in column" save si.mat si save sj.mat sj sifile=dir('si.mat') sjfile=dir('sj.mat') % Bruno
From: us on 26 Feb 2010 13:47 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hm94ak$63k$1(a)fred.mathworks.com>... > Here is an example to convince us: > > n = 1000; > m = 1e5; > > i=ceil(n*rand(1,m)); > j=ceil(n*rand(1,m)); > si = sparse(i,j,i); > sj = si'; % <- sparse(j,i,i); "pattern in column" > > save si.mat si > save sj.mat sj > > sifile=dir('si.mat') > sjfile=dir('sj.mat') > > % Bruno bruno - done(!): as you said... yet - i -really- don't see much of a difference... but - the vars are square (see MATT's reply) whos si sj; %{ si 1000x1000 1147712 double sparse sj 1000x1000 1147712 double sparse %} disp([sifile.bytes;sjfile.bytes]); %{ 2287463 2287463 %} us
From: Bruno Luong on 26 Feb 2010 14:08 Are you running a dinosaur Matlab without Mat-file compression us? Mine (2010A) gives this: disp([sifile.bytes;sjfile.bytes]) 354319 185892 Bruno
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Please help - Problem in Calling Matlab functions from C++ Next: How to get back data using Calllib to DLL |