octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: type handling bug?


From: Levente Torok
Subject: Re: type handling bug?
Date: Tue, 26 May 2009 13:02:41 +0200
User-agent: KMail/1.11.2 (Linux/2.6.27-14-generic; KDE/4.2.2; i686; ; )

HI Soren,


Thanks for the quick response.
This behaviour may be questionable.
It modifies my data hiddenly(!) for the expense of some memory saving.


Unfortunately my example contains a reference to another bug (or bug-like) finding as well
and I found no solution to this yet.


im =imread("p1020037.jpg" );
octave:10> sum(sum(im==0))
ans = 16980


z=resize( im, s=rows(im)*columns(im),1 );
octave:11> sum(sum(z==0))
ans = 3144192


Levente


On Tuesday 26 May 2009, Søren Hauberg wrote:
> tir, 26 05 2009 kl. 12:15 +0200, skrev Levente Torok:
> [snip]
> > listing the two vectors together as
> > [ [1:s]' z ]
>
> Here 's' is a 'double' and 'z' is 'uint8'. In matlab, when you concat a
> double and an uint8 you get an uint8. In Matlab 7.6 I see:
>
> >> class ([uint8(1), double(1)])
>
> ans =
>
> uint8
>
> So, this behaviour is compatible. My guess is that people mostly use the
> integer classes to save memory, so Matlab downgrades other types to
> integers when in doubt, to make sure that memory usage doesn't blow up.
>
> Søren
>
>



--
Blogger of http://fapuma.blogspot.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]