A bit. Sparse matrices with stored zeros were mostly an "I know what I'm 
doing" feature until recently. If you're familiar with the CSC data 
structure you can also call the low-level SparseMatrixCSC constructor 
directly:

julia> SparseMatrixCSC(1, 1, [1,2], [1], [0])
1x1 sparse matrix with 1 Int64 entries:
        [1, 1]  =  0


On Thursday, August 25, 2016 at 12:23:02 AM UTC-7, Gabriel Goh wrote:
>
> thats a bit of a hack, tho. Guess I can just target Julia 0.5 and ignore 
> this.
>
> On Thursday, August 25, 2016 at 12:01:03 AM UTC-7, Tony Kelman wrote:
>>
>> 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? 
>>>
>>

Reply via email to