Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pierwill/gaussiant
Gaussian integers in Rust.
https://github.com/pierwill/gaussiant
complex-numbers mathematics number-theory
Last synced: 3 months ago
JSON representation
Gaussian integers in Rust.
- Host: GitHub
- URL: https://github.com/pierwill/gaussiant
- Owner: pierwill
- Created: 2022-01-24T18:13:02.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-15T15:53:13.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T12:29:56.714Z (4 months ago)
- Topics: complex-numbers, mathematics, number-theory
- Language: Rust
- Homepage: https://crates.io/crates/gaussiant
- Size: 72.3 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![crate](https://img.shields.io/crates/v/gaussiant.svg)](https://crates.io/crates/gaussiant)
[![documentation](https://docs.rs/gaussiant/badge.svg)](https://docs.rs/gaussiant)
[![stable](https://github.com/pierwill/gaussiant/actions/workflows/stable.yml/badge.svg)](https://github.com/pierwill/gaussiant/actions/workflows/stable.yml)
[![nightly](https://github.com/pierwill/gaussiant/actions/workflows/nightly.yaml/badge.svg)](https://github.com/pierwill/gaussiant/actions/workflows/nightly.yaml)A [Gaussian integer] is a complex number whose real and imaginary parts are both integers.
`gaussiant` provides the [`GaussianInt`] type,
which is a wrapper around [`num_complex::Complex`]
with additional methods for number theoretical computation.## Example
If a prime number *p* is congruent to 3 modulo 4, then it is a Gaussian prime ([Wikipedia]).
```rust
use gaussiant::{GaussianInt, gaussint};fn main() {
let p = gaussint!(7);
assert_eq!(
p.congruent(gaussint!(3), gaussint!(4)),
p.is_gaussian_prime()
);
}
```[`num_complex::Complex`]: https://docs.rs/num-complex/latest/num_complex/struct.Complex.html
[Gaussian integer]: https://en.wikipedia.org/wiki/Gaussian_integer
[`GaussianInt`]: https://docs.rs/gaussiant/latest/gaussiant/struct.GaussianInt.html
[Wikipedia]: https://en.wikipedia.org/wiki/Gaussian_integer#Gaussian_primes