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
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
Martin Reinecke
pypocketfft
Commits
7890f60c
Commit
7890f60c
authored
Jun 18, 2019
by
Martin Reinecke
Browse files
merge master
parent
6ebf9cd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
pypocketfft.cc
View file @
7890f60c
...
...
@@ -121,9 +121,46 @@ py::array xfftn(const py::array &a, py::object axes, int inorm,
inplace
,
fwd
,
nthreads
))
}
py
::
array
fftn
(
const
py
::
array
&
a
,
py
::
object
axes
,
int
inorm
,
bool
inplace
,
size_t
nthreads
)
{
return
xfftn
(
a
,
axes
,
inorm
,
inplace
,
true
,
nthreads
);
}
template
<
typename
T
>
py
::
array
sym_rfftn_internal
(
const
py
::
array
&
in
,
py
::
object
axes_
,
int
inorm
,
size_t
nthreads
)
{
auto
axes
=
makeaxes
(
in
,
axes_
);
auto
dims
(
copy_shape
(
in
));
py
::
array
res
=
py
::
array_t
<
complex
<
T
>>
(
dims
);
auto
s_in
=
copy_strides
(
in
);
auto
s_out
=
copy_strides
(
res
);
auto
d_in
=
reinterpret_cast
<
const
T
*>
(
in
.
data
());
auto
d_out
=
reinterpret_cast
<
complex
<
T
>
*>
(
res
.
mutable_data
());
{
py
::
gil_scoped_release
release
;
T
fct
=
norm_fct
<
T
>
(
inorm
,
dims
,
axes
);
r2c
(
dims
,
s_in
,
s_out
,
axes
,
d_in
,
d_out
,
fct
,
nthreads
);
// now fill in second half
using
namespace
pocketfft
::
detail
;
ndarr
<
complex
<
T
>>
ares
(
res
.
mutable_data
(),
dims
,
s_out
);
rev_iter
<
complex
<
T
>>
iter
(
ares
,
axes
);
while
(
iter
.
remaining
()
>
0
)
{
auto
v
=
ares
.
get
(
iter
.
ofs
());
ares
.
set
(
iter
.
rev_ofs
(),
conj
(
v
));
iter
.
advance
();
}
}
return
res
;
}
py
::
array
fftn
(
const
py
::
array
&
a
,
py
::
object
axes
,
int
inorm
,
bool
inplace
,
size_t
nthreads
)
{
try
{
return
xfftn
(
a
,
axes
,
inorm
,
inplace
,
true
,
nthreads
);
}
catch
(
runtime_error
&
)
{
if
(
inplace
)
throw
runtime_error
(
"cannot do this operation in-place"
);
DISPATCH
(
a
,
f64
,
f32
,
flong
,
sym_rfftn_internal
,
(
a
,
axes
,
inorm
,
nthreads
))
}
}
py
::
array
ifftn
(
const
py
::
array
&
a
,
py
::
object
axes
,
int
inorm
,
bool
inplace
,
size_t
nthreads
)
...
...
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