The script validate.sh should run this self test on 1, 2, 3 and 4 cores.
68 MPI_Helpers::init(argc,argv);
75 unsigned my_rank = comm_pt->
my_rank();
76 unsigned nproc = comm_pt->
nproc();
113 unsigned nrow_global_t1m1 = 5;
114 unsigned ncol_t1m1 = 5;
115 unsigned nnz_t1m1 = 9;
120 double val_array_t1m1[] = {1,2,3,4,5,6,7,8,9};
121 int col_i_array_t1m1[] = {0,1,0,2,3,4,0,1,4};
122 int row_s_array_t1m1[] = {0,2,4,6,9,9};
130 nrow_global_t1m1,ncol_t1m1,comm_pt,
131 val_t1m1,col_i_t1m1,row_s_t1m1,mat_t1m1);
133 std::ostringstream mat_t1m1_stream;
134 mat_t1m1_stream <<
"t1m1_NP"<<nproc<<
"R"<<my_rank;
138 unsigned nrow_global_t1m2 = 5;
139 unsigned ncol_t1m2 = 5;
140 unsigned nnz_t1m2 = 18;
145 double val_array_t1m2[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
146 int col_i_array_t1m2[] = {0,1,2,3,4,0,1,2,3,4,2,4,0,1,2,2,3,4};
147 int row_s_array_t1m2[] = {0,5,10,12,15,18};
155 nrow_global_t1m2,ncol_t1m2,comm_pt,
156 val_t1m2,col_i_t1m2,row_s_t1m2,mat_t1m2);
158 std::ostringstream mat_t1m2_stream;
160 mat_t1m2_stream <<
"t1m2_NP"<<nproc<<
"R"<<my_rank;
167 mat_t1m1.
add(mat_t1m2,mat_t1_result);
169 std::ostringstream mat_t1_result_stream;
170 mat_t1_result_stream <<
"t1_res_NP"<<nproc<<
"R"<<my_rank;
188 unsigned nrow_global_t2m1 = 3;
189 unsigned ncol_t2m1 = 6;
190 unsigned nnz_t2m1 = 18;
195 double val_array_t2m1[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
196 int col_i_array_t2m1[] = {0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5};
197 int row_s_array_t2m1[] = {0,6,12,18};
205 nrow_global_t2m1,ncol_t2m1,comm_pt,
206 val_t2m1,col_i_t2m1,row_s_t2m1,mat_t2m1);
208 std::ostringstream mat_t2m1_stream;
209 mat_t2m1_stream <<
"t2m1_NP"<<nproc<<
"R"<<my_rank;
213 unsigned nrow_global_t2m2 = 3;
214 unsigned ncol_t2m2 = 6;
215 unsigned nnz_t2m2 = 18;
220 double val_array_t2m2[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
221 int col_i_array_t2m2[] = {0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5};
222 int row_s_array_t2m2[] = {0,6,12,18};
230 nrow_global_t2m2,ncol_t2m2,comm_pt,
231 val_t2m2,col_i_t2m2,row_s_t2m2,mat_t2m2);
233 std::ostringstream mat_t2m2_stream;
234 mat_t2m2_stream <<
"t2m2_NP"<<nproc<<
"R"<<my_rank;
241 mat_t2m1.
add(mat_t2m2,mat_t2_result);
243 std::ostringstream mat_t2_result_stream;
244 mat_t2_result_stream <<
"t2_res_NP"<<nproc<<
"R"<<my_rank;
271 unsigned nrow_global_t3m1 = 6;
272 unsigned ncol_t3m1 = 3;
273 unsigned nnz_t3m1 = 18;
278 double val_array_t3m1[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
279 int col_i_array_t3m1[] = {0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2};
280 int row_s_array_t3m1[] = {0,3,6,9,12,15,18};
288 nrow_global_t3m1,ncol_t3m1,comm_pt,
289 val_t3m1,col_i_t3m1,row_s_t3m1,mat_t3m1);
291 std::ostringstream mat_t3m1_stream;
292 mat_t3m1_stream <<
"t3m1_NP"<<nproc<<
"R"<<my_rank;
296 unsigned nrow_global_t3m2 = 6;
297 unsigned ncol_t3m2 = 3;
298 unsigned nnz_t3m2 = 18;
303 double val_array_t3m2[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
304 int col_i_array_t3m2[] = {0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2};
305 int row_s_array_t3m2[] = {0,3,6,9,12,15,18};
314 nrow_global_t3m2,ncol_t3m2,comm_pt,
315 val_t3m2,col_i_t3m2,row_s_t3m2,mat_t3m2);
317 std::ostringstream mat_t3m2_stream;
318 mat_t3m2_stream <<
"t3m2_NP"<<nproc<<
"R"<<my_rank;
325 mat_t3m1.
add(mat_t3m2,mat_t3_result);
327 std::ostringstream mat_t3_result_stream;
328 mat_t3_result_stream <<
"t3_res_NP"<<nproc<<
"R"<<my_rank;
349 unsigned nrow_global_t4m1 = 3;
350 unsigned ncol_t4m1 = 6;
351 unsigned nnz_t4m1 = 18;
356 double val_array_t4m1[] = {1,5,4,3,2,6,7,8,9,10,11,12,13,17,16,15,14,18};
357 int col_i_array_t4m1[] = {0,4,3,2,1,5,0,1,2,3,4,5,0,4,3,2,1,5};
358 int row_s_array_t4m1[] = {0,6,12,18};
366 nrow_global_t4m1,ncol_t4m1,comm_pt,
367 val_t4m1,col_i_t4m1,row_s_t4m1,mat_t4m1);
369 std::ostringstream mat_t4m1_stream;
370 mat_t4m1_stream <<
"t4m1_NP"<<nproc<<
"R"<<my_rank;
374 unsigned nrow_global_t4m2 = 3;
375 unsigned ncol_t4m2 = 6;
376 unsigned nnz_t4m2 = 18;
381 double val_array_t4m2[] = {1,2,3,4,5,6,7,11,10,9,8,12,13,14,15,16,17,18};
382 int col_i_array_t4m2[] = {0,1,2,3,4,5,0,4,3,2,1,5,0,1,2,3,4,5};
383 int row_s_array_t4m2[] = {0,6,12,18};
391 nrow_global_t4m2,ncol_t4m2,comm_pt,
392 val_t4m2,col_i_t4m2,row_s_t4m2,mat_t4m2);
394 std::ostringstream mat_t4m2_stream;
395 mat_t4m2_stream <<
"t4m2_NP"<<nproc<<
"R"<<my_rank;
402 mat_t4m1.
add(mat_t4m2,mat_t4_result);
404 std::ostringstream mat_t4_result_stream;
405 mat_t4_result_stream <<
"t4_res_NP"<<nproc<<
"R"<<my_rank;
410 MPI_Helpers::finalize();
412 return(EXIT_SUCCESS);
Definition: matrices.h:888
void add(const CRDoubleMatrix &matrix_in, CRDoubleMatrix &result_matrix) const
element-wise addition of this matrix with matrix_in.
Definition: matrices.cc:3515
void sparse_indexed_output(std::ostream &outfile, const unsigned &precision=0, const bool &output_bottom_right_zero=false) const
Definition: matrices.h:182
Definition: communicator.h:54
int my_rank() const
my rank
Definition: communicator.h:176
int nproc() const
number of processors
Definition: communicator.h:157
void construct_vector(myType given_array[], unsigned given_arraysize, Vector< myType > &result_vector)
Definition: matrix_addition.cc:34
void create_uniformly_distributed_matrix(const unsigned &nrow, const unsigned &ncol, const OomphCommunicator *const comm_pt, const Vector< double > &values, const Vector< int > &column_indices, const Vector< int > &row_start, CRDoubleMatrix &matrix_out)
Definition: matrices.cc:3676