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
8
Merge Requests
8
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
1ce8d473
Commit
1ce8d473
authored
Jul 13, 2017
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove fixed point magic
parent
997bbf68
Pipeline
#14861
passed with stage
in 6 minutes and 20 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
4 additions
and
70 deletions
+4
-70
nifty/field.py
nifty/field.py
+2
-30
nifty/spaces/rg_space/rg_space.py
nifty/spaces/rg_space/rg_space.py
+0
-18
nifty/spaces/space/space.py
nifty/spaces/space/space.py
+0
-13
test/test_field.py
test/test_field.py
+2
-0
test/test_spaces/test_lm_space.py
test/test_spaces/test_lm_space.py
+0
-4
test/test_spaces/test_rg_space.py
test/test_spaces/test_rg_space.py
+0
-5
No files found.
nifty/field.py
View file @
1ce8d473
...
...
@@ -608,39 +608,11 @@ class Field(Loggable, Versionable, object):
# correct variance
if
preserve_gaussian_variance
:
assert
issubclass
(
val
.
dtype
.
type
,
np
.
complexfloating
),
\
"complex input field is needed here"
h
*=
np
.
sqrt
(
2
)
a
*=
np
.
sqrt
(
2
)
if
not
issubclass
(
val
.
dtype
.
type
,
np
.
complexfloating
):
# in principle one must not correct the variance for the fixed
# points of the hermitianization. However, for a complex field
# the input field loses half of its power at its fixed points
# in the `hermitian` part. Hence, here a factor of sqrt(2) is
# also necessary!
# => The hermitianization can be done on a space level since
# either nothing must be done (LMSpace) or ALL points need a
# factor of sqrt(2)
# => use the preserve_gaussian_variance flag in the
# hermitian_decomposition method above.
# This code is for educational purposes:
fixed_points
=
[
domain
[
i
].
hermitian_fixed_points
()
for
i
in
spaces
]
fixed_points
=
[[
fp
]
if
fp
is
None
else
fp
for
fp
in
fixed_points
]
for
product_point
in
itertools
.
product
(
*
fixed_points
):
slice_object
=
np
.
array
((
slice
(
None
),
)
*
len
(
val
.
shape
),
dtype
=
np
.
object
)
for
i
,
sp
in
enumerate
(
spaces
):
point_component
=
product_point
[
i
]
if
point_component
is
None
:
point_component
=
slice
(
None
)
slice_object
[
list
(
domain_axes
[
sp
])]
=
point_component
slice_object
=
tuple
(
slice_object
)
h
[
slice_object
]
/=
np
.
sqrt
(
2
)
a
[
slice_object
]
/=
np
.
sqrt
(
2
)
return
(
h
,
a
)
def
_spec_to_rescaler
(
self
,
spec
,
result_list
,
power_space_index
):
...
...
nifty/spaces/rg_space/rg_space.py
View file @
1ce8d473
...
...
@@ -100,24 +100,6 @@ class RGSpace(Space):
self
.
_distances
=
self
.
_parse_distances
(
distances
)
self
.
_zerocenter
=
self
.
_parse_zerocenter
(
zerocenter
)
def
hermitian_fixed_points
(
self
):
dimensions
=
len
(
self
.
shape
)
mid_index
=
np
.
array
(
self
.
shape
)
//
2
ndlist
=
[
1
]
*
dimensions
for
k
in
range
(
dimensions
):
if
self
.
shape
[
k
]
%
2
==
0
:
ndlist
[
k
]
=
2
ndlist
=
tuple
(
ndlist
)
fixed_points
=
[]
for
index
in
np
.
ndindex
(
ndlist
):
for
k
in
range
(
dimensions
):
if
self
.
shape
[
k
]
%
2
!=
0
and
self
.
zerocenter
[
k
]:
index
=
list
(
index
)
index
[
k
]
=
1
index
=
tuple
(
index
)
fixed_points
+=
[
tuple
(
index
*
mid_index
)]
return
fixed_points
def
hermitianize_inverter
(
self
,
x
,
axes
):
# calculate the number of dimensions the input array has
dimensions
=
len
(
x
.
shape
)
...
...
nifty/spaces/space/space.py
View file @
1ce8d473
...
...
@@ -161,19 +161,6 @@ class Space(DomainObject):
raise
NotImplementedError
(
"There is no generic co-smoothing kernel for Space base class."
)
def
hermitian_fixed_points
(
self
):
""" Returns the array points which remain invariant under the action
of `hermitianize_inverter`
Returns
-------
list of index-tuples
The list contains the index-coordinates of the invariant points.
"""
return
None
def
hermitianize_inverter
(
self
,
x
,
axes
):
""" Inverts/flips x in the context of Hermitian decomposition.
...
...
test/test_field.py
View file @
1ce8d473
...
...
@@ -67,6 +67,8 @@ class Test_Functionality(unittest.TestCase):
r2
=
RGSpace
(
s2
,
harmonic
=
True
,
zerocenter
=
(
z2
,))
ra
=
RGSpace
(
s1
+
s2
,
harmonic
=
True
,
zerocenter
=
(
z1
,
z2
))
if
preserve
:
complexdata
=
True
v
=
np
.
random
.
random
(
s1
+
s2
)
if
complexdata
:
v
=
v
+
1j
*
np
.
random
.
random
(
s1
+
s2
)
...
...
test/test_spaces/test_lm_space.py
View file @
1ce8d473
...
...
@@ -127,7 +127,3 @@ class LMSpaceFunctionalityTests(unittest.TestCase):
def
test_distance_array
(
self
,
lmax
,
expected
):
l
=
LMSpace
(
lmax
)
assert_almost_equal
(
l
.
get_distance_array
(
'not'
).
data
,
expected
)
def
test_hermitian_fixed_points
(
self
):
x
=
LMSpace
(
5
)
assert_equal
(
x
.
hermitian_fixed_points
(),
None
)
test/test_spaces/test_rg_space.py
View file @
1ce8d473
...
...
@@ -190,8 +190,3 @@ class RGSpaceFunctionalityTests(unittest.TestCase):
assert_almost_equal
(
res
,
expected
)
if
inplace
:
assert_
(
x
is
res
)
def
test_hermitian_fixed_points
(
self
):
x
=
RGSpace
((
5
,
6
,
5
,
6
),
zerocenter
=
[
False
,
False
,
True
,
True
])
assert_equal
(
x
.
hermitian_fixed_points
(),
[(
0
,
0
,
2
,
0
),
(
0
,
0
,
2
,
3
),
(
0
,
3
,
2
,
0
),
(
0
,
3
,
2
,
3
)])
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