GraphBLAS / graphblas-api-c

Other
7 stars 3 forks source link

BB-31: Pretty printing #17

Open mcmillan03 opened 2 years ago

mcmillan03 commented 2 years ago

GxB_Type_fprint print and check a GrB_Type GxB_UnaryOp_fprint print and check a GrB_UnaryOp GxB_BinaryOp_fprint print and check a GrB_BinaryOp GxB_Monoid_fprint print and check a GrB_Monoid GxB_Semiring_fprint print and check a GrB_Semiring GxB_Descriptor_fprint print and check a GrB_Descriptor GxB_Matrix_fprint print and check a GrB_Matrix GxB_Vector_fprint print and check a GrB_Vector GxB_fprint print/check any object to a file GxB_print print/check any object to stdout

These methods do not modify the status of any object. If a matrix or vector has not been completed, the pending computations are guaranteed to {\em not} be performed.

Output is defined by the implementation. Printing nothing is a valid option (like GrB_error).

tgmattso commented 2 years ago

Can we have GrB_fprintf() that takes a valid C format string and a GraphBLAS object and it will output a reasonable implementation defined message to an input file descriptor?

DrTimothyAldenDavis commented 2 years ago

Tim M: I'm not sure I understand your question. This can't be done with a simple C printf format string.

What I'm asking here is a way for the user to ask the library to print the contents of their matrix, vector, or scalar. This is a common thing when trying to write an algorithm that uses GraphBLAS ... the algo. developer wants to see what the computations did to the matrix.

The alternative is to write a pretty-print in LAGraph, using (say) GrB_Matrix_export. However, this is such a common thing that anyone would want to do with any library, that I think it should be added to the spec.

The output to stdout or a FILE *, would be implementation-defined. If it likes, a library could choose to print nothing at all and still comply with the spec. The purpose of this output is not to be read back in to compute with, but just for reading by the algorithm developer. So printing nothing at all is an option, I think.