init
This commit is contained in:
commit
89dc2e245a
13 changed files with 1689 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
917
Cargo.lock
generated
Normal file
917
Cargo.lock
generated
Normal file
|
@ -0,0 +1,917 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "adler"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android-tzdata"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android_system_properties"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anyhow"
|
||||||
|
version = "1.0.76"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bumpalo"
|
||||||
|
version = "3.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck"
|
||||||
|
version = "1.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.0.83"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono"
|
||||||
|
version = "0.4.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||||
|
dependencies = [
|
||||||
|
"android-tzdata",
|
||||||
|
"iana-time-zone",
|
||||||
|
"js-sys",
|
||||||
|
"num-traits",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cmake"
|
||||||
|
version = "0.1.50"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "color_quant"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const-cstr"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ed3d0b5ff30645a68f35ece8cea4556ca14ef8a1651455f789a099a0513532a6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation"
|
||||||
|
version = "0.9.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.8.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-graphics"
|
||||||
|
version = "0.22.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"core-foundation",
|
||||||
|
"core-graphics-types",
|
||||||
|
"foreign-types",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-graphics-types"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"core-foundation",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-text"
|
||||||
|
version = "19.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation",
|
||||||
|
"core-graphics",
|
||||||
|
"foreign-types",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crc32fast"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dirs-next"
|
||||||
|
version = "2.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"dirs-sys-next",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dirs-sys-next"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"redox_users",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dlib"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||||
|
dependencies = [
|
||||||
|
"libloading",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dwrote"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
"wio",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fdeflate"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7caf4086251adeba90011a7ff9bd1f6d7f7595be0871867daa4dbb0fcf2ca932"
|
||||||
|
dependencies = [
|
||||||
|
"simd-adler32",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "flate2"
|
||||||
|
version = "1.0.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e"
|
||||||
|
dependencies = [
|
||||||
|
"crc32fast",
|
||||||
|
"miniz_oxide",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "float-ord"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "font-kit"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "21fe28504d371085fae9ac7a3450f0b289ab71e07c8e57baa3fb68b9e57d6ce5"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"byteorder",
|
||||||
|
"core-foundation",
|
||||||
|
"core-graphics",
|
||||||
|
"core-text",
|
||||||
|
"dirs-next",
|
||||||
|
"dwrote",
|
||||||
|
"float-ord",
|
||||||
|
"freetype",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"pathfinder_geometry",
|
||||||
|
"pathfinder_simd",
|
||||||
|
"walkdir",
|
||||||
|
"winapi",
|
||||||
|
"yeslogic-fontconfig-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foreign-types"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||||
|
dependencies = [
|
||||||
|
"foreign-types-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foreign-types-shared"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "freetype"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bee38378a9e3db1cc693b4f88d166ae375338a0ff75cb8263e1c601d51f35dc6"
|
||||||
|
dependencies = [
|
||||||
|
"freetype-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "freetype-sys"
|
||||||
|
version = "0.13.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a"
|
||||||
|
dependencies = [
|
||||||
|
"cmake",
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gif"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045"
|
||||||
|
dependencies = [
|
||||||
|
"color_quant",
|
||||||
|
"weezl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone"
|
||||||
|
version = "0.1.58"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20"
|
||||||
|
dependencies = [
|
||||||
|
"android_system_properties",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"iana-time-zone-haiku",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone-haiku"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "image"
|
||||||
|
version = "0.24.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
"byteorder",
|
||||||
|
"color_quant",
|
||||||
|
"jpeg-decoder",
|
||||||
|
"num-rational",
|
||||||
|
"num-traits",
|
||||||
|
"png",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jpeg-decoder"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "js-sys"
|
||||||
|
version = "0.3.66"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca"
|
||||||
|
dependencies = [
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.151"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libloading"
|
||||||
|
version = "0.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libredox"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.4.1",
|
||||||
|
"libc",
|
||||||
|
"redox_syscall",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miniz_oxide"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||||
|
dependencies = [
|
||||||
|
"adler",
|
||||||
|
"simd-adler32",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-integer"
|
||||||
|
version = "0.1.45"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-rational"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.19.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pathfinder_geometry"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"pathfinder_simd",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pathfinder_simd"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0444332826c70dc47be74a7c6a5fc44e23a7905ad6858d4162b658320455ef93"
|
||||||
|
dependencies = [
|
||||||
|
"rustc_version",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pkg-config"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "plotters"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45"
|
||||||
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
|
"font-kit",
|
||||||
|
"image",
|
||||||
|
"lazy_static",
|
||||||
|
"num-traits",
|
||||||
|
"pathfinder_geometry",
|
||||||
|
"plotters-backend",
|
||||||
|
"plotters-bitmap",
|
||||||
|
"plotters-svg",
|
||||||
|
"ttf-parser",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "plotters-backend"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "plotters-bitmap"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0cebbe1f70205299abc69e8b295035bb52a6a70ee35474ad10011f0a4efb8543"
|
||||||
|
dependencies = [
|
||||||
|
"gif",
|
||||||
|
"image",
|
||||||
|
"plotters-backend",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "plotters-svg"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab"
|
||||||
|
dependencies = [
|
||||||
|
"plotters-backend",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "png"
|
||||||
|
version = "0.17.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"crc32fast",
|
||||||
|
"fdeflate",
|
||||||
|
"flate2",
|
||||||
|
"miniz_oxide",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.71"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.33"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_users"
|
||||||
|
version = "0.4.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
"libredox",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc_version"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
||||||
|
dependencies = [
|
||||||
|
"semver",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "same-file"
|
||||||
|
version = "1.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver"
|
||||||
|
version = "1.0.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "simd-adler32"
|
||||||
|
version = "0.3.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.43"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "1.0.52"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "1.0.52"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ttf-parser"
|
||||||
|
version = "0.17.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "375812fa44dab6df41c195cd2f7fecb488f6c09fbaafb62807488cefab642bff"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "walkdir"
|
||||||
|
version = "2.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
|
||||||
|
dependencies = [
|
||||||
|
"same-file",
|
||||||
|
"winapi-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen"
|
||||||
|
version = "0.2.89"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-backend"
|
||||||
|
version = "0.2.89"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"log",
|
||||||
|
"once_cell",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro"
|
||||||
|
version = "0.2.89"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro-support"
|
||||||
|
version = "0.2.89"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-backend",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-shared"
|
||||||
|
version = "0.2.89"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "web-sys"
|
||||||
|
version = "0.3.66"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "weezl"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.3.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-i686-pc-windows-gnu",
|
||||||
|
"winapi-x86_64-pc-windows-gnu",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-i686-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-util"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-core"
|
||||||
|
version = "0.51.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wio"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "yeslogic-fontconfig-sys"
|
||||||
|
version = "3.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2bbd69036d397ebbff671b1b8e4d918610c181c5a16073b96f984a38d08c386"
|
||||||
|
dependencies = [
|
||||||
|
"const-cstr",
|
||||||
|
"dlib",
|
||||||
|
"once_cell",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zd3"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"plotters",
|
||||||
|
"rand",
|
||||||
|
]
|
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[package]
|
||||||
|
name = "zd3"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1.0.75"
|
||||||
|
plotters = "0.3.5"
|
||||||
|
rand = "0.8.5"
|
BIN
graphs/2/cmp.png
Normal file
BIN
graphs/2/cmp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
BIN
graphs/2/cpmn.png
Normal file
BIN
graphs/2/cpmn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
BIN
graphs/2/cpmnn.png
Normal file
BIN
graphs/2/cpmnn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
BIN
graphs/2/s.png
Normal file
BIN
graphs/2/s.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
BIN
graphs/2/sn.png
Normal file
BIN
graphs/2/sn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
BIN
graphs/2/snn.png
Normal file
BIN
graphs/2/snn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 87 KiB |
104
src/common.rs
Normal file
104
src/common.rs
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
use std::{collections::HashMap, iter};
|
||||||
|
|
||||||
|
use plotters::{backend::BitMapBackend, drawing::IntoDrawingArea, style::*, chart::ChartBuilder, element::Circle, series::PointSeries};
|
||||||
|
|
||||||
|
pub fn average(v: &Vec<u64>) -> f64 {
|
||||||
|
v.iter()
|
||||||
|
.sum::<u64>() as f64 /
|
||||||
|
v.len() as f64
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn draw_graph_averages(
|
||||||
|
path: &str,
|
||||||
|
map: HashMap<u64, Vec<u64>>,
|
||||||
|
min: u64,
|
||||||
|
max: u64,
|
||||||
|
step: u64,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
let _max = map.values()
|
||||||
|
.flatten()
|
||||||
|
.max()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let root_drawing_area = BitMapBackend::new(path, (1920, 1080))
|
||||||
|
.into_drawing_area();
|
||||||
|
|
||||||
|
root_drawing_area.fill(&WHITE).unwrap();
|
||||||
|
|
||||||
|
let mut chart = ChartBuilder::on(&root_drawing_area)
|
||||||
|
.x_label_area_size(20)
|
||||||
|
.y_label_area_size(60)
|
||||||
|
.build_cartesian_2d(
|
||||||
|
0f64..(max as f64),
|
||||||
|
0f64..(*_max as f64),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
chart.configure_mesh()
|
||||||
|
.x_labels(10)
|
||||||
|
.y_labels(10)
|
||||||
|
.draw()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
for n in (min..=max).step_by(step as usize) {
|
||||||
|
chart.draw_series(PointSeries::<_, _, Circle<_, _>, _>::new(
|
||||||
|
map[&n].iter().map(|r| (n as f64, *r as f64)),
|
||||||
|
2,
|
||||||
|
BLUE.filled(),
|
||||||
|
))?;
|
||||||
|
|
||||||
|
let point = iter::once(average(&map[&n])).map(|x| (n as f64, x as f64));
|
||||||
|
|
||||||
|
chart.draw_series(PointSeries::<_, _, Circle<_, _>, _>::new(
|
||||||
|
point,
|
||||||
|
5,
|
||||||
|
RED.filled(),
|
||||||
|
))?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn draw_graph(
|
||||||
|
path: &str,
|
||||||
|
function: HashMap<u64, f64>,
|
||||||
|
min: u64,
|
||||||
|
max: u64,
|
||||||
|
step: u64,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
let _max = function.values()
|
||||||
|
.map(|x| *x)
|
||||||
|
.reduce(f64::max)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let root_drawing_area = BitMapBackend::new(path, (1920, 1080))
|
||||||
|
.into_drawing_area();
|
||||||
|
|
||||||
|
root_drawing_area.fill(&WHITE).unwrap();
|
||||||
|
|
||||||
|
let mut chart = ChartBuilder::on(&root_drawing_area)
|
||||||
|
.x_label_area_size(20)
|
||||||
|
.y_label_area_size(60)
|
||||||
|
.build_cartesian_2d(
|
||||||
|
0f64..(max as f64),
|
||||||
|
0f64..(_max as f64),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
chart.configure_mesh()
|
||||||
|
.x_labels(10)
|
||||||
|
.y_labels(10)
|
||||||
|
.draw()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
for n in (min..=max).step_by(step as usize) {
|
||||||
|
let point = iter::once(function[&n]).map(|x| (n as f64, x as f64));
|
||||||
|
chart.draw_series(PointSeries::<_, _, Circle<_, _>, _>::new(
|
||||||
|
point,
|
||||||
|
5,
|
||||||
|
RED.filled(),
|
||||||
|
))?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
37
src/main.rs
Normal file
37
src/main.rs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
use std::env;
|
||||||
|
|
||||||
|
mod common;
|
||||||
|
mod zad1;
|
||||||
|
mod zad2;
|
||||||
|
|
||||||
|
fn usage() {
|
||||||
|
eprintln!(
|
||||||
|
"usage: {} [1,2]",
|
||||||
|
env::args().next().unwrap()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() -> anyhow::Result<()> {
|
||||||
|
match env::args().nth(1) {
|
||||||
|
Some(n) => match n.parse::<u64>() {
|
||||||
|
Ok(n) => {
|
||||||
|
match n {
|
||||||
|
1 => zad1::zad1(),
|
||||||
|
2 => zad2::zad2(),
|
||||||
|
_ => {
|
||||||
|
usage();
|
||||||
|
std::process::exit(1)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
usage();
|
||||||
|
std::process::exit(1)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
usage();
|
||||||
|
std::process::exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
446
src/zad1.rs
Normal file
446
src/zad1.rs
Normal file
|
@ -0,0 +1,446 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::{collections::HashMap, sync::RwLock};
|
||||||
|
use std::thread;
|
||||||
|
|
||||||
|
use rand::Rng;
|
||||||
|
|
||||||
|
use crate::common::*;
|
||||||
|
|
||||||
|
#[derive(Debug, Default)]
|
||||||
|
struct Results {
|
||||||
|
b: u64,
|
||||||
|
u: u64,
|
||||||
|
c: u64,
|
||||||
|
d: u64,
|
||||||
|
l: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test(n: u64, d: u64) -> Results {
|
||||||
|
let mut bins = vec![0u64; n as usize];
|
||||||
|
let mut one_ball_counter = 0u64;
|
||||||
|
let mut two_balls_counter = 0u64;
|
||||||
|
let mut i = 0u64;
|
||||||
|
let mut results = Results::default();
|
||||||
|
let mut rand_bins = vec![0u64; d as usize];
|
||||||
|
|
||||||
|
while i < n {
|
||||||
|
let mut rand_bin: Option<u64> = None;
|
||||||
|
for ii in 0..d {
|
||||||
|
rand_bins[ii as usize] = rand::thread_rng().gen_range(0..n);
|
||||||
|
if rand_bin.is_none() {
|
||||||
|
rand_bin = Some(rand_bins[0]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if bins[rand_bins[ii as usize] as usize] < bins[rand_bin.unwrap() as usize] {
|
||||||
|
rand_bin = Some(rand_bins[ii as usize]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let rand_bin = rand_bin.expect("failed to pick random bin\n");
|
||||||
|
|
||||||
|
bins[rand_bin as usize] += 1;
|
||||||
|
|
||||||
|
i += 1;
|
||||||
|
|
||||||
|
if bins[rand_bin as usize] == 1 {
|
||||||
|
one_ball_counter += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if bins[rand_bin as usize] == 2 {
|
||||||
|
two_balls_counter += 1;
|
||||||
|
|
||||||
|
if two_balls_counter == 1 {
|
||||||
|
results.b = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if i == (n - 1) {
|
||||||
|
results.u = n - one_ball_counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if one_ball_counter == n {
|
||||||
|
results.c = i;
|
||||||
|
// to make sure this condition isn't hit
|
||||||
|
// in further iterations — without this
|
||||||
|
// one_ball_counter stays at n until the end
|
||||||
|
one_ball_counter += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
results.d = i;
|
||||||
|
|
||||||
|
// SAFETY: bins should not be empty
|
||||||
|
results.l = *bins.iter().max().unwrap();
|
||||||
|
|
||||||
|
results
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn test_d(d: u64) -> anyhow::Result<()> {
|
||||||
|
let results: Arc<RwLock<HashMap<u64, Vec<Results>>>> = Arc::new(RwLock::new(HashMap::new()));
|
||||||
|
let mut thread_handles = vec![];
|
||||||
|
|
||||||
|
let num_cpus = thread::available_parallelism()?.get();
|
||||||
|
|
||||||
|
for cpu in 0..num_cpus {
|
||||||
|
let cpu = cpu.clone();
|
||||||
|
let results = Arc::clone(&results);
|
||||||
|
let handle = thread::spawn(move || {
|
||||||
|
for n in ((10000 + cpu * 10000)..=1000000).step_by(10000 * num_cpus) {
|
||||||
|
if results.read().expect("can't read results map").get(&(n as u64)).is_some() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut current_results = vec![];
|
||||||
|
for _k in 0..50 {
|
||||||
|
current_results.push(test(n as u64, d));
|
||||||
|
//SAFETY: there's always at least one element in current_results
|
||||||
|
println!("thread {:?}: n = {}; k = {}, results = {:?}", thread::current().id(), n, _k, current_results.last().unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
|
results.write().expect("one of the threads panicked!").insert(n as u64, current_results);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
thread_handles.push(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
for handle in thread_handles {
|
||||||
|
handle.join().expect("couldn't join handle");
|
||||||
|
}
|
||||||
|
|
||||||
|
let results = results.read().expect("can't access results");
|
||||||
|
|
||||||
|
draw_graph_averages(
|
||||||
|
format!("graphs/1/d{d}/b.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
v.iter()
|
||||||
|
.map(|r| r.b)
|
||||||
|
.collect()
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph_averages(
|
||||||
|
format!("graphs/1/d{d}/u.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
v.iter()
|
||||||
|
.map(|r| r.u)
|
||||||
|
.collect()
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph_averages(
|
||||||
|
format!("graphs/1/d{d}/c.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
v.iter()
|
||||||
|
.map(|r| r.c)
|
||||||
|
.collect()
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph_averages(
|
||||||
|
format!("graphs/1/d{d}/d.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
v.iter()
|
||||||
|
.map(|r| r.d)
|
||||||
|
.collect()
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph_averages(
|
||||||
|
format!("graphs/1/d{d}/d-c.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
v.iter()
|
||||||
|
.map(|r| r.d - r.c)
|
||||||
|
.collect()
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/bn.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.b)
|
||||||
|
.collect()
|
||||||
|
) / (*k as f64)
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/bsqrtn.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.b)
|
||||||
|
.collect()
|
||||||
|
) / ((*k as f64).sqrt())
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/un.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.u)
|
||||||
|
.collect()
|
||||||
|
) / (*k as f64)
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/cn.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.c)
|
||||||
|
.collect()
|
||||||
|
) / (*k as f64)
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/cnlnn.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.c)
|
||||||
|
.collect()
|
||||||
|
) / ((*k as f64) * (*k as f64).ln())
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/cn2.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.c)
|
||||||
|
.collect()
|
||||||
|
) / ((*k as f64) * (*k as f64))
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/dn.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.d)
|
||||||
|
.collect()
|
||||||
|
) / (*k as f64)
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/dnlnn.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.d)
|
||||||
|
.collect()
|
||||||
|
) / ((*k as f64) * (*k as f64).ln())
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/dn2.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.d)
|
||||||
|
.collect()
|
||||||
|
) / ((*k as f64) * (*k as f64))
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/dcn.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
(average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.d)
|
||||||
|
.collect()
|
||||||
|
) - average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.c)
|
||||||
|
.collect()
|
||||||
|
)) / (*k as f64)
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/dcnlnn.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
(average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.d)
|
||||||
|
.collect()
|
||||||
|
) - average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.c)
|
||||||
|
.collect()
|
||||||
|
)) / ((*k as f64) * (*k as f64).ln())
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/dcnlnlnn.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
(average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.d)
|
||||||
|
.collect()
|
||||||
|
) - average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.c)
|
||||||
|
.collect()
|
||||||
|
)) / ((*k as f64) * (*k as f64).ln().ln())
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/lf1.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.l)
|
||||||
|
.collect()
|
||||||
|
) / ((*k as f64).ln() / (*k as f64).ln().ln())
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
format!("graphs/1/d{d}/lf2.png").as_str(),
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.l)
|
||||||
|
.collect()
|
||||||
|
) / ((*k as f64).ln().ln() / 2f64.ln())
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
10000u64,
|
||||||
|
1000000u64,
|
||||||
|
10000u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn zad1() -> anyhow::Result<()> {
|
||||||
|
test_d(1)?;
|
||||||
|
test_d(2)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
175
src/zad2.rs
Normal file
175
src/zad2.rs
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
use std::{sync::{Arc, RwLock}, collections::HashMap, thread};
|
||||||
|
|
||||||
|
use rand::{seq::SliceRandom, thread_rng};
|
||||||
|
|
||||||
|
use crate::common::*;
|
||||||
|
|
||||||
|
#[derive(Debug, Default)]
|
||||||
|
struct Results {
|
||||||
|
cmp: u64,
|
||||||
|
s: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rand_vec(n: u64) -> Vec<u64> {
|
||||||
|
let mut ret = (1..=n).collect::<Vec<u64>>();
|
||||||
|
ret.shuffle(&mut thread_rng());
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
|
||||||
|
fn insertion_sort(a: &mut Vec<u64>) -> Results {
|
||||||
|
let n = a.len();
|
||||||
|
let mut cmp = 0u64;
|
||||||
|
let mut s = 0u64;
|
||||||
|
|
||||||
|
for j in 2..=(n - 1) {
|
||||||
|
let key = a[j];
|
||||||
|
let mut i = j - 1;
|
||||||
|
|
||||||
|
while i > 0 && a[i] > key {
|
||||||
|
cmp += 1;
|
||||||
|
a[i + 1] = a[i];
|
||||||
|
s += 1;
|
||||||
|
i -= 1;
|
||||||
|
}
|
||||||
|
a[i + 1] = key;
|
||||||
|
s += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Results { cmp, s }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn zad2() -> anyhow::Result<()> {
|
||||||
|
let results: Arc<RwLock<HashMap<u64, Vec<Results>>>> = Arc::new(RwLock::new(HashMap::new()));
|
||||||
|
let mut thread_handles = vec![];
|
||||||
|
|
||||||
|
let num_cpus = thread::available_parallelism()?.get();
|
||||||
|
|
||||||
|
for cpu in 0..num_cpus {
|
||||||
|
let cpu = cpu.clone();
|
||||||
|
let results = Arc::clone(&results);
|
||||||
|
let handle = thread::spawn(move || {
|
||||||
|
for n in ((100 + cpu * 100)..=10000).step_by(100 * num_cpus) {
|
||||||
|
if results.read().expect("can't read results map").get(&(n as u64)).is_some() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut current_results = vec![];
|
||||||
|
for _k in 0..50 {
|
||||||
|
current_results.push(insertion_sort(&mut rand_vec(n as u64)));
|
||||||
|
//SAFETY: there's always at least one element in current_results
|
||||||
|
println!("thread {:?}: n = {}; k = {}, results = {:?}", thread::current().id(), n, _k, current_results.last().unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
|
results.write().expect("one of the threads panicked!").insert(n as u64, current_results);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
thread_handles.push(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
for handle in thread_handles {
|
||||||
|
handle.join().expect("couldn't join handle");
|
||||||
|
}
|
||||||
|
|
||||||
|
let results = results.read().expect("can't access results");
|
||||||
|
|
||||||
|
draw_graph_averages(
|
||||||
|
"graphs/2/cmp.png",
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
v.iter()
|
||||||
|
.map(|r| r.cmp)
|
||||||
|
.collect()
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
100u64,
|
||||||
|
10000u64,
|
||||||
|
100u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph_averages(
|
||||||
|
"graphs/2/s.png",
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
v.iter()
|
||||||
|
.map(|r| r.s)
|
||||||
|
.collect()
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
100u64,
|
||||||
|
10000u64,
|
||||||
|
100u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
"graphs/2/cpmn.png",
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.cmp)
|
||||||
|
.collect()
|
||||||
|
) / (*k as f64)
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
100u64,
|
||||||
|
10000u64,
|
||||||
|
100u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
"graphs/2/cpmnn.png",
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.cmp)
|
||||||
|
.collect()
|
||||||
|
) / ((*k as f64) * (*k as f64))
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
100u64,
|
||||||
|
10000u64,
|
||||||
|
100u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
"graphs/2/sn.png",
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.s)
|
||||||
|
.collect()
|
||||||
|
) / (*k as f64)
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
100u64,
|
||||||
|
10000u64,
|
||||||
|
100u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
draw_graph(
|
||||||
|
"graphs/2/snn.png",
|
||||||
|
results.iter().map(|(k, v)|
|
||||||
|
(
|
||||||
|
*k,
|
||||||
|
average(
|
||||||
|
&v.iter()
|
||||||
|
.map(|r| r.s)
|
||||||
|
.collect()
|
||||||
|
) / ((*k as f64) * (*k as f64))
|
||||||
|
)
|
||||||
|
).collect(),
|
||||||
|
100u64,
|
||||||
|
10000u64,
|
||||||
|
100u64
|
||||||
|
)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
Loading…
Reference in a new issue