Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
c385b8bc
Commit
c385b8bc
authored
May 02, 2017
by
Theo Steininger
Browse files
Merge branch 'issue77_2' into 'master'
try to address hashing/equality problems and fix caches See merge request !72
parents
42951308
bd1e0f27
Pipeline
#11891
passed with stages
in 16 minutes and 4 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
nifty/domain_object.py
View file @
c385b8bc
...
...
@@ -40,7 +40,14 @@ class DomainObject(Versionable, Loggable, object):
def
__eq__
(
self
,
x
):
if
isinstance
(
x
,
type
(
self
)):
return
hash
(
self
)
==
hash
(
x
)
for
key
in
vars
(
self
).
keys
():
item1
=
vars
(
self
)[
key
]
if
key
in
self
.
_ignore_for_hash
or
key
==
'_ignore_for_hash'
:
continue
item2
=
vars
(
x
)[
key
]
if
item1
!=
item2
:
return
False
return
True
else
:
return
False
...
...
nifty/operators/fft_operator/transformations/rg_transforms.py
View file @
c385b8bc
...
...
@@ -223,11 +223,7 @@ class FFTW(Transform):
local_offset_Q
,
is_local
,
transform_shape
=
None
,
**
kwargs
):
# generate a id-tuple which identifies the domain-codomain setting
temp_id
=
(
domain
.
__hash__
()
^
(
101
*
codomain
.
__hash__
())
^
(
211
*
transform_shape
.
__hash__
())
^
(
131
*
is_local
.
__hash__
())
)
temp_id
=
(
domain
,
codomain
,
transform_shape
,
is_local
)
# generate the plan_and_info object if not already there
if
temp_id
not
in
self
.
info_dict
:
...
...
nifty/operators/fft_operator/transformations/transformation_cache.py
View file @
c385b8bc
...
...
@@ -22,8 +22,7 @@ class _TransformationCache(object):
self
.
cache
=
{}
def
create
(
self
,
transformation_class
,
domain
,
codomain
,
module
):
key
=
domain
.
__hash__
()
^
((
codomain
.
__hash__
()
/
111
)
^
(
module
.
__hash__
())
/
179
)
key
=
(
domain
,
codomain
,
module
)
if
key
not
in
self
.
cache
:
self
.
cache
[
key
]
=
transformation_class
(
domain
,
codomain
,
module
)
...
...
nifty/spaces/power_space/power_index_factory.py
View file @
c385b8bc
...
...
@@ -25,13 +25,13 @@ class _PowerIndexFactory(object):
def
get_power_index
(
self
,
domain
,
distribution_strategy
,
log
=
False
,
nbin
=
None
,
binbounds
=
None
):
current_hash
=
domain
.
__hash__
()
^
(
111
*
hash
(
distribution_strategy
)
)
key
=
(
domain
,
distribution_strategy
)
if
current_hash
not
in
self
.
power_indices_storage
:
self
.
power_indices_storage
[
current_hash
]
=
\
if
key
not
in
self
.
power_indices_storage
:
self
.
power_indices_storage
[
key
]
=
\
PowerIndices
(
domain
,
distribution_strategy
,
log
=
log
,
nbin
=
nbin
,
binbounds
=
binbounds
)
power_indices
=
self
.
power_indices_storage
[
current_hash
]
power_indices
=
self
.
power_indices_storage
[
key
]
power_index
=
power_indices
.
get_index_dict
(
log
=
log
,
nbin
=
nbin
,
binbounds
=
binbounds
)
...
...
nifty/spaces/space/space.py
View file @
c385b8bc
...
...
@@ -157,7 +157,6 @@ class Space(DomainObject):
"""
super
(
Space
,
self
).
__init__
()
self
.
_ignore_for_hash
+=
[
'_global_id'
]
@
abc
.
abstractproperty
def
harmonic
(
self
):
...
...
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