Skip to content
GitLab
Menu
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
c2ec7786
Commit
c2ec7786
authored
May 21, 2020
by
Martin Reinecke
Browse files
Merge branch 'testing_operators_ve' into 'NIFTy_6'
Testing operators ve See merge request
!479
parents
2c8841e4
57b7ca9a
Pipeline
#75358
failed with stages
in 7 minutes and 35 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/test_operators/test_conjugation_operator.py
0 → 100644
View file @
c2ec7786
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-2020 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import
numpy
as
np
from
numpy.testing
import
assert_allclose
import
nifty6
as
ift
from
..common
import
setup_function
,
teardown_function
def
test_conjugation_operator
():
sp
=
ift
.
RGSpace
(
8
)
dom
=
ift
.
makeDomain
(
sp
)
f
=
ift
.
from_random
(
dom
,
dtype
=
np
.
complex128
)
op
=
ift
.
ScalingOperator
(
sp
,
1
).
conjugate
()
res1
=
f
.
conjugate
()
res2
=
op
(
f
)
assert_allclose
(
res1
.
val
,
res2
.
val
)
ift
.
extra
.
consistency_check
(
op
,
domain_dtype
=
np
.
float64
,
target_dtype
=
np
.
float64
)
ift
.
extra
.
consistency_check
(
op
,
domain_dtype
=
np
.
complex128
,
target_dtype
=
np
.
complex128
,
only_r_linear
=
True
)
test/test_operators/test_contraction_operator.py
0 → 100644
View file @
c2ec7786
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2020 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import
numpy
as
np
from
numpy.testing
import
assert_allclose
import
nifty6
as
ift
from
..common
import
setup_function
,
teardown_function
def
test_contraction_operator
():
x1
=
ift
.
RGSpace
((
9
,),
distances
=
2.
)
x2
=
ift
.
RGSpace
((
2
,
12
),
distances
=
(
0.3
,))
dom1
=
ift
.
makeDomain
(
x1
)
dom2
=
ift
.
makeDomain
((
x1
,
x2
))
f1
=
ift
.
from_random
(
dom1
)
f2
=
ift
.
from_random
(
dom2
)
op1
=
ift
.
ScalingOperator
(
dom1
,
1
).
sum
()
op2
=
ift
.
ScalingOperator
(
dom2
,
1
).
sum
()
op3
=
ift
.
ScalingOperator
(
dom2
,
1
).
sum
(
spaces
=
1
)
res1
=
f1
.
sum
()
res2
=
op1
(
f1
)
assert_allclose
(
res1
.
val
,
res2
.
val
)
res3
=
f2
.
sum
()
res4
=
op2
(
f2
)
assert_allclose
(
res3
.
val
,
res4
.
val
)
res5
=
f2
.
sum
(
spaces
=
1
)
res6
=
op3
(
f2
)
assert_allclose
(
res5
.
val
,
res6
.
val
)
for
op
in
[
op1
,
op2
,
op3
]:
ift
.
extra
.
consistency_check
(
op
,
domain_dtype
=
np
.
float64
,
target_dtype
=
np
.
float64
)
ift
.
extra
.
consistency_check
(
op
,
domain_dtype
=
np
.
complex128
,
target_dtype
=
np
.
complex128
)
test/test_operators/test_integration.py
View file @
c2ec7786
...
...
@@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2020 Max-Planck-Society
# Copyright(C)
2013-
2020 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
...
...
@@ -28,8 +28,8 @@ def test_integration_operator():
x2
=
ift
.
RGSpace
((
2
,
12
),
distances
=
(
0.3
,))
dom1
=
ift
.
makeDomain
(
x1
)
dom2
=
ift
.
makeDomain
((
x1
,
x2
))
f1
=
ift
.
from_random
(
dom1
,
'normal'
)
f2
=
ift
.
from_random
(
dom2
,
'normal'
)
f1
=
ift
.
from_random
(
dom1
)
f2
=
ift
.
from_random
(
dom2
)
op1
=
ift
.
ScalingOperator
(
dom1
,
1
).
integrate
()
op2
=
ift
.
ScalingOperator
(
dom2
,
1
).
integrate
()
op3
=
ift
.
ScalingOperator
(
dom2
,
1
).
integrate
(
spaces
=
1
)
...
...
test/test_operators/test_vdot_operator.py
0 → 100644
View file @
c2ec7786
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2020 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import
numpy
as
np
from
numpy.testing
import
assert_allclose
import
nifty6
as
ift
from
..common
import
setup_function
,
teardown_function
def
test_vdot_operator
():
dom
=
ift
.
makeDomain
(
ift
.
RGSpace
(
8
))
fa_1
=
ift
.
FieldAdapter
(
dom
,
'f1'
)
fa_2
=
ift
.
FieldAdapter
(
dom
,
'f2'
)
op1
=
fa_1
.
vdot
(
fa_2
)
f
=
ift
.
from_random
(
op1
.
domain
,
dtype
=
np
.
float64
)
res1
=
f
[
'f1'
].
vdot
(
f
[
'f2'
])
res2
=
op1
(
f
)
assert_allclose
(
res1
.
val
,
res2
.
val
)
ift
.
extra
.
check_jacobian_consistency
(
op1
,
f
)
#another Test for linearization?
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