99#include <unistd.h>
1010
1111#include "cuqdyn.h"
12- #include "functions.h"
1312#include "handlers/handlers.h"
1413
1514#if defined(MPI ) || defined(MPI2 )
1817
1918int handle_solve (int argc , char * argv []);
2019void print_matrix (SUNMatrix mat , FILE * output_file , char * name );
20+ void print_transposed_matrix (TransposedStates mat , FILE * output_file , char * name );
2121void print_vector (N_Vector vec , FILE * output_file , char * name );
2222
2323Handler create_solve_handler ()
@@ -116,7 +116,7 @@ int handle_solve(int argc, char *argv[])
116116 {
117117
118118 N_Vector params_median = cuqdyn_result -> predicted_params_median ;
119- SUNMatrix data_median = cuqdyn_result -> predicted_data_median ;
119+ TransposedStates data_median = cuqdyn_result -> predicted_data_median ;
120120
121121 SUNMatrix q_low = cuqdyn_result -> q_low ;
122122 SUNMatrix q_up = cuqdyn_result -> q_up ;
@@ -129,7 +129,7 @@ int handle_solve(int argc, char *argv[])
129129 FILE * output_file = fopen (output_file_path , "w" );
130130
131131 print_vector (params_median , output_file , "Params" );
132- print_matrix (data_median , output_file , "Data" );
132+ print_transposed_matrix (data_median , output_file , "Data" );
133133 print_matrix (q_low , output_file , "Q_low" );
134134 print_matrix (q_up , output_file , "Q_up" );
135135 print_vector (times , output_file , "Times" );
@@ -160,6 +160,21 @@ void print_matrix(SUNMatrix mat, FILE *output_file, char *name)
160160 }
161161}
162162
163+ void print_transposed_matrix (TransposedStates mat , FILE * output_file , char * name )
164+ {
165+ fprintf (output_file , "[%s]\n" , name );
166+ fprintf (output_file , "%ld %ld\n" , SM_COLUMNS_D (mat ), SM_ROWS_D (mat ));
167+
168+ for (int i = 0 ; i < SM_COLUMNS_D (mat ); i ++ )
169+ {
170+ for (int j = 0 ; j < SM_ROWS_D (mat ); j ++ )
171+ {
172+ fprintf (output_file , "%.8lf " , SM_ELEMENT_D (mat , j , i ));
173+ }
174+ fprintf (output_file , "\n" );
175+ }
176+ }
177+
163178void print_vector (N_Vector vec , FILE * output_file , char * name )
164179{
165180 fprintf (output_file , "[%s]\n" , name );
0 commit comments