31 |
|
if (!dnew) |
32 |
|
return(NULL); |
33 |
|
|
34 |
< |
dnew->dtype = DTdouble; |
34 |
> |
dnew->dtype = DTrmx_native; |
35 |
|
dnew->nrows = nr; |
36 |
|
dnew->ncols = nc; |
37 |
|
dnew->ncomp = n; |
225 |
|
static int |
226 |
|
rmx_load_double(double *drp, const RMATRIX *rm, FILE *fp) |
227 |
|
{ |
228 |
+ |
if (DTrmx_native != DTdouble) |
229 |
+ |
return(0); |
230 |
|
if (getbinary(drp, sizeof(*drp)*rm->ncomp, rm->ncols, fp) != rm->ncols) |
231 |
|
return(0); |
232 |
|
if (rm->pflags & RMF_SWAPIN) |
340 |
|
int i; |
341 |
|
#ifdef MAP_FILE |
342 |
|
long pos; /* map memory for file > 1MB if possible */ |
343 |
< |
if ((rm->dtype == DTdouble) & !(rm->pflags & RMF_SWAPIN) && |
343 |
> |
if ((rm->dtype == DTrmx_native) & !(rm->pflags & RMF_SWAPIN) && |
344 |
|
rmx_array_size(rm) >= 1L<<20 && |
345 |
|
(pos = ftell(fp)) >= 0 && !(pos % sizeof(double))) { |
346 |
|
rm->mapped = mmap(NULL, rmx_array_size(rm)+pos, PROT_READ|PROT_WRITE, |
593 |
|
return(rmx_write_ascii(dp, nc, len, fp)); |
594 |
|
case DTfloat: |
595 |
|
return(rmx_write_float(dp, nc*len, fp)); |
596 |
< |
case DTdouble: |
596 |
> |
case DTrmx_native: |
597 |
|
return(putbinary(dp, sizeof(*dp)*nc, len, fp) == len); |
598 |
|
case DTrgbe: |
599 |
|
case DTxyze: |
617 |
|
#ifdef getc_unlocked |
618 |
|
flockfile(fp); |
619 |
|
#endif |
620 |
< |
if (dtype == DTdouble) /* write all at once? */ |
620 |
> |
if (dtype == DTrmx_native) /* write all at once? */ |
621 |
|
ok = rmx_write_data(rm->mtx, rm->ncomp, |
622 |
|
rm->nrows*rm->ncols, dtype, fp); |
623 |
|
else /* else row by row */ |