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
4ff7b806
Commit
4ff7b806
authored
Jun 20, 2016
by
theos
Browse files
Fixed calc_dot in point_space and rg_space.
parent
6733e2dc
Changes
2
Show whitespace changes
Inline
Side-by-side
nifty_core.py
View file @
4ff7b806
...
...
@@ -1186,7 +1186,7 @@ class point_space(space):
result
=
result
**
(
1.
/
q
)
return
result
def
calc_dot
(
self
,
x
,
y
):
def
calc_dot
(
self
,
x
,
y
,
axes
=
None
):
"""
Computes the discrete inner product of two given arrays of field
values.
...
...
@@ -1203,11 +1203,10 @@ class point_space(space):
dot : scalar
Inner product of the two arrays.
"""
if
axes
is
None
:
result
=
x
.
vdot
(
y
)
if
np
.
isreal
(
result
):
result
=
np
.
asscalar
(
np
.
real
(
result
))
else
:
result
=
(
x
.
conjugate
()
*
y
).
sum
(
axis
=
axes
)
return
result
...
...
rg/nifty_rg.py
View file @
4ff7b806
...
...
@@ -771,38 +771,6 @@ class rg_space(point_space):
def
get_weight
(
self
,
power
=
1
):
return
np
.
prod
(
self
.
distances
)
**
power
def
calc_dot
(
self
,
x
,
y
):
"""
Computes the discrete inner product of two given arrays of field
values.
Parameters
----------
x : numpy.ndarray
First array
y : numpy.ndarray
Second array
Returns
-------
dot : scalar
Inner product of the two arrays.
"""
x
=
self
.
cast
(
x
)
y
=
self
.
cast
(
y
)
result
=
x
.
vdot
(
y
)
if
np
.
isreal
(
result
):
result
=
np
.
asscalar
(
np
.
real
(
result
))
if
self
.
paradict
[
'complexity'
]
!=
2
:
if
(
np
.
absolute
(
result
.
imag
)
>
self
.
epsilon
**
2
*
np
.
absolute
(
result
.
real
)):
about
.
warnings
.
cprint
(
"WARNING: Discarding considerable imaginary part."
)
result
=
np
.
asscalar
(
np
.
real
(
result
))
return
result
def
calc_transform
(
self
,
x
,
codomain
=
None
,
axes
=
None
,
**
kwargs
):
"""
Computes the transform of a given array of field values.
...
...
@@ -822,7 +790,6 @@ class rg_space(point_space):
Tx : numpy.ndarray
Transformed array
"""
x
=
self
.
cast
(
x
)
if
codomain
is
None
:
codomain
=
self
.
get_codomain
()
...
...
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