GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — Check that imported values have an element for every entry by eriknw · Pull Request #643 · python-graphblas/python-graphblas Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #643 +/- ## ========================================== + Coverage 98.16% 98.75% +0.58% ========================================== Files 105 105 Lines 30578 30670 +92 Branches 3600 3607 +7 ========================================== + Hits 30018 30289 +271 + Misses 327 245 -82 + Partials 233 136 -97 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d4703df to
f11c703
Compare
f11c703 to
2e69171
Compare
2e69171 to
1e9240e
Compare
0e0e155 to
f5d2961
Compare
842d327 to
cdfaec6
Compare
4b91734 to
a8136c3
Compare
a8136c3 to
125101d
Compare
125101d to
3d834e2
Compare
3dc1a1e to
40427e0
Compare
40427e0 to
2c5dff3
Compare
1a09737 to
e023593
Compare
df42073 to
cb05b74
Compare
SuiteSparse compares the byte size of an imported values buffer with the
number of entries, not with the bytes they need (GB_import.c sets
Ax_memsize_for_non_iso to nvals or vlen * vdim), so any buffer of at least
nvals bytes got through and was read past its end:
Vector.ss.import_full(values=np.ones(3), size=5)
built a Vector whose last two values were heap garbage, and so did values
too short for a sub-array dtype, as in
Vector.ss.import_sparse(size=3, indices=[0, 1], values=np.ones(2), dtype="FP64[2]")
Every ss import and pack (sparse, bitmap and full Vectors; csr, csc,
hypercsr, hypercsc, bitmapr, bitmapc, fullr and fullc Matrices, and so
from_dcsr and from_dcsc) now raises
ValueError: values must have 5 or more elements of dtype FP64, not 3
before handing GraphBLAS the buffer. An iso import needs one element.
…lues SuiteSparse:GraphBLAS 10.5.2 fixed the import size check that check_values_size works around: GB_import.c compared the byte size of the values with the number of entries. With check_values_size bypassed, the five short imports tried (import_full, import_sparse of FP64[2], import_bitmapr, and two import_csr) now raise InvalidValue with an empty message on 10.5.2, where 10.5.1 built them from bytes past the end. check_values_size still runs on every version: older ones need it, and its ValueError says what is wrong. Its docstring and the comments of the two test_ss_import_values_size tests now give the versions. Comments only.
Matrix.from_dcsr([0, 1], [0, 1, 2], [0, 1], 1.5, "FP64[2]") gave [[1.5, 1.5], [1.5, 1.5]] without SuiteSparse, and on SuiteSparse raised "values must have 1 or more elements of dtype FP64[2], not 0": its SuiteSparse branch imported the scalar as it was, 8 bytes where one element is 16. It now broadcasts a scalar to one whole element and imports it iso, as from_csr and from_csc do; the same for from_dcsc. check_values_size also says what is wrong in two cases it misreported: - A scalar that does not fill one element of a sub-array dtype, as in Vector.ss.import_full(values=1.5, size=3, dtype="FP64[2]", is_iso=True): "a scalar does not fill one element of dtype FP64[2], of shape (2,)" (it said "not 0"). - Index pointers that give more entries than there are indices, as in import_csr(nrows=1, ncols=3, indptr=[0, 2**62], col_indices=[0], values=[1.0]): "index pointers give 4611686018427387904 entries, more than the number of indices, 1" (it asked for that many values). GraphBLAS rejects such an indptr itself, with an InvalidValue and no message, so the check comes first.
import_fullr(values=1.5, nrows=2, ncols=2) said "a scalar does not fill one element of dtype FP64", though 1.5 is a whole FP64 element and the problem is that four are needed. Keep that message for a scalar shorter than one element of a sub-array dtype. Found by review (r47abc).
cb05b74 to
e464a64
Compare
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.