src/GamIO/ML5Reals.cc
/* These are the functions which will input a reals array sub-element in MATLAB
   ".mat" binary format, version 5.  In a valid MATLAB MAT file, the reals 
   array sub-element is a combination of {tag,data}, and both will be read in
   these funcitons.  
   Remember, the MATLAB MAT version 5 tag for this sub-element contains
   8-bytes with two important settings: 1.) data type & 2.) # of bytes.
   The data type resides in the first 4 bytes and the number of bytes
   resides in the last 4 bytes (for non-compressed data elements, which should
   be the case for arrays). 
   It would be splendid if the array elements themselves were stored as doubles
   (MATLAB type miDOUBLE, i.e. value 9), but such will only be certain if the
   MAT file was generated from GAMMA. Instead, we may have to type cast the
   values and byte swap as needed.
   Finally, class MatLab5Tag does handle reading of the tag but class 
   MatLab5SE does NOT handle reading of the data.  That is because here we want
   the data placed into a GAMMA array, and that same array we will wish to 
   share with the imaginaries array sub-element if necessary.  So we handle the
   data input directly.
 
                Input           ML5Re	: MAT version 5 sub-element (this)
                                fp      : Output file stream
				mx      : GAMMA matrix
				rv	: GAMMA row vector
				cv	: GAMMA column vector
                Output          void    : Output file stream is modified
                                          by having the ML5Re written to it
                Note                    : No care taken herein to insure the
 
                Input           ML5Re	: MAT version 5 reals array (this)
                                fp      : Input file stream
                                warn    : Warning output level
                                                0 = no warnings
                                                1 = warnings
                                               >1 = fatal warnings
                Output          void    : ML5Re is set from values found
                                          in the input stream
                Note                    : No care is taken to insure the
                                          reals array is read from the top of a
                                          data element (as it should be in
					  MATLAB)                            */
These are the functions which will input a reals array sub-element in MATLAB
".mat" binary format, version 5.  In a valid MATLAB MAT file, the reals
array sub-element is a combination of {tag,data}, and both will be read in
these funcitons.
Remember, the MATLAB MAT version 5 tag for this sub-element contains
8-bytes with two important settings: 1.) data type & 2.) # of bytes.
The data type resides in the first 4 bytes and the number of bytes
resides in the last 4 bytes (for non-compressed data elements, which should
be the case for arrays).
It would be splendid if the array elements themselves were stored as doubles
(MATLAB type miDOUBLE, i.e. value 9), but such will only be certain if the
MAT file was generated from GAMMA. Instead, we may have to type cast the
values and byte swap as needed.
Finally, class MatLab5Tag does handle reading of the tag but class
MatLab5SE does NOT handle reading of the data.  That is because here we want
the data placed into a GAMMA array, and that same array we will wish to
share with the imaginaries array sub-element if necessary.  So we handle the
data input directly.




These are the functions which will input a reals array sub - element in MATLAB " . mat " binary format version 5 . In a valid MATLAB MAT file the reals array sub - element is a combination of { tag data } and both will be read in these funcitons . Remember the MATLAB MAT version 5 tag for this sub - element contains 8 - bytes with two important settings : 1 . ) data type & 2 . ) # of bytes . The data type resides in the first 4 bytes and the number of bytes resides in the last 4 bytes ( for non - compressed data elements which should be the case for arrays ) . It would be splendid if the array elements themselves were stored as doubles ( MATLAB type miDOUBLE i . e . value 9 ) but such will only be certain if the MAT file was generated from GAMMA . Instead we may have to type cast the values and byte swap as needed . Finally class MatLab5Tag does handle reading of the tag but class MatLab5SE does NOT handle reading of the data . That is because here we want the data placed into a GAMMA array and that same array we will wish to share with the imaginaries array sub - element if necessary . So we handle the data input directly .
int MatLab5Re::fread(std::fstream& fp, int bigend, int warn)
  {
  if(!MLTag.read(fp, bigend, (warn)?1:0)) 	
    {                                           
    if(warn)                                    
      {                                         
      if(warn==1) MLRE5error(10, 1);
      else        MLRE5fatality(10);
      }  
    return 0;
    }
  if(!MLTag.Compressed)				
    fp.seekp(MLTag.Bytes(), std::ios::cur);		
  return 1;					
  }
int MatLab5Re :: fread ( std :: fstream & fp , int bigend , int warn ) { if ( ! MLTag . read ( fp , bigend , ( warn ) ? 1 : 0 ) ) { if ( warn ) { if ( warn == 1 ) MLRE5error ( 10 , 1 ) ; else MLRE5fatality ( 10 ) ; } return 0 ; } if ( ! MLTag . Compressed ) fp . seekp ( MLTag . Bytes ( ) , std :: ios :: cur ) ; return 1 ; }
These are the functions which will input a reals array sub-element in MATLAB
".mat" binary format, version 5.
These are the functions which will input a reals array sub - element in MATLAB " . mat " binary format version 5 .
// Read sub-element tag // If this has problems, then // we must deal with them // appropriately now // If the data element isn't // compressed, skip to data end // (if compressed, at end now)