file - cholmod: How to read a sparse matrix in c++ -
i new in cholmod solver. want run simple example comes installation folder. matrice read alwas empty. code:
file* f; cholmod_sparse *a ; cholmod_dense *x, *b, *r ; cholmod_factor *l ; double 1 [2] = {1,0}, m1 [2] = {-1,0} ; /* basic scalars */ cholmod_common c ; cholmod_start (&c) ; if ((f = fopen("../dynamic_systemmatrix.mtx","r")) == null) { my_handler (cholmod_invalid, __file__, __line__, "unable open file") ; } = cholmod_l_read_sparse (f, &c) ; /* read in matrix */ cholmod_print_sparse (a, "a", &c) ; /* print matrix */ if (a == null || a->stype == 0) /* must symmetric */ { cholmod_free_sparse (&a, &c) ; cholmod_finish (&c) ; return (0) ; }`
how should .mtx file ? read function cholmod_l_read_sparse .
Comments
Post a Comment