Skip to content

Commit

Permalink
gr_mat_mul_strassen; nmod32 gr domain
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-johansson committed Aug 13, 2023
1 parent 9809014 commit ea5900c
Show file tree
Hide file tree
Showing 11 changed files with 811 additions and 17 deletions.
4 changes: 3 additions & 1 deletion doc/source/gr_domains.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ Base rings and fields
`\mathbb{Z}[i]` with elements of type :type:`fmpzi_t`.

.. function:: void gr_ctx_init_nmod8(gr_ctx_t ctx, unsigned char n)
void gr_ctx_init_nmod32(gr_ctx_t ctx, unsigned int n)

Initializes *ctx* to the ring `\mathbb{Z}/n\mathbb{Z}`
of integers modulo *n* where
elements have type :type:`uint8`. We require `1 \le n \le 255`.
elements have type :type:`uint8` or :type:`uint32`. The modulus must be
nonzero.

.. function:: void gr_ctx_init_nmod(gr_ctx_t ctx, ulong n)

Expand Down
1 change: 1 addition & 0 deletions doc/source/gr_mat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ Arithmetic
.. function:: int gr_mat_sub(gr_mat_t res, const gr_mat_t mat1, const gr_mat_t mat2, gr_ctx_t ctx)

.. function:: int gr_mat_mul_classical(gr_mat_t res, const gr_mat_t mat1, const gr_mat_t mat2, gr_ctx_t ctx)
int gr_mat_mul_strassen(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);
int gr_mat_mul_generic(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx)
int gr_mat_mul(gr_mat_t res, const gr_mat_t mat1, const gr_mat_t mat2, gr_ctx_t ctx)

Expand Down
2 changes: 1 addition & 1 deletion doc/source/history.rst

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/gr.h
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ void gr_method_tab_init(gr_funcptr * methods, gr_method_tab_input * tab);
typedef enum
{
GR_CTX_FMPZ, GR_CTX_FMPQ, GR_CTX_FMPZI,
GR_CTX_FMPZ_MOD, GR_CTX_NMOD, GR_CTX_NMOD8,
GR_CTX_FMPZ_MOD, GR_CTX_NMOD, GR_CTX_NMOD8, GR_CTX_NMOD32,
GR_CTX_FQ, GR_CTX_FQ_NMOD, GR_CTX_FQ_ZECH,
GR_CTX_NF,
GR_CTX_REAL_ALGEBRAIC_QQBAR, GR_CTX_COMPLEX_ALGEBRAIC_QQBAR,
Expand Down Expand Up @@ -1339,7 +1339,9 @@ void gr_ctx_fmpz_mod_set_primality(gr_ctx_t ctx, truth_t is_prime);

void gr_ctx_init_nmod(gr_ctx_t ctx, ulong n);
void _gr_ctx_init_nmod(gr_ctx_t ctx, void * nmod_t_ref);

void gr_ctx_init_nmod8(gr_ctx_t ctx, unsigned char n);
void gr_ctx_init_nmod32(gr_ctx_t ctx, unsigned int n);

void gr_ctx_init_real_qqbar(gr_ctx_t ctx);
void gr_ctx_init_complex_qqbar(gr_ctx_t ctx);
Expand Down
2 changes: 2 additions & 0 deletions src/gr/init_random.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ void gr_ctx_init_random(gr_ctx_t ctx, flint_rand_t state)
gr_ctx_init_fmpz(ctx);
else if (which < 40)
gr_ctx_init_nmod8(ctx, n_randtest(state) % 255 + 1);
else if (which < 42)
gr_ctx_init_nmod32(ctx, n_randtest(state) % UWORD(4294967295) + 1);
else if (which < 45)
gr_ctx_init_nmod(ctx, n_randtest_not_zero(state));
else if (which < 50)
Expand Down
Loading

0 comments on commit ea5900c

Please sign in to comment.