I want to convert a sparse matrix stored in CSR (Compressed Sparse Row) format to a matrix stored in VBR (Variable Block Row) format.
SPARSKIT has a way to do it, but it seems to be in Fortran, which I want to avoid.
There is a method called CreateMatReprFromCSR
to convert a matrix from CSR to VBR in OSKI.
https://bebop.cs.berkeley.edu/oski/html/structoski__matVBR__t.html
https://bebop.cs.berkeley.edu/oski/html/group__MATTYPES__INTERFACE.html#g7e8be918a49ee9bb61d5319cd7222329
In OSKI, one can create a CSR matrix as such -
int Aptr[DIM+1] = {0, 1, 3, 5};
int Aind[NUM_STORED_NZ] = {0, 0, 1, 0, 2};
double Aval[NUM_STORED_NZ] = {1, -2, 1, 0.5, 1};
oski_matrix_t T = oski_CreateMatCSR(Aptr, Aind, Aval, 3, 3, SHARE_INPUTMAT, 1, INDEX_ZERO_BASED);
But then calling CreateMatReprFromCSR
on T
seems difficult because every matrix format seems to implement it (therefore not sure how to convert to VBR specifically) and the function takes a const oski_matcommon_t * props
argument which I am not sure how to initialize.
For eg.
oski_matcommon_t props;
props.num_rows = 3;
props.num_cols = 3;
props.num_nonzeros = NUM_STORED_NZ;
oski_CreateMatReprFromCSR(T, &props);
something like this gives an error - undefined reference to MOD_NAME_Tid_LTX_oski_CreateMatReprFromCSR
If there is a way to convert a matrix from CSR to VBR in any other language, that is also fine, as long as it isn't Fortran or MATLAB.
How do I go from CSR to VBR without implementing a conversion routine myself?