Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91956858
test_fftw_r2c.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 16, 03:01
Size
3 KB
Mime Type
text/x-c
Expires
Mon, Nov 18, 03:01 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22353824
Attached To
rMSPPROTO µSpectre prototype implementation
test_fftw_r2c.cc
View Options
/**
* file test_fftw_r2c.cc
*
* @author Till Junge <till.junge@epfl.ch>
*
* @date 13 May 2017
*
* @brief test fftw real to complex engine
*
* @section LICENCE
*
* Copyright (C) 2017 Till Junge
*
* µSpectre is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3, or (at
* your option) any later version.
*
* µSpectre is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Emacs; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <boost/test/unit_test.hpp>
#include <iostream>
#include "complex"
#include "system/fftw_engine_r2c.hh"
#include "tests.hh"
namespace
muSpectre
{
template
<
Dim_t
DimS
,
Dim_t
DimM
>
struct
fftw_r2c_fixture:
public
FFTW_EngineR2C
<
DimS
,
DimM
>
{
fftw_r2c_fixture
()
:
FFTW_EngineR2C
<
DimS
,
DimM
>
(
std_nb_pix
,
FFT_PlanFlags
::
estimate
){}
const
static
typename
FFTW_EngineR2C
<
DimS
,
DimM
>::
Ccoord
std_nb_pix
;
};
template
<>
const
Ccoord_t
<
1
>
fftw_r2c_fixture
<
1
,
1
>::
std_nb_pix
{
3
};
template
<>
const
Ccoord_t
<
2
>
fftw_r2c_fixture
<
2
,
2
>::
std_nb_pix
{
5
,
3
};
template
<>
const
Ccoord_t
<
3
>
fftw_r2c_fixture
<
3
,
3
>::
std_nb_pix
{
7
,
5
,
3
};
using
fix2
=
fftw_r2c_fixture
<
2
,
2
>
;
BOOST_FIXTURE_TEST_CASE
(
half_stride_index_test
,
fix2
)
{
Eigen
::
Matrix
<
int
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
,
Eigen
::
RowMajor
>
mat
(
fix2
::
std_nb_pix
[
0
],
fix2
::
std_nb_pix
[
1
]);
mat
<<
1
,
2
,
-
1
,
3
,
4
,
-
2
,
5
,
6
,
-
3
,
7
,
8
,
-
4
,
9
,
10
,
-
5
;
auto
it
=
begin
();
int
counter
=
1
;
const
auto
end_it
=
end
();
for
(;
it
!=
end_it
;
++
it
)
{
BOOST_CHECK_EQUAL
(
counter
,
mat
.
data
()[
std
::
get
<
0
>
(
*
it
)]);
counter
++
;
}
}
using
fix3
=
fftw_r2c_fixture
<
3
,
3
>
;
BOOST_FIXTURE_TEST_CASE
(
half_stride_index_test3
,
fix3
)
{
int
mat
[]
=
{
1
,
2
,
-
1
,
3
,
4
,
-
2
,
5
,
6
,
-
3
,
7
,
8
,
-
4
,
9
,
10
,
-
5
,
11
,
12
,
-
11
,
13
,
14
,
-
12
,
15
,
16
,
-
13
,
17
,
18
,
-
14
,
19
,
20
,
-
15
,
21
,
22
,
-
21
,
23
,
24
,
-
22
,
25
,
26
,
-
23
,
27
,
28
,
-
24
,
29
,
30
,
-
25
,
31
,
32
,
-
31
,
33
,
34
,
-
32
,
35
,
36
,
-
33
,
37
,
38
,
-
34
,
39
,
40
,
-
35
,
41
,
42
,
-
41
,
43
,
44
,
-
42
,
45
,
46
,
-
43
,
47
,
48
,
-
44
,
49
,
50
,
-
45
,
51
,
52
,
-
61
,
53
,
54
,
-
62
,
55
,
56
,
-
63
,
57
,
58
,
-
64
,
59
,
60
,
-
65
,
61
,
62
,
-
71
,
63
,
64
,
-
72
,
65
,
66
,
-
73
,
67
,
68
,
-
74
,
69
,
70
,
-
75
};
auto
it
=
begin
();
int
counter
=
1
;
const
auto
end_it
=
end
();
for
(;
it
!=
end_it
;
++
it
)
{
BOOST_CHECK_EQUAL
(
counter
,
mat
[
std
::
get
<
0
>
(
*
it
)]);
counter
++
;
}
}
}
// muSpectre
Event Timeline
Log In to Comment