コード例 #1
0
ファイル: Practica6.c プロジェクト: Nigsia/MN1
int resol(int n, double **A, double *b, int *p){
	int res = 0;
	//Primer permutam el vector b.
	permutarB(p, b, n);

	//Despres resolem el sistema Lz = Pb
	res = triinf(n, A, b, TOL);
	//Despres resolem el sistema Ux = z
	res += trisup(n, A, b, TOL);

	//Si la funcio ens retorna un valor > 1 vol dir que haura fallat en alguna part dels algorismes anteriors.
	//Haurem de parar els algorismes.
	return res;

}
コード例 #2
0
ファイル: 2ex.c プロジェクト: TresLos/Universitat
int main (void)
{
	int n;
	double tol = 1e-14;
	double **A, *b;

	for (n = 1; n <= 15; n++)
	{
		A = GMH (n);
		b = GV1 (n, A);

		gauss (n, A, b, tol);
		trisup (n, A, b, tol);

		printf ("%3d:\t%.30le\n", n, Norm (n, b)-1);

		FM (A, n, n);
		FV (b, n);
	}

	return 0;
}