-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add tests for SubArrays in test/linalg/bunchkaufman.jl #15354
Conversation
It might be better to make individual pull requests for each of the files or maybe a couple and use JuliaLang/LinearAlgebra.jl#299 to track the progress. It's easier to review smaller PRs and since most of the changes probably won't depend on each other it shouldn't cause issues to split them up. |
I agree, edited to reflect your comment. It should be good to go, let's see if Travis agrees. |
Doing the |
Added tests for |
if btype == "Array" | ||
b = b | ||
else | ||
b = sub(a, 1:n, 1:2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be sub(b,
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course! Will fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing it, such that a-> b
makes
@test_approx_eq_eps asym * (bc1\b) b 1000ε
fail with
ERROR: LoadError: MethodError: no method matching reinterpret(::Type{Float32}, ::SubArray{Complex{Float32},2,Array{Complex{Float32},2},Tuple{UnitRange{Int64},UnitRange{Int64}},false}, ::Tuple{Int64,Int64})
Will try to fix it.
Adding the SubArray tests caused https://github.com/JuliaLang/julia/pull/15354/files#diff-be0f75db178315152e44756ee149ffd8R58 to fail for |
Using |
Just one - given #15367, should |
I can change it if it's appropriate, and if there's no reason to restrict it to StridedMatrix, I assume that it is. Is there an easy way to go back to the first commit and change it? I guess I would branch, reset to the commit, make the change, and then merge with my original branch. Is that the way to go? |
You can do See for example: http://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit-in-git |
Perfect, thank you! Edit: I am just wondering: since all of the other functions around it has |
I'm not sure if these work well beyond |
Add tests for SubArrays in test/linalg/bunchkaufman.jl
The use of julia> A = rand(6,5); A = A'*A
5x5 Array{Float64,2}:
2.79981 1.44259 1.9957 2.33348 1.43793
1.44259 1.50449 1.16219 1.20452 1.22158
1.9957 1.16219 1.93965 1.61173 0.964557
2.33348 1.20452 1.61173 1.9936 1.11126
1.43793 1.22158 0.964557 1.11126 1.66233
julia> F = cholfact(A);
julia> v6 = rand(Complex128, 6)
6-element Array{Complex{Float64},1}:
0.485376+0.020852im
0.855035+0.32091im
0.152016+0.935278im
0.78076+0.0182181im
0.954256+0.378917im
0.982591+0.995221im
julia> v5 = sub(v6, 1:5)
5-element SubArray{Complex{Float64},1,Array{Complex{Float64},1},Tuple{UnitRange{Int64}},true}:
0.485376+0.020852im
0.855035+0.32091im
0.152016+0.935278im
0.78076+0.0182181im
0.954256+0.378917im
julia> F\v5
ERROR: DimensionMismatch("new dimensions (2,5) must be consistent with array size 12")
in reinterpret(::Type{Float64}, ::Array{Complex{Float64},1}, ::Tuple{Int64,Int64}) at ./array.jl:94
in \(::Base.LinAlg.Cholesky{Float64,Array{Float64,2}}, ::SubArray{Complex{Float64},1,Array{Complex{Float64},1},Tuple{UnitRange{Int64}},true}) at ./linalg/factorization.jl:27
in eval(::Module, ::Any) at ./boot.jl:243 |
Maybe the original version was correct if we can define |
Well that is obviously not intended. To to be sure, is this something you're working on @timholy or were you just pointing it out? |
Haven't started trying to fix it yet. It was going to get in my way (so I might have fixed it quickly), but then I had to take a step back and think some more. |
Oh, and @andreasnoack: since |
Okay, if I can help let me know. |
Oh, I meant "think some more" about my BIG SCARY problem, not this specific issue. Sorry for the confusion 😄. |
Oh, okay! So the bug is still there? I'm confused, sorry :) |
Yes, AFAIK the bug is still there, and I'm not working on it. |
linalg/bunchkaufman.jl
. Found tiny dispatch bug, asfactorize
didn't dispatch properly forSubArray
s (changedMatrix
->StridedMatrix
).svd.jl
.givens.jl
. Again, at loop overArray
andSubArray
, here for the matrixA
, and vectorx
.SubArray
s seem to pass just fine.