Skip to content

Inconsistent errors with SparseArray construction (new in 1.2) #32548

@sbromberger

Description

@sbromberger

In 1.1:

julia> a = spzeros(Float64, UInt8, 255, 255)
255×255 SparseMatrixCSC{Float64,UInt8} with 0 stored entries

julia> a = spzeros(Float64, UInt8, 0xff, 0xff)
255×255 SparseMatrixCSC{Float64,UInt8} with 0 stored entries

But in 1.2, there apparently was a change to ensure that the number of nonzero entries could fit:

julia> a = spzeros(Float64, UInt8, 255, 255)
ERROR: ArgumentError: maximal nnz+1 (m*n+1 = 65026) does not fit in Ti = UInt8

However, the check is not applied consistently:

julia> a = spzeros(Float64, UInt8, 0xff, 0xff)
255×255 SparseMatrixCSC{Float64,UInt8} with 0 stored entries

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorsparseSparse arrays

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions