

<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.amigaos.net/w/index.php?action=history&amp;feed=atom&amp;title=MTRX_IFF_Matrix_Data_Storage</id>
	<title>MTRX IFF Matrix Data Storage - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.amigaos.net/w/index.php?action=history&amp;feed=atom&amp;title=MTRX_IFF_Matrix_Data_Storage"/>
	<link rel="alternate" type="text/html" href="https://wiki.amigaos.net/w/index.php?title=MTRX_IFF_Matrix_Data_Storage&amp;action=history"/>
	<updated>2026-05-06T17:09:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.amigaos.net/w/index.php?title=MTRX_IFF_Matrix_Data_Storage&amp;diff=2102&amp;oldid=prev</id>
		<title>Steven Solie: Created page with &quot;= MTRX =  &lt;pre&gt; Numerical data storage (MathVision - Seven Seas)  MTRX FORM, for matrix data storage                    19-July-1990  Submitted by: Doug Houck               Se...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.amigaos.net/w/index.php?title=MTRX_IFF_Matrix_Data_Storage&amp;diff=2102&amp;oldid=prev"/>
		<updated>2012-05-10T19:36:58Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= MTRX =  &amp;lt;pre&amp;gt; Numerical data storage (MathVision - Seven Seas)  MTRX FORM, for matrix data storage                    19-July-1990  Submitted by: Doug Houck               Se...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= MTRX =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Numerical data storage (MathVision - Seven Seas)&lt;br /&gt;
&lt;br /&gt;
MTRX FORM, for matrix data storage                    19-July-1990&lt;br /&gt;
&lt;br /&gt;
Submitted by: Doug Houck&lt;br /&gt;
              Seven Seas Software&lt;br /&gt;
              (address, etc)&lt;br /&gt;
&lt;br /&gt;
INTRODUCTION:&lt;br /&gt;
&lt;br /&gt;
Numerical data, as it comes from the real world, is an ill-mannered beast.&lt;br /&gt;
Often much is assumed about the data, such as the number of dimensions, &lt;br /&gt;
formatting, compression, limits, and sizes.  As such, data is not portable.&lt;br /&gt;
The MTRX FORM will both store the data, and completely describe its&lt;br /&gt;
format, such that programs no longer need to guess the parameters of&lt;br /&gt;
a data file.  There needs to be but one program to read ascii files and&lt;br /&gt;
output MTRX IFF files.&lt;br /&gt;
&lt;br /&gt;
A matrix, by our definition, is composed of three types of things.&lt;br /&gt;
Firstly, the atomic data, such as an integer, or floating point number.&lt;br /&gt;
Secondly, arrays, which are simply lists of things which are all the same.&lt;br /&gt;
Thirdly, structures, which are lists of things which are different.&lt;br /&gt;
Both arrays and structures may be composed of things besides atomic data - &lt;br /&gt;
they may contain other structures and arrays as well.  This concept&lt;br /&gt;
of nesting structures may be repeated to any desired depth. &lt;br /&gt;
&lt;br /&gt;
For example, a list of data pairs could be encoded as an array of structures,&lt;br /&gt;
where each structure contains two numbers.  A two-dimensional array is&lt;br /&gt;
simply an array of arrays.  &lt;br /&gt;
&lt;br /&gt;
Since space conservation is often desirable, there is provision for&lt;br /&gt;
representing each number with fewer bits, and compressing the bits together.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CHUNKS&lt;br /&gt;
&lt;br /&gt;
The MTRX FORM is composed of the definition of the structure, followed&lt;br /&gt;
by the BODY which contains the data which is defined.  Usually, there&lt;br /&gt;
is only one set of data, but a smarter IFF read could use the definition&lt;br /&gt;
as a PROPerty, with identically formatted data sets (BODYs) in a LIST.&lt;br /&gt;
&lt;br /&gt;
  FORM MTRX&lt;br /&gt;
    definition (ARRY | STRU | DTYP)&lt;br /&gt;
    BODY&lt;br /&gt;
&lt;br /&gt;
ARRY: The array chunk defines a counted list of similar items.&lt;br /&gt;
The first (required) chunk in an ARRY is ELEM, which gives the number&lt;br /&gt;
of elements in the array.  Optionally, there may be limits given, (LOWR&lt;br /&gt;
and UPPR), which could be used in scaling during sampling of the data.&lt;br /&gt;
Lastly is the definition of an element of the array, which may be a &lt;br /&gt;
nested definition like everything else. &lt;br /&gt;
&lt;br /&gt;
  ARRY ::= &amp;quot;ARRY&amp;quot; #{ ELEM [LOWR] [UPPR] [PACK] ARRY|STRU|DTYP }&lt;br /&gt;
&lt;br /&gt;
STRU: The structure chunk defines a counted list of dissimilar things.&lt;br /&gt;
The first (required) chunk in a STRU is FLDS, which gives the number &lt;br /&gt;
of fields in the structure.  Lastly are definitions of each field&lt;br /&gt;
in the structure.  Again, each field may have a nested definition like&lt;br /&gt;
everything else.&lt;br /&gt;
&lt;br /&gt;
 STRU ::= &amp;quot;STRU&amp;quot; #{ FLDS ([PACK] ARRY|STRU|DTYP)* }&lt;br /&gt;
&lt;br /&gt;
VALU: The value contains a datatype, and then a constant of that type.&lt;br /&gt;
The datatype contains the size of the constant, so this chunk has variable&lt;br /&gt;
size.  VALU is used in the ARRY chunk to give the scaling limits of the array.&lt;br /&gt;
&lt;br /&gt;
BODY: This is the actual data we went to so much effort to describe.&lt;br /&gt;
It is stored in &amp;quot;row-first&amp;quot; format, that is, items at the bottom of the&lt;br /&gt;
nested description are stored next to each other.  In most cases, it&lt;br /&gt;
should be sufficient to simply block-read the whole chunk from disk, &lt;br /&gt;
unless the reader needs to adjust byte-ordering or store in a more&lt;br /&gt;
time-efficient format in memory.  Data is assumed to be byte-aligned.&lt;br /&gt;
&lt;br /&gt;
PACK: The PACK chunk is necessary when the bit length of the data is&lt;br /&gt;
not a multiple of 8, that is, not byte-aligned, and the user wishes&lt;br /&gt;
to conserve space by packing data items together.  PACK is simply a&lt;br /&gt;
number - the number of items to bit-pack before aligning on a byte.&lt;br /&gt;
A PACK is in effect for the remainder of its nested scope, or until &lt;br /&gt;
overridden by a new specification.  A STRU or ARRY is assumed to have &lt;br /&gt;
a PACK of 1 by default - it is not affected by PACKs in definitions above.&lt;br /&gt;
A PACK of 0 means to byte-align before processing the next definition.&lt;br /&gt;
The PACK specifier should be normalized.  For example, when packing a large&lt;br /&gt;
array of 3-bit numbers, PACK should be 8 since 3*8 = 24. In this case 8 is&lt;br /&gt;
the smallest PACK number which aligns on a byte naturally.&lt;br /&gt;
&lt;br /&gt;
DTYP: The DataType is the most interesting chunk, as it attempts to define&lt;br /&gt;
every conceivable type of numeric data with 32 bits.  The 32 bits are broken&lt;br /&gt;
down into three fields, 1) the size in bits, 2) the Class, and 3) SubClass.&lt;br /&gt;
The Class makes the most major distinction, separating integers from floating&lt;br /&gt;
point numbers from Binary Coded Decimal and etc.  Within each class is a&lt;br /&gt;
SubClass, which gives the specific encoding used.  Finally, the Size tells&lt;br /&gt;
what how much room the data occupies.  The basic division of datatypes is&lt;br /&gt;
given in the tree structure below.&lt;br /&gt;
&lt;br /&gt;
Class             SubClass     Size  Final Specific Type&lt;br /&gt;
=====             ========     ====  ===================&lt;br /&gt;
 |&lt;br /&gt;
Binary Unsigned - 0 ------------ 8   UByte&lt;br /&gt;
 |                              16   UWord&lt;br /&gt;
 |                              32   ULong&lt;br /&gt;
 |&lt;br /&gt;
Binary Signed --- 0 ------------  8  Byte&lt;br /&gt;
 |                               16  Word&lt;br /&gt;
 |                               32  ULong&lt;br /&gt;
 |&lt;br /&gt;
Real ------------Ieee38 -------- 32  Ieee Single Precision&lt;br /&gt;
 |                |&lt;br /&gt;
 |               Ieee308 ------- 64  Double Precision&lt;br /&gt;
 |                |              32  Truncated Double Precision&lt;br /&gt;
 |                |&lt;br /&gt;
 |               FFP ----------- 32  Motorola Fast Floating Point&lt;br /&gt;
 |&lt;br /&gt;
Text ----------- Text0 --------- ??  Null-terminated text&lt;br /&gt;
 |                |&lt;br /&gt;
 |               CText --------- ??  Number of characters in first byte&lt;br /&gt;
 |                |&lt;br /&gt;
 |               FText --------- ??  Fixed length, space padded&lt;br /&gt;
 |&lt;br /&gt;
BCD ------------ Nibble -------- ??&lt;br /&gt;
                  |&lt;br /&gt;
                 Character ----- ??&lt;br /&gt;
&lt;br /&gt;
  A design goal was to create a classification system which other people&lt;br /&gt;
can easily plug into.  Many data types are simply size variations on &lt;br /&gt;
existing data types.  For example, a 4-bit integer can be specified by&lt;br /&gt;
giving the size as four bits in the Signed Binary class.  Be aware that&lt;br /&gt;
not all MTRX readers may support your new type, but there will not be&lt;br /&gt;
any type clashes or ambiguities by following these rules.  If you have&lt;br /&gt;
a truly unique Class or SubClass, you will need to register it with&lt;br /&gt;
Commodore to prevent clashes.&lt;br /&gt;
&lt;br /&gt;
 A second design goal was to create a format which is easily decoded&lt;br /&gt;
by software.  By aligning fields on bytes, you have the option of redefining&lt;br /&gt;
the datatype as a structure, so as to avoid shifting when accessing the &lt;br /&gt;
fields.  Since the numbers are sequentially assigned, they are suitable&lt;br /&gt;
as array indicies, and may be optimized in a C switch statement.&lt;br /&gt;
&lt;br /&gt;
A third design goal was allowing for naive and sophisticated readers.&lt;br /&gt;
In checking for a certain datatype, a naive reader can simply compare&lt;br /&gt;
the whole datatype with a small set of known types, which assumes that&lt;br /&gt;
each different Size defines a unique datatype.  Sophisticated readers&lt;br /&gt;
will consider the Class, SubClass and Size separately, so as to support&lt;br /&gt;
arbitrary size integers, and truncated Floating Point numbers, for example. &lt;br /&gt;
&lt;br /&gt;
 *&lt;br /&gt;
 * MTRX ::= &amp;quot;FORM&amp;quot; #{ &amp;quot;MTRX&amp;quot; ARRY|STRU|DTYP BODY        } Matrix&lt;br /&gt;
 * ARRY ::= &amp;quot;ARRY&amp;quot; #{ ELEM [LOWR] [UPPR] [PACK] ARRY|STRU|DTYP } Array&lt;br /&gt;
 * STRU ::= &amp;quot;STRU&amp;quot; #{ FLDS ([PACK] ARRY|STRU|DTYP)*     } Structure&lt;br /&gt;
 * ELEM ::= &amp;quot;ELEM&amp;quot; #{ elements                          } Array elements&lt;br /&gt;
 * LOWR ::= &amp;quot;LOWR&amp;quot;  { VALU                              } Minimum limit &lt;br /&gt;
 * UPPR ::= &amp;quot;UPPR&amp;quot;  { VALU                              } Maximum limit&lt;br /&gt;
 * VALU ::=        #{ dtyp value                        } Value (in union)&lt;br /&gt;
 * dtyp ::=         { size, subclass, class             } Data Type (scalar)&lt;br /&gt;
 * DTYP ::= &amp;quot;DTYP&amp;quot; #{ dtyp                              } &lt;br /&gt;
 * FLDS ::= &amp;quot;FLDS&amp;quot; #{ number of fields                  } Number of Fields&lt;br /&gt;
 * PACK ::= &amp;quot;PACK&amp;quot; #{ units packed b4 byte alignment    } Packing&lt;br /&gt;
 * BODY ::= &amp;quot;BODY&amp;quot; #{ inner-first binary dump           } Data&lt;br /&gt;
 *&lt;br /&gt;
 *   [] means optional&lt;br /&gt;
 *   #  means the size of the unit following&lt;br /&gt;
 *   *  means one or more of&lt;br /&gt;
 *&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Steven Solie</name></author>
	</entry>
</feed>