Dominique,

No problem!  Just so you know, the "inner" sparse constructor (in which the 
column-start and row-index arrays are directly specified) does not check 
the ordering.  However, the higher-level 'outer' constructors, e.g., the 
constructor sparse(is,js,es,m,n) that mimics Matlab syntax, will take care 
of the ordering and catch errors.

-- Steve


On Tuesday, August 23, 2016 at 12:37:38 AM UTC-4, Dominique Orban wrote:
>
> Many thanks, Steve! Unsorted row indices were the issue. I mistakenly 
> assumed that calling sparse() sorted the indices for me.
>
> On Monday, August 22, 2016 at 11:24:19 PM UTC-4, [email protected] 
> wrote:
>>
>> I've been using the cholmod routines recently also in 0.4.6 (Windows 64) 
>> and have never seen this error.  The routine cholmod_check_sparse seems to 
>> be in source code file cholmod_check.c of the SuiteSparse source code, and 
>> it doesn't seem to do much except check that the row indices are in 
>> increasing order for each column and that all indices are in range.  Is it 
>> possible that your matrix has been corrupted and has row indices out of 
>> order or out of range?
>>
>>
>>
>> On Monday, August 22, 2016 at 9:43:59 PM UTC-4, Dominique Orban wrote:
>>>
>>> I'm trying to solve a least-squares problem using sparse QR, but:
>>>
>>> julia> size(A)
>>> (3140,1988)
>>>
>>> julia> nnz(A)
>>> 8510
>>>
>>> julia> size(b)
>>> (3140,)
>>>
>>> julia> typeof(A)
>>> SparseMatrixCSC{Float64,Int64}
>>>
>>> julia> A \ b
>>> ERROR: Base.SparseMatrix.CHOLMOD.CHOLMODException("")
>>>  in convert at sparse/cholmod.jl:867
>>>  in factorize at sparse/linalg.jl:854
>>>  in \ at linalg/generic.jl:326
>>>
>>>
>>> The matrix A is rank deficient, but I don't think that's the source of 
>>> the problem. I get the same exception if I regularize the problem.
>>>
>>> This is with Julia 0.4.6. The relevant portion of sparse/cholmod.jl is:
>>>
>>>  
>>> 856 function convert{Tv<:VTypes}(::Type{Sparse}, A::SparseMatrixCSC{Tv,
>>> SuiteSparse_long}, stype::Integer)
>>>  857     o = allocate_sparse(A.m, A.n, length(A.nzval), true, true, 
>>> stype, Tv)
>>>  858     s = unsafe_load(o.p)
>>>  859     for i = 1:length(A.colptr)
>>>  860         unsafe_store!(s.p, A.colptr[i] - 1, i)
>>>  861     end
>>>  862     for i = 1:length(A.rowval)
>>>  863         unsafe_store!(s.i, A.rowval[i] - 1, i)
>>>  864     end
>>>  865     unsafe_copy!(s.x, pointer(A.nzval), length(A.nzval))
>>>  866
>>>  867     @isok check_sparse(o)
>>>  868
>>>  869     return o
>>>  870 end
>>>
>>>
>>> How can I find out more about what's gone wrong?
>>>
>>

Reply via email to