-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
matmul: don't assume the existence of type-conversions #14293
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -193,3 +193,20 @@ b = rand(3,3) | |
| @test_throws ArgumentError A_mul_B!(a, a, b) | ||
| @test_throws ArgumentError A_mul_B!(a, b, a) | ||
| @test_throws ArgumentError A_mul_B!(a, a, a) | ||
|
|
||
| # Number types that lack conversion to the destination type (#14293) | ||
| immutable RootInt | ||
| i::Int | ||
| end | ||
| import Base: *, promote_op | ||
| (*)(x::RootInt, y::RootInt) = x.i*y.i | ||
| promote_op(::Base.MulFun, ::Type{RootInt}, ::Type{RootInt}) = Int | ||
|
|
||
| a = [RootInt(3)] | ||
| C = [0] | ||
| A_mul_Bt!(C, a, a) | ||
| @test C[1] == 9 | ||
| a = [RootInt(2),RootInt(10)] | ||
| @test a*a' == [4 20; 20 100] | ||
|
Contributor
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.
oh right this also depends on #13803
Member
Author
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. If you want to backport this, we could add that method (for use by the test).
Contributor
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. without the
Member
Author
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. |
||
| A = [RootInt(3) RootInt(5)] | ||
| @test A*a == [56] | ||
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.
put these in aletor give them issue-number-specific namesnevermind guess it isn't necessary here, the same file is already using these names above