-
-
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
Deprecate convert(::Type{<:AbstractTriangular}, A::(Diagonal|Bidiagonal)) methods #17723
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…ractTriangular. Remove tests of those convert methods.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,30 +9,30 @@ srand(1) | |
debug && println("Test interconversion between special matrix types") | ||
let a=[1.0:n;] | ||
A=Diagonal(a) | ||
for newtype in [Diagonal, Bidiagonal, SymTridiagonal, Tridiagonal, LowerTriangular, UpperTriangular, Matrix] | ||
for newtype in [Diagonal, Bidiagonal, SymTridiagonal, Tridiagonal, Matrix] | ||
debug && println("newtype is $(newtype)") | ||
@test full(convert(newtype, A)) == full(A) | ||
end | ||
for newtype in [Base.LinAlg.UnitUpperTriangular, Base.LinAlg.UnitLowerTriangular] | ||
@test_throws ArgumentError convert(newtype, A) | ||
@test full(convert(newtype, Diagonal(ones(n)))) == eye(n) | ||
end | ||
|
||
for isupper in (true, false) | ||
debug && println("isupper is $(isupper)") | ||
A=Bidiagonal(a, [1.0:n-1;], isupper) | ||
for newtype in [Bidiagonal, Tridiagonal, isupper ? UpperTriangular : LowerTriangular, Matrix] | ||
for newtype in [Bidiagonal, Tridiagonal, Matrix] | ||
debug && println("newtype is $(newtype)") | ||
@test full(convert(newtype, A)) == full(A) | ||
@test full(newtype(A)) == full(A) | ||
end | ||
@test_throws ArgumentError convert(SymTridiagonal, A) | ||
tritype = isupper ? UpperTriangular : LowerTriangular | ||
@test full(tritype(A)) == full(A) | ||
|
||
A=Bidiagonal(a, zeros(n-1), isupper) #morally Diagonal | ||
for newtype in [Diagonal, Bidiagonal, SymTridiagonal, Tridiagonal, isupper ? UpperTriangular : LowerTriangular, Matrix] | ||
for newtype in [Diagonal, Bidiagonal, SymTridiagonal, Tridiagonal, Matrix] | ||
debug && println("newtype is $(newtype)") | ||
@test full(convert(newtype, A)) == full(A) | ||
@test full(newtype(A)) == full(A) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. likewise here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see the response above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. deleting the tests that cover methods we still have seems unfortunate - I agree some refactoring is in order, but I'd say try to preserve test coverage until the methods themselves are actually modified There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed! Apologies, I just realized I might've misunderstood your original comments. Did you mean to imply that I missed testing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a few lines mimicking the former There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, that's what I meant - the line I commented on would still be relevant for the types you removed from the loop, though the convert tests no longer would because you're deprecating them |
||
end | ||
@test full(tritype(A)) == full(A) | ||
end | ||
|
||
A = SymTridiagonal(a, [1.0:n-1;]) | ||
|
@@ -78,10 +78,6 @@ let a=[1.0:n;] | |
for newtype in [Diagonal, Bidiagonal, Tridiagonal, SymTridiagonal] | ||
@test_throws ArgumentError convert(newtype,A) | ||
end | ||
A = Diagonal(a) | ||
for newtype in [UpperTriangular, LowerTriangular] | ||
@test full(convert(newtype,A)) == full(A) | ||
end | ||
end | ||
|
||
# Binary ops among special types | ||
|
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 line still be tested?
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.
Depends.
Bidiagonal(A)
/convert(Bidiagonal, A)
andMatrix(A)
/convert(Matrix, A)
test essentially the same code path, butTridiagonal(A)
tests a different code path fromconvert(Tridiagonal, A)
. If you feel exercising the latter path is worthwhile, then this line should remain; if not, it should disappear. Thoughts? Thanks!