{"id":15067683,"url":"https://github.com/breadinator/qmat","last_synced_at":"2026-01-30T20:31:51.746Z","repository":{"id":41242258,"uuid":"507895548","full_name":"Breadinator/qmat","owner":"Breadinator","description":"A simple library for 2-dimensional matrices.","archived":false,"fork":false,"pushed_at":"2022-07-01T06:04:15.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T04:28:17.134Z","etag":null,"topics":["data-structures","math","mathematics","matrix","matrix-calculations","matrix-library","matrix-multiplication","rust","rustlang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Breadinator.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}},"created_at":"2022-06-27T12:15:04.000Z","updated_at":"2022-06-28T18:55:48.000Z","dependencies_parsed_at":"2022-08-29T00:11:25.955Z","dependency_job_id":null,"html_url":"https://github.com/Breadinator/qmat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Breadinator%2Fqmat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Breadinator%2Fqmat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Breadinator%2Fqmat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Breadinator%2Fqmat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Breadinator","download_url":"https://codeload.github.com/Breadinator/qmat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826826,"owners_count":20354220,"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":["data-structures","math","mathematics","matrix","matrix-calculations","matrix-library","matrix-multiplication","rust","rustlang"],"created_at":"2024-09-25T01:25:50.352Z","updated_at":"2026-01-30T20:31:51.709Z","avatar_url":"https://github.com/Breadinator.png","language":"Rust","readme":"# qmat\r\n[![Version](https://img.shields.io/crates/v/qmat)](https://crates.io/crates/qmat)\r\n[![Docs](https://img.shields.io/docsrs/qmat)](https://docs.rs/qmat/latest)\r\n[![codecov](https://codecov.io/gh/Breadinator/qmat/branch/main/graph/badge.svg?token=5351LB1WAN)](https://codecov.io/gh/Breadinator/qmat)\r\n[![Build Status](https://img.shields.io/github/workflow/status/Breadinator/qmat/Rust)](https://github.com/Breadinator/qmat/actions/workflows/rust.yml)\r\n[![open issues](https://img.shields.io/github/issues-raw/Breadinator/qmat)](https://github.com/Breadinator/qmat/issues)\r\n[![License](https://img.shields.io/github/license/Breadinator/qmat)](https://github.com/Breadinator/qmat/blob/main/LICENSE)\r\n![Code Size](https://img.shields.io/github/languages/code-size/Breadinator/qmat)\r\n\r\n**qmat** is a simple library for 2-dimensional matrices.\r\n\r\n## Usage\r\n### New matrix\r\nThere are three main ways to create a new matrix.\r\n\r\n```rust\r\nuse qmat::prelude::*;\r\n\r\n// Creates the matrix 2x3\r\n//     [0, 1, 2]\r\n//     [3, 4, 5]\r\n// The generics are the data type, the number of rows, the\r\n// number of cols then the lenth of the data (rows * cols) \r\nlet mat: Matrix\u003ci32, 2, 3, 6\u003e = Matrix::new([0, 1, 2, 3, 4, 5]).unwrap();\r\n\r\n// Or,\r\nlet mat = Matrix::\u003c_, 2, 3, 6\u003e::new([0, 1, 2, 3, 4, 5]).unwrap();\r\n```\r\n\r\n```rust\r\nuse qmat::prelude::*;\r\n\r\n// Creates the same matrix using the analagous macro pattern.\r\n// Automatically unwraps the errors.\r\nlet mat = matrix!(2, 3, [0, 1, 2, 3, 4, 5]);\r\n```\r\n\r\n```rust\r\nuse qmat::prelude::*;\r\nlet mat = matrix!([[0, 1, 2], [3, 4, 5]]);\r\n```\r\n\r\nMatrices can also be created using [Matrix::empty](https://docs.rs/qmat/latest/qmat/mat/struct.Matrix.html#method.empty) and [Matrix::diag](https://docs.rs/qmat/latest/qmat/mat/struct.Matrix.html#method.diag).\r\n\r\n### Retrieving a value\r\n#### Using a [usize; 2]\r\n```rust\r\nuse qmat::prelude::*;\r\nlet mat = matrix!([[0, 1, 2], [3, 4, 5]]);\r\nprintln!(\"{}\", mat[[1, 1]]); // 4\r\n```\r\n\r\n#### Using the position struct\r\n```rust\r\nuse qmat::prelude::*;\r\nlet mat = matrix!([[0, 1, 2], [3, 4, 5]]);\r\nlet pos = Position(0, 2);\r\nprintln!(\"{}\", mat[pos]); // 2\r\n```\r\n\r\n### Matrix operations\r\n### Iterators\r\n\r\n## Todo\r\n* Implement mutable row and col iterators\r\n* Implement inverting for matrices that aren't of the shape (2, 2)\r\n* Allow indexing for anything that can be converted into [usize; 2]\r\n* Optimise\r\n* Add examples for matrix operations and iterators to README.md","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreadinator%2Fqmat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbreadinator%2Fqmat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreadinator%2Fqmat/lists"}