-
Notifications
You must be signed in to change notification settings - Fork 275
Fmpz mod mat rand and randfull functions #2430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4cf3226
Add a randunif function to src/nmod_vec
dlesnoff 48d863f
Add randtest to the documentation
dlesnoff f30cff0
Add fmpz_mod_mat random functions and upgrade documentation
dlesnoff 534cd06
Update headers and documentation
dlesnoff 7ab4f13
Change randunif to rand
dlesnoff 1fb1e3e
randunif->rand: Change file name
dlesnoff c245cdc
Uses fmpz_zero instead of dereferencing
dlesnoff 2ff76f1
Add documentation suggestions
dlesnoff 1baa250
Fix loops in random generation
dlesnoff 3ce0ff0
Fix documentation
dlesnoff 9a63870
Uses vec internally
dlesnoff ed77486
Adds a function to get the modulus
dlesnoff 5440826
Apply suggestions from code review
dlesnoff 8b58392
Apply suggestion for nmod_mat_rand(full)
dlesnoff 4afd8c0
Make looping over matrices compatible with stride
dlesnoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,19 @@ | ||
| #include "fmpz.h" | ||
| #include "fmpz_mod_mat.h" | ||
|
|
||
| void fmpz_mod_mat_rand(fmpz_mod_mat_t mat, flint_rand_t state, const fmpz_mod_ctx_t ctx) | ||
| { | ||
| fmpz* e; | ||
| slong i, j, r, c; | ||
| r = fmpz_mod_mat_nrows(mat, ctx); | ||
| c = fmpz_mod_mat_nrows(mat, ctx); | ||
|
|
||
| for (i = 0; i < r; i++) | ||
| { | ||
| for (j = 0; j < c; j++) | ||
| { | ||
| e = fmpz_mod_mat_entry(mat, i, j); | ||
| fmpz_randm(e, state, ctx->n); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,21 @@ | ||
| #include "fmpz.h" | ||
| #include "fmpz_mod_mat.h" | ||
|
|
||
| void fmpz_mod_mat_randfull(fmpz_mod_mat_t mat, flint_rand_t state, const fmpz_mod_ctx_t ctx) | ||
| { | ||
| fmpz* e; | ||
| slong i, j, r, c; | ||
| r = fmpz_mod_mat_nrows(mat, ctx); | ||
| c = fmpz_mod_mat_nrows(mat, ctx); | ||
|
|
||
| for (i = 0; i < r; i++) | ||
| { | ||
| for (j = 0; j < c; j++) | ||
| { | ||
| e = fmpz_mod_mat_entry(mat, i, j); | ||
| fmpz_randm(e, state, ctx->n); | ||
| if (fmpz_cmp_ui(e, 0)) | ||
| fmpz_one(e); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.