Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pypocketfft
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Reinecke
pypocketfft
Commits
e4576e41
Commit
e4576e41
authored
Jan 07, 2020
by
Peter Bell
Committed by
Martin Reinecke
Jan 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export good_size using raw C-API
parent
8961a318
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
pypocketfft.cc
pypocketfft.cc
+25
-3
No files found.
pypocketfft.cc
View file @
e4576e41
...
...
@@ -372,10 +372,29 @@ py::array genuine_hartley(const py::array &in, const py::object &axes_,
out_
,
nthreads
))
}
size_t
good_size
(
size_t
n
,
bool
real
)
// Export good_size in raw C-API to reduce overhead (~4x faster)
PyObject
*
good_size
(
PyObject
*
self
,
PyObject
*
args
)
{
Py_ssize_t
n_
=
-
1
;
int
real
=
false
;
if
(
!
PyArg_ParseTuple
(
args
,
"n|p:good_size"
,
&
n_
,
&
real
))
return
nullptr
;
if
(
n_
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"Target length must be positive"
);
return
nullptr
;
}
if
((
n_
-
1
)
>
static_cast
<
Py_ssize_t
>
(
std
::
numeric_limits
<
size_t
>::
max
()
/
11
))
{
PyErr_Format
(
PyExc_ValueError
,
"Target length is too large to perform an FFT: %zi"
,
n_
);
return
nullptr
;
}
const
auto
n
=
static_cast
<
size_t
>
(
n_
);
using
namespace
pocketfft
::
detail
;
return
real
?
util
::
good_size_real
(
n
)
:
util
::
good_size_cmplx
(
n
);
return
PyLong_FromSize_t
(
real
?
util
::
good_size_real
(
n
)
:
util
::
good_size_cmplx
(
n
));
}
const
char
*
pypocketfft_DS
=
R"""(Fast Fourier and Hartley transforms.
...
...
@@ -702,5 +721,8 @@ PYBIND11_MODULE(pypocketfft, m)
"out"
_a
=
None
,
"nthreads"
_a
=
1
);
m
.
def
(
"dst"
,
dst
,
dst_DS
,
"a"
_a
,
"type"
_a
,
"axes"
_a
=
None
,
"inorm"
_a
=
0
,
"out"
_a
=
None
,
"nthreads"
_a
=
1
);
m
.
def
(
"good_size"
,
good_size
,
good_size_DS
,
"n"
_a
,
"real"
_a
=
false
);
static
PyMethodDef
good_size_meth
[]
=
{{
"good_size"
,
good_size
,
METH_VARARGS
,
good_size_DS
},
{
0
}};
PyModule_AddFunctions
(
m
.
ptr
(),
good_size_meth
);
}
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