refactor(structure): normalize folder names with leading zeros for consistency
- Renamed all folders from format NEx (e.g., 1Ex, 2Ex...) to 0NEx (01Ex, 02Ex, etc.) - Updated subdirectories and files accordingly - Removed old main Makefile and tasks (a01.c–a09.c, solve.c, io_status.h), likely obsolete - Cleaned up deprecated task binaries and configs
This commit is contained in:
parent
2cf18a1ff3
commit
8a7aac7c23
385 changed files with 2 additions and 1468 deletions
39
2025.03.07/01Ex/array_io.c
Normal file
39
2025.03.07/01Ex/array_io.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include <stdio.h>
|
||||
#include "array_io.h"
|
||||
|
||||
io_status read_sq_matrix(double *a, int n, const char *name)
|
||||
{
|
||||
int i, j;
|
||||
FILE *fp;
|
||||
if (!(fp = fopen(name, "r"))) return ERROR_OPEN;
|
||||
for (i = 0; i < n; i++)
|
||||
for (j = 0; j < n; j++)
|
||||
if (fscanf(fp, "%lf", a + i * n + j) != 1)
|
||||
{fclose(fp); return ERROR_READ;}
|
||||
fclose(fp);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void print_sq_matrix(const double *a, int n, int p)
|
||||
{
|
||||
int np = (n > p ? p : n);
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < np; i++)
|
||||
{
|
||||
for (j = 0; j < np; j++)
|
||||
printf(" %10.3e", a[i * n + j]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void init_sq_matrix(double *a, int n, int k)
|
||||
{
|
||||
double (*q)(int, int, int, int);
|
||||
double (*f[])(int, int, int, int) = {f1, f2, f3, f4};
|
||||
int i, j;
|
||||
q = f[k-1];
|
||||
for (i = 0; i < n; i++)
|
||||
for (j = 0; j < n; j++)
|
||||
a[i * n + j] = q(n, n, i+1, j+1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue