action_ger.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_GER
16 #define ACTION_GER
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_ger {
28 
29 public :
30 
31  // Ctor
33  {
34  MESSAGE("Action_ger Ctor");
35 
36  // STL matrix and vector initialization
37  typename Interface::stl_matrix tmp;
38  init_matrix<pseudo_random>(A_stl,_size);
39  init_vector<pseudo_random>(B_stl,_size);
40  init_vector<pseudo_random>(X_stl,_size);
41  init_vector<null_function>(resu_stl,_size);
42 
43  // generic matrix and vector initialization
44  Interface::matrix_from_stl(A_ref,A_stl);
45  Interface::matrix_from_stl(A,A_stl);
46  Interface::vector_from_stl(B_ref,B_stl);
47  Interface::vector_from_stl(B,B_stl);
48  Interface::vector_from_stl(X_ref,X_stl);
49  Interface::vector_from_stl(X,X_stl);
50  }
51 
52  // invalidate copy ctor
54  {
55  INFOS("illegal call to Action_ger Copy Ctor");
56  exit(1);
57  }
58 
59  // Dtor
61  MESSAGE("Action_ger Dtor");
62  Interface::free_matrix(A,_size);
63  Interface::free_vector(B);
64  Interface::free_vector(X);
65  Interface::free_matrix(A_ref,_size);
66  Interface::free_vector(B_ref);
67  Interface::free_vector(X_ref);
68 
69  }
70 
71  // action name
72  static inline std::string name( void )
73  {
74  return "ger_" + Interface::name();
75  }
76 
77  double nb_op_base( void ){
78  return 2.0*_size*_size;
79  }
80 
82  Interface::copy_matrix(A_ref,A,_size);
83  Interface::copy_vector(B_ref,B,_size);
84  Interface::copy_vector(X_ref,X,_size);
85  }
86 
87  BTL_DONT_INLINE void calculate( void ) {
88  BTL_ASM_COMMENT("#begin ger");
89  Interface::ger(A,B,X,_size);
90  BTL_ASM_COMMENT("end ger");
91  }
92 
94  // calculation check
95  Interface::vector_to_stl(X,resu_stl);
96 
98 
99  typename Interface::real_type error=
101 
102  if (error>1.e-3){
103  INFOS("WRONG CALCULATION...residual=" << error);
104 // exit(0);
105  }
106 
107  }
108 
109 private :
110 
111  typename Interface::stl_matrix A_stl;
112  typename Interface::stl_vector B_stl;
113  typename Interface::stl_vector X_stl;
114  typename Interface::stl_vector resu_stl;
115 
116  typename Interface::gene_matrix A_ref;
117  typename Interface::gene_vector B_ref;
118  typename Interface::gene_vector X_ref;
119 
120  typename Interface::gene_matrix A;
121  typename Interface::gene_vector B;
122  typename Interface::gene_vector X;
123 
124  int _size;
125 };
126 
127 
128 #endif
Action_ger::calculate
BTL_DONT_INLINE void calculate(void)
Definition: action_ger.hh:87
Action_ger::initialize
BTL_DONT_INLINE void initialize(void)
Definition: action_ger.hh:81
Action_ger::nb_op_base
double nb_op_base(void)
Definition: action_ger.hh:77
Action_ger::resu_stl
Interface::stl_vector resu_stl
Definition: action_ger.hh:114
B
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition: bench_gemm.cpp:49
Action_ger::Action_ger
BTL_DONT_INLINE Action_ger(int size)
Definition: action_ger.hh:32
STL_interface.hh
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Action_ger::X_ref
Interface::gene_vector X_ref
Definition: action_ger.hh:118
ger
int EIGEN_BLAS_FUNC() ger(int *m, int *n, Scalar *palpha, Scalar *px, int *incx, Scalar *py, int *incy, Scalar *pa, int *lda)
Definition: level2_real_impl.h:278
X
#define X
Definition: icosphere.cpp:20
Action_ger::B
Interface::gene_vector B
Definition: action_ger.hh:121
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
Action_ger::_size
int _size
Definition: action_ger.hh:124
Action_ger::A
Interface::gene_matrix A
Definition: action_ger.hh:120
init_function.hh
Action_ger::name
static std::string name(void)
Definition: action_ger.hh:72
MESSAGE
#define MESSAGE(chain)
Definition: 3rdparty/Eigen/bench/btl/generic_bench/utils/utilities.h:76
BTL_ASM_COMMENT
#define BTL_ASM_COMMENT(X)
Definition: btl.hh:44
Action_ger::B_stl
Interface::stl_vector B_stl
Definition: action_ger.hh:112
Action_ger::X_stl
Interface::stl_vector X_stl
Definition: action_ger.hh:113
init_vector.hh
Action_ger::A_ref
Interface::gene_matrix A_ref
Definition: action_ger.hh:116
init_matrix.hh
error
static double error
Definition: testRot3.cpp:37
Action_ger::B_ref
Interface::gene_vector B_ref
Definition: action_ger.hh:117
INFOS
#define INFOS(chain)
Definition: 3rdparty/Eigen/bench/btl/generic_bench/utils/utilities.h:22
Action_ger::A_stl
Interface::stl_matrix A_stl
Definition: action_ger.hh:111
std
Definition: BFloat16.h:88
copy_matrix
void copy_matrix(MatrixType &m)
Definition: bench_move_semantics.cpp:19
Action_ger::X
Interface::gene_vector X
Definition: action_ger.hh:122
Action_ger::check_result
BTL_DONT_INLINE void check_result(void)
Definition: action_ger.hh:93
Action_ger
Definition: action_ger.hh:27
STL_interface::norm_diff
static real norm_diff(const stl_vector &A, const stl_vector &B)
Definition: STL_interface.hh:203
Action_ger::Action_ger
Action_ger(const Action_ger &)
Definition: action_ger.hh:53
STL_interface::ger
static void ger(gene_matrix &A, gene_vector &X, gene_vector &Y, int N)
Definition: STL_interface.hh:162
BTL_DONT_INLINE
#define BTL_DONT_INLINE
Definition: btl.hh:38
Action_ger::~Action_ger
BTL_DONT_INLINE ~Action_ger(void)
Definition: action_ger.hh:60


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:01:47