Description
Hello, I don`t understand how to make GraphBlass not write implicit zeroes (identity values). I found in the documentation the following:
The entries in the pattern of A can take on any value, including the implicit value, whatever it happens to be. This differs slightly from MATLAB, which always drops all explicit zeros from its sparse matrices. This is a minor difference but it cannot be done in GraphBLAS.
What I should do, if I want to always drop identity values after some operations?
Below there is a simple example of matrix multiplication that generates identity (zero) value.
GrB_Matrix a, b;
GrB_Matrix_new(&a, GrB_INT64, 2, 2);
GrB_Matrix_new(&b,GrB_INT64, 2, 2);
GrB_Matrix_setElement(a, 2, 0, 0);
GrB_Matrix_setElement(a, -2, 0, 1);
GrB_Matrix_setElement(b, 1, 0, 0);
GrB_Matrix_setElement(b, 1, 1, 0);
GrB_Monoid monoid;
GrB_Semiring semiring;
GrB_Monoid_new_INT64(&monoid, GrB_PLUS_INT64, (int64_t) 0);
GrB_Semiring_new(&semiring, monoid, GrB_TIMES_INT64);
GrB_Matrix matrix_new;
GrB_Matrix_new(&matrix_new, GrB_INT64, 2, 2);
GrB_mxm(matrix_new, GrB_NULL, GrB_NULL, semiring, a, b, GrB_NULL);
GxB_print(matrix_new, GxB_SHORT);
The output matrix contains one entry that equal to zero:
...
row: 0 : 1 entries [0:0]
column 0: int64 0
In the real task, I need to use custom types and custom operations, but at first, I want to solve this small problem. Can you help me, please?