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
6cb5f23d
Commit
6cb5f23d
authored
May 12, 2019
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return early for zero-sized arrays
parent
8ac40bf5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
11 deletions
+48
-11
pocketfft_hdronly.h
pocketfft_hdronly.h
+48
-11
No files found.
pocketfft_hdronly.h
View file @
6cb5f23d
/*
* This file is part of pocketfft.
* Licensed under a 3-clause BSD style license - see LICENSE.md
*/
/*
* Main implementation file.
*
* Copyright (C) 2004-2019 Max-Planck-Society
* \author Martin Reinecke
*/
This file is part of pocketfft.
Copyright (C) 2010-2019 Max-Planck-Society
Author: Martin Reinecke
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef POCKETFFT_HDRONLY_H
#define POCKETFFT_HDRONLY_H
#ifndef __cplusplus
#error This file is C++ and requires a C++ compiler
#endif
#if __cplusplus < 201103L
#error This file requires at least C++11 support
#endif
#include <cmath>
#include <cstring>
#include <cstdlib>
...
...
@@ -2409,6 +2437,7 @@ template<typename T> void c2c(const shape_t &shape, const stride_t &stride_in,
const
std
::
complex
<
T
>
*
data_in
,
std
::
complex
<
T
>
*
data_out
,
T
fct
)
{
using
namespace
detail
;
if
(
util
::
prod
(
shape
)
==
0
)
return
;
util
::
sanity_check
(
shape
,
stride_in
,
stride_out
,
data_in
==
data_out
,
axes
);
ndarr
<
cmplx
<
T
>>
ain
(
data_in
,
shape
,
stride_in
),
aout
(
data_out
,
shape
,
stride_out
);
...
...
@@ -2420,9 +2449,12 @@ template<typename T> void r2c(const shape_t &shape_in,
const
T
*
data_in
,
std
::
complex
<
T
>
*
data_out
,
T
fct
)
{
using
namespace
detail
;
if
(
util
::
prod
(
shape_in
)
==
0
)
return
;
util
::
sanity_check
(
shape_in
,
stride_in
,
stride_out
,
false
,
axis
);
ndarr
<
T
>
ain
(
data_in
,
shape_in
,
stride_in
);
ndarr
<
cmplx
<
T
>>
aout
(
data_out
,
shape_in
,
stride_out
);
// FIXME
shape_t
shape_out
(
shape_in
);
shape_out
[
axis
]
=
shape_in
[
axis
]
/
2
+
1
;
ndarr
<
cmplx
<
T
>>
aout
(
data_out
,
shape_out
,
stride_out
);
general_r2c
(
ain
,
aout
,
axis
,
fct
);
}
...
...
@@ -2431,6 +2463,7 @@ template<typename T> void r2c(const shape_t &shape_in,
const
T
*
data_in
,
std
::
complex
<
T
>
*
data_out
,
T
fct
)
{
using
namespace
detail
;
if
(
util
::
prod
(
shape_in
)
==
0
)
return
;
util
::
sanity_check
(
shape_in
,
stride_in
,
stride_out
,
false
,
axes
);
r2c
(
shape_in
,
stride_in
,
stride_out
,
axes
.
back
(),
data_in
,
data_out
,
fct
);
if
(
axes
.
size
()
==
1
)
return
;
...
...
@@ -2447,6 +2480,7 @@ template<typename T> void c2r(const shape_t &shape_out,
const
std
::
complex
<
T
>
*
data_in
,
T
*
data_out
,
T
fct
)
{
using
namespace
detail
;
if
(
util
::
prod
(
shape_out
)
==
0
)
return
;
util
::
sanity_check
(
shape_out
,
stride_in
,
stride_out
,
false
,
axis
);
shape_t
shape_in
(
shape_out
);
shape_in
[
axis
]
=
shape_out
[
axis
]
/
2
+
1
;
...
...
@@ -2460,6 +2494,7 @@ template<typename T> void c2r(const shape_t &shape_out,
const
std
::
complex
<
T
>
*
data_in
,
T
*
data_out
,
T
fct
)
{
using
namespace
detail
;
if
(
util
::
prod
(
shape_out
)
==
0
)
return
;
if
(
axes
.
size
()
==
1
)
{
c2r
(
shape_out
,
stride_in
,
stride_out
,
axes
[
0
],
data_in
,
data_out
,
fct
);
...
...
@@ -2486,6 +2521,7 @@ template<typename T> void r2r_fftpack(const shape_t &shape,
bool
forward
,
const
T
*
data_in
,
T
*
data_out
,
T
fct
)
{
using
namespace
detail
;
if
(
util
::
prod
(
shape
)
==
0
)
return
;
util
::
sanity_check
(
shape
,
stride_in
,
stride_out
,
data_in
==
data_out
,
axis
);
ndarr
<
T
>
ain
(
data_in
,
shape
,
stride_in
),
aout
(
data_out
,
shape
,
stride_out
);
general_r
(
ain
,
aout
,
axis
,
forward
,
fct
);
...
...
@@ -2496,6 +2532,7 @@ template<typename T> void r2r_hartley(const shape_t &shape,
const
T
*
data_in
,
T
*
data_out
,
T
fct
)
{
using
namespace
detail
;
if
(
util
::
prod
(
shape
)
==
0
)
return
;
util
::
sanity_check
(
shape
,
stride_in
,
stride_out
,
data_in
==
data_out
,
axes
);
ndarr
<
T
>
ain
(
data_in
,
shape
,
stride_in
),
aout
(
data_out
,
shape
,
stride_out
);
general_hartley
(
ain
,
aout
,
axes
,
fct
);
...
...
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