Compare commits

...

8 Commits

Author SHA1 Message Date
318f6d7d77 begin working on implementation for pd2v1 2024-01-13 03:10:52 +00:00
131cc7ed84 add requirements section to readme 2024-01-13 01:56:28 +00:00
1d6713710f update pd2v1 intro 2024-01-09 18:03:21 +00:00
a1e2bb09cb create specification for problem definitions 2024-01-09 18:02:04 +00:00
2846d55194 update readme 2023-12-27 17:54:16 +00:00
6878f1f04f update readme 2023-12-27 17:51:59 +00:00
8cc467e5a7 solve a problem 2023-12-27 17:48:14 +00:00
5b53b52e2f reduce problem to solve 2023-12-27 17:17:26 +00:00
9 changed files with 1303 additions and 10 deletions

902
Cargo.lock generated
View File

@@ -2,19 +2,292 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "anyhow"
version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]]
name = "approx"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base64"
version = "0.21.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9"
[[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 = "cauchy"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff11ddd2af3b5e80dd0297fee6e56ac038d9bdc549573cdb51bd6d2efe7f05e"
dependencies = [
"num-complex",
"num-traits",
"rand",
"serde",
]
[[package]]
name = "cblas-sys"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6feecd82cce51b0204cf063f0041d69f24ce83f680d87514b004248e7b0fa65"
dependencies = [
"libc",
]
[[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 = "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 = "crc32fast"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [
"cfg-if",
]
[[package]]
name = "dirs"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
dependencies = [
"libc",
"redox_users",
"winapi",
]
[[package]]
name = "errno"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "fastrand"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]] [[package]]
name = "fea" name = "fea"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"ndarray", "ndarray",
"ndarray-linalg",
] ]
[[package]]
name = "filetime"
version = "0.2.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"windows-sys 0.52.0",
]
[[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 = "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 = "form_urlencoded"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
[[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 = "idna"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "katexit"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb1304c448ce2c207c2298a34bc476ce7ae47f63c23fa2b498583b26be9bc88c"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "lapack-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447f56c85fb410a7a3d36701b2153c1018b1d2b908c5fbaf01c1b04fac33bcbe"
dependencies = [
"libc",
]
[[package]]
name = "lax"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f96a229d9557112e574164f8024ce703625ad9f88a90964c1780809358e53da"
dependencies = [
"cauchy",
"katexit",
"lapack-sys",
"num-traits",
"openblas-src",
"thiserror",
]
[[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 = "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 = "linux-raw-sys"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
[[package]]
name = "log"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]] [[package]]
name = "matrixmultiply" name = "matrixmultiply"
version = "0.3.8" version = "0.3.8"
@@ -25,12 +298,42 @@ dependencies = [
"rawpointer", "rawpointer",
] ]
[[package]]
name = "miniz_oxide"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
dependencies = [
"adler",
]
[[package]]
name = "native-tls"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
dependencies = [
"lazy_static",
"libc",
"log",
"openssl",
"openssl-probe",
"openssl-sys",
"schannel",
"security-framework",
"security-framework-sys",
"tempfile",
]
[[package]] [[package]]
name = "ndarray" name = "ndarray"
version = "0.15.6" version = "0.15.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32" checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32"
dependencies = [ dependencies = [
"approx",
"cblas-sys",
"libc",
"matrixmultiply", "matrixmultiply",
"num-complex", "num-complex",
"num-integer", "num-integer",
@@ -38,6 +341,22 @@ dependencies = [
"rawpointer", "rawpointer",
] ]
[[package]]
name = "ndarray-linalg"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b0e8dda0c941b64a85c5deb2b3e0144aca87aced64678adfc23eacea6d2cc42"
dependencies = [
"cauchy",
"katexit",
"lax",
"ndarray",
"num-complex",
"num-traits",
"rand",
"thiserror",
]
[[package]] [[package]]
name = "num-complex" name = "num-complex"
version = "0.4.4" version = "0.4.4"
@@ -45,6 +364,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214"
dependencies = [ dependencies = [
"num-traits", "num-traits",
"rand",
"serde",
] ]
[[package]] [[package]]
@@ -66,8 +387,589 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "openblas-build"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eba42c395477605f400a8d79ee0b756cfb82abe3eb5618e35fa70d3a36010a7f"
dependencies = [
"anyhow",
"flate2",
"native-tls",
"tar",
"thiserror",
"ureq",
"walkdir",
]
[[package]]
name = "openblas-src"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38e5d8af0b707ac2fe1574daa88b4157da73b0de3dc7c39fe3e2c0bb64070501"
dependencies = [
"dirs",
"openblas-build",
"vcpkg",
]
[[package]]
name = "openssl"
version = "0.10.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45"
dependencies = [
"bitflags 2.4.1",
"cfg-if",
"foreign-types",
"libc",
"once_cell",
"openssl-macros",
"openssl-sys",
]
[[package]]
name = "openssl-macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
]
[[package]]
name = "openssl-probe"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "percent-encoding"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pkg-config"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[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]] [[package]]
name = "rawpointer" name = "rawpointer"
version = "0.2.1" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
[[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 = "rustix"
version = "0.38.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
dependencies = [
"bitflags 2.4.1",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "rustls-native-certs"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
dependencies = [
"base64",
]
[[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 = "schannel"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88"
dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "security-framework"
version = "2.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
dependencies = [
"bitflags 1.3.2",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "serde"
version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
]
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[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 = "tar"
version = "0.4.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb"
dependencies = [
"filetime",
"libc",
"xattr",
]
[[package]]
name = "tempfile"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
dependencies = [
"cfg-if",
"fastrand",
"redox_syscall",
"rustix",
"windows-sys 0.48.0",
]
[[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 2.0.43",
]
[[package]]
name = "tinyvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "unicode-bidi"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416"
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-normalization"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
dependencies = [
"tinyvec",
]
[[package]]
name = "ureq"
version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97"
dependencies = [
"base64",
"flate2",
"log",
"native-tls",
"once_cell",
"rustls-native-certs",
"url",
]
[[package]]
name = "url"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
]
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[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 = "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-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.0",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
dependencies = [
"windows_aarch64_gnullvm 0.52.0",
"windows_aarch64_msvc 0.52.0",
"windows_i686_gnu 0.52.0",
"windows_i686_msvc 0.52.0",
"windows_x86_64_gnu 0.52.0",
"windows_x86_64_gnullvm 0.52.0",
"windows_x86_64_msvc 0.52.0",
]
[[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_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
[[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_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
[[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_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
[[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_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "xattr"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7dae5072fe1f8db8f8d29059189ac175196e410e40ba42d5d4684ae2f750995"
dependencies = [
"libc",
"linux-raw-sys",
"rustix",
]

View File

@@ -7,3 +7,4 @@ edition = "2021"
[dependencies] [dependencies]
ndarray = "0.15.0" ndarray = "0.15.0"
ndarray-linalg = { version = "0.16.0", features = [ "openblas-static"]}

View File

@@ -1,3 +1,28 @@
# :bridge_at_night: fea :globe_with_meridians: # :bridge_at_night: fea :globe_with_meridians:
> A simple finite element analysis solver made for educational purposes > A simple finite element analysis solver made for educational purposes
Currently the project can only be used to solve beam element problems where all points are constrained
by boundary conditions, but this will be improved in future.
The project also has no GUI for defining the problem at the moment, and must be written
in rust (see [`src/bin/two_d.rs`](./src/bin/two_d.rs) for an example of setting up a problem).
## Requirements
- [OpenBLAS](https://github.com/OpenMathLib/OpenBLAS)
- A FORTRAN compiler, such as [GFortran](https://gcc.gnu.org/fortran/)
To install on an Arch based distro:
```
pacman -S blas-openblas gcc-fortran
```
# Format Specifications
The project will likely be composed of multiple independent programs as it is developed.
The formats specified in the [specs folder](./specs) will be used to to exchange information between
the programs.
- [PD2v1](./specs/pd2v1.md) (2D Problem Definition Version 1)

111
specs/pd2v1.md Normal file
View File

@@ -0,0 +1,111 @@
# 2D Problem Definition Version 1 (PD2v1) Specification
A format for defining shapes that humans can write and machines can read.
I think it should have a better name.
## Usage
### Beam Elements (BE)
Beam element problem definitions use points to represent nodes and links to represent
beams.
A given point (node) can be connected to any number of links (beams).
### Finite Elements (FE)
Finite element problem definitions use points to represent nodes and links to represent
edges.
A given point (node) can only be connected to two links (edges).
### Mesh
The spec can also be used to export meshes by using fixed boundary conditions and definining a set
of `LINK_PROPS` that can be ignored (i.e. `LINK_PROPS ignore 0 0`).
## Types
### REAL
A real number
#### Examples
```
0
-1
1
-1.0
1.0
9999999.999999
```
### IDs (`ID`)
String that can include numbers, letters, underscores (`_`), and dashes (`-`).
### Boundary condition types (`BC_TYPE`)
- `NONE`
- `FIXED`
- `FORCE <VEC_ID>`
## Syntax
### Comments
```
// comments begin with // and end at the end of a line
```
### Definitions
Each definiton goes on its own line.
Definitons cannot refer to IDs of objects that are defined in latter lines.
Every ID given for every object must be unqiue amongst its object type but not between types (although it is fine if it is).
All definitions are immutable.
| Object Type | Syntax |
|--------------------|----------------------------------------------------------|
| Boundary Condition | `BOUNDARY_CONDITION <ID ID> <BC_TYPE BC_TYPE>` |
| Link | `LINK <ID ID> <ID LINK_PROPS> <ID NODE_ID> <ID NODE_ID>` |
| Link Properties | `LINK_PROPS <ID ID> <ID MATERIAL> <REAL AREA>` |
| Material | `MATERIAL <ID ID> <REAL YOUNGS_MODULUS>` |
| Point | `POINT <ID ID> <ID VEC_ID> <ID BOUNDARY_CONDITION>` |
| Vector | `VEC <ID ID> <REAL X> <REAL Y>` |
## Example
### Beam Element
```
// Define a fixed boundary conditon as it can be shared by all fixed points
BOUNDARY_CONDITION bc_fixed FIXED
MATERIAL aluminium 210000000000 250000000
LINK_PROPS beam_props aluminium 0.0019635
// Define the first node
VEC point1_pos 0 0
POINT point1 point1_pos bc_fixed
// Define node with force boundary condition
VEC point4_pos 1.7321 1
VEC bc4_mag 14142 14142
BOUNDARY_CONDITION bc4 FORCE bc4_mag
POINT point4 point4_pos bc4
// Define rest of the nodes
VEC point2_pos 0 1.1547
POINT point2 point2_pos bc_fixed
VEC point3_pos 0 4.4641
POINT point3 point3_pos bc_fixed
// And finally link the nodes together to create the beams
LINK link1 beam_props point1 point4
LINK link2 beam_props point2 point4
LINK link3 beam_props point3 point4
```

124
specs/pd2v1_drawer.html Normal file
View File

@@ -0,0 +1,124 @@
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://styles.alv.cx/colors/gruvbox.css" />
<link rel="stylesheet" type="text/css" href="https://styles.alv.cx/base.css" />
<link rel="stylesheet" type="text/css" href="https://styles.alv.cx/modules/darkmode.css" />
<style>
body {
margin: 0 auto 0 auto;
padding: 0;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
}
#canvas {
width: 100%;
height: 70%;
}
#options {
display: flex;
align-items: center;
}
#force_x, #force_y {
width: 6em;
}
.hidden {
display: none;
}
</style>
<title>PD2v1 Drawer</title>
</head>
<body>
<canvas id="canvas"></canvas>
<div id="options">
<label for="bc_select">Boundary condition type: </label>
<select id="bc_select">
<option value="NONE">NONE</option>
<option value="FIXED">FIXED</option>
<option value="FORCE">FORCE</option>
</select>
<input type="number" id="force_x" name="force_x" placeholder="Force (X)" class="hidden">
<input type="number" id="force_y" name="force_y" placeholder="Force (Y)" class="hidden">
</div>
<script>
const MB_LEFT = "MB_LEFT";
const MB_RIGHT = "MB_RIGHT";
const MB_MIDDLE = "MB_MIDDLE";
const style = getComputedStyle(document.body);
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
const input_bc_select = document.getElementById("bc_select");
const input_force_x = document.getElementById("force_x");
const input_force_y = document.getElementById("force_y");
let points = [];
let links = [];
function handleCanvasClick(ev, mouse_button) {
ev.preventDefault();
const rect = canvas.getBoundingClientRect();
const x = (ev.clientX - rect.left)/rect.width;
const y = (ev.clientY - rect.top)/rect.height;
console.log(x, y, mouse_button);
if (mouse_button === MB_LEFT) {
addPoint(x, y, input_bc_select.value, input_force_x.value, input_force_y.value);
}
}
function updateBcInputs() {
if (input_bc_select.value === "FORCE") {
input_force_x.classList.remove("hidden");
input_force_y.classList.remove("hidden");
} else {
input_force_x.classList.add("hidden");
input_force_y.classList.add("hidden");
}
}
function addPoint(x, y, bc_type, bc_fx, bc_fy) {
points.push({
x: x,
y: y,
boundary_condition: {
type: bc_type,
force_x: bc_fx,
force_y: bc_fy
}
});
redraw();
}
function redraw() {
const canvas_styles = getComputedStyle(canvas);
canvas.height = canvas_styles.height.slice(0, -2);
canvas.width = canvas_styles.width.slice(0, -2);
const rect = canvas.getBoundingClientRect();
ctx.fillStyle = style.getPropertyValue("--fg");
ctx.fillRect(0, 0, rect.width, rect.height);
ctx.fillStyle = style.getPropertyValue("--red");
points.forEach(point => {
ctx.beginPath();
ctx.arc(point.x*rect.width, point.y*rect.height, rect.width/60, 0, 2*Math.PI);
ctx.fill();
})
}
canvas.addEventListener("click", ev => handleCanvasClick(ev, MB_LEFT));
canvas.addEventListener("contextmenu", ev => handleCanvasClick(ev, MB_RIGHT));
input_bc_select.addEventListener("change", updateBcInputs);
updateBcInputs();
redraw();
</script>
</body>

View File

@@ -1,5 +1,8 @@
use fea::two_d::beam_elements::*; use fea::two_d::beam_elements::*;
use fea::two_d::*; use fea::two_d::*;
use fea::Value;
use ndarray::prelude::*;
use ndarray_linalg::Solve;
fn main() { fn main() {
let student_id_last_digit = 9_f32; let student_id_last_digit = 9_f32;
@@ -20,12 +23,11 @@ fn main() {
let p2 = Point { let p2 = Point {
id: 2, id: 2,
pos: Vector(0.0, l * theta.sin()), pos: Vector(0.0, l * theta.sin()),
bc: BoundaryCondition::Force(Vector(0.0, 1000.0)), bc: BoundaryCondition::Fixed,
beams: vec![], beams: vec![],
}; };
let l_e3 = 2.0 / theta.sin(); let l_e3 = 2.0 / theta.sin();
println!("l_e3 {l_e3}");
let p3 = Point { let p3 = Point {
id: 3, id: 3,
@@ -80,6 +82,33 @@ fn main() {
) )
.unwrap(); .unwrap();
println!("{:?}", w); println!("w = {:?}", w);
println!("{:?}", w.stiffness_matrix().unwrap()); println!("w.shape() = {:?}", w.shape());
let stiffness = Array2::from_shape_vec(w.shape(), w.stiffness()).unwrap();
println!("w.stiffness = \n{:?}", stiffness);
println!("w.displacement() = {:?}", w.displacement());
println!("w.force() = {:?}", w.force());
let reduced_stiffness =
Array2::from_shape_vec(w.reduced_shape(), w.reduced_stiffness()).unwrap();
let reduced_force = w
.reduced_force()
.into_iter()
.map(|v| match v {
Value::Known(v) => v,
Value::Unknown => panic!("Unknown force at unknown vector!"),
})
.collect();
let reduced_force = Array1::from_shape_vec(w.reduced_dof(), reduced_force).unwrap();
let reduced_displacement =
Array2::from_shape_vec((1, w.reduced_dof()), w.reduced_displacement()).unwrap();
println!("w.reduced_stiffness() = \n{:?}", reduced_stiffness);
println!("w.reduced_force() = {:?}", reduced_force);
println!("w.reduced_displacement() = {:?}", reduced_displacement);
println!(
"soln: {:?}",
reduced_stiffness.solve_into(reduced_force).unwrap(),
)
} }

View File

@@ -5,3 +5,9 @@ pub struct Material {
pub youngs_modulus: f32, pub youngs_modulus: f32,
pub yield_stress: f32, pub yield_stress: f32,
} }
#[derive(Clone, Debug, PartialEq)]
pub enum Value {
Unknown,
Known(f32),
}

View File

@@ -1,5 +1,5 @@
use super::*; use super::*;
use ndarray::prelude::*; use crate::Value;
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::HashMap; use std::collections::HashMap;
use std::rc::Rc; use std::rc::Rc;
@@ -11,8 +11,24 @@ pub struct World {
} }
impl World { impl World {
pub fn stiffness_matrix(&self) -> Result<Array<f32, Ix2>, String> { pub fn dof(&self) -> usize {
let dof = self.points.len() * 2; self.points.len() * 2
}
pub fn reduced_dof(&self) -> usize {
self.reduced_displacement().len()
}
pub fn shape(&self) -> (usize, usize) {
(self.dof(), self.dof())
}
pub fn reduced_shape(&self) -> (usize, usize) {
(self.reduced_dof(), self.reduced_dof())
}
/// Create the stiffness matrix for the system of equations to solve
pub fn stiffness(&self) -> Vec<f32> {
let dof = self.dof();
let mut a: Vec<f32> = vec![0.0; dof.pow(2)]; let mut a: Vec<f32> = vec![0.0; dof.pow(2)];
for point in self.points.values() { for point in self.points.values() {
@@ -53,10 +69,84 @@ impl World {
} }
} }
match Array2::from_shape_vec((dof, dof), a) { a
Ok(arr) => Ok(arr), }
Err(e) => Err(e.to_string()), fn idx_to_coord(&self, idx: usize) -> (usize, usize) {
let shape = self.shape();
let row = idx / shape.0;
let col = idx - (row * shape.0);
(row, col)
}
pub fn reduced_stiffness(&self) -> Vec<f32> {
let d = self.displacement();
self.stiffness()
.into_iter()
.enumerate()
.filter(|&(i, _)| {
let (row, col) = self.idx_to_coord(i);
//println!("row = {} d[row] = {:?}", row, d[row]);
//println!("col = {} d[col] = {:?}", col, d[col]);
d[row] == Value::Unknown && d[col] == Value::Unknown
})
.map(|(_, e)| e)
.collect()
}
pub fn displacement(&self) -> Vec<Value> {
let mut a = vec![Value::Known(0_f32); self.dof()];
for point in self.points.values() {
let point = point.borrow();
let ax = 2 * (point.id - 1);
let ay = ax + 1;
if let BoundaryCondition::Fixed = point.bc {
continue;
}
a[ax] = Value::Unknown;
a[ay] = Value::Unknown;
} }
a
}
pub fn reduced_displacement(&self) -> Vec<Value> {
self.displacement()
.into_iter()
.filter(|d| *d == Value::Unknown)
.collect::<Vec<_>>()
}
pub fn force(&self) -> Vec<Value> {
let mut a = vec![Value::Unknown; self.dof()];
for point in self.points.values() {
let point = point.borrow();
let ax = 2 * (point.id - 1);
let ay = ax + 1;
if let BoundaryCondition::Force(v) = &point.bc {
a[ax] = Value::Known(v.0);
a[ay] = Value::Known(v.1);
}
}
a
}
pub fn reduced_force(&self) -> Vec<Value> {
let d = self.displacement();
self.force()
.into_iter()
.enumerate()
.filter(|&(i, _)| d[i] == Value::Unknown)
.map(|(_, f)| f)
.collect()
} }
pub fn link(&mut self, id1: usize, id2: usize, new_beam: NewBeam) -> Result<(), &str> { pub fn link(&mut self, id1: usize, id2: usize, new_beam: NewBeam) -> Result<(), &str> {

5
todo Normal file
View File

@@ -0,0 +1,5 @@
add support for parsing PD2v1 files for beam element programs
create program to help make PD2v1 files by drawing on canvas
expand beam element solver to be able to solve problems with nodes with no boundary conditions
support finite element solving