Mercurial > octave
diff libinterp/dldfcn/amd.cc @ 27081:c0d8ce61c1c9 stable
Always reserve at least 1 element of storage for sparse matrices (bug #56232).
* Sparse.h (SparseRep (void), SparseRep (octave_idx_type n),
SparseRep (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz = 1)):
Rewrite constructors to always create valid d and r pointers with enough
memory for 1 value. Always initialize nzmx to at least 1.
* Sparse.cc (SparseRep::change_length): Check for nz == 0 and change value to 1
so that sparse array always maintains memory for at least one value.
* amd.cc (Famd): Re-write failing BIST test that now works.
* data.cc (Fnzmax): Document that nzmax will always return at least 1.
* sparse.cc (Fspalloc): Document that 1 element will always be allocated.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 08 May 2019 15:18:32 -0700 |
parents | 00f796120a6d |
children | 1a75fca6ad5d |
line wrap: on
line diff
--- a/libinterp/dldfcn/amd.cc Mon May 06 20:25:15 2019 -0700 +++ b/libinterp/dldfcn/amd.cc Wed May 08 15:18:32 2019 -0700 @@ -182,7 +182,7 @@ %!shared A, A2, opts %! A = ones (20, 30); %! A2 = ones (30, 30); -%! + %!testif HAVE_AMD %! assert(amd (A2), [1:30]); %! opts.dense = 25; @@ -190,7 +190,9 @@ %! opts.aggressive = 1; %! assert(amd (A2, opts), [1:30]); +%!testif HAVE_AMD +%! assert (amd ([]), zeros (1,0)) + %!error <S must be a square matrix|was unavailable or disabled> amd (A) %!error amd (A2, 2) -%!error <matrix S is corrupted|was unavailable or disabled> amd ([]) */