1111nrutil.c

来自「nrtil.cpp nrtil.c 计算对角所必须」· C语言 代码 · 共 56 行

C
56
字号
 #include "nrutil.h"
 #include "malloc.h"
#include   <math.h>   
#define   NRANSI   
  //#include   "nrutil.h"  
 //#include "NR_UTILSnrutil.h" 
float   *vector(long   nl,   long   nh)   
  /*   allocate   a   float   vector   with   subscript   range   v[nl..nh]   */   
  {   
  float   *v;   
    
  v=(float   *)malloc((size_t)   ((nh-nl+1+NR_END)*sizeof(float)));   
  if   (!v)   nrerror("allocation   failure   in   vector()");   
  return   v-nl+NR_END;   
  }   
    
  int   *ivector(long   nl,   long   nh)   
  /*   allocate   an   int   vector   with   subscript   range   v[nl..nh]   */   
  {   
  int   *v;   
    
  v=(int   *)malloc((size_t)   ((nh-nl+1+NR_END)*sizeof(int)));   
  if   (!v)   nrerror("allocation   failure   in   ivector()");   
  return   v-nl+NR_END;   
  }   
    
  unsigned   char   *cvector(long   nl,   long   nh)   
  /*   allocate   an   unsigned   char   vector   with   subscript   range   v[nl..nh]   */   
  {   
  unsigned   char   *v;   
    
  v=(unsigned   char   *)malloc((size_t)   ((nh-nl+1+NR_END)*sizeof(unsigned   char)));   
  if   (!v)   nrerror("allocation   failure   in   cvector()");   
  return   v-nl+NR_END;   
  }   
    
  unsigned   long   *lvector(long   nl,   long   nh)   
  /*   allocate   an   unsigned   long   vector   with   subscript   range   v[nl..nh]   */   
  {   
  unsigned   long   *v;   
    
  v=(unsigned   long   *)malloc((size_t)   ((nh-nl+1+NR_END)*sizeof(long)));   
  if   (!v)   nrerror("allocation   failure   in   lvector()");   
  return   v-nl+NR_END;   
  }   
    
  double   *dvector(long   nl,   long   nh)   
  /*   allocate   a   double   vector   with   subscript   range   v[nl..nh]   */   
  {   
  double   *v;   
    
  v=(double   *)malloc((size_t)   ((nh-nl+1+NR_END)*sizeof(double)));   
  if   (!v)   nrerror("allocation   failure   in   dvector()");   
  return   v-nl+NR_END;   
  } 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?