00001
00002
00003
00004
00005
00006
00007
00008 #include "nl.h"
00009
00010 int main()
00011 {
00012 double **A, *b;
00013 size_t n = 3;
00014
00015 A = nl_dmatrix_create(n, n);
00016 b = nl_dvector_create(n);
00017
00018 A[0][0] = .1; A[0][1] = .2; A[0][2] = .3; b[0] = .6;
00019 A[1][0] = .2; A[1][1] = .7; A[1][2] = .9; b[1] = 1.8;
00020 A[2][0] = .3; A[2][1] = .9; A[2][2] = 1.3; b[2] = 2.5;
00021
00022 printf("Матрица A:\n");
00023 nl_dmatrix_print(A, n, n, NULL);
00024
00025 chol_decomp(A, n);
00026
00027 printf("\nРазложение Холецкого:\n");
00028 printf("\n(в нижней треугольной части):\n");
00029 nl_dmatrix_print(A, n, n, NULL);
00030
00031 printf("\nВектор b:\n");
00032 nl_dvector_print(b, n, NULL);
00033
00034 chol_solve(A, n, b);
00035
00036 printf("\nРешение системы Ax = b:\n");
00037 nl_dvector_print(b, n, NULL);
00038
00039 nl_dmatrix_free(A, n);
00040 nl_dvector_free(b);
00041
00042 return 0;
00043 }