/*
 * call-seq: _dump
 *
 * For Marshal.  Uses native data format.
 *
 */
VALUE rb_dmatrix_marshal_dump(VALUE self, VALUE depth)
{
    /*
     * format:
     *   sizeof(integer)                  vsize  
     *   sizeof(integer)                  hsize
     *   40*sizeof(char)                  reserved
     *   vsize*hsize*sizeof(doublereal)   data
     */

    DMatrix* a ;
    VALUE str ;
    char reserved[40] = { 0 } ;
    
    get_dmatrix(a, self) ;
    
    str = rb_str_buf_new(1*sizeof(integer) +
                         1*sizeof(integer) +
                         40*sizeof(char) +
                         a->vsize*a->hsize*sizeof(doublereal)) ;

    rb_str_buf_cat(str, (const char*)(&a->vsize), 1*sizeof(integer)) ;
    rb_str_buf_cat(str, (const char*)(&a->hsize), 1*sizeof(integer)) ;
    rb_str_buf_cat(str, (const char*)(reserved), 40*sizeof(char)) ;
    rb_str_buf_cat(str, (const char*)(a->data),
                   a->vsize*a->hsize*sizeof(doublereal)) ;
    return str ;
}