/[escript]/branches/doubleplusgood/paso/src/mmio.cpp
ViewVC logotype

Diff of /branches/doubleplusgood/paso/src/mmio.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4323 by jfenwick, Wed Feb 27 06:09:33 2013 UTC revision 4324 by jfenwick, Wed Mar 20 00:55:44 2013 UTC
# Line 77  int mm_read_unsymmetric_sparse(const cha Line 77  int mm_read_unsymmetric_sparse(const cha
77    
78      /* reserve memory for matrices */      /* reserve memory for matrices */
79    
80      Ip = MEMALLOC(nz, int);      Ip = new  int[nz];
81      Jp = MEMALLOC(nz, int);      Jp = new  int[nz];
82      val = MEMALLOC(nz, double);      val = new  double[nz];
83    
84      *val_ = val;      *val_ = val;
85      *I_ = Ip;      *I_ = Ip;
# Line 94  int mm_read_unsymmetric_sparse(const cha Line 94  int mm_read_unsymmetric_sparse(const cha
94      int scan_ret = fscanf(f, "%d %d %lg\n", &Ip[i], &Jp[i], &val[i]);      int scan_ret = fscanf(f, "%d %d %lg\n", &Ip[i], &Jp[i], &val[i]);
95      if (scan_ret!=3)      if (scan_ret!=3)
96      {      {
97              MEMFREE(Ip);              delete[] Ip;
98              MEMFREE(Jp);              delete[] Jp;
99              MEMFREE(val);              delete[] val;
100          fclose(f);          fclose(f);
101          return -1;          return -1;
102      }      }
# Line 380  int mm_read_mtx_crd(char *fname, int *M, Line 380  int mm_read_mtx_crd(char *fname, int *M,
380          return ret_code;          return ret_code;
381    
382    
383      *Ip = MEMALLOC(*nz, int);      *Ip = new  int[*nz];
384      *Jp = MEMALLOC(*nz, int);      *Jp = new  int[*nz];
385      *val = NULL;      *val = NULL;
386    
387      if (mm_is_complex(*matcode))      if (mm_is_complex(*matcode))
388      {      {
389          *val = MEMALLOC(*nz * 2, double);          *val = new  double[*nz * 2];
390          ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *Ip, *Jp, *val,          ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *Ip, *Jp, *val,
391                  *matcode);                  *matcode);
392          if (ret_code != 0) return ret_code;          if (ret_code != 0) return ret_code;
393      }      }
394      else if (mm_is_real(*matcode))      else if (mm_is_real(*matcode))
395      {      {
396          *val = MEMALLOC(*nz, double);          *val = new  double[*nz];
397          ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *Ip, *Jp, *val,          ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *Ip, *Jp, *val,
398                  *matcode);                  *matcode);
399          if (ret_code != 0) return ret_code;          if (ret_code != 0) return ret_code;

Legend:
Removed from v.4323  
changed lines
  Added in v.4324

  ViewVC Help
Powered by ViewVC 1.1.26