From 9ac855db96ac7958104098908a116a2cce4d109d Mon Sep 17 00:00:00 2001 From: AZEN-SGG Date: Tue, 8 Apr 2025 17:30:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=B5=D0=B4=D0=BB=D0=B8?= =?UTF-8?q?=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2025.04.04/dist/Krivoruchenko_SK/Makefile | 6 +++--- 2025.04.04/dist/Krivoruchenko_SK/solve.c | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/2025.04.04/dist/Krivoruchenko_SK/Makefile b/2025.04.04/dist/Krivoruchenko_SK/Makefile index b49b1fd..b29f78f 100644 --- a/2025.04.04/dist/Krivoruchenko_SK/Makefile +++ b/2025.04.04/dist/Krivoruchenko_SK/Makefile @@ -10,17 +10,17 @@ WFLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused \ CFLAGS = -mfpmath=sse -std=gnu99 -O3 -TARGET = a.out +TARGET = a.exe OBJ = main.o solve.o array_io.o init_f.o matrix.o %.o: %.c gcc $(CFLAGS) $(WFLAGS) -c $< -o $@ $(TARGET): $(OBJ) - gcc $^ -o $@ -lm + gcc $^ -o $@ -lm -lssp gdb: CFLAGS = -mfpmath=sse -std=gnu99 -g gdb: clean $(TARGET) clean: - rm -f *.o *.out + del -f *.o *.exe diff --git a/2025.04.04/dist/Krivoruchenko_SK/solve.c b/2025.04.04/dist/Krivoruchenko_SK/solve.c index df00779..3d455e3 100644 --- a/2025.04.04/dist/Krivoruchenko_SK/solve.c +++ b/2025.04.04/dist/Krivoruchenko_SK/solve.c @@ -143,17 +143,15 @@ void gauss_inverse(const int n, const int k, double * restrict A, double * restr const int kn = k*n; const int kk = kn + k; const double inv_akk = 1./A[kk]; - A[kk] = 1.; if (eps > DBL_EPSILON) eps = DBL_EPSILON; - for (int ij = kk+1; ij < kn+n; ij++) - A[ij] *= inv_akk; - - for (int ij = kn; ij < kn + n; ij++) - X[ij] *= inv_akk; + // Делим на A[k][k] + for (int kj = kk+1; kj < kn+n; kj++) + A[kj] *= inv_akk; + // Меняем обратную матрицу for (int j = 0; j < n; ++j) { double xkj = X[kn + j]; @@ -189,7 +187,6 @@ void gauss_back_substitution(const int n, double * restrict A, double * restrict { const int in = i*n; const double aik = A[in + k]; - A[in + k] = 0; for (int j = 0; j < n; ++j) X[in + j] -= X[kn + j] * aik;