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

UniformScaling: allow writing generic polynomicals with I. #6472

Merged
merged 1 commit into from
Apr 8, 2014

Conversation

StefanKarpinski
Copy link
Sponsor Member

julia> p(x) = x^2 - 2x + I
p (generic function with 1 method)

julia> p(4)
9

julia> p(rand(3,3))
3x3 Array{Float64,2}:
  0.386215   -0.22931    0.0859286
 -0.18856     0.664356  -0.693054
  0.0600554  -0.361883   0.619314

	julia> p(x) = x^2 - 2x + I
	p (generic function with 1 method)

	julia> p(4)
	9

	julia> p(rand(3,3))
	3x3 Array{Float64,2}:
	  0.386215   -0.22931    0.0859286
	 -0.18856     0.664356  -0.693054
	  0.0600554  -0.361883   0.619314
@StefanKarpinski
Copy link
Sponsor Member Author

cc: @JeffBezanson, @andreasnoackjensen, @jiahao, @stevengj, @ViralBShah

@JeffBezanson
Copy link
Sponsor Member

No objections here.

StefanKarpinski added a commit that referenced this pull request Apr 8, 2014
UniformScaling: allow writing generic polynomicals with I.
@StefanKarpinski StefanKarpinski merged commit 10b2d19 into master Apr 8, 2014
@StefanKarpinski StefanKarpinski deleted the sk/unifscal branch April 8, 2014 23:31
@toivoh
Copy link
Contributor

toivoh commented Apr 9, 2014

+1 for UniformScaling + Number = Number, which I take it is the heart of this. (LGTM)

@StefanKarpinski
Copy link
Sponsor Member Author

Yep, that was the change. It's an interesting case because how you "promote" is different for different for different arithmetic operations.

@andreasnoack
Copy link
Member

👍

@jiahao
Copy link
Member

jiahao commented Apr 10, 2014

Also cute:

julia> p(I)
UniformScaling{Int64}(0)

@StefanKarpinski
Copy link
Sponsor Member Author

That is cute.

@toivoh
Copy link
Contributor

toivoh commented Apr 10, 2014

It's also a nice sign of consistency. Thanks for bringing it up!

@carlobaldassi
Copy link
Member

Looks like the scope of this type could (should?) be extended to any ring, becoming part of the (informally defined) interface provided by zero, one, +, *. May make sense to call it ScaledUnity at that point?
It also occurs to me that we should define one(::UniformScaling) and companions, in light of that.

@carlobaldassi
Copy link
Member

(Update: I just added one and zero to UniformScaling, mostly because why not?)

@stevengj stevengj mentioned this pull request Sep 14, 2016
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

Successfully merging this pull request may close these issues.

None yet

6 participants