正在加载图片...
17.3 Relaxation Methods 771 for (i-iel;i<-ie2;i++){ Implicit pivoting,as in $2.1. big=0.0; for (j=jel;j<=je2;j++) if (fabs(s[i][j])>big)big=fabs(s[i][j]); if (big ==0.0)nrerror("Singular matrix row all 0,in pinvs"); pscl[i]=1.0/big; indxr[i]=0; for (id=ie1;id<=ie2;id++){ piv=0.0; for (isiel;i<eie2;i++) Find pivot element. if (indxr[i]==0){ http://www.n read able files Permission is b1g=0.0; for (i=jel;j<=ie2;j++) if (fabs(s[i][j])>big){ 83g jp=j; (including this one) granted for 19881992 big=fabs(s[i][j]); 11-800 if (big*pscl[i]piv){ -872 ipiv=i; jpiv=jp; to any server computer, by Cambridge University Press. from NUMERICAL RECIPES IN piv=big*pscl[i]; 1 if (s[ipiv][jpiv]==0.0)nrerror("Singular matrix in routine pinvs"); (North America THE indxr[ipiv]=jpiv; In place reduction.Save column ordering. one paper ART pivinv=1.0/s[ipiv][jpiv]; for (j=je1;j<=jsf;j++)s[ipiv][j]*pivinv; Normalize pivot row. s[ipiv][jpiv]=1.0; for (1=1e1;1<=1e2;1+)( Reduce nonpivot elements in column. if(indxr[i]!=jpiv)[ if (s[i][ipiv]){ st st Programs dum=s[i][jpiv] for (j=je1;j<=jsf;j++) s[i][i]-dum*s[ipiv][j]; s[i][jpiv]=0.0; jcoff=jc1-js1; Sort and store unreduced coefficients v@cambri icoff=ie1-je1; for (i-iel;i<=ie2;i++){ irow=indxr [i]+icoff; 1988-1992 by Numerical Recipes OF SCIENTIFIC COMPUTING(ISBN 10-:6211 43108 for (j=js1;j<=jsf;j++)c[irow][j+jcoff][k]=s[i][j]; free_vector(pscl,ie1,ie2); free_ivector(indxr,ie1,ie2); 2 (outside North America) Software. visit website ying of void red(int iz1,int iz2,int jz1,int jz2,int jmi,int jm2,int jmf, machine int icl,int jci,int jcf,int kc,float ***c,float **s) Reduce columns jz1-jz2 of the s matrix,using previous results as stored in the c matrix.Only columns jm1-jm2,jmf are affected by the prior results.red is used internally by solvde. int loff,1,j,ic,i; float vx; loff=jc1-jm1; 1c=1c1:17.3 Relaxation Methods 771 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). for (i=ie1;i<=ie2;i++) { Implicit pivoting, as in §2.1. big=0.0; for (j=je1;j<=je2;j++) if (fabs(s[i][j]) > big) big=fabs(s[i][j]); if (big == 0.0) nrerror("Singular matrix - row all 0, in pinvs"); pscl[i]=1.0/big; indxr[i]=0; } for (id=ie1;id<=ie2;id++) { piv=0.0; for (i=ie1;i<=ie2;i++) { Find pivot element. if (indxr[i] == 0) { big=0.0; for (j=je1;j<=je2;j++) { if (fabs(s[i][j]) > big) { jp=j; big=fabs(s[i][j]); } } if (big*pscl[i] > piv) { ipiv=i; jpiv=jp; piv=big*pscl[i]; } } } if (s[ipiv][jpiv] == 0.0) nrerror("Singular matrix in routine pinvs"); indxr[ipiv]=jpiv; In place reduction. Save column ordering. pivinv=1.0/s[ipiv][jpiv]; for (j=je1;j<=jsf;j++) s[ipiv][j] *= pivinv; Normalize pivot row. s[ipiv][jpiv]=1.0; for (i=ie1;i<=ie2;i++) { Reduce nonpivot elements in column. if (indxr[i] != jpiv) { if (s[i][jpiv]) { dum=s[i][jpiv]; for (j=je1;j<=jsf;j++) s[i][j] -= dum*s[ipiv][j]; s[i][jpiv]=0.0; } } } } jcoff=jc1-js1; Sort and store unreduced coefficients. icoff=ie1-je1; for (i=ie1;i<=ie2;i++) { irow=indxr[i]+icoff; for (j=js1;j<=jsf;j++) c[irow][j+jcoff][k]=s[i][j]; } free_vector(pscl,ie1,ie2); free_ivector(indxr,ie1,ie2); } void red(int iz1, int iz2, int jz1, int jz2, int jm1, int jm2, int jmf, int ic1, int jc1, int jcf, int kc, float ***c, float **s) Reduce columns jz1-jz2 of the s matrix, using previous results as stored in the c matrix. Only columns jm1-jm2,jmf are affected by the prior results. red is used internally by solvde. { int loff,l,j,ic,i; float vx; loff=jc1-jm1; ic=ic1;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有