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
f43066e4
Commit
f43066e4
authored
Jul 19, 2019
by
Martin Reinecke
Browse files
remove r2r_ prefixes from DCTs/DSTs
parent
3c7e76d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
pocketfft_hdronly.h
View file @
f43066e4
...
...
@@ -3294,7 +3294,7 @@ template<typename T> void c2c(const shape_t &shape, const stride_t &stride_in,
general_c
(
ain
,
aout
,
axes
,
forward
,
fct
,
nthreads
);
}
template
<
typename
T
>
void
r2r_
dct
(
const
shape_t
&
shape
,
template
<
typename
T
>
void
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
)
{
...
...
@@ -3315,7 +3315,7 @@ template<typename T> void r2r_dct(const shape_t &shape,
throw
runtime_error
(
"unsupported DCT type"
);
}
template
<
typename
T
>
void
r2r_
dst
(
const
shape_t
&
shape
,
template
<
typename
T
>
void
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
)
{
...
...
@@ -3442,8 +3442,8 @@ using detail::c2r;
using
detail
::
r2c
;
using
detail
::
r2r_fftpack
;
using
detail
::
r2r_separable_hartley
;
using
detail
::
r2r_
dct
;
using
detail
::
r2r_
dst
;
using
detail
::
dct
;
using
detail
::
dst
;
}
// namespace pocketfft
...
...
pypocketfft.cc
View file @
f43066e4
...
...
@@ -226,7 +226,7 @@ py::array r2r_fftpack(const py::array &in, const py::object &axes_,
real2hermitian
,
forward
,
inorm
,
out_
,
nthreads
))
}
template
<
typename
T
>
py
::
array
r2r_
dct_internal
(
const
py
::
array
&
in
,
template
<
typename
T
>
py
::
array
dct_internal
(
const
py
::
array
&
in
,
const
py
::
object
&
axes_
,
int
type
,
int
inorm
,
py
::
object
&
out_
,
size_t
nthreads
)
{
...
...
@@ -241,21 +241,21 @@ template<typename T> py::array r2r_dct_internal(const py::array &in,
py
::
gil_scoped_release
release
;
T
fct
=
(
type
==
1
)
?
norm_fct
<
T
>
(
inorm
,
dims
,
axes
,
2
,
-
1
)
:
norm_fct
<
T
>
(
inorm
,
dims
,
axes
,
2
);
pocketfft
::
r2r_
dct
(
dims
,
s_in
,
s_out
,
axes
,
type
,
d_in
,
d_out
,
fct
,
pocketfft
::
dct
(
dims
,
s_in
,
s_out
,
axes
,
type
,
d_in
,
d_out
,
fct
,
nthreads
);
}
return
res
;
}
py
::
array
r2r_
dct
(
const
py
::
array
&
in
,
int
type
,
const
py
::
object
&
axes_
,
py
::
array
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
invalid_argument
(
"invalid DCT type"
);
DISPATCH
(
in
,
f64
,
f32
,
flong
,
r2r_
dct_internal
,
(
in
,
axes_
,
type
,
inorm
,
DISPATCH
(
in
,
f64
,
f32
,
flong
,
dct_internal
,
(
in
,
axes_
,
type
,
inorm
,
out_
,
nthreads
))
}
template
<
typename
T
>
py
::
array
r2r_
dst_internal
(
const
py
::
array
&
in
,
template
<
typename
T
>
py
::
array
dst_internal
(
const
py
::
array
&
in
,
const
py
::
object
&
axes_
,
int
type
,
int
inorm
,
py
::
object
&
out_
,
size_t
nthreads
)
{
...
...
@@ -270,17 +270,17 @@ template<typename T> py::array r2r_dst_internal(const py::array &in,
py
::
gil_scoped_release
release
;
T
fct
=
(
type
==
1
)
?
norm_fct
<
T
>
(
inorm
,
dims
,
axes
,
2
,
1
)
:
norm_fct
<
T
>
(
inorm
,
dims
,
axes
,
2
);
pocketfft
::
r2r_
dst
(
dims
,
s_in
,
s_out
,
axes
,
type
,
d_in
,
d_out
,
fct
,
pocketfft
::
dst
(
dims
,
s_in
,
s_out
,
axes
,
type
,
d_in
,
d_out
,
fct
,
nthreads
);
}
return
res
;
}
py
::
array
r2r_
dst
(
const
py
::
array
&
in
,
int
type
,
const
py
::
object
&
axes_
,
py
::
array
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
invalid_argument
(
"invalid DST type"
);
DISPATCH
(
in
,
f64
,
f32
,
flong
,
r2r_
dst_internal
,
(
in
,
axes_
,
type
,
inorm
,
DISPATCH
(
in
,
f64
,
f32
,
flong
,
dst_internal
,
(
in
,
axes_
,
type
,
inorm
,
out_
,
nthreads
))
}
...
...
@@ -600,8 +600,8 @@ PYBIND11_MODULE(pypocketfft, m)
"axes"
_a
=
None
,
"inorm"
_a
=
0
,
"out"
_a
=
None
,
"nthreads"
_a
=
1
);
m
.
def
(
"genuine_hartley"
,
genuine_hartley
,
genuine_hartley_DS
,
"a"
_a
,
"axes"
_a
=
None
,
"inorm"
_a
=
0
,
"out"
_a
=
None
,
"nthreads"
_a
=
1
);
m
.
def
(
"
r2r_
dct"
,
r2r_
dct
,
/*
r2r_
dct_DS,*/
"a"
_a
,
"type"
_a
,
"axes"
_a
=
None
,
m
.
def
(
"dct"
,
dct
,
/*dct_DS,*/
"a"
_a
,
"type"
_a
,
"axes"
_a
=
None
,
"inorm"
_a
=
0
,
"out"
_a
=
None
,
"nthreads"
_a
=
1
);
m
.
def
(
"
r2r_
dst"
,
r2r_
dst
,
/*
r2r_
dst_DS,*/
"a"
_a
,
"type"
_a
,
"axes"
_a
=
None
,
m
.
def
(
"dst"
,
dst
,
/*dst_DS,*/
"a"
_a
,
"type"
_a
,
"axes"
_a
=
None
,
"inorm"
_a
=
0
,
"out"
_a
=
None
,
"nthreads"
_a
=
1
);
}
test.py
View file @
f43066e4
...
...
@@ -215,12 +215,12 @@ def testdcst1D(len, inorm, type):
itp
=
(
0
,
1
,
3
,
2
,
4
)
itype
=
itp
[
type
]
if
type
!=
1
or
len
>
1
:
_assert_close
(
a
,
pypocketfft
.
r2r_
dct
(
pypocketfft
.
r2r_
dct
(
c
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
2e-18
)
_assert_close
(
a
,
pypocketfft
.
r2r_
dct
(
pypocketfft
.
r2r_
dct
(
a
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
1.5e-15
)
_assert_close
(
b
,
pypocketfft
.
r2r_
dct
(
pypocketfft
.
r2r_
dct
(
b
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
6e-7
)
_assert_close
(
a
,
pypocketfft
.
r2r_
dst
(
pypocketfft
.
r2r_
dst
(
c
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
2e-18
)
_assert_close
(
a
,
pypocketfft
.
r2r_
dst
(
pypocketfft
.
r2r_
dst
(
a
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
1.5e-15
)
_assert_close
(
b
,
pypocketfft
.
r2r_
dst
(
pypocketfft
.
r2r_
dst
(
b
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
6e-7
)
_assert_close
(
a
,
pypocketfft
.
dct
(
pypocketfft
.
dct
(
c
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
2e-18
)
_assert_close
(
a
,
pypocketfft
.
dct
(
pypocketfft
.
dct
(
a
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
1.5e-15
)
_assert_close
(
b
,
pypocketfft
.
dct
(
pypocketfft
.
dct
(
b
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
6e-7
)
_assert_close
(
a
,
pypocketfft
.
dst
(
pypocketfft
.
dst
(
c
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
2e-18
)
_assert_close
(
a
,
pypocketfft
.
dst
(
pypocketfft
.
dst
(
a
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
1.5e-15
)
_assert_close
(
b
,
pypocketfft
.
dst
(
pypocketfft
.
dst
(
b
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
6e-7
)
# TEMPORARY: separate test for DCT/DST IV, since they are less accurate
...
...
@@ -234,9 +234,9 @@ def testdcst1D4(len, inorm, type):
itp
=
(
0
,
1
,
3
,
2
,
4
)
itype
=
itp
[
type
]
if
type
!=
1
or
len
>
1
:
_assert_close
(
a
,
pypocketfft
.
r2r_
dct
(
pypocketfft
.
r2r_
dct
(
c
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
2e-16
)
_assert_close
(
a
,
pypocketfft
.
r2r_
dct
(
pypocketfft
.
r2r_
dct
(
a
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
1.5e-13
)
_assert_close
(
b
,
pypocketfft
.
r2r_
dct
(
pypocketfft
.
r2r_
dct
(
b
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
6e-5
)
_assert_close
(
a
,
pypocketfft
.
r2r_
dst
(
pypocketfft
.
r2r_
dst
(
c
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
2e-16
)
_assert_close
(
a
,
pypocketfft
.
r2r_
dst
(
pypocketfft
.
r2r_
dst
(
a
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
1.5e-13
)
_assert_close
(
b
,
pypocketfft
.
r2r_
dst
(
pypocketfft
.
r2r_
dst
(
b
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
6e-5
)
_assert_close
(
a
,
pypocketfft
.
dct
(
pypocketfft
.
dct
(
c
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
2e-16
)
_assert_close
(
a
,
pypocketfft
.
dct
(
pypocketfft
.
dct
(
a
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
1.5e-13
)
_assert_close
(
b
,
pypocketfft
.
dct
(
pypocketfft
.
dct
(
b
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
6e-5
)
_assert_close
(
a
,
pypocketfft
.
dst
(
pypocketfft
.
dst
(
c
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
2e-16
)
_assert_close
(
a
,
pypocketfft
.
dst
(
pypocketfft
.
dst
(
a
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
1.5e-13
)
_assert_close
(
b
,
pypocketfft
.
dst
(
pypocketfft
.
dst
(
b
,
inorm
=
inorm
,
type
=
type
),
inorm
=
2
-
inorm
,
type
=
itype
),
6e-5
)
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