Skip to content

sparse.^0 incorrect #77

Closed
Closed
@tkelman

Description

@tkelman

Sparse matrix to elementwise power of 0 is incorrect, ref https://github.com/JuliaLang/julia/blob/c93ed16a093e33fe9e0de153120c821959641bd2/base/sparse/sparsematrix.jl#L579

In Julia:

julia> sparse(zeros(2,2)).^0
2x2 sparse matrix with 0 Float64 nonzeros:

In Matlab:

>> sparse(zeros(2,2)).^0
ans =
   (1,1)        1
   (2,1)        1
   (1,2)        1
   (2,2)        1

Separate comment, but it would be nice if I got a more descriptive error message (or no error at all) from:

julia> sparse([1 2],[1 2],[1 2])
MethodError(sparse,(
1x2 Array{Int64,2}:
 1  2,

1x2 Array{Int64,2}:
 1  2,

1x2 Array{Int64,2}:
 1  2))

Putting commas or semicolons in fixes things, but that's not particularly obvious to a new user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions