📄 vandef.c
字号:
/* Copyright (c) Colorado School of Mines, 1990./* All rights reserved. *//*FUNCTION: solve Vandermonde system of equations Vx=b (float version)PARAMETERS:n i dimension of systemv i array of 2nd row of Vandermonde matrix (1st row is all ones)b i array of right-hand-side column vectorx o array of solution column vectorNOTES:The arrays b and x may be equivalenced.Adapted from Algorithm 5.6-2 in Golub, G. H., and Van Loan, C. F., 1983,Matrix Computations, John-Hopkins University Press.AUTHOR: Dave Hale, Colorado School of Mines, 06/02/89*/void vandef (int n, float v[], float b[], float x[]){ int i,j; for (i=0; i<n; i++) x[i] = b[i]; for (i=0; i<n-1; i++) for (j=n-1; j>i; j--) x[j] -= v[i]*x[j-1]; for (i=n-1; i>0; i--) { for (j=i; j<n; j++) x[j] /= (v[j]-v[j-i]); for (j=i; j<n; j++) x[j-1] -= x[j]; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -