diff options
Diffstat (limited to '118')
-rw-r--r-- | 118/Makefile | 18 | ||||
-rw-r--r-- | 118/README.md | 5 | ||||
-rw-r--r-- | 118/compile_flags.txt | 4 | ||||
l--------- | 118/include | 1 | ||||
-rw-r--r-- | 118/main.cpp | 13 | ||||
-rw-r--r-- | 118/plots.gp | 14 |
6 files changed, 55 insertions, 0 deletions
diff --git a/118/Makefile b/118/Makefile new file mode 100644 index 0000000..eb309ff --- /dev/null +++ b/118/Makefile @@ -0,0 +1,18 @@ + +CFLAGS = -std=c++2c -mavx -Iinclude -ggdb + +.PHONY: all run_main clean gnuplot + +run: gnuplot + +gnuplot: plots.gp run_main + gnuplot $< + +run_main: main + ./main + +main: main.cpp include/* + $(CXX) -o $@ $< $(CFLAGS) + +clean: + rm -fr main *.png *.plot diff --git a/118/README.md b/118/README.md new file mode 100644 index 0000000..96fd716 --- /dev/null +++ b/118/README.md @@ -0,0 +1,5 @@ +<!-- Шаблон для прака --> +<!-- файлы, заканчивающиеся на .plot считаются генерируемыми и удаляются через make clean --> +# Обработка <> прака + + diff --git a/118/compile_flags.txt b/118/compile_flags.txt new file mode 100644 index 0000000..34ae930 --- /dev/null +++ b/118/compile_flags.txt @@ -0,0 +1,4 @@ +-Iinclude +-std=c++2c +-mavx2 + diff --git a/118/include b/118/include new file mode 120000 index 0000000..2225752 --- /dev/null +++ b/118/include @@ -0,0 +1 @@ +../libprakpp/include/
\ No newline at end of file diff --git a/118/main.cpp b/118/main.cpp new file mode 100644 index 0000000..5e2c0a2 --- /dev/null +++ b/118/main.cpp @@ -0,0 +1,13 @@ +#include <iostream> + +#include "include/prakmath.hpp" + +int main() { + prak::vector<f64> dx = {0.003, 0.005, 0.013, 0.007, 0.015, 0.020, 0.022, 0.028, 0.030, 0.032, 0.036, 0.040, 0.042, 0.046, 0.047, 0.065, 0.052}; + prak::vector<f64> ms = {0.010, 0.020, 0.050, 0.030, 0.060, 0.070, 0.080, 0.100, 0.110, 0.120, 0.130, 0.150, 0.160, 0.170, 0.180, 0.243, 0.193}; + prak::vector<f64> ss = {0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001}; + prak::pvalue<f64> A, B; + prak::least_squares_linear<f64>(ms, dx, ss, A, B); + std::cout << A << '\n' << B << std::endl; + return 0; +} diff --git a/118/plots.gp b/118/plots.gp new file mode 100644 index 0000000..702408a --- /dev/null +++ b/118/plots.gp @@ -0,0 +1,14 @@ +set term pngcairo size 1000, 800 +set tmargin at screen 0.95 + +f1(x) = a1*x+b1 +fit f1(x) '.plot' using 1:2:3 yerr via a1, b1 + +set output '' +set label "" at graph 0.5, graph 1.025 center +set xlabel "" +set ylabel "" + +plot '.plot' using 1:2:3 with yerrorbars notitle lc 0 pt 1 lw 2, \ + f1(x) title "" lc rgb "red", \ + |