dimforge / alga

Abstract algebra for Rust.
194 stars 39 forks source link

Polynomial ring over a finite field #92

Closed Fiono11 closed 4 years ago

Fiono11 commented 4 years ago

Hello!

I would like to construct a polynomial ring over a finite field, but I am new to Rust and this type of math. Can this library be used for this and, if so, can someone point me in the right direction?

Thanks!

WaDelma commented 4 years ago

Here is an implementation of polynomial ring. The code is bit gnarly and I didn't have time to implement the multiplication today, but it should give idea on how this crate is supposed to be used.

You can implement std::ops:: traits to make calling operations cleaner and use alga_derive crate to skip the boilerplate of implementing all those traits (and generating quickcheck tests that check that the algebraic properties actually hold). I would have probably used it myself here, but apparently playpen doesn't have it as possible dependency.

It isn't strictly over finite fields as there isn't trait for that, but that could be potentially arranged (You could create one just for your own project too and you have to implement your own finite fields in any case).

You can also look at example to get another look at how the library can be used.

If you have any question, feel free to ask!

Fiono11 commented 4 years ago

Wow, thank you so much! Will take a look at these and try to understand how they work.