action_lu_decomp.hh
Go to the documentation of this file.
1 //=====================================================
2 // File : action_lu_decomp.hh
3 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
4 //=====================================================
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 #ifndef ACTION_LU_DECOMP
20 #define ACTION_LU_DECOMP
21 #include "utilities.h"
22 #include "STL_interface.hh"
23 #include <string>
24 #include "init/init_function.hh"
25 #include "init/init_vector.hh"
26 #include "init/init_matrix.hh"
27 
28 using namespace std;
29 
30 template<class Interface>
32 
33 public :
34 
35  // Ctor
36 
37  Action_lu_decomp( int size ):_size(size)
38  {
39  MESSAGE("Action_lu_decomp Ctor");
40 
41  // STL vector initialization
42  init_matrix<pseudo_random>(X_stl,_size);
43 
44  init_matrix<null_function>(C_stl,_size);
45  init_matrix<null_function>(resu_stl,_size);
46 
47  // generic matrix and vector initialization
48  Interface::matrix_from_stl(X_ref,X_stl);
49  Interface::matrix_from_stl(X,X_stl);
50  Interface::matrix_from_stl(C,C_stl);
51 
52  _cost = 2.0*size*size*size/3.0 + size*size;
53  }
54 
55  // invalidate copy ctor
56 
58  {
59  INFOS("illegal call to Action_lu_decomp Copy Ctor");
60  exit(1);
61  }
62 
63  // Dtor
64 
66 
67  MESSAGE("Action_lu_decomp Dtor");
68 
69  // deallocation
70  Interface::free_matrix(X_ref,_size);
71  Interface::free_matrix(X,_size);
72  Interface::free_matrix(C,_size);
73  }
74 
75  // action name
76 
77  static inline std::string name( void )
78  {
79  return "complete_lu_decomp_"+Interface::name();
80  }
81 
82  double nb_op_base( void ){
83  return _cost;
84  }
85 
86  inline void initialize( void ){
87  Interface::copy_matrix(X_ref,X,_size);
88  }
89 
90  inline void calculate( void ) {
91  Interface::lu_decomp(X,C,_size);
92  }
93 
94  void check_result( void ){
95  // calculation check
96  Interface::matrix_to_stl(C,resu_stl);
97 
98 // STL_interface<typename Interface::real_type>::lu_decomp(X_stl,C_stl,_size);
99 //
100 // typename Interface::real_type error=
101 // STL_interface<typename Interface::real_type>::norm_diff(C_stl,resu_stl);
102 //
103 // if (error>1.e-6){
104 // INFOS("WRONG CALCULATION...residual=" << error);
105 // exit(0);
106 // }
107 
108  }
109 
110 private :
111 
112  typename Interface::stl_matrix X_stl;
113  typename Interface::stl_matrix C_stl;
114  typename Interface::stl_matrix resu_stl;
115 
116  typename Interface::gene_matrix X_ref;
117  typename Interface::gene_matrix X;
118  typename Interface::gene_matrix C;
119 
120  int _size;
121  double _cost;
122 };
123 
124 #endif
Action_lu_decomp::_cost
double _cost
Definition: action_lu_decomp.hh:121
STL_interface.hh
Action_lu_decomp::nb_op_base
double nb_op_base(void)
Definition: action_lu_decomp.hh:82
Action_lu_decomp::X
Interface::gene_matrix X
Definition: action_lu_decomp.hh:117
Action_lu_decomp::name
static std::string name(void)
Definition: action_lu_decomp.hh:77
Action_lu_decomp::C_stl
Interface::stl_matrix C_stl
Definition: action_lu_decomp.hh:113
X
#define X
Definition: icosphere.cpp:20
Action_lu_decomp
Definition: action_lu_decomp.hh:31
Action_lu_decomp::~Action_lu_decomp
~Action_lu_decomp(void)
Definition: action_lu_decomp.hh:65
Action_lu_decomp::initialize
void initialize(void)
Definition: action_lu_decomp.hh:86
name
static char name[]
Definition: rgamma.c:72
Action_lu_decomp::Action_lu_decomp
Action_lu_decomp(int size)
Definition: action_lu_decomp.hh:37
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_lu_decomp::calculate
void calculate(void)
Definition: action_lu_decomp.hh:90
Action_lu_decomp::Action_lu_decomp
Action_lu_decomp(const Action_lu_decomp &)
Definition: action_lu_decomp.hh:57
Action_lu_decomp::check_result
void check_result(void)
Definition: action_lu_decomp.hh:94
init_vector.hh
init_matrix.hh
Action_lu_decomp::X_stl
Interface::stl_matrix X_stl
Definition: action_lu_decomp.hh:112
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
Action_lu_decomp::resu_stl
Interface::stl_matrix resu_stl
Definition: action_lu_decomp.hh:114
Action_lu_decomp::_size
int _size
Definition: action_lu_decomp.hh:120
INFOS
#define INFOS(chain)
Definition: 3rdparty/Eigen/bench/btl/generic_bench/utils/utilities.h:22
std
Definition: BFloat16.h:88
Action_lu_decomp::C
Interface::gene_matrix C
Definition: action_lu_decomp.hh:118
copy_matrix
void copy_matrix(MatrixType &m)
Definition: bench_move_semantics.cpp:19
Action_lu_decomp::X_ref
Interface::gene_matrix X_ref
Definition: action_lu_decomp.hh:116


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