Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix for MMWrite (invalid output on array format) #253

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/comments_full.mtx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%GraphBLAS type double
% comments for full.mtx
% this file was created by test_MMRead.c
3 3 9
3 3
.646
.709
.754
Expand Down
14 changes: 12 additions & 2 deletions src/utility/LAGraph_MMWrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,18 @@ int LAGraph_MMWrite
nvals_to_print = nself_edges + (nvals - nself_edges) / 2 ;
}

FPRINTF (f, "%" PRIu64 " %" PRIu64 " %" PRIu64 "\n",
nrows, ncols, nvals_to_print) ;
if (MM_fmt == MM_array)
{
// write `nrows ncols` if the array format is used
FPRINTF (f, "%" PRIu64 " %" PRIu64 "\n",
nrows, ncols) ;
}
else
{
// otherwise write `nrows ncols nvals` for the coordinate format
FPRINTF (f, "%" PRIu64 " %" PRIu64 " %" PRIu64 "\n",
nrows, ncols, nvals_to_print) ;
}

if (nvals_to_print == 0)
{
Expand Down
Loading