{"id":26534802,"url":"https://github.com/ulthiel/gaussianintegers.jl","last_synced_at":"2025-07-05T17:35:06.662Z","repository":{"id":53824695,"uuid":"226109801","full_name":"ulthiel/GaussianIntegers.jl","owner":"ulthiel","description":"Julia package implementing the ring of Gaussian integers using the generic (Euclidean) ring interface of AbstractAlgebra.jl","archived":false,"fork":false,"pushed_at":"2023-07-22T14:44:43.000Z","size":35,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-20T21:41:15.024Z","etag":null,"topics":["algebra","julia","math"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ulthiel.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-05T13:34:33.000Z","updated_at":"2023-09-25T14:27:22.000Z","dependencies_parsed_at":"2022-09-16T08:52:41.241Z","dependency_job_id":null,"html_url":"https://github.com/ulthiel/GaussianIntegers.jl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulthiel%2FGaussianIntegers.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulthiel%2FGaussianIntegers.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulthiel%2FGaussianIntegers.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulthiel%2FGaussianIntegers.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ulthiel","download_url":"https://codeload.github.com/ulthiel/GaussianIntegers.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244861077,"owners_count":20522548,"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":["algebra","julia","math"],"created_at":"2025-03-21T20:20:18.375Z","updated_at":"2025-03-21T20:20:19.573Z","avatar_url":"https://github.com/ulthiel.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GaussianIntegers.jl\n\nThis simple [Julia](https://julialang.org) package illustrates how to implement the ring of [Gaussian integers](https://en.wikipedia.org/wiki/Gaussian_integer) using the generic (Euclidean) ring interface of [AbstractAlgebra.jl](https://github.com/Nemocas/AbstractAlgebra.jl). This allows for example to compute Hermite and Smith normal forms of matrices over the Gaussian integers without further ado.\n\nBy [Ulrich Thiel](https://ulthiel.com/math) (University of Kaiserslautern), 2019 (updated 2022)\n\n## Background\n\nIn my [course](https://ulthiel.com/math/teaching/ant-19/) on algorithmic algebraic number theory I (un)fortunately gave as an exercise to compute Hermite and Smith normal forms of matrices over the Gaussian integers in order to illustrate that the theory works over Euclidean rings in general and not just over ℤ and K[X].[^1] I noticed that by hand it is easy to make mistakes and therefore I wanted to verify my results with the computer. But if one creates the Gaussian integers as a maximal order in a computer algebra system like Magma, the system doesn't know about the Euclidean ring structure, so one cannot compute division with remainder and normal forms of matrices. AbstractAlgebra.jl supports generic (Euclidean) rings and algorithms, and once all the basic ring functions are implemented, everything else is handled without further ado. Nice!\n\n**Remark.** The Hermite normal form is only unique after fixing a system of representatives of non-associates and of residues. In the implementation I have chosen the points in the first quadrant and the positive real line as representatives of non-associates—this is handled by the function ```canonical_unit```. The explicit division with remainder algorithm *by itself* defines a system of representatives of residues, so we do not (have to) deal with this any further.\n\n## Installation\n```julia\njulia\u003e using Pkg\n\njulia\u003e Pkg.add(url=\"https://github.com/ulthiel/GaussianIntegers.jl\")\n```\n\n## Usage\n\n```julia\njulia\u003e using GaussianIntegers, AbstractAlgebra\n\njulia\u003e R = GaussianIntegerRing() #Create the ring of Gaussian integers\nRing of Gaussian integers\n\njulia\u003e x=R(2,1) #Create the Gaussian integer 2+i*1\n(2, 1)\n\njulia\u003e x+x #Addition\n(4, 2)\n\njulia\u003e x*x #Multiplication\n(3, 4)\n\njulia\u003e A=matrix(R,2,2,[(2,-1), (2,0), (7,-1), (3,1)]) #Creating a 2x2-matrix of Gaussian integers\n[(2, -1)  (2, 0)]\n[(7, -1)  (3, 1)]\n\njulia\u003e hnf(A) #The Hermite normal form of A (hnf_with_transform will also return the transformation matrix)\n[(1, 2)  (1, -1)]\n[(0, 0)   (3, 1)]\n\njulia\u003e snf(A) #The Smith normal form of A\n[(1, 0)  (0, 0)]\n[(0, 0)  (1, 7)]\n```\n\n## References\n\n[^1]: Adkins, W. A. \u0026 Weintraub, S. H. (1992). *Algebra*. Chapter 5.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulthiel%2Fgaussianintegers.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fulthiel%2Fgaussianintegers.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulthiel%2Fgaussianintegers.jl/lists"}