Task 7 is done
This commit is contained in:
parent
b75291790e
commit
3c3c94b028
4 changed files with 69 additions and 2 deletions
|
@ -1,13 +1,28 @@
|
||||||
#ifndef INIT_F_H
|
#ifndef INIT_F_H
|
||||||
#define INIT_F_H
|
#define INIT_F_H
|
||||||
|
|
||||||
int get_call_count (void);
|
int get_call_function_count (void);
|
||||||
|
int get_call_derivative_count (void);
|
||||||
|
|
||||||
double f0 (double x);
|
double f0 (double x);
|
||||||
|
double d0 (double x);
|
||||||
|
|
||||||
double f1 (double x);
|
double f1 (double x);
|
||||||
|
double d1 (double x);
|
||||||
|
|
||||||
double f2 (double x);
|
double f2 (double x);
|
||||||
|
double d2 (double x);
|
||||||
|
|
||||||
double f3 (double x);
|
double f3 (double x);
|
||||||
|
double d3 (double x);
|
||||||
|
|
||||||
double f4 (double x);
|
double f4 (double x);
|
||||||
|
double d4 (double x);
|
||||||
|
|
||||||
double f5 (double x);
|
double f5 (double x);
|
||||||
|
double d5 (double x);
|
||||||
|
|
||||||
double f6 (double x);
|
double f6 (double x);
|
||||||
|
double d6 (double x);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,6 +19,8 @@ int t7_solve (
|
||||||
x_0 = y;
|
x_0 = y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
x_0 = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it > m)
|
if (it > m)
|
||||||
|
|
2
2025.05.02/dist/Krivoruchenko_SK/comp.h
vendored
2
2025.05.02/dist/Krivoruchenko_SK/comp.h
vendored
|
@ -33,7 +33,7 @@ static inline double * fp_abs_max (double *pa, double *pb, double *fa, double *f
|
||||||
static inline int is_equal (const double a, const double b)
|
static inline int is_equal (const double a, const double b)
|
||||||
{
|
{
|
||||||
double diff = a - b;
|
double diff = a - b;
|
||||||
double max_val = (a > b) ? a : b;
|
double max_val = fabs((a > b) ? a : b);
|
||||||
return ((diff < 0) ? -diff : diff) < (DBL_EPSILON * max_val);
|
return ((diff < 0) ? -diff : diff) < (DBL_EPSILON * max_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
50
2025.05.02/tests/last_test.sh
Executable file
50
2025.05.02/tests/last_test.sh
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
script_name="$(basename "$0")"
|
||||||
|
|
||||||
|
iter="1000"
|
||||||
|
eps="1e-14"
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Не указан как параметр номер программы"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
num=$(printf "%02d" "$1")
|
||||||
|
prog="a$num.out"
|
||||||
|
|
||||||
|
mkdir -p tests
|
||||||
|
|
||||||
|
if [ -f Makefile ]; then
|
||||||
|
echo "Компиляция..."
|
||||||
|
make clean
|
||||||
|
make
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $prog ]; then
|
||||||
|
echo "Отсутствует исполняемый файл... [$prog]"
|
||||||
|
echo "Завершение..."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
outlog="$(pwd)/tests/out_a${num}_$script_name.log"
|
||||||
|
errlog="$(pwd)/tests/err_a${num}_$script_name.log"
|
||||||
|
|
||||||
|
rm -f "$outlog" "$errlog"
|
||||||
|
|
||||||
|
echo "Тест запущен..."
|
||||||
|
|
||||||
|
i=2
|
||||||
|
|
||||||
|
for (( k = 0 ; k < 7; k++ )); do
|
||||||
|
for (( a = -100 ; a < 100 ; a++ )); do
|
||||||
|
x="$(echo "$a / 10" | bc -l)"
|
||||||
|
cmd="./$prog $x $eps $iter $k"
|
||||||
|
echo "$cmd"
|
||||||
|
echo "$i $(eval "$cmd")"
|
||||||
|
((i+=2))
|
||||||
|
done
|
||||||
|
done >$outlog 2>$errlog
|
||||||
|
|
||||||
|
echo "Тест записан в $outlog"
|
||||||
|
echo "Ошибки записаны в $errlog"
|
||||||
|
echo "Тест завершен"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue