action_rot.hh
Go to the documentation of this file.
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 
24 using namespace std;
25 
26 template<class Interface>
27 class Action_rot {
28 
29 public :
30 
31  // Ctor
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
50  {
51  INFOS("illegal call to Action_rot Copy Ctor");
52  exit(1);
53  }
54 
55  // Dtor
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 
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 
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 
101 private :
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
Action_rot::A_ref
Interface::gene_vector A_ref
Definition: action_rot.hh:106
Action_rot::B
Interface::gene_vector B
Definition: action_rot.hh:110
B
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition: bench_gemm.cpp:49
STL_interface.hh
Action_rot::_size
int _size
Definition: action_rot.hh:112
Action_rot::A_stl
Interface::stl_vector A_stl
Definition: action_rot.hh:103
Action_rot::initialize
BTL_DONT_INLINE void initialize(void)
Definition: action_rot.hh:74
rot
int EIGEN_BLAS_FUNC() rot(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pc, RealScalar *ps)
Definition: level1_real_impl.h:79
A
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:48
name
static char name[]
Definition: rgamma.c:72
size
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
init_function.hh
MESSAGE
#define MESSAGE(chain)
Definition: 3rdparty/Eigen/bench/btl/generic_bench/utils/utilities.h:76
Action_rot::~Action_rot
BTL_DONT_INLINE ~Action_rot(void)
Definition: action_rot.hh:56
Action_rot::A
Interface::gene_vector A
Definition: action_rot.hh:109
BTL_ASM_COMMENT
#define BTL_ASM_COMMENT(X)
Definition: btl.hh:44
Action_rot::check_result
BTL_DONT_INLINE void check_result(void)
Definition: action_rot.hh:85
init_vector.hh
init_matrix.hh
Action_rot::B_stl
Interface::stl_vector B_stl
Definition: action_rot.hh:104
Action_rot::nb_op_base
double nb_op_base(void)
Definition: action_rot.hh:70
Action_rot::Action_rot
BTL_DONT_INLINE Action_rot(int size)
Definition: action_rot.hh:32
INFOS
#define INFOS(chain)
Definition: 3rdparty/Eigen/bench/btl/generic_bench/utils/utilities.h:22
std
Definition: BFloat16.h:88
Action_rot
Definition: action_rot.hh:27
Action_rot::calculate
BTL_DONT_INLINE void calculate(void)
Definition: action_rot.hh:79
Action_rot::Action_rot
Action_rot(const Action_rot &)
Definition: action_rot.hh:49
Action_rot::B_ref
Interface::gene_vector B_ref
Definition: action_rot.hh:107
BTL_DONT_INLINE
#define BTL_DONT_INLINE
Definition: btl.hh:38
Action_rot::name
static std::string name(void)
Definition: action_rot.hh:65


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:31:51