20 #ifndef ACTION_LU_SOLVE 21 #define ACTION_LU_SOLVE 22 #include "utilities.h" 31 template<
class Interface>
37 static inline std::string
name(
void )
43 return 2.0*size*size*size/3.0;
51 typename Interface::stl_matrix A_stl;
52 typename Interface::stl_vector B_stl;
53 typename Interface::stl_vector X_stl;
55 init_matrix<pseudo_random>(A_stl,
size);
56 init_vector<pseudo_random>(B_stl,
size);
57 init_vector<null_function>(X_stl,
size);
61 typename Interface::gene_matrix
A;
62 typename Interface::gene_vector
B;
63 typename Interface::gene_vector
X;
65 typename Interface::gene_matrix LU;
67 Interface::matrix_from_stl(A,A_stl);
68 Interface::vector_from_stl(B,B_stl);
69 Interface::vector_from_stl(X,X_stl);
70 Interface::matrix_from_stl(LU,A_stl);
74 typename Interface::Pivot_Vector pivot;
75 Interface::new_Pivot_Vector(pivot,size);
85 for (
int ii=0;ii<nb_calc;ii++){
89 Interface::LU_factor(LU,pivot,size);
93 Interface::LU_solve(LU,pivot,B,X,size);
105 typename Interface::stl_vector B_new_stl(size);
106 Interface::vector_to_stl(X,X_stl);
110 typename Interface::real_type
error=
114 INFOS(
"WRONG CALCULATION...residual=" << error);
122 Interface::free_matrix(A,size);
123 Interface::free_vector(B);
124 Interface::free_vector(X);
125 Interface::free_Pivot_Vector(pivot);
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
static double nb_op_base(int size)
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static void matrix_vector_product(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
static real norm_diff(const stl_vector &A, const stl_vector &B)
void copy_matrix(MatrixType &m)
static std::string name(void)
static void display_vector(const stl_vector &A)
static double calculate(int nb_calc, int size)