Skip to content

Commit 0a8bff8

Browse files
committed
Survive _goodbuffers test in SparseMatrixCSC constructor
for Julia >=1.7
1 parent d8551f2 commit 0a8bff8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ExtendableSparse"
22
uuid = "95c220a8-a1cf-11e9-0c77-dbfce5f500b3"
33
authors = ["Juergen Fuhrmann <juergen.fuhrmann@wias-berlin.de>"]
4-
version = "0.6.3"
4+
version = "0.6.4"
55

66
[deps]
77
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"

src/sparsematrixlnk.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ function Base.:+(lnk::SparseMatrixLNK{Tv,Ti},csc::SparseMatrixCSC)::SparseMatrix
310310
@assert(csc.m==lnk.m)
311311
@assert(csc.n==lnk.n)
312312

313+
# overallocate arrays in order to avoid
314+
# presumably slower push!
313315
xnnz=nnz(csc)+nnz(lnk)
314316
colptr=Vector{Ti}(undef,csc.n+1)
315317
rowval=Vector{Ti}(undef,xnnz)
@@ -389,6 +391,9 @@ function Base.:+(lnk::SparseMatrixLNK{Tv,Ti},csc::SparseMatrixCSC)::SparseMatrix
389391
end
390392
end
391393
colptr[csc.n+1]=inz
394+
# Julia 1.7 wants this correct
395+
resize!(rowval,inz-1)
396+
resize!(nzval,inz-1)
392397
SparseMatrixCSC{Tv,Ti}(csc.m,csc.n,colptr,rowval,nzval)
393398
end
394399

0 commit comments

Comments
 (0)