数值分析C程序:LU直接三角分解,改进平方根法,追赶法(摘)
#define N 4
#include<stdio.h>
main()
{
int i,j,r,k;
float a[N][N],l[N][N],u[N][N],b[N],x[N],y[N];
float de=0;
printf('Please imput the%d*%d matrix A:\n',N-1,N-1);
for(i=1;i<N;i++)
for(j=1;j<N;j++)
scanf('%f',&a[i][j]);
printf('please imput the 1*%d matrix b:\n',N-1);
for(j=1;j<N;j++)
scanf('%f',&b[j]);
for(j=1;j<N;j++)
{
u[1][j]=a[1][j];
l[j][1]=a[j][1]/u[1][1];
}
for(r=2;r<N;r++)
{
for(j=r;j<N;j++)
{
for(k=1;k<r;k++)
{
de+=l[r][k]*u[k][j];
}
|