Debug mode (Atom-Juno) skipping error during SVD in julia script

Hello julia developers,

I am trying to apply a method called HePPCAT to my data. This method is able to reduce variance in heteroscedastic data by a nonconvex optimization through expectation maximization. During one of the iterations for the optimization, it applies SVD to this specific matrix:

[0.1746182282998856,-0.6171083424122719,-0.10161672920484996,0.24935540726310024,-0.191934958184816],
[-0.7997810719100824,0.02456823952155479,0.2720151519781276,0.15798214648006442,-0.4217722434190048],
[0.05989816411446859,-0.43025210241710476,0.047081075929078606,0.3803838966072425,0.2245628208083081],
[-0.6401040774245556,-0.4569082092456684,0.3092149820236465,0.20689361805972434,-0.43824705986091284],
[0.7680685173276751,-0.07869835787051918,0.2724995883552494,-0.12193999749886392,-0.16880515903501797],
[-0.871439451910555,0.15625348016327426,-0.14944014460690067,-0.007356111791921184,0.14840819770700966],
[0.33517301728128546,-0.014292980852890767,-0.6057724996205377,0.11192548624822127,-0.4388383154146511],
[-0.038457759945819875,0.12597741089885325,0.8011992487371911,-0.48095861136172835,-0.19735872433570106],
[0.4601424596803763,-0.7775768238893597,-0.19115923798732107,-0.14238962302717048,-0.07082751042801942],
[-0.7794516818446141,0.221064038064075,0.0702591390932779,0.22847656015742332,0.2964403412986121],
[-0.2525838125954246,0.18205731456323307,-0.5727909721472904,-0.6058933165976225,-0.10045684382757313],
[-0.809997853278977,-0.2515062942818194,0.0127790806089391,0.12245930701061956,0.21208548065643057],
[0.7514842054996702,-0.32744420239906014,0.309948157065752,0.03367277114243117,0.277354642846169],
[-0.9516895791474432,-0.07528410261375228,-0.09165231915397332,-0.054756592822946475,-0.1517972673549273],
[-0.31844381313213244,-0.7447901723579247,0.004522659951182407,-0.49035816665667475,0.15290250723363427],
[-0.6381855442002474,-0.6109087853693019,-0.03188003130867513,-0.2881562985953268,0.14924373861046605]]

However, during the SVD execution, the script crashes and I get the next error:

LoadError: SingularException(5)
in expression starting at /home/rafa/HePPCAT_on_data_Julia/Modelo_HePPCAT_SVM.jl:34
checknonsingular at factorization.jl:19 [inlined]
checknonsingular at factorization.jl:21 [inlined]
#lu!#146 at lu.jl:82 [inlined]
lu! at lu.jl:81 [inlined]
lu(A::Adjoint{Float64, Matrix{Float64}}, pivot::RowMaximum; check::Bool) at lu.jl:279
lu at lu.jl:278 [inlined]
lu at lu.jl:278 [inlined]
\(A::Adjoint{Float64, Matrix{Float64}}, B::Adjoint{Float64, Matrix{Float64}}) at generic.jl:1142
/(A::Matrix{Float64}, B::Matrix{Float64}) at generic.jl:1150
updateF!(M::HePPCATModel{Float64, Float64}, Y::Vector{Vector{Float64}}, #unused#::HePPCAT.ExpectationMaximization) at updateF.jl:24 <--- SVD execution
heppcat(Y::Vector{Vector{Float64}}, k::Int64, iters::Int64; init::HePPCATModel{Float64, Float64}) at extern.jl:20
heppcat(Y::Vector{Vector{Float64}}, k::Int64, iters::Int64) at extern.jl:17
top-level scope at Modelo_HePPCAT_SVM.jl:53
eval at boot.jl:373 [inlined]
include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) at loading.jl:1196

While debugging, this error does not appear and julia avoid sthe crash, which is strange. I performed SVD on the matrix in python and I was able to obtain a result from the SVD without crashing.

is it possible that Julia modifies the matrix in a certain way, maybe rounding some numbers making it singular, during normal execution mode but this is not applied during debug mode?

I am sharing my data and script to reproduce the error:

I am using julia 1.7.2

thank you!

1 Like

Hi Rafael, did you get any insights into your problem or is it still causing issues?

I still have that issue. However, I have changed the optimization method for one that seems stable.