/[escript]/trunk/paso/src/mmio.c
ViewVC logotype

Diff of /trunk/paso/src/mmio.c

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

revision 1627 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 1628 by phornby, Fri Jul 11 13:12:46 2008 UTC
# Line 21  Line 21 
21  *   (Version 1.01, 5/2003)  *   (Version 1.01, 5/2003)
22  */  */
23    
24    #include "Common.h"
25  #include "mmio.h"  #include "mmio.h"
26    
27  #include <string.h>  #include <string.h>
 #include <malloc.h>  
28  #include <ctype.h>  #include <ctype.h>
29    
30    
# Line 75  int mm_read_unsymmetric_sparse(const cha Line 75  int mm_read_unsymmetric_sparse(const cha
75    
76      /* reseve memory for matrices */      /* reseve memory for matrices */
77    
78      I = (int *) malloc(nz * sizeof(int));      I = MEMALLOC(nz, int);
79      J = (int *) malloc(nz * sizeof(int));      J = MEMALLOC(nz, int);
80      val = (double *) malloc(nz * sizeof(double));      val = MEMALLOC(nz, double);
81    
82      *val_ = val;      *val_ = val;
83      *I_ = I;      *I_ = I;
# Line 369  int mm_read_mtx_crd(char *fname, int *M, Line 369  int mm_read_mtx_crd(char *fname, int *M,
369          return ret_code;          return ret_code;
370    
371    
372      *I = (int *)  malloc(*nz * sizeof(int));      *I = MEMALLOC(*nz, int);
373      *J = (int *)  malloc(*nz * sizeof(int));      *J = MEMALLOC(*nz, int);
374      *val = NULL;      *val = NULL;
375    
376      if (mm_is_complex(*matcode))      if (mm_is_complex(*matcode))
377      {      {
378          *val = (double *) malloc(*nz * 2 * sizeof(double));          *val = MEMALLOC(*nz * 2, double);
379          ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val,          ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val,
380                  *matcode);                  *matcode);
381          if (ret_code != 0) return ret_code;          if (ret_code != 0) return ret_code;
382      }      }
383      else if (mm_is_real(*matcode))      else if (mm_is_real(*matcode))
384      {      {
385          *val = (double *) malloc(*nz * sizeof(double));          *val = MEMALLOC(*nz, double);
386          ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val,          ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val,
387                  *matcode);                  *matcode);
388          if (ret_code != 0) return ret_code;          if (ret_code != 0) return ret_code;

Legend:
Removed from v.1627  
changed lines
  Added in v.1628

  ViewVC Help
Powered by ViewVC 1.1.26