{"id":51428383,"url":"https://github.com/leanprover/hex-matrix","last_synced_at":"2026-07-05T03:00:29.780Z","repository":{"id":367311665,"uuid":"1279146358","full_name":"leanprover/hex-matrix","owner":"leanprover","description":"Dense matrices over an arbitrary coefficient type: arithmetic, elementary row and column operations, and the Gram matrix. Mathlib-free.","archived":false,"fork":false,"pushed_at":"2026-07-03T21:57:39.000Z","size":367,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-03T23:27:14.721Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://kim-em.github.io/hex-dev/find/?domain=Verso.Genre.Manual.section\u0026name=hex-matrix","language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leanprover.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-24T12:18:34.000Z","updated_at":"2026-07-03T21:57:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leanprover/hex-matrix","commit_stats":null,"previous_names":["kim-em/hex-matrix","leanprover/hex-matrix"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/leanprover/hex-matrix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-matrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-matrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-matrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-matrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanprover","download_url":"https://codeload.github.com/leanprover/hex-matrix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-matrix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35141966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2026-07-05T03:00:22.224Z","updated_at":"2026-07-05T03:00:29.744Z","avatar_url":"https://github.com/leanprover.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hex-matrix\n\nPart of [`hex`](https://github.com/kim-em/hex-dev), a computer algebra\nlibrary for Lean 4. The aim is fast executable code, fully verified, built\nwith spec-driven development.\n\n`hex-matrix` provides dense matrices, represented as `Vector (Vector R m) n`\nand generic over the coefficient type `R`. This library has no dependencies.\nSee [`hex-matrix-mathlib`](https://github.com/leanprover/hex-matrix-mathlib) for\nthe correspondence with Mathlib's types and theory.\n\n# Quickstart\n\nAdd to your `lakefile.toml`:\n\n```toml\n[[require]]\nname = \"hex-matrix\"\ngit = \"https://github.com/leanprover/hex-matrix.git\"\nrev = \"main\"\n```\n\n```lean\nimport HexMatrix\n\nopen Hex\n\n-- Build a matrix from an entry function, or write one out explicitly.\ndef A : Matrix Int 2 3 := Matrix.ofFn fun i j =\u003e (i + j : Int)\ndef B : Matrix Int 3 2 := #m[1, 2; 3, 4; 5, 6]\n\n#eval A * B                        -- 2×2 matrix product\n#eval Matrix.transpose A           -- 3×2 transpose\n#eval Matrix.gramMatrix A          -- A * Aᵀ\n#eval Matrix.mulVec A (Vector.ofFn fun j =\u003e (j + 1 : Int))\n\n-- Elementary row operations.\n#eval Matrix.rowSwap A 0 1\n#eval Matrix.rowScale A 0 5\n#eval Matrix.identity (R := Int) 3 -- the 3×3 identity\n```\n\n# Functionality\n\nDense `n × m` matrices over an arbitrary coefficient type:\n\n- constructors and accessors: `ofFn`, `row`, `col`, `setRow`, `setCol`,\n  `transpose`, the zero and identity matrices;\n- arithmetic: vector dot product and norm-squared, matrix-vector and\n  matrix-matrix multiplication (also via `*`);\n- elementary row operations `rowSwap`, `rowScale`, `rowAdd`, `rowMoveUp`\n  and the column analogues `colAdd` / `colAddRight`;\n- submatrix / leading-submatrix slicing and the Gram matrix `M * Mᵀ`.\n\nRow reduction ([`hex-row-reduce`](https://github.com/leanprover/hex-row-reduce)),\nthe Leibniz determinant ([`hex-determinant`](https://github.com/leanprover/hex-determinant)),\nand the Bareiss algorithm ([`hex-bareiss`](https://github.com/leanprover/hex-bareiss))\nbuild on it.\n\n# Verification\n\nThe elementary operations and matrix algebra carry their algebraic\nidentities: entrywise characterizations of every operation, the identity\nmatrix acting as a left and right multiplicative identity, involutivity of\n`transpose`, `gramMatrix M = M * Mᵀ`, and the involutivity, multiplicative,\nand inverse-preservation lemmas for the elementary operations.\n\nThe `Semiring` / `Ring` structure and the equivalence with Mathlib's\n`Matrix`, which let you transfer Mathlib's linear-algebra results, live in\n[`hex-matrix-mathlib`](https://github.com/leanprover/hex-matrix-mathlib).\n\n# Reference manual\n\nThe hex reference manual covers this library at\n\u003chttps://kim-em.github.io/hex-dev/find/?domain=Verso.Genre.Manual.section\u0026name=hex-matrix\u003e.\n\n# Contributing\n\nDevelopment happens in the [`hex-dev`](https://github.com/kim-em/hex-dev)\nmonorepo, not in this published mirror. Contributions are welcome as pull\nrequests to the `SPEC/` directory: describe the behaviour you want, and\nleave the implementation to the maintainer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Fhex-matrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanprover%2Fhex-matrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Fhex-matrix/lists"}