Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some LAPACK glitches #3082

Closed
bsxfan opened this issue May 11, 2013 · 3 comments
Closed

some LAPACK glitches #3082

bsxfan opened this issue May 11, 2013 · 3 comments
Labels
kind:bug Indicates an unexpected problem or unintended behavior

Comments

@bsxfan
Copy link

bsxfan commented May 11, 2013

  • This was already mentioned in closed issue Provide logabsdet(::Matrix)? #3070: a failed cholesky factorization tries to throw PosDefException, but finds it is undefined.

  • Similar problems occur with DimensionMismatch, e.g.:

    julia> lufact(randn(3,3)) \ randn(2)
    ERROR: in getrs!: DimensionMismatch not defined
    
  • Method signatures for \ involving Cholesky and LU differ and thus cause difficulties. In factorization.jl, we have:

    \{T<:BlasFloat}(C::Cholesky{T}, B::StridedVecOrMat{T}) = ...
    

    but

    function (\)(A::LU, B::StridedVecOrMat)    
      ...
    

    Now try:

    julia> cholfact(eye(3)) \ [1,2,3]
    ERROR: no method \(Cholesky{Float64},Array{Int32,1})
    

    but

    julia> lufact(eye(3)) \ [1,2,3]
    ERROR: no method getrs!(Char,Array{Float64,2},Array{Int32,1},Array{Int32,1})
    

    This difference is harmless until you try to extend the applicability of \. For Cholesky, one can do e.g.:

    (\){T<:BlasFloat,S<:Union(Integer,Rational)}(C::Cholesky{T},B::Vector{S}) =
    C\convert(Vector{T},B)
    

But if you try similar for LU, you will just get a stackoverflow, because the signature (\)(A::LU, B::StridedVecOrMat) is too general and will not be invoked after conversion.

@ViralBShah
Copy link
Member

Cc: @jiahao @andreasnoackjensen

The exception stuff is probably due to the recent refactoring of the exceptions code.

@ViralBShah
Copy link
Member

Can this be closed?

@bsxfan
Copy link
Author

bsxfan commented May 16, 2013

OK, I've tried my examples above on the new build. They work now, except for a very minor issue. The error type definitions are now reachable, but some of the error messages in LAPACK are missing, have bad grammar or are misleading. Examples:

julia> lufact(randn(3,3)) \ randn(2)
ERROR: DimensionMismatch("Matrix must be square")

The LHS is square as it should be, but does not match the RHS

julia> cholfact((X->X*X')(randn(3,4)))\randn(2)
ERROR: DimensionMismatch("Left and right hand side does not fit")

maybe this should rather be "Left and right hand sides do not fit"?

julia> qrfact(randn(3,3))\randn(2)
ERROR: DimensionMismatch("")

These are hardly bugs and probably won't bother anyone.

@bsxfan bsxfan closed this as completed May 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants