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
1a1f6477
Commit
1a1f6477
authored
Sep 27, 2019
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more tweaks
parent
b87f51f5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
16 deletions
+25
-16
pocketfft_hdronly.h
pocketfft_hdronly.h
+18
-13
stress.py
stress.py
+7
-3
No files found.
pocketfft_hdronly.h
View file @
1a1f6477
...
...
@@ -270,7 +270,7 @@ template<typename T> class sincos_2pibyn
{
private:
using
Thigh
=
typename
conditional
<
(
sizeof
(
T
)
>
sizeof
(
double
)),
T
,
double
>::
type
;
size_t
mask
,
shift
;
size_t
N
,
mask
,
shift
;
arr
<
cmplx
<
Thigh
>>
v1
,
v2
;
static
cmplx
<
Thigh
>
calc
(
size_t
x
,
size_t
n
,
Thigh
ang
)
...
...
@@ -309,27 +309,35 @@ template<typename T> class sincos_2pibyn
public:
POCKETFFT_NOINLINE
sincos_2pibyn
(
size_t
n
)
:
N
(
n
)
{
constexpr
auto
pi
=
3.141592653589793238462643383279502884197
L
;
Thigh
ang
=
Thigh
(
0.25
L
*
pi
/
n
);
size_t
nval
=
(
n
+
2
)
/
2
;
shift
=
1
;
while
((
size_t
(
1
)
<<
shift
)
*
(
size_t
(
1
)
<<
shift
)
<
n
)
++
shift
;
while
((
size_t
(
1
)
<<
shift
)
*
(
size_t
(
1
)
<<
shift
)
<
n
val
)
++
shift
;
mask
=
(
size_t
(
1
)
<<
shift
)
-
1
;
v1
.
resize
(
mask
+
1
);
v1
[
0
].
Set
(
Thigh
(
1
),
Thigh
(
0
));
for
(
size_t
i
=
1
;
i
<
v1
.
size
();
++
i
)
v1
[
i
]
=
calc
(
i
,
n
,
ang
);
v2
.
resize
((
n
+
mask
)
/
(
mask
+
1
));
v2
.
resize
((
n
val
+
mask
)
/
(
mask
+
1
));
v2
[
0
].
Set
(
Thigh
(
1
),
Thigh
(
0
));
for
(
size_t
i
=
1
;
i
<
v2
.
size
();
++
i
)
v2
[
i
]
=
calc
(
i
*
(
mask
+
1
),
n
,
ang
);
}
cmplx
<
T
>
operator
[](
size_t
idx
)
const
{
if
(
2
*
idx
<=
N
)
{
auto
x1
=
v1
[
idx
&
mask
],
x2
=
v2
[
idx
>>
shift
];
return
cmplx
<
T
>
(
T
(
x1
.
r
*
x2
.
r
-
x1
.
i
*
x2
.
i
),
T
(
x1
.
r
*
x2
.
i
+
x1
.
i
*
x2
.
r
));
}
idx
=
N
-
idx
;
auto
x1
=
v1
[
idx
&
mask
],
x2
=
v2
[
idx
>>
shift
];
return
cmplx
<
T
>
(
T
(
x1
.
r
*
x2
.
r
-
x1
.
i
*
x2
.
i
),
-
T
(
x1
.
r
*
x2
.
i
+
x1
.
i
*
x2
.
r
));
}
};
struct
util
// hack to avoid duplicate symbols
...
...
@@ -2484,10 +2492,9 @@ template<typename T0> class T_dcst23
POCKETFFT_NOINLINE
T_dcst23
(
size_t
length
)
:
fftplan
(
length
),
twiddle
(
length
)
{
constexpr
auto
pi
=
T0
(
3.141592653589793238462643383279502884197
L
);
const
auto
oo2n
=
pi
*
T0
(
0.5
)
/
T0
(
length
);
sincos_2pibyn
<
T0
>
tw
(
4
*
length
);
for
(
size_t
i
=
0
;
i
<
length
;
++
i
)
twiddle
[
i
]
=
cos
(
oo2n
*
T0
(
i
+
1
))
;
twiddle
[
i
]
=
tw
[
i
+
1
].
r
;
}
template
<
typename
T
>
POCKETFFT_NOINLINE
void
exec
(
T
c
[],
T0
fct
,
bool
ortho
,
...
...
@@ -2560,13 +2567,11 @@ template<typename T0> class T_dcst4
rfft
((
N
&
1
)
?
new
pocketfft_r
<
T0
>
(
N
)
:
nullptr
),
C2
((
N
&
1
)
?
0
:
N
/
2
)
{
const
auto
oon
=
-
T0
(
1.
)
/
T0
(
N
);
if
((
N
&
1
)
==
0
)
for
(
size_t
i
=
0
;
i
<
N
/
2
;
++
i
)
{
constexpr
auto
pi
=
T0
(
3.141592653589793238462643383279502884197
L
);
T0
ang
=
pi
*
oon
*
(
T0
(
i
)
+
T0
(
0.125
));
C2
[
i
]
.
Set
(
cos
(
ang
),
sin
(
ang
))
;
sincos_2pibyn
<
T0
>
tw
(
8
*
N
);
for
(
size_t
i
=
0
;
i
<
N
/
2
;
++
i
)
C2
[
i
]
=
tw
[
8
*
N
-
8
*
i
-
1
]
;
}
}
...
...
stress.py
View file @
1a1f6477
...
...
@@ -61,12 +61,12 @@ def test(err):
b
=
fftn
(
ifftn
(
a
.
real
,
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
inorm
=
2
,
nthreads
=
nthreads
)
err
=
update_err
(
err
,
"cmax"
,
_l2error
(
a
.
real
,
b
,
axes
))
b
=
irfftn
(
rfftn
(
a
.
real
,
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
inorm
=
2
,
lastsize
=
lastsize
,
nthreads
=
nthreads
)
err
=
update_err
(
err
,
"rmax"
,
_l2error
(
a
.
real
,
b
,
axes
))
b
=
ifftn
(
fftn
(
a
.
astype
(
np
.
complex64
),
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
inorm
=
2
,
nthreads
=
nthreads
)
err
=
update_err
(
err
,
"cmaxf"
,
_l2error
(
a
.
astype
(
np
.
complex64
),
b
,
axes
))
b
=
irfftn
(
rfftn
(
a
.
real
,
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
inorm
=
2
,
lastsize
=
lastsize
,
nthreads
=
nthreads
)
err
=
update_err
(
err
,
"rmax"
,
_l2error
(
a
.
real
,
b
,
axes
))
b
=
irfftn
(
rfftn
(
a
.
real
.
astype
(
np
.
float32
),
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
inorm
=
2
,
lastsize
=
lastsize
,
nthreads
=
nthreads
)
err
=
update_err
(
err
,
"rmaxf"
,
_l2error
(
a
.
real
.
astype
(
np
.
float32
),
b
,
axes
))
...
...
@@ -113,6 +113,10 @@ def test(err):
pypocketfft
.
dct
(
a_32
.
real
,
axes
=
axes
,
nthreads
=
nthreads
,
type
=
4
),
axes
=
axes
,
type
=
4
,
nthreads
=
nthreads
,
inorm
=
2
)
err
=
update_err
(
err
,
"c4maxf"
,
_l2error
(
a_32
.
real
,
b
,
axes
))
b
=
pypocketfft
.
dst
(
pypocketfft
.
dst
(
a
.
real
,
axes
=
axes
,
nthreads
=
nthreads
,
type
=
1
),
axes
=
axes
,
type
=
1
,
nthreads
=
nthreads
,
inorm
=
2
)
err
=
update_err
(
err
,
"s1max"
,
_l2error
(
a
.
real
,
b
,
axes
))
b
=
pypocketfft
.
dst
(
pypocketfft
.
dst
(
a_32
.
real
,
axes
=
axes
,
nthreads
=
nthreads
,
type
=
1
),
axes
=
axes
,
type
=
1
,
nthreads
=
nthreads
,
inorm
=
2
)
...
...
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