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
6146b0ce
Commit
6146b0ce
authored
Dec 02, 2016
by
Theo Steininger
Browse files
Improved the lm_transformation_factory.pyx
parent
00823a86
Changes
1
Show whitespace changes
Inline
Side-by-side
nifty/operators/fft_operator/transformations/lm_transformation_factory.pyx
View file @
6146b0ce
import
numpy
as
np
import
numpy
as
np
cimport
numpy
as
np
cimport
numpy
as
np
...
@@ -30,12 +31,12 @@ cpdef np.ndarray[np.float32_t, ndim=1] _buildIdx_f(np.ndarray[np
...
@@ -30,12 +31,12 @@ cpdef np.ndarray[np.float32_t, ndim=1] _buildIdx_f(np.ndarray[np
cpdef
np
.
ndarray
[
np
.
float32_t
,
ndim
=
1
]
_realify_f
(
np
.
ndarray
[
np
.
complex64_t
,
ndim
=
1
]
nr
,
np
.
int_t
lmax
):
cpdef
np
.
ndarray
[
np
.
float32_t
,
ndim
=
1
]
_realify_f
(
np
.
ndarray
[
np
.
complex64_t
,
ndim
=
1
]
nr
,
np
.
int_t
lmax
):
cdef
np
.
ndarray
resi
=
np
.
zeros
([
len
(
nr
)],
dtype
=
np
.
float32
)
cdef
np
.
ndarray
resi
=
np
.
zeros
([
len
(
nr
)],
dtype
=
np
.
float32
)
resi
[
0
:
lmax
+
1
]
=
np
.
real
(
nr
[
0
:
lmax
+
1
]
)
resi
[
0
:
lmax
+
1
]
=
nr
[
0
:
lmax
+
1
]
.
real
for
i
in
xrange
(
lmax
+
1
,
len
(
nr
),
2
):
for
i
in
xrange
(
lmax
+
1
,
len
(
nr
),
2
):
mi
=
int
(
np
.
ceil
(((
2
*
lmax
+
1
)
-
np
.
sqrt
((
2
*
lmax
+
1
)
*
(
2
*
lmax
+
1
)
-
4
*
(
i
-
lmax
)
+
1
))
/
2
))
mi
=
int
(
np
.
ceil
(((
2
*
lmax
+
1
)
-
np
.
sqrt
((
2
*
lmax
+
1
)
*
(
2
*
lmax
+
1
)
-
4
*
(
i
-
lmax
)
+
1
))
/
2
))
resi
[
i
]
=
np
.
sqrt
(
2
)
*
np
.
real
(
nr
[
i
])
*
(
-
1
)
**
(
mi
*
mi
)
resi
[
i
]
=
np
.
sqrt
(
2
)
*
(
nr
[
i
])
.
real
*
(
-
1
)
**
(
mi
*
mi
)
resi
[
i
+
1
]
=
np
.
sqrt
(
2
)
*
np
.
imag
(
nr
[
i
])
*
(
-
1
)
**
(
mi
*
mi
)
resi
[
i
+
1
]
=
np
.
sqrt
(
2
)
*
(
nr
[
i
])
.
imag
*
(
-
1
)
**
(
mi
*
mi
)
return
resi
return
resi
cpdef
np
.
ndarray
[
np
.
float64_t
,
ndim
=
1
]
_buildIdx
(
np
.
ndarray
[
np
.
complex128_t
,
cpdef
np
.
ndarray
[
np
.
float64_t
,
ndim
=
1
]
_buildIdx
(
np
.
ndarray
[
np
.
complex128_t
,
...
@@ -55,12 +56,12 @@ cpdef np.ndarray[np.float64_t, ndim=1] _buildIdx(np.ndarray[np.complex128_t,
...
@@ -55,12 +56,12 @@ cpdef np.ndarray[np.float64_t, ndim=1] _buildIdx(np.ndarray[np.complex128_t,
cpdef
np
.
ndarray
[
np
.
float64_t
,
ndim
=
1
]
_realify
(
np
.
ndarray
[
np
.
complex128_t
,
ndim
=
1
]
nr
,
np
.
int_t
lmax
):
cpdef
np
.
ndarray
[
np
.
float64_t
,
ndim
=
1
]
_realify
(
np
.
ndarray
[
np
.
complex128_t
,
ndim
=
1
]
nr
,
np
.
int_t
lmax
):
cdef
np
.
ndarray
resi
=
np
.
zeros
([
len
(
nr
)],
dtype
=
np
.
float64
)
cdef
np
.
ndarray
resi
=
np
.
zeros
([
len
(
nr
)],
dtype
=
np
.
float64
)
resi
[
0
:
lmax
+
1
]
=
np
.
real
(
nr
[
0
:
lmax
+
1
])
resi
[
0
:
lmax
+
1
]
=
(
nr
[
0
:
lmax
+
1
])
.
real
for
i
in
xrange
(
lmax
+
1
,
len
(
nr
),
2
):
for
i
in
xrange
(
lmax
+
1
,
len
(
nr
),
2
):
mi
=
int
(
np
.
ceil
(((
2
*
lmax
+
1
)
-
np
.
sqrt
((
2
*
lmax
+
1
)
*
(
2
*
lmax
+
1
)
-
4
*
(
i
-
lmax
)
+
1
))
/
2
))
mi
=
int
(
np
.
ceil
(((
2
*
lmax
+
1
)
-
np
.
sqrt
((
2
*
lmax
+
1
)
*
(
2
*
lmax
+
1
)
-
4
*
(
i
-
lmax
)
+
1
))
/
2
))
resi
[
i
]
=
np
.
sqrt
(
2
)
*
np
.
real
(
nr
[
i
])
*
(
-
1
)
**
(
mi
*
mi
)
resi
[
i
]
=
np
.
sqrt
(
2
)
*
(
nr
[
i
])
.
real
*
(
-
1
)
**
(
mi
*
mi
)
resi
[
i
+
1
]
=
np
.
sqrt
(
2
)
*
np
.
imag
(
nr
[
i
])
*
(
-
1
)
**
(
mi
*
mi
)
resi
[
i
+
1
]
=
np
.
sqrt
(
2
)
*
(
nr
[
i
])
.
imag
*
(
-
1
)
**
(
mi
*
mi
)
return
resi
return
resi
cpdef
np
.
ndarray
[
np
.
complex64_t
,
ndim
=
1
]
_buildLm_f
(
np
.
ndarray
[
np
.
float32_t
,
cpdef
np
.
ndarray
[
np
.
complex64_t
,
ndim
=
1
]
_buildLm_f
(
np
.
ndarray
[
np
.
float32_t
,
...
@@ -79,7 +80,7 @@ ndim=1] nr, np.int_t lmax):
...
@@ -79,7 +80,7 @@ ndim=1] nr, np.int_t lmax):
cpdef
np
.
ndarray
[
np
.
complex64_t
,
ndim
=
1
]
_inverseRealify_f
(
np
.
ndarray
[
np
.
float32_t
,
ndim
=
1
]
nr
,
np
.
int_t
lmax
):
cpdef
np
.
ndarray
[
np
.
complex64_t
,
ndim
=
1
]
_inverseRealify_f
(
np
.
ndarray
[
np
.
float32_t
,
ndim
=
1
]
nr
,
np
.
int_t
lmax
):
cdef
np
.
ndarray
resi
=
np
.
zeros
([
len
(
nr
)],
dtype
=
np
.
complex64
)
cdef
np
.
ndarray
resi
=
np
.
zeros
([
len
(
nr
)],
dtype
=
np
.
complex64
)
resi
[
0
:
lmax
+
1
]
=
np
.
real
(
nr
[
0
:
lmax
+
1
])
resi
[
0
:
lmax
+
1
]
=
(
nr
[
0
:
lmax
+
1
])
.
real
for
i
in
xrange
(
lmax
+
1
,
len
(
nr
),
2
):
for
i
in
xrange
(
lmax
+
1
,
len
(
nr
),
2
):
mi
=
int
(
np
.
ceil
(((
2
*
lmax
+
1
)
-
np
.
sqrt
((
2
*
lmax
+
1
)
*
(
2
*
lmax
+
1
)
-
4
*
(
i
-
lmax
)
+
1
))
/
2
))
mi
=
int
(
np
.
ceil
(((
2
*
lmax
+
1
)
-
np
.
sqrt
((
2
*
lmax
+
1
)
*
(
2
*
lmax
+
1
)
-
4
*
(
i
-
lmax
)
+
1
))
/
2
))
...
@@ -104,7 +105,7 @@ ndim=1] nr, np.int_t lmax):
...
@@ -104,7 +105,7 @@ ndim=1] nr, np.int_t lmax):
cpdef
np
.
ndarray
[
np
.
complex128_t
,
ndim
=
1
]
_inverseRealify
(
np
.
ndarray
[
np
.
float64_t
,
ndim
=
1
]
nr
,
np
.
int_t
lmax
):
cpdef
np
.
ndarray
[
np
.
complex128_t
,
ndim
=
1
]
_inverseRealify
(
np
.
ndarray
[
np
.
float64_t
,
ndim
=
1
]
nr
,
np
.
int_t
lmax
):
cdef
np
.
ndarray
resi
=
np
.
zeros
([
len
(
nr
)],
dtype
=
np
.
complex128
)
cdef
np
.
ndarray
resi
=
np
.
zeros
([
len
(
nr
)],
dtype
=
np
.
complex128
)
resi
[
0
:
lmax
+
1
]
=
np
.
real
(
nr
[
0
:
lmax
+
1
])
resi
[
0
:
lmax
+
1
]
=
(
nr
[
0
:
lmax
+
1
])
.
real
for
i
in
xrange
(
lmax
+
1
,
len
(
nr
),
2
):
for
i
in
xrange
(
lmax
+
1
,
len
(
nr
),
2
):
mi
=
int
(
np
.
ceil
(((
2
*
lmax
+
1
)
-
np
.
sqrt
((
2
*
lmax
+
1
)
*
(
2
*
lmax
+
1
)
-
4
*
(
i
-
lmax
)
+
1
))
/
2
))
mi
=
int
(
np
.
ceil
(((
2
*
lmax
+
1
)
-
np
.
sqrt
((
2
*
lmax
+
1
)
*
(
2
*
lmax
+
1
)
-
4
*
(
i
-
lmax
)
+
1
))
/
2
))
...
...
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