It could happen if a pivot is zero. CHOLMOD's ldlt is only making
permutations in the symbolic step to reduce fill in. The problem can easily
arise if a random matrix is too sparse, e.g.
julia> A = sprandn(5,5, 0.2);
julia> A = A + A';
julia> b = A*ones(5);
julia> cholfact(A)\b
CHOLMOD warning: not positive definite
5-element Array{Float64,1}:
NaN
NaN
NaN
NaN
Inf
2015-05-27 17:11 GMT-04:00 Eduardo Lenz <[email protected]>:
> OK, I see.
>
> It is really using the LDLt, I will try to find why it is returning the
> NaNs for my matrix.
>
> Thank you very much for your time and knowledge
>
>
>
> On Wednesday, May 27, 2015 at 5:54:20 PM UTC-3, Andreas Noack wrote:
>
>> As I wrote in the first reply: in 0.3 the cholfact function returns the
>> LDLt when the matrix is symmetric but not positive definite, e.g.
>> julia> A = sprandn(5,5, 0.5);
>>
>> julia> A = A + A';
>>
>> julia> b = A*ones(5);
>>
>> julia> cholfact(A)
>>
>> CHOLMOD factor: : 5-by-5
>> scalar types: SuiteSparse_long, real, double
>> simplicial, LDL'.
>> ordering method used: AMD
>> 0:4
>> 1:3
>> 2:0
>> 3:1
>> 4:2
>> col: 0 colcount: 3
>> col: 1 colcount: 3
>> col: 2 colcount: 3
>> col: 3 colcount: 2
>> col: 4 colcount: 1
>> monotonic: 1
>> nzmax 12.
>> col 0: nz 3 start 0 end 3 space 3 free 0:
>> 0: -0.077417
>> 1: 8.3137
>> 3: -0.22451
>> col 1: nz 3 start 3 end 6 space 3 free 0:
>> 1: 6.1217
>> 3: -0.023604
>> 4: 0.33154
>> col 2: nz 3 start 6 end 9 space 3 free 0:
>> 2: -0.82878
>> 3: -0.16901
>> 4: 2.1383
>> col 3: nz 2 start 9 end 11 space 2 free 0:
>> 3: 0.96632
>> 4: -1.1466
>> col 4: nz 1 start 11 end 12 space 1 free 0:
>> 4: 1.8461
>> nz 12 OK
>>
>>
>> julia> cholfact(A)\b
>> 5-element Array{Float64,1}:
>> 1.0
>> 1.0
>> 1.0
>> 1.0
>> 1.0
>>
>> You do have CHOLMOD installed, but in 0.3 it is in a different module.
>> Try Base.LinAlg.CHOLMOD
>>
>> 2015-05-27 16:44 GMT-04:00 Eduardo Lenz <[email protected]>:
>>
>> Sorry for pointing a wrong julia version.
>>>
>>> The matrix is not posdef, so it gives me a (correct) warning and than my
>>> computations return NaN.
>>>
>>> I will take a deeper look, but I really cannot understand why I dont
>>> have CHOLMOD avaliable in a regular
>>> windows install.
>>>
>>> Thanks for your help Andreas !
>>>
>>>
>>> On Wednesday, May 27, 2015 at 5:37:53 PM UTC-3, Andreas Noack wrote:
>>>>
>>>> You are using 0.3.8 and not 0.4. Have you tried cholfact(A)?
>>>>
>>>> 2015-05-27 16:33 GMT-04:00 Eduardo Lenz <[email protected]>:
>>>>
>>>> Just to make it clear...
>>>>> _
>>>>> julia> versioninfo()
>>>>> Julia Version 0.3.8
>>>>> Commit 79599ad (2015-04-30 23:40 UTC)
>>>>> Platform Info:
>>>>> System: Windows (x86_64-w64-mingw32)
>>>>> CPU: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
>>>>> WORD_SIZE: 64
>>>>> BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
>>>>> LAPACK: libopenblas
>>>>> LIBM: libopenlibm
>>>>> LLVM: libLLVM-3.3
>>>>>
>>>>> julia> Base.SparseMatrix.CHOLMOD
>>>>> ERROR: CHOLMOD not defined
>>>>>
>>>>>
>>>>>
>>>>> On Wednesday, May 27, 2015 at 3:25:46 PM UTC-3, Eduardo Lenz wrote:
>>>>>>
>>>>>> Funny... I dont have CHOLMOD installed...but I am using the official
>>>>>> windows installer.. I will try to make a fresh install.
>>>>>>
>>>>>> Thanks Andreas !
>>>>>>
>>>>>> On Wednesday, May 27, 2015 at 2:59:30 PM UTC-3, Andreas Noack wrote:
>>>>>>>
>>>>>>> What do you get when you type Base.SparseMatrix.CHOLMOD.ITypes in
>>>>>>> the terminal?
>>>>>>>
>>>>>>> 2015-05-27 13:56 GMT-04:00 Eduardo Lenz <[email protected]>:
>>>>>>>
>>>>>>>> Thanks Andreas.
>>>>>>>>
>>>>>>>> Indeed ... but I am using 0.4 with ldltfact and it is complaining
>>>>>>>> about the type of the matrix, which is OK.
>>>>>>>>
>>>>>>>> I am realy confused with this error.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wednesday, May 27, 2015 at 2:22:30 PM UTC-3, Andreas Noack wrote:
>>>>>>>>>
>>>>>>>>> In 0.3 the sparse LDLt and Cholesky factorizations are both in the
>>>>>>>>> cholfact function. If the matrix is symmetric, but not positive
>>>>>>>>> definite
>>>>>>>>> the result of cholfact will be an LDLt factorization. In 0.4 the
>>>>>>>>> factorizations have been split into cholfact and ldltfact.
>>>>>>>>>
>>>>>>>>> Den onsdag den 27. maj 2015 kl. 12.34.30 UTC-4 skrev Eduardo Lenz:
>>>>>>>>>>
>>>>>>>>>> Hi.
>>>>>>>>>>
>>>>>>>>>> I am trying to solve a linear system defined by a Symmetric
>>>>>>>>>> sparse matrix. The lufact is working well, but as the matrix is
>>>>>>>>>> symmetric,
>>>>>>>>>> I intend to use ldltfact.
>>>>>>>>>>
>>>>>>>>>> Unfortunately, it is returning the following error:
>>>>>>>>>>
>>>>>>>>>> ERROR: `ldltfact` has no method matching
>>>>>>>>>> ldltfact(::SparseMatrixCSC{Float64,Int64})
>>>>>>>>>>
>>>>>>>>>> but my matrix is reported as
>>>>>>>>>>
>>>>>>>>>> typeof(A)
>>>>>>>>>> SparseMatrixCSC{Float64,Int64}.
>>>>>>>>>>
>>>>>>>>>> Is it an error or Im doing something wrong.
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Eduardo.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>
>>