We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a5da4a3 commit 6ed460aCopy full SHA for 6ed460a
3 files changed
examples/check_equivalence.c
@@ -53,7 +53,8 @@ int check_array_equivalence(bsp_array_t array1, bsp_array_t array2) {
53
bsp_array_read(array2, i, value2);
54
55
if (value1 != value2) {
56
- fprintf(stderr, "Array values are not equal.\n");
+ fprintf(stderr, "Array values are not equal. (%zu != %zu)\n", value1,
57
+ value2);
58
return 4;
59
}
60
} else if (mm_type1 == BSP_MM_REAL) {
@@ -62,7 +63,11 @@ int check_array_equivalence(bsp_array_t array1, bsp_array_t array2) {
62
63
64
65
66
+ fprintf(stderr,
67
+ "Array values are not equal. (%.17lg + i%.17lg != %.17lg + "
68
+ "i%.17lg)\n",
69
+ __real__ value1, __imag__ value1, __real__ value2,
70
+ __imag__ value2);
71
72
73
} else if (mm_type1 == BSP_MM_COMPLEX) {
include/binsparse/hdf5_wrapper.h
@@ -96,8 +96,7 @@ void bsp_write_attribute(hid_t f, char* label, char* string) {
96
hid_t strtype = H5Tcopy(H5T_C_S1);
97
H5Tset_size(strtype, strlen(string));
98
H5Tset_cset(strtype, H5T_CSET_UTF8);
99
- hsize_t size = 1;
100
- hid_t dataspace = H5Screate_simple(1, &size, H5P_DEFAULT);
+ hid_t dataspace = H5Screate(H5S_SCALAR);
101
102
hid_t attribute =
103
H5Acreate2(f, label, strtype, dataspace, H5P_DEFAULT, H5P_DEFAULT);
include/binsparse/matrix_market/matrix_market_write.h
@@ -76,16 +76,18 @@ void bsp_mmwrite(char* file_path, bsp_matrix_t matrix) {
76
bsp_array_read(matrix.indices_0, count, i);
77
bsp_array_read(matrix.indices_1, count, j);
78
bsp_array_read(matrix.values, count, value);
79
- fprintf(f, "%zu %zu %lf\n", i + 1, j + 1, value);
+ fprintf(f, "%zu %zu %.17lg\n", i + 1, j + 1, value);
80
} else if (mm_type == BSP_MM_COMPLEX) {
81
+ // TODO: use Tim Davis' trick from SuiteSparse to limit the number of
82
+ // digits printed without reducing accuracy.
83
size_t i, j;
84
double _Complex value;
85
86
87
88
double real_value = 1.0 * value;
89
double complex_value = 1j * value;
- fprintf(f, "%zu %zu %lf %lf\n", i + 1, j + 1, real_value,
90
+ fprintf(f, "%zu %zu %.17lg %.17lg\n", i + 1, j + 1, real_value,
91
complex_value);
92
} else {
93
assert(false);
0 commit comments