diff --git a/src/main.c b/src/main.c index a6d0999..088f16c 100644 --- a/src/main.c +++ b/src/main.c @@ -3,6 +3,7 @@ #include "matrix_operation.h" #include "sparse_matrix.h" #include "read_from_mtx.h" +#include "read_from_rb.h" #include "vector.h" #include "power_algorithm.h" #include "gauss_seidel.h" @@ -14,7 +15,15 @@ void test_stationary_distribution(const char *path, double epsilon, double alpha struct timeval tvstart, tvend; gettimeofday(&tvstart, NULL); - SparseMatrix *matrix = read_sparse_matrix_from_mtx(path); + + SparseMatrix *matrix = NULL; + const char *extension = strrchr(path, '.'); + if (extension && strcasecmp(extension, ".rb") == 0) { + matrix = read_sparse_matrix_from_rb(path); + } else { + matrix = read_sparse_matrix_from_mtx(path); + } + convert_to_stochastic(matrix); gettimeofday(&tvend, NULL); print_time_diff("Read and convert matrix", &tvstart, &tvend);