Skip to content

Commit d057b8e

Browse files
committed
1 parent 8085047 commit d057b8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+265
-260
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,10 @@ Deprecated or removed
622622
* `a:b` is deprecated for constructing a `StepRange` when `a` and `b` have physical units
623623
(Dates and Times). Use `a:s:b`, where `s = Dates.Day(1)` or `s = Dates.Second(1)`.
624624

625+
* The aliases `Complex32`, `Complex64` and `Complex128` have been deprecated in favor of `Complex{Float16}`,
626+
`Complex{Float32}` and `Complex{Float64}` respectively (#24647).
627+
628+
625629
Command-line option changes
626630
---------------------------
627631

base/array.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ For convenience `dims` may also be passed in variadic form.
384384
385385
# Examples
386386
```jldoctest
387-
julia> ones(Complex128, 2, 3)
387+
julia> ones(Complex{Float64}, 2, 3)
388388
2×3 Array{Complex{Float64},2}:
389389
1.0+0.0im 1.0+0.0im 1.0+0.0im
390390
1.0+0.0im 1.0+0.0im 1.0+0.0im

base/complex.jl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
Complex{T<:Real} <: Number
55
66
Complex number type with real and imaginary part of type `T`.
7-
8-
`Complex32`, `Complex64` and `Complex128` are aliases for
9-
`Complex{Float16}`, `Complex{Float32}` and `Complex{Float64}` respectively.
107
"""
118
struct Complex{T<:Real} <: Number
129
re::T
@@ -28,10 +25,6 @@ julia> im * im
2825
"""
2926
const im = Complex(false, true)
3027

31-
const Complex128 = Complex{Float64}
32-
const Complex64 = Complex{Float32}
33-
const Complex32 = Complex{Float16}
34-
3528
convert(::Type{Complex{T}}, x::Real) where {T<:Real} = Complex{T}(x,0)
3629
convert(::Type{Complex{T}}, z::Complex) where {T<:Real} = Complex{T}(real(z),imag(z))
3730
convert(::Type{T}, z::Complex) where {T<:Real} =
@@ -353,7 +346,7 @@ inv(z::Complex{<:Union{Float16,Float32}}) =
353346
# a + i*b
354347
# p + i*q = ---------
355348
# c + i*d
356-
function /(z::Complex128, w::Complex128)
349+
function /(z::Complex{Float64}, w::Complex{Float64})
357350
a, b = reim(z); c, d = reim(w)
358351
half = 0.5
359352
two = 2.0
@@ -369,7 +362,7 @@ function /(z::Complex128, w::Complex128)
369362
ab <= un*two/ϵ && (a=a*bs; b=b*bs; s=s/bs ) # scale up a,b
370363
cd <= un*two/ϵ && (c=c*bs; d=d*bs; s=s*bs ) # scale up c,d
371364
abs(d)<=abs(c) ? ((p,q)=robust_cdiv1(a,b,c,d) ) : ((p,q)=robust_cdiv1(b,a,d,c); q=-q)
372-
return Complex128(p*s,q*s) # undo scaling
365+
return Complex{Float64}(p*s,q*s) # undo scaling
373366
end
374367
function robust_cdiv1(a::Float64, b::Float64, c::Float64, d::Float64)
375368
r = d/c
@@ -387,7 +380,7 @@ function robust_cdiv2(a::Float64, b::Float64, c::Float64, d::Float64, r::Float64
387380
end
388381
end
389382

390-
function inv(w::Complex128)
383+
function inv(w::Complex{Float64})
391384
c, d = reim(w)
392385
half = 0.5
393386
two = 2.0
@@ -411,7 +404,7 @@ function inv(w::Complex128)
411404
p = r * t
412405
q = -t
413406
end
414-
return Complex128(p*s,q*s) # undo scaling
407+
return Complex{Float64}(p*s,q*s) # undo scaling
415408
end
416409

417410
function ssqs(x::T, y::T) where T<:AbstractFloat

base/deprecated.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,6 +2097,11 @@ end
20972097
@deprecate chol!(x::Number, uplo) chol(x) false
20982098
end
20992099

2100+
# #24647
2101+
@deprecate_binding Complex32 Complex{Float16}
2102+
@deprecate_binding Complex64 Complex{Float32}
2103+
@deprecate_binding Complex128 Complex{Float64}
2104+
21002105
# END 0.7 deprecations
21012106

21022107
# BEGIN 1.0 deprecations

base/essentials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Size, in bytes, of the canonical binary representation of the given DataType `T`
351351
julia> sizeof(Float32)
352352
4
353353
354-
julia> sizeof(Complex128)
354+
julia> sizeof(Complex{Float64})
355355
16
356356
```
357357

base/exports.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ export
4444
Cmd,
4545
Colon,
4646
Complex,
47-
Complex128,
48-
Complex64,
49-
Complex32,
5047
ConjArray,
5148
ConjVector,
5249
ConjMatrix,

base/fastmath.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ issubnormal_fast(x) = false
187187

188188
# complex numbers
189189

190-
ComplexTypes = Union{Complex64, Complex128}
190+
ComplexTypes = Union{Complex{Float32}, Complex{Float64}}
191191

192192
@fastmath begin
193193
abs_fast(x::ComplexTypes) = hypot(real(x), imag(x))

base/inference.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,7 @@ function abstract_call(@nospecialize(f), fargs::Union{Tuple{},Vector{Any}}, argt
24602460
length(argtypes) == 3 && (argtypes[3] Int32 || argtypes[3] Int64)
24612461

24622462
a1 = argtypes[2]
2463-
basenumtype = Union{corenumtype, Main.Base.Complex64, Main.Base.Complex128, Main.Base.Rational}
2463+
basenumtype = Union{corenumtype, Main.Base.Complex{Float32}, Main.Base.Complex{Float64}, Main.Base.Rational}
24642464
if a1 basenumtype
24652465
ftimes = Main.Base.:*
24662466
ta1 = widenconst(a1)
@@ -5249,7 +5249,7 @@ function inlining_pass(e::Expr, sv::OptimizationState, stmts::Vector{Any}, ins,
52495249
triple = (a2 === Int32(3) || a2 === Int64(3))
52505250
if square || triple
52515251
a1 = e.args[2]
5252-
basenumtype = Union{corenumtype, Main.Base.Complex64, Main.Base.Complex128, Main.Base.Rational}
5252+
basenumtype = Union{corenumtype, Main.Base.Complex{Float32}, Main.Base.Complex{Float64}, Main.Base.Rational}
52535253
if isa(a1, basenumtype) || ((isa(a1, Symbol) || isa(a1, Slot) || isa(a1, SSAValue)) &&
52545254
exprtype(a1, sv.src, sv.mod) basenumtype)
52555255
if square

base/linalg/arpack.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ for (T, saupd_name, seupd_name, naupd_name, neupd_name) in
255255
end
256256

257257
for (T, TR, naupd_name, neupd_name) in
258-
((:Complex128, :Float64, :znaupd_, :zneupd_),
259-
(:Complex64, :Float32, :cnaupd_, :cneupd_))
258+
((Complex{Float64}, :Float64, :znaupd_, :zneupd_),
259+
(Complex{Float32}, :Float32, :cnaupd_, :cneupd_))
260260
@eval begin
261261
function naupd(ido, bmat, n, evtype, nev, TOL::Ref{$TR}, resid::Vector{$T}, ncv, v::Matrix{$T}, ldv,
262262
iparam, ipntr, workd::Vector{$T}, workl::Vector{$T}, lworkl,

base/linalg/blas.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ const liblapack = Base.liblapack_name
6565

6666
import ..LinAlg: BlasReal, BlasComplex, BlasFloat, BlasInt, DimensionMismatch, checksquare, axpy!
6767

68+
const Complex64 = Complex{Float32}
69+
const Complex128 = Complex{Float64}
70+
6871
# utility routines
6972
function vendor()
7073
lib = Libdl.dlopen_e(Base.libblas_name)
@@ -169,8 +172,8 @@ function blascopy! end
169172

170173
for (fname, elty) in ((:dcopy_,:Float64),
171174
(:scopy_,:Float32),
172-
(:zcopy_,:Complex128),
173-
(:ccopy_,:Complex64))
175+
(:zcopy_,Complex{Float64}),
176+
(:ccopy_,Complex{Float32}))
174177
@eval begin
175178
# SUBROUTINE DCOPY(N,DX,INCX,DY,INCY)
176179
function blascopy!(n::Integer, DX::Union{Ptr{$elty},StridedArray{$elty}}, incx::Integer, DY::Union{Ptr{$elty},StridedArray{$elty}}, incy::Integer)

0 commit comments

Comments
 (0)