Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sage-code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Multivariate Quadric-polynomial Public Key Cryptography
sage-code
Commits
bfc72f45
Commit
bfc72f45
authored
7 years ago
by
Maximilian Stauss
Browse files
Options
Downloads
Patches
Plain Diff
add sage extensions
parent
19c99c04
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
classes/helpers/sage_extensions.py
+20
-0
20 additions, 0 deletions
classes/helpers/sage_extensions.py
with
20 additions
and
0 deletions
classes/helpers/sage_extensions.py
0 → 100644
+
20
−
0
View file @
bfc72f45
from
__future__
import
absolute_import
from
sage.all
import
random_matrix
,
random_vector
,
random
def
random_invertible_matrix
(
finite_field
,
n
):
matrix
=
random_matrix
(
finite_field
,
n
)
while
not
matrix
.
is_invertible
():
matrix
=
random_matrix
(
finite_field
,
n
)
return
matrix
def
random_value
(
finite_field
):
return
random_vector
(
finite_field
,
1
)[
0
]
def
random_between
(
j
,
k
):
a
=
int
(
random
()
*
(
k
-
j
+
1
))
+
j
return
a
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment