Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
d1ab800e
Commit
d1ab800e
authored
Jun 21, 2020
by
Philipp Arras
Browse files
Use nifty's random number generator
parent
80eae8ba
Pipeline
#77029
passed with stages
in 12 minutes and 24 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/extra.py
View file @
d1ab800e
...
...
@@ -15,12 +15,12 @@
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import
random
from
itertools
import
combinations
import
numpy
as
np
from
numpy.testing
import
assert_
from
.
import
random
from
.domain_tuple
import
DomainTuple
from
.field
import
Field
from
.linearization
import
Linearization
...
...
@@ -326,8 +326,8 @@ def _check_nontrivial_constant(op, loc, tol, ntries, only_r_differentiable,
for
ll
in
range
(
1
,
len
(
keys
)):
combis
.
extend
(
list
(
combinations
(
keys
,
ll
)))
if
len
(
combis
)
>
max_combinations
:
random
.
seed
(
42
)
combis
=
random
.
sample
(
combis
,
int
(
max_combinations
)
)
combis
=
random
.
current_rng
().
choice
(
combis
,
int
(
max_combinations
),
replace
=
False
)
for
cstkeys
in
combis
:
varkeys
=
set
(
keys
)
-
set
(
cstkeys
)
cstloc
=
loc
.
extract_by_keys
(
cstkeys
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment