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
Martin Reinecke
pypocketfft
Commits
df6b820b
Commit
df6b820b
authored
Apr 16, 2019
by
Martin Reinecke
Browse files
bug fixes and better error messages
parent
6b670717
Changes
1
Hide whitespace changes
Inline
Side-by-side
pocketfft.cc
View file @
df6b820b
...
...
@@ -17,8 +17,6 @@ using namespace std;
namespace
{
class
OOM
{};
template
<
typename
T
>
struct
arr
{
private:
...
...
@@ -35,7 +33,7 @@ template<typename T> struct arr
arr
(
size_t
n
)
:
p
(
ralloc
(
n
)),
sz
(
n
)
{
if
((
!
p
)
&&
(
n
!=
0
))
throw
OOM
();
throw
bad_alloc
();
}
~
arr
()
{
dealloc
(
p
);
}
...
...
@@ -356,7 +354,7 @@ template<typename T0> class cfftp
void
add_factor
(
size_t
factor
)
{
if
(
nfct
>=
NFCT
)
throw
OOM
(
);
if
(
nfct
>=
NFCT
)
throw
runtime_error
(
"too many prime factors"
);
fct
[
nfct
++
].
fct
=
factor
;
}
...
...
@@ -923,7 +921,7 @@ template<typename T> NOINLINE void pass_all(T c[], T0 fact,
NOINLINE
cfftp
(
size_t
length_
)
:
length
(
length_
),
nfct
(
0
)
{
if
(
length
==
0
)
throw
42
;
if
(
length
==
0
)
throw
runtime_error
(
"zero length FFT requested"
)
;
if
(
length
==
1
)
return
;
factorize
();
mem
.
resize
(
twsize
());
...
...
@@ -1026,7 +1024,7 @@ template<typename T0> class pocketfft_c
NOINLINE
pocketfft_c
(
size_t
length
)
:
packplan
(
nullptr
),
blueplan
(
nullptr
),
len
(
length
)
{
if
(
length
==
0
)
throw
42
;
if
(
length
==
0
)
throw
runtime_error
(
"zero-length FFT requested"
)
;
if
((
length
<
50
)
||
(
largest_prime_factor
(
length
)
<=
sqrt
(
length
)))
{
packplan
=
unique_ptr
<
cfftp
<
T0
>>
(
new
cfftp
<
T0
>
(
length
));
...
...
@@ -1185,7 +1183,7 @@ namespace py = pybind11;
namespace
{
using
a_cd
=
py
::
array_t
<
complex
<
double
>>
;
using
a_cs
=
py
::
array_t
<
complex
<
double
>>
;
using
a_cs
=
py
::
array_t
<
complex
<
float
>>
;
py
::
array
execute
(
const
py
::
array
&
in
,
bool
fwd
)
{
...
...
@@ -1228,7 +1226,6 @@ PYBIND11_MODULE(pypocketfft, m)
m
.
def
(
"fftn"
,
&
fftn
);
m
.
def
(
"ifftn"
,
&
ifftn
);
// m.def("ifftn",&ifftn);
}
#else
...
...
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