2020年5月24日日曜日

Error in Matrix Makert IO function (C)

I feel that there is an error in I/O functions of the Matrix Market Routine (https://math.nist.gov/MatrixMarket/mmio-c.html) .

mm_is_* functions in mmio.h expects that descriptions in matrix files are in the upper case, but 
at least those in bcsstk14.mtx are all in the lower case.

Then, the following modifications should work;

/********************* MM_typecode query fucntions ***************************/

#define mm_is_matrix(typecode)  ((typecode)[0]=='M' || (typecode)[0]=='m')

#define mm_is_sparse(typecode)  ((typecode)[1]=='C' || (typecode)[1]=='c')
#define mm_is_coordinate(typecode)((typecode)[1]=='C' || (typecode)[1]=='c')
#define mm_is_dense(typecode)   ((typecode)[1]=='A' || (typecode)[1]=='a')
#define mm_is_array(typecode)   ((typecode)[1]=='A' || (typecode)[1]=='a')

#define mm_is_complex(typecode) ((typecode)[2]=='C' || (typecode)[2]=='c')
#define mm_is_real(typecode)    ((typecode)[2]=='R' || (typecode)[2]=='r')
#define mm_is_pattern(typecode) ((typecode)[2]=='P' || (typecode)[2]=='p')
#define mm_is_integer(typecode) ((typecode)[2]=='I' || (typecode)[2]=='i')

#define mm_is_symmetric(typecode)((typecode)[3]=='S' || (typecode)[3]=='s')
#define mm_is_general(typecode) ((typecode)[3]=='G' || (typecode)[3]=='g')
#define mm_is_skew(typecode)    ((typecode)[3]=='K' || (typecode)[3]=='k')
#define mm_is_hermitian(typecode)((typecode)[3]=='H' || (typecode)[3]=='H')