Skip to content

Commit e8428a5

Browse files
committed
remove misuse of dot, v0.6 clean up
1 parent 0da3d97 commit e8428a5

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/Polynomials.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ export Pade, padeval
1515
import Base: start, next, done, length, size, eltype
1616
import Base: endof, getindex, setindex!, copy, zero, one, convert, norm, gcd
1717
import Base: show, print, *, /, //, -, +, ==, isapprox, divrem, div, rem, eltype
18-
import Base: promote_rule, truncate, chop, call, conj, transpose, dot, hash
18+
import Base: promote_rule, truncate, chop, conj, transpose, dot, hash
1919
import Base: isequal
2020

21-
typealias SymbolLike Union{AbstractString,Char,Symbol}
21+
const SymbolLike = Union{AbstractString,Char,Symbol}
2222

2323
"""
2424
@@ -260,9 +260,6 @@ one{T}(::Type{Poly{T}}) = Poly([one(T)])
260260
## Overload arithmetic operators for polynomial operations between polynomials and scalars
261261
*{T<:Number,S}(c::T, p::Poly{S}) = Poly(c * p.a, p.var)
262262
*{T<:Number,S}(p::Poly{S}, c::T) = Poly(p.a * c, p.var)
263-
dot{T<:Number,S}(p::Poly{S}, c::T) = p * c
264-
dot{T<:Number,S}(c::T, p::Poly{S}) = c * p
265-
dot(p1::Poly, p2::Poly) = p1 * p2
266263
/(p::Poly, c::Number) = Poly(p.a / c, p.var)
267264
-(p::Poly) = Poly(-p.a, p.var)
268265
-{T<:Number}(p::Poly, c::T) = +(p, -c)

src/show.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ showone{S}(::Type{Poly{S}}) = false
5050

5151
"Show different operations depending on mimetype. `l-` is leading minus sign."
5252
function showop(::MIME"text/plain", op)
53-
d = Dict("*" => "", "+" => " + ", "-" => " - ", "l-" => "-")
53+
d = Dict("*" => "*", "+" => " + ", "-" => " - ", "l-" => "-")
5454
d[op]
5555
end
5656

test/runtests.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,15 @@ repr(p)
227227

228228
## changes to show
229229
p = Poly([1,2,3,1]) # leading coefficient of 1
230-
@test repr(p) == "Poly(1 + 2x + 3x^2 + x^3)"
230+
@test repr(p) == "Poly(1 + 2*x + 3*x^2 + x^3)"
231231
p = Poly([1.0, 2.0, 3.0, 1.0])
232-
@test repr(p) == "Poly(1.0 + 2.0x + 3.0x^2 + 1.0x^3)"
232+
@test repr(p) == "Poly(1.0 + 2.0*x + 3.0*x^2 + 1.0*x^3)"
233233
p = Poly([1, im])
234-
@test repr(p) == "Poly(1 + imx)"
234+
@test repr(p) == "Poly(1 + im*x)"
235235
p = Poly([1+im, 1-im, -1+im, -1 - im])# minus signs
236-
@test repr(p) == "Poly((1 + 1im) + (1 - 1im)x - (1 - 1im)x^2 - (1 + 1im)x^3)"
236+
@test repr(p) == "Poly((1 + 1im) + (1 - 1im)*x - (1 - 1im)*x^2 - (1 + 1im)*x^3)"
237237
p = Poly([1.0, 0 + NaN*im, NaN, Inf, 0 - Inf*im]) # handle NaN or Inf appropriately
238-
@test repr(p) == "Poly(1.0 + NaN⋅im⋅x + NaNx^2 + Infx^3 - Inf⋅im⋅x^4)"
238+
@test repr(p) == "Poly(1.0 + NaN*im*x + NaN*x^2 + Inf*x^3 - Inf*im*x^4)"
239239

240240
p = Poly([1,2,3])
241241
@test reprmime("text/latex", p) == "\$1 + 2\\cdot x + 3\\cdot x^{2}\$"

0 commit comments

Comments
 (0)