正在加载图片...
22 Chapter 1.Preliminaries void free_dmatrix(double **m,long nrl,long nrh,long ncl,long nch) Frees a matrix allocated with dmatrix. void free_imatrix(int **m,long nrl,long nrh,long ncl,long nch) Frees a matrix allocated with imatrix. A typical use is float **a; http://www.nr. Permission is readable files a=matrix(1,13,1,9); a[3][5]=... 83g ..+a[2][9]/3.0. someroutine(a,...); 11-800 (including this one) 19881992 free_matrix(a,1,13,1,9); All matrices in Numerical Recipes are handled with the above paradigm,and we commend it to you. Some further utilities for handling matrices are also included in nrutil.c. (North The first is a function submatrix()that sets up a new pointer reference to an America by Cambridge University Press. users to make one paper from NUMERICAL RECIPES IN computer, THE already-existing matrix (or sub-block thereof),along with new offsets if desired. Its synopsis is ART 9 Programs float **submatrix(float **a,long oldrl,long oldrh,long oldcl, long oldch,long newrl,long nevcl) Point a submatrix [newrl..newrl+(oldrh-oldrl)][newcl..newcl+(oldch-oldcl)]to the existing matrix range a[oldr1..oldrh][oldcl..oldch]. 兰三会袋 to dir Here oldrl and oldrh are respectively the lower and upper row indices of the original matrix that are to be represented by the new matrix,oldcl and oldch are OF SCIENTIFIC COMPUTING (ISBN the corresponding column indices,and newrl and newcl are the lower row and 19841820 column indices for the new matrix.(We don't need upper row and column indices, since they are implied by the quantities already given.) 10-521 Two sample uses might be,first,to select as a 2 x 2 submatrix b[1..2] [1..2]some interior range of an existing matrix,say a[4..5][2..3], Numerical Recipes 43108 f10at**a,**b; (outside a=matrix(1,13,1,9); North Software. b=submatrix(a,4,5,2,3,1,1); and second,to map an existing matrix a[1..13][1..9]into a new matrix b[0.12][0..8], float **a,**b; a=matrix(1,13,1,9): b=submatrix(a,1,13,1,9,0,0);22 Chapter 1. Preliminaries 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). void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch) Frees a matrix allocated with dmatrix. void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch) Frees a matrix allocated with imatrix. A typical use is float **a; a=matrix(1,13,1,9); ... a[3][5]=... ...+a[2][9]/3.0... someroutine(a,...); ... free_matrix(a,1,13,1,9); All matrices in Numerical Recipes are handled with the above paradigm, and we commend it to you. Some further utilities for handling matrices are also included in nrutil.c. The first is a function submatrix() that sets up a new pointer reference to an already-existing matrix (or sub-block thereof), along with new offsets if desired. Its synopsis is float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long oldch, long newrl, long newcl) Point a submatrix [newrl..newrl+(oldrh-oldrl)][newcl..newcl+(oldch-oldcl)] to the existing matrix range a[oldrl..oldrh][oldcl..oldch]. Here oldrl and oldrh are respectively the lower and upper row indices of the original matrix that are to be represented by the new matrix, oldcl and oldch are the corresponding column indices, and newrl and newcl are the lower row and column indices for the new matrix. (We don’t need upper row and column indices, since they are implied by the quantities already given.) Two sample uses might be, first, to select as a 2 × 2 submatrix b[1..2] [1..2] some interior range of an existing matrix, say a[4..5][2..3], float **a,**b; a=matrix(1,13,1,9); ... b=submatrix(a,4,5,2,3,1,1); and second, to map an existing matrix a[1..13][1..9] into a new matrix b[0..12][0..8], float **a,**b; a=matrix(1,13,1,9); ... b=submatrix(a,1,13,1,9,0,0);
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有