[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #31942] Save/load single precision variables w
From: |
David Bateman |
Subject: |
[Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails |
Date: |
Thu, 06 Jan 2011 22:18:56 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009091010 Iceweasel/3.0.14 (Debian-3.0.14-1) |
Follow-up Comment #9, bug #31942 (project octave):
I'm starting to remember why I hate the matlab file format....
The new issue has to do with the way matlab treats small (tag,value) pairs.
That is a matlab data element is made up of a number of pairs (tag,value)
where the tag contains the type of the value and its size in bytes. Typically
the tag is 8 bytes with 4 bytes of the type followed by 4 bytes for the length
of value.. and here's the catch. If the size saved in the tag is 4bytes of
less, then the type is coded in 2 bytes, the length in two bytes and the data
in four bytes!
As the length of a single element in the double type is 8 bytes they were
never saved with short tags.. Single elements of the single type however are.
So when calculating the length of the data to be saved we now need to take
into account short tags for the single precision type.. My copy-paste to
create the single-precision load/save code didn't take this into account.
I've attached a new changeset and hopefully this time there are no further
issues. The new patch also avoids some copying when calculating the element
length by casting the arrays as const.
Given the past history of this bug I won't commit this and close this bug
till I have a report that there aren't any other issues.
D.
(file #22365)
_______________________________________________________
Additional Item Attachment:
File name: changeset2.single Size:3 KB
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31942>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails, anonymous, 2011/01/04
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails, Rik, 2011/01/04
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails, David Bateman, 2011/01/04
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails, Søren Hauberg, 2011/01/05
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails, anonymous, 2011/01/05
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails, David Bateman, 2011/01/05
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails, anonymous, 2011/01/06
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails,
David Bateman <=
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails, John W. Eaton, 2011/01/09
- [Octave-bug-tracker] [bug #31942] Save/load single precision variables with MATLAB data format fails, David Bateman, 2011/01/09