From 1e4e6f1e06d51712954579b89dc0a7e2c298667e Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Mon, 2 Dec 2024 16:25:38 +0300 Subject: added 110 prak --- 110/Makefile | 18 ++++++++++++++++++ 110/README.md | 5 +++++ 110/common | 2 ++ 110/common1 | 1 + 110/compile_flags.txt | 4 ++++ 110/data1 | 8 ++++++++ 110/data2 | 5 +++++ 110/include | 1 + 110/main | Bin 0 -> 301936 bytes 110/main.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 110/plots.gp | 14 ++++++++++++++ 11 files changed, 99 insertions(+) create mode 100644 110/Makefile create mode 100644 110/README.md create mode 100644 110/common create mode 100644 110/common1 create mode 100644 110/compile_flags.txt create mode 100644 110/data1 create mode 100644 110/data2 create mode 120000 110/include create mode 100755 110/main create mode 100644 110/main.cpp create mode 100644 110/plots.gp (limited to '110') diff --git a/110/Makefile b/110/Makefile new file mode 100644 index 0000000..eb309ff --- /dev/null +++ b/110/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/110/README.md b/110/README.md new file mode 100644 index 0000000..96fd716 --- /dev/null +++ b/110/README.md @@ -0,0 +1,5 @@ + + +# Обработка <> прака + + diff --git a/110/common b/110/common new file mode 100644 index 0000000..75797ad --- /dev/null +++ b/110/common @@ -0,0 +1,2 @@ +R1 R2 x0_1 x2_1 x4_1 m1 R2_0 R2_1 m2_0 m2_1 +0.0194 0.0296 0.745 0 0.04 0.20145 0.0296 0.0194 0.20145 0.12977 diff --git a/110/common1 b/110/common1 new file mode 100644 index 0000000..bd692b4 --- /dev/null +++ b/110/common1 @@ -0,0 +1 @@ +R1 R2 x0 x2 m1 m2 x4 diff --git a/110/compile_flags.txt b/110/compile_flags.txt new file mode 100644 index 0000000..34ae930 --- /dev/null +++ b/110/compile_flags.txt @@ -0,0 +1,4 @@ +-Iinclude +-std=c++2c +-mavx2 + diff --git a/110/data1 b/110/data1 new file mode 100644 index 0000000..7be72e7 --- /dev/null +++ b/110/data1 @@ -0,0 +1,8 @@ +x3 x11 x12 x13 t1 t2 t3 +0.76 0.575 0.573 0.578 5.683 5.572 5.711 +0.72 0.548 0.564 0.560 5.952 5.672 5.878 +0.65 0.503 0.498 0.505 5.041 5.173 5.059 +0.60 0.465 0.466 0.469 4.862 4.776 4.728 +0.55 0.429 0.466 0.469 4.593 4.520 4.519 +0.50 0.391 0.400 0.402 4.097 4.077 4.244 +0.40 0.329 0.327 0.325 3.640 3.612 3.629 diff --git a/110/data2 b/110/data2 new file mode 100644 index 0000000..cc0e301 --- /dev/null +++ b/110/data2 @@ -0,0 +1,5 @@ +R M t1 t2 t3 +0 0 5.573 5.693 5.676 +0 1 6.597 6.661 6.685 +1 0 8.261 8.324 8.319 +1 1 10.254 10.467 10.441 diff --git a/110/include b/110/include new file mode 120000 index 0000000..1b37f46 --- /dev/null +++ b/110/include @@ -0,0 +1 @@ +../libprakpp/include \ No newline at end of file diff --git a/110/main b/110/main new file mode 100755 index 0000000..2af817c Binary files /dev/null and b/110/main differ diff --git a/110/main.cpp b/110/main.cpp new file mode 100644 index 0000000..3ce0d0b --- /dev/null +++ b/110/main.cpp @@ -0,0 +1,41 @@ +#include + +#include "include/praktable.hpp" + +using table = prak::table; +using vecarg = const std::vector &; +table data; + +f64 get(std::string key) { + return data[key, 0]; +} + +// [0] = x0 +f64 getsqrt(vecarg v) { + return std::sqrt(std::abs(get("x0_1") - v[0])); +} + +table prepare_ex1(std::string s) { + table ret(s); + ret.add_column("x1", std::vector(ret.rows, NAN)); + ret.add_column("t", std::vector(ret.rows, NAN)); + ret.add_column("st", std::vector(ret.rows, NAN)); + ret.add_column("sqrt", std::vector(ret.rows, NAN)); + ret .apply(prak::avg, {"x11", "x12", "x13"}, "x1") + .apply(prak::avg, {"t1", "t2", "t3"}, "t") + .apply(prak::stddev, {"t1", "t2", "t3"}, "st") + .apply(getsqrt, {"x3"}, "sqrt"); + + std::cout << ret; + return ret; +} + +void ex1(void) { + table t; +} + +int main() { + data = table("common"); + prepare_ex1("data1"); + return 0; +} diff --git a/110/plots.gp b/110/plots.gp new file mode 100644 index 0000000..702408a --- /dev/null +++ b/110/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", \ + -- cgit v1.2.3-70-g09d2