source: pacpussensors/trunk/Vislab/lib3dv/eigen/bench/btl/actions/action_rot.hh@ 136

Last change on this file since 136 was 136, checked in by ldecherf, 7 years ago

Doc

File size: 2.9 KB
Line 
1
2// This program is free software; you can redistribute it and/or
3// modify it under the terms of the GNU General Public License
4// as published by the Free Software Foundation; either version 2
5// of the License, or (at your option) any later version.
6//
7// This program is distributed in the hope that it will be useful,
8// but WITHOUT ANY WARRANTY; without even the implied warranty of
9// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10// GNU General Public License for more details.
11// You should have received a copy of the GNU General Public License
12// along with this program; if not, write to the Free Software
13// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14//
15#ifndef ACTION_ROT
16#define ACTION_ROT
17#include "utilities.h"
18#include "STL_interface.hh"
19#include <string>
20#include "init/init_function.hh"
21#include "init/init_vector.hh"
22#include "init/init_matrix.hh"
23
24using namespace std;
25
26template<class Interface>
27class Action_rot {
28
29public :
30
31 // Ctor
32 BTL_DONT_INLINE Action_rot( int size ):_size(size)
33 {
34 MESSAGE("Action_rot Ctor");
35
36 // STL matrix and vector initialization
37 typename Interface::stl_matrix tmp;
38 init_vector<pseudo_random>(A_stl,_size);
39 init_vector<pseudo_random>(B_stl,_size);
40
41 // generic matrix and vector initialization
42 Interface::vector_from_stl(A_ref,A_stl);
43 Interface::vector_from_stl(A,A_stl);
44 Interface::vector_from_stl(B_ref,B_stl);
45 Interface::vector_from_stl(B,B_stl);
46 }
47
48 // invalidate copy ctor
49 Action_rot( const Action_rot & )
50 {
51 INFOS("illegal call to Action_rot Copy Ctor");
52 exit(1);
53 }
54
55 // Dtor
56 BTL_DONT_INLINE ~Action_rot( void ){
57 MESSAGE("Action_rot Dtor");
58 Interface::free_vector(A);
59 Interface::free_vector(B);
60 Interface::free_vector(A_ref);
61 Interface::free_vector(B_ref);
62 }
63
64 // action name
65 static inline std::string name( void )
66 {
67 return "rot_" + Interface::name();
68 }
69
70 double nb_op_base( void ){
71 return 6.0*_size;
72 }
73
74 BTL_DONT_INLINE void initialize( void ){
75 Interface::copy_vector(A_ref,A,_size);
76 Interface::copy_vector(B_ref,B,_size);
77 }
78
79 BTL_DONT_INLINE void calculate( void ) {
80 BTL_ASM_COMMENT("#begin rot");
81 Interface::rot(A,B,0.5,0.6,_size);
82 BTL_ASM_COMMENT("end rot");
83 }
84
85 BTL_DONT_INLINE void check_result( void ){
86 // calculation check
87// Interface::vector_to_stl(X,resu_stl);
88
89// STL_interface<typename Interface::real_type>::rot(A_stl,B_stl,X_stl,_size);
90
91// typename Interface::real_type error=
92// STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
93
94// if (error>1.e-3){
95// INFOS("WRONG CALCULATION...residual=" << error);
96// exit(0);
97// }
98
99 }
100
101private :
102
103 typename Interface::stl_vector A_stl;
104 typename Interface::stl_vector B_stl;
105
106 typename Interface::gene_vector A_ref;
107 typename Interface::gene_vector B_ref;
108
109 typename Interface::gene_vector A;
110 typename Interface::gene_vector B;
111
112 int _size;
113};
114
115
116#endif
Note: See TracBrowser for help on using the repository browser.