-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from GiacomoPope/add_fmpz_mod
Add fmpz mod
- Loading branch information
Showing
13 changed files
with
635 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
**fmpz_mod** -- integers mod n | ||
=============================================================================== | ||
|
||
.. autoclass :: flint.fmpz_mod_ctx | ||
:members: | ||
:inherited-members: | ||
:undoc-members: | ||
.. autoclass :: flint.fmpz_mod | ||
:members: | ||
:inherited-members: | ||
:undoc-members: | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ Scalar types | |
|
||
fmpz.rst | ||
fmpq.rst | ||
fmpz_mod.rst | ||
nmod.rst | ||
arb.rst | ||
acb.rst | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from flint.flintlib.flint cimport ulong, slong | ||
from flint.flintlib.fmpz cimport fmpz_t, fmpz_preinvn_struct | ||
from flint.flintlib.nmod cimport nmod_t | ||
|
||
# unimported types {'fmpz_mod_discrete_log_pohlig_hellman_t'} | ||
|
||
cdef extern from "flint/fmpz_mod.h": | ||
ctypedef struct fmpz_mod_ctx_struct: | ||
fmpz_t n | ||
nmod_t mod | ||
ulong n_limbs[3] | ||
ulong ninv_limbs[3] | ||
fmpz_preinvn_struct * ninv_huge | ||
ctypedef fmpz_mod_ctx_struct fmpz_mod_ctx_t[1] | ||
|
||
# Parsed from here | ||
void fmpz_mod_ctx_init(fmpz_mod_ctx_t ctx, const fmpz_t n) | ||
void fmpz_mod_ctx_clear(fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_ctx_set_modulus(fmpz_mod_ctx_t ctx, const fmpz_t n) | ||
void fmpz_mod_set_fmpz(fmpz_t a, const fmpz_t b, const fmpz_mod_ctx_t ctx) | ||
int fmpz_mod_is_canonical(const fmpz_t a, const fmpz_mod_ctx_t ctx) | ||
int fmpz_mod_is_one(const fmpz_t a, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_add(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_add_fmpz(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_add_ui(fmpz_t a, const fmpz_t b, ulong c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_add_si(fmpz_t a, const fmpz_t b, slong c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_sub(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_sub_fmpz(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_sub_ui(fmpz_t a, const fmpz_t b, ulong c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_sub_si(fmpz_t a, const fmpz_t b, slong c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_fmpz_sub(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_ui_sub(fmpz_t a, ulong b, const fmpz_t c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_si_sub(fmpz_t a, slong b, const fmpz_t c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_neg(fmpz_t a, const fmpz_t b, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_mul(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_inv(fmpz_t a, const fmpz_t b, const fmpz_mod_ctx_t ctx) | ||
int fmpz_mod_divides(fmpz_t a, const fmpz_t b, const fmpz_t c, const fmpz_mod_ctx_t ctx) | ||
void fmpz_mod_pow_ui(fmpz_t a, const fmpz_t b, ulong e, const fmpz_mod_ctx_t ctx) | ||
int fmpz_mod_pow_fmpz(fmpz_t a, const fmpz_t b, const fmpz_t e, const fmpz_mod_ctx_t ctx) | ||
# void fmpz_mod_discrete_log_pohlig_hellman_init(fmpz_mod_discrete_log_pohlig_hellman_t L) | ||
# void fmpz_mod_discrete_log_pohlig_hellman_clear(fmpz_mod_discrete_log_pohlig_hellman_t L) | ||
# double fmpz_mod_discrete_log_pohlig_hellman_precompute_prime(fmpz_mod_discrete_log_pohlig_hellman_t L, const fmpz_t p) | ||
# const fmpz_struct * fmpz_mod_discrete_log_pohlig_hellman_primitive_root(const fmpz_mod_discrete_log_pohlig_hellman_t L) | ||
# void fmpz_mod_discrete_log_pohlig_hellman_run(fmpz_t x, const fmpz_mod_discrete_log_pohlig_hellman_t L, const fmpz_t y) | ||
int fmpz_next_smooth_prime(fmpz_t a, const fmpz_t b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from flint.flint_base.flint_base cimport flint_scalar | ||
from flint.flintlib.fmpz cimport fmpz_t | ||
from flint.flintlib.fmpz_mod cimport fmpz_mod_ctx_t | ||
|
||
|
||
cdef class fmpz_mod_ctx: | ||
cdef fmpz_mod_ctx_t val | ||
|
||
cdef class fmpz_mod(flint_scalar): | ||
cdef fmpz_mod_ctx ctx | ||
cdef fmpz_t val | ||
|
||
cdef any_as_fmpz_mod(self, obj) | ||
|
Oops, something went wrong.