-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove unsupported use of chained type parameters
- Loading branch information
1 parent
79e006b
commit 2e46b1b
Showing
5 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2e46b1b
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.
I'm disturbed by how much code there seems to be in linalg that appears to be entirely untested.
2e46b1b
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.
This was our attempt to mimic triangular dispatch. A lot of the code for special matrix types needs to reason about the type of the container and the type of the matrix element. The signature doesn't make the compiler complain (yet), but it doesn't quite work as expected. @andreasnoack has encountered issues where the type parameter
T
of the container would silently promote (e.g. fromMatrix{Float64}
toMatrix{BigFloat}
), but the declared eltype of the container (S
) doesn't change, and so the kernels had to be rewritten to manually updateS
at runtime.This is a problem that needs to be thought about more carefully. Ref: #8240
2e46b1b
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.
While the syntax is still a little ugly for the moment, you can get triangular dispatch with the trick in #2345. I've had to do a lot of that with Images ever since the transition to incorporating Color.
2e46b1b
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.
The behavior that falls out of an implementation detail of the compiler here is that the
T
inAbstractMatrix{T}
basically has no effect, so on master I don't think this commit changes any functionality. However on my jb/call_constructors branch the implementation changed, and this gives a "T not defined" error, which is why I did this.2e46b1b
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.
@JeffBezanson Thanks for the explanation. Ironically, as @jiahao mentioned, I encountered the problem this Friday without realising the root cause. I have been living in delusion. Probably, I'll have to write inner constructors for all the types to ensure that
T
actually carries information about the element type.@StefanKarpinski There is room for improvement, but I think that the coverage of exported functions in
LinAlg
is decent. However, promotion is a challenge. We try, but it is difficult to cover all corners of possible promotions. Regarding this commit, the wrong assumption thatT
had an effect inAbstractMatrix{T}
has probably not been discovered before because the problematic constructors are rarely used, e.g. when constructing a triangular matrix it is more common to writeTriangular(A, :L)
thanTriangular{Float64,SubArray{Float64,2,Array{Float64,2},(UnitRange{Int64},UnitRange{Int64})},:L,false}(A)
.2e46b1b
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.
This is less bad than I thought it was since it used to accidentally work – I thought it was fundamentally broken and that brokenness simply hadn't been discovered. There's been a fair amount of that sort of thing in the linalg code in the past but it does seem to be much better since you guys have been putting so much work into it.