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

Error in LAPACK.geqrt3! #3114

Closed
bsxfan opened this issue May 15, 2013 · 1 comment
Closed

Error in LAPACK.geqrt3! #3114

bsxfan opened this issue May 15, 2013 · 1 comment

Comments

@bsxfan
Copy link

bsxfan commented May 15, 2013

Julia's QR factorization calls the Linalg.LAPACK wrapper method:

function geqrt3!(A::StridedMatrix{$elty})

As far as I can see, all other the LAPACK wrappers do: chkstride1() on their arguments, but geqrt3!() for some reason does not. Can geqrt3!() somehow handle stride(::Submatrix,1)>1?. The following experiment suggests it cannot. I think geqrt3!() should also do chkstride1().

julia> B = sub(randn(4,2),1:2:3,1:2)
2x2 SubArray of 4x2 Float64 Array:
 -0.621393  -0.352925
 -1.0989     0.841417

julia> C = copy(B)
2x2 Float64 Array:
 -0.621393  -0.352925
 -1.0989     0.841417

julia> strides(B)
(2,4)

julia> strides(C)
(1,2)

julia> LinAlg.LAPACK.geqrt3!(B)
(
2x2 SubArray of 4x2 Float64 Array:
  0.956532  -0.538699
 -1.0989     0.841417,

2x2 Float64 Array:
 1.64963     0.0
 9.93473e44  0.0)

julia> LinAlg.LAPACK.geqrt3!(C)
(
2x2 Float64 Array:
 1.26243   -0.558711
 0.583338   0.721374,

2x2 Float64 Array:
 1.49222  0.0
 0.0      0.0)    

The factorizations differ.

In contrast, the other factorization methods do not accept B, e.g.:

julia> LinAlg.LAPACK.potrf!('U',B)
ERROR: LAPACK: Matrix must have contiguous columns
@andreasnoack
Copy link
Member

The author of that wrapper forgot to write chkstride1. Fixed by a1f72e2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants