正在加载图片...
944 Appendix B if (!m)nrerror("allocation failure 1 in matrix()"); m+=NR_END; m-=nrl; /allocate rows and set pointers to them * m[nrl]=(float *malloc((size_t)((nrow*ncol+NR_END)*sizeof(float))); if (!m[nrl])nrerror("allocation failure 2 in matrix()"); m[nrl]+NR_END; m[nrl]-ncl; for(i=nrl+1;i<mnrh;i++)m[i]=m[i-1]+ncol; http://www.nr. readable files Permission is /return pointer to array of pointers to rows * return m; 83g granted for 19881992 double **dmatrix(long nrl,long nrh,long ncl,long nch) /allocate a double matrix with subscript range m[nrl..nrh][ncl..nch]* 11-600 (including this one) long i,nrow=nrh-nrl+1,ncol=nch-ncl+1; 872 double米*m; 7423 to to tusers to make one paper by Cambridge University Press. from NUMERICAL RECIPES IN /allocate pointers to rows m=(double **malloc((size_t)((nrow+NR_END)*sizeof(double*))); if (!m)nrerror("allocation failure 1 in matrix()"); m+=NR_END; (North America THE m-=nrl; /allocate rows and set pointers to them * m[nrl]=(double *malloc((size_t)((nrow*ncol+NR_END)*sizeof(double))); 是 if (!m[nrl])nrerror("allocation failure 2 in matrix()"); Programs m[nrl]+NR_END; m[nrl]-ncl; st st for(i=nrl+1;i<=nrh;i++)m[i]=m[i-1]+ncol; /return pointer to array of pointers to rows * return m; to directcustsen To order Numerical Recipes books or 1988-1992 by Numerical Recipes ART OF SCIENTIFIC COMPUTING(ISBN 0-521- int **imatrix(long nrl,long nrh,long ncl,long nch) allocate a int matrix with subscript range m[nrl..nrh][ncl..nch]* long i,nrowsnrh-nrl+1,ncolsnch-ncl+1; int **m; @cambridge.org allocate pointers to rows * -431085 m=(int **malloc((size_t)((nrow+NR_END)*sizeof(int*))); if (!m)nrerror("allocation failure 1 in matrix()"); m +NR_END; m-=nrl: (outside North America) Software. /allocate rows and set pointers to them * m[nrl]=(int *malloc((size_t)((nrow*ncol+NR_END)*sizeof(int))); if (!m[nrl])nrerror("allocation failure 2 in matrix()"); machine m[nrl]+NR_END; m[nrl]-ncl; for(i=nrl+1;i<=nrh;i++)m[i]=m[i-1]+ncol; /return pointer to array of pointers to rows*/ return m;944 Appendix B Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copyin Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) g of machine￾readable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America). if (!m) nrerror("allocation failure 1 in matrix()"); m += NR_END; m -= nrl; /* allocate rows and set pointers to them */ m[nrl]=(float *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(float))); if (!m[nrl]) nrerror("allocation failure 2 in matrix()"); m[nrl] += NR_END; m[nrl] -= ncl; for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; /* return pointer to array of pointers to rows */ return m; } double **dmatrix(long nrl, long nrh, long ncl, long nch) /* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */ { long i, nrow=nrh-nrl+1,ncol=nch-ncl+1; double **m; /* allocate pointers to rows */ m=(double **) malloc((size_t)((nrow+NR_END)*sizeof(double*))); if (!m) nrerror("allocation failure 1 in matrix()"); m += NR_END; m -= nrl; /* allocate rows and set pointers to them */ m[nrl]=(double *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(double))); if (!m[nrl]) nrerror("allocation failure 2 in matrix()"); m[nrl] += NR_END; m[nrl] -= ncl; for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; /* return pointer to array of pointers to rows */ return m; } int **imatrix(long nrl, long nrh, long ncl, long nch) /* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */ { long i, nrow=nrh-nrl+1,ncol=nch-ncl+1; int **m; /* allocate pointers to rows */ m=(int **) malloc((size_t)((nrow+NR_END)*sizeof(int*))); if (!m) nrerror("allocation failure 1 in matrix()"); m += NR_END; m -= nrl; /* allocate rows and set pointers to them */ m[nrl]=(int *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(int))); if (!m[nrl]) nrerror("allocation failure 2 in matrix()"); m[nrl] += NR_END; m[nrl] -= ncl; for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; /* return pointer to array of pointers to rows */ return m; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有