action_aat_product.hh
Go to the documentation of this file.
1 //=====================================================
2 // File : action_aat_product.hh
3 // Author : L. Plagne <laurent.plagne@edf.fr)>
4 // Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
5 //=====================================================
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 //
20 #ifndef ACTION_AAT_PRODUCT
21 #define ACTION_AAT_PRODUCT
22 #include "utilities.h"
23 #include "STL_interface.hh"
24 #include <string>
25 #include "init/init_function.hh"
26 #include "init/init_vector.hh"
27 #include "init/init_matrix.hh"
28 
29 using namespace std;
30 
31 template<class Interface>
33 
34 public :
35 
36  // Ctor
37 
38  Action_aat_product( int size ):_size(size)
39  {
40  MESSAGE("Action_aat_product Ctor");
41 
42  // STL matrix and vector initialization
43 
44  init_matrix<pseudo_random>(A_stl,_size);
45  init_matrix<null_function>(X_stl,_size);
46  init_matrix<null_function>(resu_stl,_size);
47 
48  // generic matrix and vector initialization
49 
50  Interface::matrix_from_stl(A_ref,A_stl);
51  Interface::matrix_from_stl(X_ref,X_stl);
52 
53  Interface::matrix_from_stl(A,A_stl);
54  Interface::matrix_from_stl(X,X_stl);
55 
56  }
57 
58  // invalidate copy ctor
59 
61  {
62  INFOS("illegal call to Action_aat_product Copy Ctor");
63  exit(0);
64  }
65 
66  // Dtor
67 
69 
70  MESSAGE("Action_aat_product Dtor");
71 
72  // deallocation
73 
74  Interface::free_matrix(A,_size);
75  Interface::free_matrix(X,_size);
76 
77  Interface::free_matrix(A_ref,_size);
78  Interface::free_matrix(X_ref,_size);
79 
80  }
81 
82  // action name
83 
84  static inline std::string name( void )
85  {
86  return "aat_"+Interface::name();
87  }
88 
89  double nb_op_base( void ){
90  return double(_size)*double(_size)*double(_size);
91  }
92 
93  inline void initialize( void ){
94 
95  Interface::copy_matrix(A_ref,A,_size);
96  Interface::copy_matrix(X_ref,X,_size);
97 
98  }
99 
100  inline void calculate( void ) {
101 
102  Interface::aat_product(A,X,_size);
103 
104  }
105 
106  void check_result( void ){
107  if (_size>128) return;
108  // calculation check
109 
110  Interface::matrix_to_stl(X,resu_stl);
111 
113 
114  typename Interface::real_type error=
116 
117  if (error>1.e-6){
118  INFOS("WRONG CALCULATION...residual=" << error);
119  exit(1);
120  }
121 
122  }
123 
124 private :
125 
126  typename Interface::stl_matrix A_stl;
127  typename Interface::stl_matrix X_stl;
128  typename Interface::stl_matrix resu_stl;
129 
130  typename Interface::gene_matrix A_ref;
131  typename Interface::gene_matrix X_ref;
132 
133  typename Interface::gene_matrix A;
134  typename Interface::gene_matrix X;
135 
136 
137  int _size;
138 
139 };
140 
141 
142 #endif
143 
144 
145 
Interface::gene_matrix A
Definition: BFloat16.h:88
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:48
static std::string name(void)
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
Action_aat_product(const Action_aat_product &)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Interface::stl_matrix X_stl
static void aat_product(const gene_matrix &A, gene_matrix &X, int N)
Interface::stl_matrix A_stl
static double error
Definition: testRot3.cpp:37
static real norm_diff(const stl_vector &A, const stl_vector &B)
void copy_matrix(MatrixType &m)
Interface::gene_matrix X
Interface::stl_matrix resu_stl
#define X
Definition: icosphere.cpp:20
Interface::gene_matrix A_ref
Interface::gene_matrix X_ref


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:33:53