Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
57775452
Commit
57775452
authored
Jul 13, 2017
by
Theo Steininger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved tests.
parent
6292ee2a
Pipeline
#14840
failed with stages
in 6 minutes and 36 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
test/test_spaces/test_lm_space.py
test/test_spaces/test_lm_space.py
+6
-9
test/test_spaces/test_rg_space.py
test/test_spaces/test_rg_space.py
+4
-3
No files found.
test/test_spaces/test_lm_space.py
View file @
57775452
...
@@ -20,7 +20,7 @@ import unittest
...
@@ -20,7 +20,7 @@ import unittest
import
numpy
as
np
import
numpy
as
np
from
numpy.testing
import
assert_
,
assert_equal
,
assert_raises
,
\
from
numpy.testing
import
assert_
,
assert_equal
,
assert_raises
,
\
assert_almost_equal
assert_almost_equal
,
assert_array_almost_equal
from
d2o
import
distributed_data_object
from
d2o
import
distributed_data_object
from
nifty
import
LMSpace
from
nifty
import
LMSpace
from
test.common
import
expand
from
test.common
import
expand
...
@@ -108,15 +108,12 @@ class LMSpaceFunctionalityTests(unittest.TestCase):
...
@@ -108,15 +108,12 @@ class LMSpaceFunctionalityTests(unittest.TestCase):
for
key
,
value
in
expected
.
iteritems
():
for
key
,
value
in
expected
.
iteritems
():
assert_equal
(
getattr
(
l
,
key
),
value
)
assert_equal
(
getattr
(
l
,
key
),
value
)
@
expand
(
get_hermitian_configs
())
def
test_hermitianize_inverter
(
self
):
def
test_hermitian_decomposition
(
self
,
x
,
real
,
imag
):
l
=
LMSpace
(
5
)
l
=
LMSpace
(
5
)
assert_almost_equal
(
v
=
distributed_data_object
(
global_shape
=
l
.
shape
,
dtype
=
np
.
complex128
)
l
.
hermitian_decomposition
(
distributed_data_object
(
x
))[
0
],
v
[:]
=
np
.
random
.
random
(
l
.
shape
)
+
1j
*
np
.
random
.
random
(
l
.
shape
)
real
)
inverted
=
l
.
hermitianize_inverter
(
v
,
axes
=
(
0
,))
assert_almost_equal
(
assert_array_almost_equal
(
inverted
.
get_full_data
(),
v
.
get_full_data
())
l
.
hermitian_decomposition
(
distributed_data_object
(
x
))[
1
],
imag
*
1j
)
@
expand
(
get_weight_configs
())
@
expand
(
get_weight_configs
())
def
test_weight
(
self
,
x
,
power
,
axes
,
inplace
,
expected
):
def
test_weight
(
self
,
x
,
power
,
axes
,
inplace
,
expected
):
...
...
test/test_spaces/test_rg_space.py
View file @
57775452
...
@@ -21,6 +21,8 @@ from __future__ import division
...
@@ -21,6 +21,8 @@ from __future__ import division
import
unittest
import
unittest
import
numpy
as
np
import
numpy
as
np
from
d2o
import
distributed_data_object
from
numpy.testing
import
assert_
,
assert_equal
,
assert_almost_equal
from
numpy.testing
import
assert_
,
assert_equal
,
assert_almost_equal
from
nifty
import
RGSpace
from
nifty
import
RGSpace
from
test.common
import
expand
from
test.common
import
expand
...
@@ -157,9 +159,8 @@ class RGSpaceFunctionalityTests(unittest.TestCase):
...
@@ -157,9 +159,8 @@ class RGSpaceFunctionalityTests(unittest.TestCase):
[
True
,
False
]))
[
True
,
False
]))
def
test_hermitianize_inverter
(
self
,
shape
,
zerocenter
):
def
test_hermitianize_inverter
(
self
,
shape
,
zerocenter
):
r
=
RGSpace
(
shape
,
harmonic
=
True
,
zerocenter
=
zerocenter
)
r
=
RGSpace
(
shape
,
harmonic
=
True
,
zerocenter
=
zerocenter
)
v
=
np
.
empty
(
shape
,
dtype
=
np
.
complex128
)
v
=
distributed_data_object
(
global_shape
=
shape
,
dtype
=
np
.
complex128
)
v
.
real
=
np
.
random
.
random
(
shape
)
v
[:]
=
np
.
random
.
random
(
shape
)
+
1j
*
np
.
random
.
random
(
shape
)
v
.
imag
=
np
.
random
.
random
(
shape
)
inverted
=
r
.
hermitianize_inverter
(
v
,
axes
=
range
(
len
(
shape
)))
inverted
=
r
.
hermitianize_inverter
(
v
,
axes
=
range
(
len
(
shape
)))
# test hermitian flipping of `inverted`
# test hermitian flipping of `inverted`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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