Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef ACTION_PARTIAL_LU
00020 #define ACTION_PARTIAL_LU
00021 #include "utilities.h"
00022 #include "STL_interface.hh"
00023 #include <string>
00024 #include "init/init_function.hh"
00025 #include "init/init_vector.hh"
00026 #include "init/init_matrix.hh"
00027
00028 using namespace std;
00029
00030 template<class Interface>
00031 class Action_partial_lu {
00032
00033 public :
00034
00035
00036
00037 Action_partial_lu( int size ):_size(size)
00038 {
00039 MESSAGE("Action_partial_lu Ctor");
00040
00041
00042 init_matrix<pseudo_random>(X_stl,_size);
00043 init_matrix<null_function>(C_stl,_size);
00044
00045
00046 for (int i=0; i<_size; ++i)
00047 X_stl[i][i] = X_stl[i][i] * 1e2 + 1;
00048
00049
00050 Interface::matrix_from_stl(X_ref,X_stl);
00051 Interface::matrix_from_stl(X,X_stl);
00052 Interface::matrix_from_stl(C,C_stl);
00053
00054 _cost = 2.0*size*size*size/3.0 + size*size;
00055 }
00056
00057
00058
00059 Action_partial_lu( const Action_partial_lu & )
00060 {
00061 INFOS("illegal call to Action_partial_lu Copy Ctor");
00062 exit(1);
00063 }
00064
00065
00066
00067 ~Action_partial_lu( void ){
00068
00069 MESSAGE("Action_partial_lu Dtor");
00070
00071
00072 Interface::free_matrix(X_ref,_size);
00073 Interface::free_matrix(X,_size);
00074 Interface::free_matrix(C,_size);
00075 }
00076
00077
00078
00079 static inline std::string name( void )
00080 {
00081 return "partial_lu_decomp_"+Interface::name();
00082 }
00083
00084 double nb_op_base( void ){
00085 return _cost;
00086 }
00087
00088 inline void initialize( void ){
00089 Interface::copy_matrix(X_ref,X,_size);
00090 }
00091
00092 inline void calculate( void ) {
00093 Interface::partial_lu_decomp(X,C,_size);
00094 }
00095
00096 void check_result( void ){
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 }
00111
00112 private :
00113
00114 typename Interface::stl_matrix X_stl;
00115 typename Interface::stl_matrix C_stl;
00116
00117 typename Interface::gene_matrix X_ref;
00118 typename Interface::gene_matrix X;
00119 typename Interface::gene_matrix C;
00120
00121 int _size;
00122 double _cost;
00123 };
00124
00125 #endif