Skip to content
GitLab
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
8d294b9b
Commit
8d294b9b
authored
Sep 20, 2017
by
Martin Reinecke
Browse files
performance tweaks
parent
afc5daa7
Pipeline
#18435
canceled with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty2go/operators/laplace_operator/laplace_operator.py
View file @
8d294b9b
...
...
@@ -20,7 +20,7 @@ import numpy as np
from
...field
import
Field
from
...spaces.power_space
import
PowerSpace
from
..endomorphic_operator
import
EndomorphicOperator
from
...
import
sqrt
,
DomainTuple
from
...
import
DomainTuple
from
...
import
nifty_utilities
as
utilities
...
...
nifty2go/random.py
View file @
8d294b9b
...
...
@@ -35,15 +35,13 @@ class Random(object):
def
normal
(
dtype
,
shape
,
mean
=
0.
,
std
=
1.
):
if
issubclass
(
dtype
,
(
complex
,
np
.
complexfloating
)):
x
=
np
.
empty
(
shape
,
dtype
=
dtype
)
x
.
real
=
np
.
random
.
normal
(
loc
=
0.
,
scale
=
np
.
sqrt
(
0.5
),
size
=
shape
)
x
.
imag
=
np
.
random
.
normal
(
loc
=
0.
,
scale
=
np
.
sqrt
(
0.5
),
size
=
shape
)
x
.
real
=
np
.
random
.
normal
(
loc
=
mean
.
real
,
scale
=
std
*
np
.
sqrt
(
0.5
),
size
=
shape
)
x
.
imag
=
np
.
random
.
normal
(
loc
=
mean
.
imag
,
scale
=
std
*
np
.
sqrt
(
0.5
),
size
=
shape
)
else
:
x
=
np
.
random
.
normal
(
loc
=
0.
,
scale
=
1.
,
size
=
shape
)
x
=
np
.
random
.
normal
(
loc
=
mean
,
scale
=
std
,
size
=
shape
)
x
=
x
.
astype
(
dtype
,
copy
=
False
)
if
std
!=
1.
:
x
*=
std
if
mean
!=
0.
:
x
+=
mean
return
x
@
staticmethod
...
...
nifty2go/spaces/lm_space/lm_space.py
View file @
8d294b9b
...
...
@@ -139,11 +139,19 @@ class LMSpace(Space):
def
get_unique_k_lengths
(
self
):
return
np
.
arange
(
self
.
lmax
+
1
,
dtype
=
np
.
float64
)
@
staticmethod
def
_kernel
(
x
,
sigma
):
res
=
x
+
1.
res
*=
x
res
*=
-
0.5
*
sigma
*
sigma
np
.
exp
(
res
,
out
=
res
)
return
res
def
get_fft_smoothing_kernel_function
(
self
,
sigma
):
# cf. "All-sky convolution for polarimetry experiments"
# by Challinor et al.
# http://arxiv.org/abs/astro-ph/0008228
return
lambda
x
:
np
.
exp
(
-
0.5
*
x
*
(
x
+
1
)
*
sigma
*
sigma
)
return
lambda
x
:
self
.
_kernel
(
x
,
sigma
)
@
property
def
lmax
(
self
):
...
...
nifty2go/spaces/rg_space/rg_space.py
View file @
8d294b9b
...
...
@@ -164,10 +164,17 @@ class RGSpace(Space):
# rightmost point correctly.
return
tmp
[
np
.
diff
(
np
.
r_
[
tmp
,
2
*
tmp
[
-
1
]])
>
tol
]
@
staticmethod
def
_kernel
(
x
,
sigma
):
tmp
=
x
*
x
tmp
*=
-
2.
*
np
.
pi
*
np
.
pi
*
sigma
*
sigma
np
.
exp
(
tmp
,
out
=
tmp
)
return
tmp
def
get_fft_smoothing_kernel_function
(
self
,
sigma
):
if
(
not
self
.
harmonic
):
raise
NotImplementedError
return
lambda
x
:
np
.
exp
(
-
2.
*
np
.
pi
*
np
.
pi
*
x
*
x
*
sigma
*
sigma
)
return
lambda
x
:
self
.
_kernel
(
x
,
sigma
)
def
get_default_codomain
(
self
):
distances
=
1.
/
(
np
.
array
(
self
.
shape
)
*
np
.
array
(
self
.
distances
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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