⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stoepd.c

📁 seismic software,very useful
💻 C
字号:
/* Copyright (c) Colorado School of Mines, 1990./* All rights reserved.                       *//*FUNCTION:  solve a symmetric Toeplitz linear system of equations Rf=g for f(double version)PARAMETERS:n			i dimension of systemr			i array of top row of Toeplitz matrixg			i array of right-hand-side column vectorf			o array of solution (left-hand-side) column vectora			o array of solution to Ra=v (Claerbout, FGDP, p. 57)NOTES:This routine does NOT solve the case when the main diagonal is zero, itjust silently returns.The left column of the Toeplitz matrix is assumed to be equal to the toprow (as specified in r); i.e., the Toeplitz matrix is assumed symmetric.AUTHOR:  Dave Hale, Colorado School of Mines, 06/02/89*/void stoepd (int n, double r[], double g[], double f[], double a[]){	int i,j;	double v,e,c,w,bot;	if (r[0] == 0.0) return;	a[0] = 1.0;	v = r[0];	f[0] = g[0]/r[0];	for (j=1; j<n; j++) {				/* solve Ra=v as in Claerbout, FGDP, p. 57 */		a[j] = 0.0;		f[j] = 0.0;		for (i=0,e=0.0; i<j; i++)			e += a[i]*r[j-i];		c = e/v;		v -= c*e;		for (i=0; i<=j/2; i++) {			bot = a[j-i]-c*a[i];			a[i] -= c*a[j-i];			a[j-i] = bot;		}		/* use a and v above to get f[i], i = 0,1,2,...,j */		for (i=0,w=0.0; i<j; i++)			w += f[i]*r[j-i];		c = (w-g[j])/v;		for (i=0; i<=j; i++)			f[i] -= c*a[j-i];	}}

⌨️ 快捷键说明

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