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
3
Merge Requests
3
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
3c7e76d6
Commit
3c7e76d6
authored
Jul 19, 2019
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve error handling; throw invalid_argument instead of runtime_error in some cases
parent
5483e02e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
pocketfft_hdronly.h
pocketfft_hdronly.h
+7
-7
pypocketfft.cc
pypocketfft.cc
+3
-4
No files found.
pocketfft_hdronly.h
View file @
3c7e76d6
...
...
@@ -474,8 +474,8 @@ struct util // hack to avoid duplicate symbols
shape_t
tmp
(
ndim
,
0
);
for
(
auto
ax
:
axes
)
{
if
(
ax
>=
ndim
)
throw
runtime_error
(
"bad axis number"
);
if
(
++
tmp
[
ax
]
>
1
)
throw
runtime_error
(
"axis specified repeatedly"
);
if
(
ax
>=
ndim
)
throw
invalid_argument
(
"bad axis number"
);
if
(
++
tmp
[
ax
]
>
1
)
throw
invalid_argument
(
"axis specified repeatedly"
);
}
}
...
...
@@ -484,7 +484,7 @@ struct util // hack to avoid duplicate symbols
size_t
axis
)
{
sanity_check
(
shape
,
stride_in
,
stride_out
,
inplace
);
if
(
axis
>=
shape
.
size
())
throw
runtime_error
(
"bad axis number"
);
if
(
axis
>=
shape
.
size
())
throw
invalid_argument
(
"bad axis number"
);
}
#ifdef POCKETFFT_OPENMP
...
...
@@ -1245,7 +1245,7 @@ template<bool fwd, typename T> void pass_all(T c[], T0 fct)
POCKETFFT_NOINLINE
cfftp
(
size_t
length_
)
:
length
(
length_
)
{
if
(
length
==
0
)
throw
runtime_error
(
"zero
length FFT requested"
);
if
(
length
==
0
)
throw
runtime_error
(
"zero
-
length FFT requested"
);
if
(
length
==
1
)
return
;
factorize
();
mem
.
resize
(
twsize
());
...
...
@@ -2085,7 +2085,7 @@ template<typename T> void radbg(size_t ido, size_t ip, size_t l1,
POCKETFFT_NOINLINE
rfftp
(
size_t
length_
)
:
length
(
length_
)
{
if
(
length
==
0
)
throw
runtime_error
(
"zero-
sized FFT
"
);
if
(
length
==
0
)
throw
runtime_error
(
"zero-
length FFT requested
"
);
if
(
length
==
1
)
return
;
factorize
();
mem
.
resize
(
twsize
());
...
...
@@ -3298,7 +3298,7 @@ template<typename T> void r2r_dct(const shape_t &shape,
const
stride_t
&
stride_in
,
const
stride_t
&
stride_out
,
const
shape_t
&
axes
,
int
type
,
const
T
*
data_in
,
T
*
data_out
,
T
fct
,
size_t
nthreads
=
1
)
{
if
((
type
<
1
)
||
(
type
>
4
))
throw
runtime_error
(
"invalid DCT type"
);
if
((
type
<
1
)
||
(
type
>
4
))
throw
invalid_argument
(
"invalid DCT type"
);
if
(
util
::
prod
(
shape
)
==
0
)
return
;
util
::
sanity_check
(
shape
,
stride_in
,
stride_out
,
data_in
==
data_out
,
axes
);
cndarr
<
T
>
ain
(
data_in
,
shape
,
stride_in
);
...
...
@@ -3319,7 +3319,7 @@ template<typename T> void r2r_dst(const shape_t &shape,
const
stride_t
&
stride_in
,
const
stride_t
&
stride_out
,
const
shape_t
&
axes
,
int
type
,
const
T
*
data_in
,
T
*
data_out
,
T
fct
,
size_t
nthreads
=
1
)
{
if
((
type
<
1
)
||
(
type
>
4
))
throw
runtime_error
(
"invalid DST type"
);
if
((
type
<
1
)
||
(
type
>
4
))
throw
invalid_argument
(
"invalid DST type"
);
if
(
util
::
prod
(
shape
)
==
0
)
return
;
util
::
sanity_check
(
shape
,
stride_in
,
stride_out
,
data_in
==
data_out
,
axes
);
cndarr
<
T
>
ain
(
data_in
,
shape
,
stride_in
);
...
...
pypocketfft.cc
View file @
3c7e76d6
...
...
@@ -250,7 +250,7 @@ template<typename T> py::array r2r_dct_internal(const py::array &in,
py
::
array
r2r_dct
(
const
py
::
array
&
in
,
int
type
,
const
py
::
object
&
axes_
,
int
inorm
,
py
::
object
&
out_
,
size_t
nthreads
)
{
if
((
type
<
1
)
||
(
type
>
4
))
throw
runtime_error
(
"invalid DCT type"
);
if
((
type
<
1
)
||
(
type
>
4
))
throw
invalid_argument
(
"invalid DCT type"
);
DISPATCH
(
in
,
f64
,
f32
,
flong
,
r2r_dct_internal
,
(
in
,
axes_
,
type
,
inorm
,
out_
,
nthreads
))
}
...
...
@@ -279,7 +279,7 @@ template<typename T> py::array r2r_dst_internal(const py::array &in,
py
::
array
r2r_dst
(
const
py
::
array
&
in
,
int
type
,
const
py
::
object
&
axes_
,
int
inorm
,
py
::
object
&
out_
,
size_t
nthreads
)
{
if
((
type
<
1
)
||
(
type
>
4
))
throw
runtime_error
(
"invalid DST type"
);
if
((
type
<
1
)
||
(
type
>
4
))
throw
invalid_argument
(
"invalid DST type"
);
DISPATCH
(
in
,
f64
,
f32
,
flong
,
r2r_dst_internal
,
(
in
,
axes_
,
type
,
inorm
,
out_
,
nthreads
))
}
...
...
@@ -293,7 +293,7 @@ template<typename T> py::array c2r_internal(const py::array &in,
shape_t
dims_in
(
copy_shape
(
in
)),
dims_out
=
dims_in
;
if
(
lastsize
==
0
)
lastsize
=
2
*
dims_in
[
axis
]
-
1
;
if
((
lastsize
/
2
)
+
1
!=
dims_in
[
axis
])
throw
runtime_error
(
"bad lastsize"
);
throw
invalid_argument
(
"bad lastsize"
);
dims_out
[
axis
]
=
lastsize
;
py
::
array
res
=
prepare_output
<
T
>
(
out_
,
dims_out
);
auto
s_in
=
copy_strides
(
in
);
...
...
@@ -355,7 +355,6 @@ template<typename T>py::array complex2hartley(const py::array &in,
py
::
gil_scoped_release
release
;
simple_iter
iin
(
atmp
);
rev_iter
iout
(
aout
,
axes
);
if
(
iin
.
remaining
()
!=
iout
.
remaining
())
throw
runtime_error
(
"oops"
);
while
(
iin
.
remaining
()
>
0
)
{
auto
v
=
atmp
[
iin
.
ofs
()];
...
...
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