{"id":20289357,"url":"https://github.com/apt1002/multidimension","last_synced_at":"2025-04-11T10:38:31.274Z","repository":{"id":192937161,"uuid":"687764650","full_name":"apt1002/multidimension","owner":"apt1002","description":"Pure Rust library providing high-level manipulation of multi-dimensional arrays","archived":false,"fork":false,"pushed_at":"2023-12-11T08:05:56.000Z","size":245,"stargazers_count":1,"open_issues_count":7,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-24T14:37:54.654Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apt1002.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-06T00:47:40.000Z","updated_at":"2023-12-10T14:18:07.000Z","dependencies_parsed_at":"2023-10-30T05:33:06.839Z","dependency_job_id":"96ec3967-aa2f-4115-9986-c5ac97d4cdfe","html_url":"https://github.com/apt1002/multidimension","commit_stats":null,"previous_names":["apt1002/multidimension"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apt1002%2Fmultidimension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apt1002%2Fmultidimension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apt1002%2Fmultidimension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apt1002%2Fmultidimension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apt1002","download_url":"https://codeload.github.com/apt1002/multidimension/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248376349,"owners_count":21093681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T14:53:11.898Z","updated_at":"2025-04-11T10:38:31.232Z","avatar_url":"https://github.com/apt1002.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multidimensional Arrays\n\nA pure-Rust library providing high-level manipulation of multi-dimensional\narrays.\n\n## Design goals\n\nThe focus of this library is to provide an easy and bug-free way of programming\nwith multi-dimensional arrays. In particular:\n\n - The internal representation of an array is dense (a boxed slice) but not\nSIMD optimized (unless you explicitly make an array of a SIMD type).\n - Does not integrate with [BLAS] in the back-end, or with [NumPy] in the\nfront-end, so it's simply the cleanest design I could make.\n - The API will be familiar to users of [NumPy] and of Rust's [`std::iter`].\n - The array indices can be of any type that implements\n`multidimension::Index`, and you are encouraged to make type distinctions among\narray indices.\n - The library provides a high-level way of expressing many common operations,\nand a safe, modular way of writing new operations if necessary.\n\n[BLAS]: https://www.netlib.org/blas/\n[NumPy]: https://numpy.org/\n[`std::iter`]: https://doc.rust-lang.org/std/iter/index.html\n\n## Examples\n\nMore can be found in [the docs](https://docs.rs/multidimension/).\n\nGenerate a diagonal matrix:\n\n```rust\nlet a: Array\u003c_, _\u003e = usize::all(3).map(|x| x + 10).diagonal().collect();\nassert_eq!(a.as_ref(), [\n    10, 0, 0,\n    0, 11, 0,\n    0, 0, 12,\n]);\n```\n\nUse one vector to select from another:\n\n```rust\nlet a: Array\u003cbool, usize\u003e = Array::new((), [2, 1]);\nlet b: Array\u003cusize, \u0026str\u003e = Array::new(3, [\"apple\", \"body\", \"crane\"]);\nlet ab: Array\u003cbool, \u0026str\u003e = a.compose(b).collect();\nassert_eq!(ab.as_ref(), [\"crane\", \"body\"])\n```\n\nZip two arrays:\n\n```rust\nlet a: Array\u003cusize, usize\u003e = usize::all(3).collect();\nlet b: Array\u003cusize, \u0026str\u003e = Array::new(3, [\"apple\", \"body\", \"crane\"]);\nlet ab: Array\u003cusize, (usize, \u0026str)\u003e = a.zip(b).collect();\nassert_eq!(ab.as_ref(), [\n    (0, \"apple\"),\n    (1, \"body\"),\n    (2, \"crane\"),\n]);\n```\n\nTranspose a matrix of pairs:\n\n```rust\nlet a: Array\u003c_, _\u003e = \u003c(usize, usize)\u003e::all((3, 2)).collect();\nassert_eq!(a.as_ref(), [\n    (0, 0), (0, 1),\n    (1, 0), (1, 1),\n    (2, 0), (2, 1),\n]);\nlet b: Array\u003c_, _\u003e = a.transpose::\u003c(), usize, usize, ()\u003e().collect();\nassert_eq!(b.as_ref(), [\n    (0, 0), (1, 0), (2, 0),\n    (0, 1), (1, 1), (2, 1),\n]);\n```\n\n## Contributions\n\nare welcome!\n\n© 2023 Alistair Turnbull. Please use multidimension at minworks dot co dot uk.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapt1002%2Fmultidimension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapt1002%2Fmultidimension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapt1002%2Fmultidimension/lists"}