Try
julia> flagval = -123456789
-123456789
julia> A = sparse([1],[1],flagval)
1×1 sparse matrix with 1 Int64 nonzero entries:
[1, 1] = -123456789
julia> A.nzval[A.nzval .== flagval] = 0
0
julia> A
1×1 sparse matrix with 1 Int64 nonzero entries:
[1, 1] = 0
On Wednesday, August 24, 2016 at 11:24:29 PM UTC-7, Gabriel Goh wrote:
>
> Say I want a 1x1 matrix with some structural zeros. Julia 0.4.* gives
>
> julia> sparse([1],[1], 0)
> 1x1 sparse matrix with 0 Int64 entries:
>
> while Julia 0.5 does
>
> julia> sparse([1],[1],0)
> 1×1 sparse matrix with 1 Int64 nonzero entries:
> [1, 1] = 0
>
> the latter behavior is what I prefer, is there a way to emulate it in
> Julia 0.4?
>