Re: [julia-users] Re: chol() more strict in v0.5?

2016-08-08 Thread Andreas Noack
Okay. I did it this time

https://github.com/JuliaLang/Compat.jl/pull/268

On Monday, August 8, 2016 at 6:37:53 PM UTC-4, Giuseppe Ragusa wrote:
>
> Me too! I have been trying to update a package to `v0.5` and I do not 
> really see a clean way to support both 0.4 and 0.5 without an entry like 
> this in Compat.jl. 
>
> On Sunday, August 7, 2016 at 10:02:44 PM UTC+2, Andreas Noack wrote:
>>
>> It would be great with an entry for this in Compat.jl, e.g. something like
>>
>> cholfact(A::HermOrSym, args...) = cholfact(A.data, A.uplo, args...)
>>
>> On Sun, Aug 7, 2016 at 2:44 PM, Chris <7hunde...@gmail.com> wrote:
>>
>>> mmh, could you explain your comment a little more?
>>>
>>> David, thanks for the tip.
>>
>>
>>

Re: [julia-users] Re: chol() more strict in v0.5?

2016-08-08 Thread Giuseppe Ragusa
Me too! I have been trying to update a package to `v0.5` and I do not 
really see a clean way to support both 0.4 and 0.5 without an entry like 
this in Compat.jl. 

On Sunday, August 7, 2016 at 10:02:44 PM UTC+2, Andreas Noack wrote:
>
> It would be great with an entry for this in Compat.jl, e.g. something like
>
> cholfact(A::HermOrSym, args...) = cholfact(A.data, A.uplo, args...)
>
> On Sun, Aug 7, 2016 at 2:44 PM, Chris <7hunde...@gmail.com > 
> wrote:
>
>> mmh, could you explain your comment a little more?
>>
>> David, thanks for the tip.
>
>
>

Re: [julia-users] Re: chol() more strict in v0.5?

2016-08-07 Thread Andreas Noack
It would be great with an entry for this in Compat.jl, e.g. something like

cholfact(A::HermOrSym, args...) = cholfact(A.data, A.uplo, args...)

On Sun, Aug 7, 2016 at 2:44 PM, Chris <7hunderstr...@gmail.com> wrote:

> mmh, could you explain your comment a little more?
>
> David, thanks for the tip.


[julia-users] Re: chol() more strict in v0.5?

2016-08-07 Thread Chris
mmh, could you explain your comment a little more? 

David, thanks for the tip.

[julia-users] Re: chol() more strict in v0.5?

2016-08-04 Thread mmh
In matlab i always add a little nugget to the diagonal to stabilize the 
cholesky

On Thursday, August 4, 2016 at 10:15:49 AM UTC-4, Chris wrote:
>
> The reasoning makes sense to me, it's just a minor annoyance to have it 
> fail due to rounding errors, essentially. I think going further "upstream" 
> in my code and enforcing symmetry more explicitly will ultimately lead to 
> cleaner code anyway. Thanks.



[julia-users] Re: chol() more strict in v0.5?

2016-08-04 Thread Chris
The reasoning makes sense to me, it's just a minor annoyance to have it fail 
due to rounding errors, essentially. I think going further "upstream" in my 
code and enforcing symmetry more explicitly will ultimately lead to cleaner 
code anyway. Thanks.

[julia-users] Re: chol() more strict in v0.5?

2016-08-03 Thread Andreas Noack
Yes. We are stricter now. LAPACK doesn't check for symmetry at all which we 
used to mimic. It might seem pedantic but it will capture programming 
errors and it is more in line with how check things elsewhere and it's in 
line with the behavior for the sparse Cholesky. For now, you'd need to use 
the Symmetric wrapper but ideally we'd have more operations returning 
Symmetric in the future, e.g. cov.

On Tuesday, August 2, 2016 at 8:49:22 AM UTC-4, Chris wrote:
>
> I ran into this issue when some of my unit tests failed on the v0.5 
> release candidate. This example illustrates it:
>
> v0.4:
>_   _ _(_)_ |  A fresh approach to technical computing
>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>_ _   _| |_  __ _   |  Type "?help" for help.
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.4.6 (2016-06-19 17:16 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
> |__/   |  x86_64-w64-mingw32
>
> julia> a = cov(rand(1000,6));
>
> julia> chol(inv(a))
> 6x6 UpperTriangular{Float64,Array{Float64,2}}:
>  3.58638  -0.0476413  -0.208862   0.0448371  -0.1271090.163736
>  0.0   3.5431 -0.0297272  0.1167 -0.0598619  -0.105655
>  0.0   0.0 3.456670.0493362   0.0118136  -0.00615045
>  0.0   0.0 0.03.36366 0.0491131   0.146946
>  0.0   0.0 0.00.0 3.52767-0.0148549
>  0.0   0.0 0.00.0 0.0 3.52757
>
> v0.5:
>_   _ _(_)_ |  A fresh approach to technical computing
>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>_ _   _| |_  __ _   |  Type "?help" for help.
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.5.0-rc0+0 (2016-07-26 20:22 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
> |__/   |  x86_64-w64-mingw32
>
> julia> a = cov(rand(1000,6));
>
> julia> chol(inv(a))
> ERROR: ArgumentError: matrix is not symmetric/Hermitian. This error can be 
> avoided by calling chol(Hermitian(A)) which will ignore either the upper or 
> lower triangle of the matrix.
>  in chol(::Array{Float64,2}) at .\linalg\cholesky.jl:156
>
> julia> b = inv(a);
>
> julia> maximum(b'-b)
> 1.1102230246251565e-16
>
> I know an example using rand() is not ideal, but the behavior is pretty 
> consistent. I tracked the difference down to here 
> :
>  
> basically, in v0.5 there is an explicit check for a Hermitian matrix using 
> ishermitian(), whereas in v0.4, chol() just uses the `info` output 
> parameter from LAPACK.potrf!(). Calling potrf!() on the matrix `b` above 
> returns a zero for info, meaning the execution completed successfully. So, 
> it seems the ishermtian check for symmetry is stricter than LAPACK's.
>
> This is not necessarily a problem, but I run into this kind of issue 
> frequently in my code, and I'm wondering what the best way forward is. I 
> could wrap every chol() argument with Hermitian to ensure it's exactly 
> symmetric, but then I lose a guard against more sinister bugs, since it 
> will force any matrix to be Hermitian. Thoughts? Is the explicit 
> ishermitian check necessary?
>