diff --git a/NEWS.md b/NEWS.md index ca0345653b5300..8c3334d07f451d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -622,6 +622,10 @@ Deprecated or removed * `a:b` is deprecated for constructing a `StepRange` when `a` and `b` have physical units (Dates and Times). Use `a:s:b`, where `s = Dates.Day(1)` or `s = Dates.Second(1)`. + * The aliases `Complex32`, `Complex64` and `Complex128` have been deprecated in favor of `Complex{Float16}`, + `Complex{Float32}` and `Complex{Float64}` respectively (#TODO). + + Command-line option changes --------------------------- diff --git a/base/array.jl b/base/array.jl index 4a49a373aaacb7..d229d026abb09b 100644 --- a/base/array.jl +++ b/base/array.jl @@ -384,7 +384,7 @@ For convenience `dims` may also be passed in variadic form. # Examples ```jldoctest -julia> ones(Complex128, 2, 3) +julia> ones(Complex{Float64}, 2, 3) 2×3 Array{Complex{Float64},2}: 1.0+0.0im 1.0+0.0im 1.0+0.0im 1.0+0.0im 1.0+0.0im 1.0+0.0im diff --git a/base/complex.jl b/base/complex.jl index 2df484cf130f45..05d5d0d1253d43 100644 --- a/base/complex.jl +++ b/base/complex.jl @@ -4,9 +4,6 @@ Complex{T<:Real} <: Number Complex number type with real and imaginary part of type `T`. - -`Complex32`, `Complex64` and `Complex128` are aliases for -`Complex{Float16}`, `Complex{Float32}` and `Complex{Float64}` respectively. """ struct Complex{T<:Real} <: Number re::T @@ -28,10 +25,6 @@ julia> im * im """ const im = Complex(false, true) -const Complex128 = Complex{Float64} -const Complex64 = Complex{Float32} -const Complex32 = Complex{Float16} - convert(::Type{Complex{T}}, x::Real) where {T<:Real} = Complex{T}(x,0) convert(::Type{Complex{T}}, z::Complex) where {T<:Real} = Complex{T}(real(z),imag(z)) convert(::Type{T}, z::Complex) where {T<:Real} = @@ -353,7 +346,7 @@ inv(z::Complex{<:Union{Float16,Float32}}) = # a + i*b # p + i*q = --------- # c + i*d -function /(z::Complex128, w::Complex128) +function /(z::Complex{Float64}, w::Complex{Float64}) a, b = reim(z); c, d = reim(w) half = 0.5 two = 2.0 @@ -369,7 +362,7 @@ function /(z::Complex128, w::Complex128) ab <= un*two/ϵ && (a=a*bs; b=b*bs; s=s/bs ) # scale up a,b cd <= un*two/ϵ && (c=c*bs; d=d*bs; s=s*bs ) # scale up c,d abs(d)<=abs(c) ? ((p,q)=robust_cdiv1(a,b,c,d) ) : ((p,q)=robust_cdiv1(b,a,d,c); q=-q) - return Complex128(p*s,q*s) # undo scaling + return Complex{Float64}(p*s,q*s) # undo scaling end function robust_cdiv1(a::Float64, b::Float64, c::Float64, d::Float64) r = d/c @@ -387,7 +380,7 @@ function robust_cdiv2(a::Float64, b::Float64, c::Float64, d::Float64, r::Float64 end end -function inv(w::Complex128) +function inv(w::Complex{Float64}) c, d = reim(w) half = 0.5 two = 2.0 @@ -411,7 +404,7 @@ function inv(w::Complex128) p = r * t q = -t end - return Complex128(p*s,q*s) # undo scaling + return Complex{Float64}(p*s,q*s) # undo scaling end function ssqs(x::T, y::T) where T<:AbstractFloat diff --git a/base/deprecated.jl b/base/deprecated.jl index 78eabaafc219eb..576f1a70206420 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -2097,6 +2097,10 @@ end @deprecate chol!(x::Number, uplo) chol(x) false end +@deprecate_binding Complex32 Complex{Float16} +@deprecate_binding Complex64 Complex{Float32} +@deprecate_binding Complex128 Complex{Float64} + # END 0.7 deprecations # BEGIN 1.0 deprecations diff --git a/base/essentials.jl b/base/essentials.jl index cc4e01f647709c..71e59d194b072c 100644 --- a/base/essentials.jl +++ b/base/essentials.jl @@ -351,7 +351,7 @@ Size, in bytes, of the canonical binary representation of the given DataType `T` julia> sizeof(Float32) 4 -julia> sizeof(Complex128) +julia> sizeof(Complex{Float64}) 16 ``` diff --git a/base/exports.jl b/base/exports.jl index 84e7e3ed29790d..ad5e51a101d3a1 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -44,9 +44,6 @@ export Cmd, Colon, Complex, - Complex128, - Complex64, - Complex32, ConjArray, ConjVector, ConjMatrix, diff --git a/base/fastmath.jl b/base/fastmath.jl index 9297ea20464998..351dee93564884 100644 --- a/base/fastmath.jl +++ b/base/fastmath.jl @@ -187,7 +187,7 @@ issubnormal_fast(x) = false # complex numbers -ComplexTypes = Union{Complex64, Complex128} +ComplexTypes = Union{Complex{Float32}, Complex{Float64}} @fastmath begin abs_fast(x::ComplexTypes) = hypot(real(x), imag(x)) diff --git a/base/inference.jl b/base/inference.jl index 50e1218edaed33..667babf52767e6 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -2460,7 +2460,7 @@ function abstract_call(@nospecialize(f), fargs::Union{Tuple{},Vector{Any}}, argt length(argtypes) == 3 && (argtypes[3] ⊑ Int32 || argtypes[3] ⊑ Int64) a1 = argtypes[2] - basenumtype = Union{corenumtype, Main.Base.Complex64, Main.Base.Complex128, Main.Base.Rational} + basenumtype = Union{corenumtype, Main.Base.Complex{Float32}, Main.Base.Complex{Float64}, Main.Base.Rational} if a1 ⊑ basenumtype ftimes = Main.Base.:* ta1 = widenconst(a1) @@ -5249,7 +5249,7 @@ function inlining_pass(e::Expr, sv::OptimizationState, stmts::Vector{Any}, ins, triple = (a2 === Int32(3) || a2 === Int64(3)) if square || triple a1 = e.args[2] - basenumtype = Union{corenumtype, Main.Base.Complex64, Main.Base.Complex128, Main.Base.Rational} + basenumtype = Union{corenumtype, Main.Base.Complex{Float32}, Main.Base.Complex{Float64}, Main.Base.Rational} if isa(a1, basenumtype) || ((isa(a1, Symbol) || isa(a1, Slot) || isa(a1, SSAValue)) && exprtype(a1, sv.src, sv.mod) ⊑ basenumtype) if square diff --git a/base/linalg/arpack.jl b/base/linalg/arpack.jl index 4389e122ea43e9..ceb6e7318edaaa 100644 --- a/base/linalg/arpack.jl +++ b/base/linalg/arpack.jl @@ -255,8 +255,8 @@ for (T, saupd_name, seupd_name, naupd_name, neupd_name) in end for (T, TR, naupd_name, neupd_name) in - ((:Complex128, :Float64, :znaupd_, :zneupd_), - (:Complex64, :Float32, :cnaupd_, :cneupd_)) + ((Complex{Float64}, :Float64, :znaupd_, :zneupd_), + (Complex{Float32}, :Float32, :cnaupd_, :cneupd_)) @eval begin function naupd(ido, bmat, n, evtype, nev, TOL::Ref{$TR}, resid::Vector{$T}, ncv, v::Matrix{$T}, ldv, iparam, ipntr, workd::Vector{$T}, workl::Vector{$T}, lworkl, diff --git a/base/linalg/blas.jl b/base/linalg/blas.jl index 186750b7b65027..03fa8a3719e665 100644 --- a/base/linalg/blas.jl +++ b/base/linalg/blas.jl @@ -65,6 +65,9 @@ const liblapack = Base.liblapack_name import ..LinAlg: BlasReal, BlasComplex, BlasFloat, BlasInt, DimensionMismatch, checksquare, axpy! +const Complex64 = Complex{Float32} +const Complex128 = Complex{Float64} + # utility routines function vendor() lib = Libdl.dlopen_e(Base.libblas_name) @@ -169,8 +172,8 @@ function blascopy! end for (fname, elty) in ((:dcopy_,:Float64), (:scopy_,:Float32), - (:zcopy_,:Complex128), - (:ccopy_,:Complex64)) + (:zcopy_,Complex{Float64}), + (:ccopy_,Complex{Float32})) @eval begin # SUBROUTINE DCOPY(N,DX,INCX,DY,INCY) function blascopy!(n::Integer, DX::Union{Ptr{$elty},StridedArray{$elty}}, incx::Integer, DY::Union{Ptr{$elty},StridedArray{$elty}}, incy::Integer) diff --git a/base/linalg/lapack.jl b/base/linalg/lapack.jl index 0475c1fe96c456..e78539a44cf771 100644 --- a/base/linalg/lapack.jl +++ b/base/linalg/lapack.jl @@ -14,6 +14,9 @@ import ..LinAlg: BlasFloat, Char, BlasInt, LAPACKException, using Base: iszero +const Complex64 = Complex{Float32} +const Complex128 = Complex{Float64} + #Generic LAPACK error handlers """ Handle only negative LAPACK error codes diff --git a/base/linalg/linalg.jl b/base/linalg/linalg.jl index 410d81e14a8b43..f6043b63a9041b 100644 --- a/base/linalg/linalg.jl +++ b/base/linalg/linalg.jl @@ -182,9 +182,9 @@ export # Constants I -const BlasFloat = Union{Float64,Float32,Complex128,Complex64} +const BlasFloat = Union{Float64,Float32,Complex{Float64},Complex{Float32}} const BlasReal = Union{Float64,Float32} -const BlasComplex = Union{Complex128,Complex64} +const BlasComplex = Union{Complex{Float64},Complex{Float32},} if USE_BLAS64 const BlasInt = Int64 diff --git a/base/linalg/qr.jl b/base/linalg/qr.jl index 9057ec7a61b946..6e9d24eb95a088 100644 --- a/base/linalg/qr.jl +++ b/base/linalg/qr.jl @@ -252,7 +252,7 @@ The returned object `F` stores the factorization in a packed format: - if `pivot == Val(true)` then `F` is a [`QRPivoted`](@ref) object, - otherwise if the element type of `A` is a BLAS type ([`Float32`](@ref), [`Float64`](@ref), - `Complex64` or `Complex128`), then `F` is a [`QRCompactWY`](@ref) object, + `Complex{Float32}` or `Complex{Float64}`), then `F` is a [`QRCompactWY`](@ref) object, - otherwise `F` is a [`QR`](@ref) object. diff --git a/base/math.jl b/base/math.jl index 9b4b317cc34ee3..15fb528c9c704f 100644 --- a/base/math.jl +++ b/base/math.jl @@ -969,7 +969,7 @@ for func in (:sin,:cos,:tan,:asin,:acos,:atan,:sinh,:cosh,:tanh,:asinh,:acosh, :atanh,:exp,:exp2,:exp10,:log,:log2,:log10,:sqrt,:lgamma,:log1p) @eval begin $func(a::Float16) = Float16($func(Float32(a))) - $func(a::Complex32) = Complex32($func(Complex64(a))) + $func(a::Complex{Float16}) = Complex{Float16}($func(Complex{Float32}(a))) end end diff --git a/base/random/normal.jl b/base/random/normal.jl index 8f816867afbd7b..649abb3f8f51d3 100644 --- a/base/random/normal.jl +++ b/base/random/normal.jl @@ -24,10 +24,10 @@ from the circularly symmetric complex normal distribution. ```jldoctest julia> rng = MersenneTwister(1234); -julia> randn(rng, Complex128) +julia> randn(rng, Complex{Float64}) 0.6133070881429037 - 0.6376291670853887im -julia> randn(rng, Complex64, (2, 3)) +julia> randn(rng, Complex{Float32}, (2, 3)) 2×3 Array{Complex{Float32},2}: -0.349649-0.638457im 0.376756-0.192146im -0.396334-0.0136413im 0.611224+1.56403im 0.355204-0.365563im 0.0905552+1.31012im diff --git a/base/sparse/cholmod.jl b/base/sparse/cholmod.jl index e68417cad7a367..0325eed02999bf 100644 --- a/base/sparse/cholmod.jl +++ b/base/sparse/cholmod.jl @@ -700,7 +700,7 @@ function sdmult!(A::Sparse{Tv}, transpose::Bool, end @isok ccall((@cholmod_name("sdmult", SuiteSparse_long),:libcholmod), Cint, (Ptr{C_Sparse{Tv}}, Cint, - Ref{Complex128}, Ref{Complex128}, + Ref{Complex{Float64}}, Ref{Complex{Float64}}, Ptr{C_Dense{Tv}}, Ptr{C_Dense{Tv}}, Ptr{UInt8}), A, transpose, α, β, X, Y, common_struct) Y @@ -754,7 +754,7 @@ function factorize_p!(A::Sparse{Tv}, β::Real, F::Factor{Tv}, cmmn::Vector{UInt8 # note that β is passed as a complex number (double beta[2]), # but the CHOLMOD manual says that only beta[0] (real part) is used @isok ccall((@cholmod_name("factorize_p", SuiteSparse_long),:libcholmod), Cint, - (Ptr{C_Sparse{Tv}}, Ref{Complex128}, Ptr{SuiteSparse_long}, Csize_t, + (Ptr{C_Sparse{Tv}}, Ref{Complex{Float64}}, Ptr{SuiteSparse_long}, Csize_t, Ptr{C_Factor{Tv}}, Ptr{UInt8}), A, β, C_NULL, 0, F, cmmn) F @@ -1373,7 +1373,7 @@ See also [`cholfact`](@ref). !!! note This method uses the CHOLMOD library from SuiteSparse, which only supports doubles or complex doubles. Input matrices not of those element types will - be converted to `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex128}` + be converted to `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex{Float64}}` as appropriate. """ cholfact!(F::Factor, A::Union{SparseMatrixCSC{T}, @@ -1426,7 +1426,7 @@ it should be a permutation of `1:size(A,1)` giving the ordering to use !!! note This method uses the CHOLMOD library from SuiteSparse, which only supports doubles or complex doubles. Input matrices not of those element types will - be converted to `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex128}` + be converted to `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex{Float64}}` as appropriate. Many other functions from CHOLMOD are wrapped but not exported from the @@ -1467,7 +1467,7 @@ See also [`ldltfact`](@ref). !!! note This method uses the CHOLMOD library from SuiteSparse, which only supports doubles or complex doubles. Input matrices not of those element types will - be converted to `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex128}` + be converted to `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex{Float64}}` as appropriate. """ ldltfact!(F::Factor, A::Union{SparseMatrixCSC{T}, @@ -1526,7 +1526,7 @@ it should be a permutation of `1:size(A,1)` giving the ordering to use !!! note This method uses the CHOLMOD library from SuiteSparse, which only supports doubles or complex doubles. Input matrices not of those element types will - be converted to `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex128}` + be converted to `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex{Float64}}` as appropriate. Many other functions from CHOLMOD are wrapped but not exported from the diff --git a/base/sparse/cholmod_h.jl b/base/sparse/cholmod_h.jl index ef772bb2f1cefd..a8f4a8c2ef53f7 100644 --- a/base/sparse/cholmod_h.jl +++ b/base/sparse/cholmod_h.jl @@ -16,8 +16,8 @@ const DOUBLE = Int32(0) # all numerical values are double const SINGLE = Int32(1) # all numerical values are float dtyp(::Type{Float32}) = SINGLE dtyp(::Type{Float64}) = DOUBLE -dtyp(::Type{Complex64}) = SINGLE -dtyp(::Type{Complex128}) = DOUBLE +dtyp(::Type{Complex{Float32}}) = SINGLE +dtyp(::Type{Complex{Float64}}) = DOUBLE ## xtype defines the kind of numerical values used: const PATTERN = Int32(0) # pattern only, no numerical values @@ -26,8 +26,8 @@ const COMPLEX = Int32(2) # a complex matrix (ANSI C99 compatible) const ZOMPLEX = Int32(3) # a complex matrix (MATLAB compatible) xtyp(::Type{Float32}) = REAL xtyp(::Type{Float64}) = REAL -xtyp(::Type{Complex64}) = COMPLEX -xtyp(::Type{Complex128}) = COMPLEX +xtyp(::Type{Complex{Float32}}) = COMPLEX +xtyp(::Type{Complex{Float64}}) = COMPLEX ## Scaling modes, selected by the scale input parameter: const SCALAR = Int32(0) # A = s*A @@ -67,7 +67,7 @@ else const ITypes = Union{Int32, Int64} end -const VTypes = Union{Complex128, Float64} +const VTypes = Union{Complex{Float64}, Float64} const VRealTypes = Union{Float64} struct CHOLMODException <: Exception diff --git a/base/sparse/umfpack.jl b/base/sparse/umfpack.jl index c71b6d2b659618..3f59663c12182a 100644 --- a/base/sparse/umfpack.jl +++ b/base/sparse/umfpack.jl @@ -15,6 +15,8 @@ struct MatrixIllConditionedException <: Exception msg::AbstractString end +const Complex128 = Complex{Float64} + function umferror(status::Integer) if status==UMFPACK_OK return @@ -66,7 +68,7 @@ else const UMFITypes = Union{Int32, Int64} end -const UMFVTypes = Union{Float64,Complex128} +const UMFVTypes = Union{Float64,Complex{Float64}} ## UMFPACK @@ -107,7 +109,7 @@ end Compute the LU factorization of a sparse matrix `A`. For sparse `A` with real or complex element type, the return type of `F` is -`UmfpackLU{Tv, Ti}`, with `Tv` = [`Float64`](@ref) or `Complex128` respectively and +`UmfpackLU{Tv, Ti}`, with `Tv` = [`Float64`](@ref) or `Complex{Float64}` respectively and `Ti` is an integer type ([`Int32`](@ref) or [`Int64`](@ref)). The individual components of the factorization `F` can be accessed by indexing: @@ -134,8 +136,8 @@ The relation between `F` and `A` is !!! note `lufact(A::SparseMatrixCSC)` uses the UMFPACK library that is part of SuiteSparse. As this library only supports sparse matrices with [`Float64`](@ref) or - `Complex128` elements, `lufact` converts `A` into a copy that is of type - `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex128}` as appropriate. + `Complex{Float64}` elements, `lufact` converts `A` into a copy that is of type + `SparseMatrixCSC{Float64}` or `SparseMatrixCSC{Complex{Float64}}` as appropriate. """ function lufact(S::SparseMatrixCSC{<:UMFVTypes,<:UMFITypes}) zerobased = S.colptr[1] == 0 @@ -148,11 +150,11 @@ function lufact(S::SparseMatrixCSC{<:UMFVTypes,<:UMFITypes}) end lufact(A::SparseMatrixCSC{<:Union{Float16,Float32},Ti}) where {Ti<:UMFITypes} = lufact(convert(SparseMatrixCSC{Float64,Ti}, A)) -lufact(A::SparseMatrixCSC{<:Union{Complex32,Complex64},Ti}) where {Ti<:UMFITypes} = - lufact(convert(SparseMatrixCSC{Complex128,Ti}, A)) +lufact(A::SparseMatrixCSC{<:Union{Complex{Float16},Complex{Float32}},Ti}) where {Ti<:UMFITypes} = + lufact(convert(SparseMatrixCSC{Complex{Float64},Ti}, A)) lufact(A::Union{SparseMatrixCSC{T},SparseMatrixCSC{Complex{T}}}) where {T<:AbstractFloat} = throw(ArgumentError(string("matrix type ", typeof(A), "not supported. ", - "Try lufact(convert(SparseMatrixCSC{Float64/Complex128,Int}, A)) for ", + "Try lufact(convert(SparseMatrixCSC{Float64/Complex{Float64},Int}, A)) for ", "sparse floating point LU using UMFPACK or lufact(Array(A)) for generic ", "dense LU."))) lufact(A::SparseMatrixCSC) = lufact(float(A)) diff --git a/doc/src/manual/calling-c-and-fortran-code.md b/doc/src/manual/calling-c-and-fortran-code.md index a0ef7744c4b06f..189adb46f2d81b 100644 --- a/doc/src/manual/calling-c-and-fortran-code.md +++ b/doc/src/manual/calling-c-and-fortran-code.md @@ -275,7 +275,7 @@ First, a review of some relevant Julia type terminology: | | | "TypeVar" :: The `T` in the type parameter declaration is referred to as a TypeVar (short for type variable). | | `primitive type` | `Int`, `Float64` | "Primitive Type" :: A type with no fields, but a size. It is stored and defined by-value. | | `struct` | `Pair{Int, Int}` | "Struct" :: A type with all fields defined to be constant. It is defined by-value, and may be stored with a type-tag. | -| | `Complex128` (`isbits`) | "Is-Bits" :: A `primitive type`, or a `struct` type where all fields are other `isbits` types. It is defined by-value, and is stored without a type-tag. | +| | `Complex{Float64}` (`isbits`) | "Is-Bits" :: A `primitive type`, or a `struct` type where all fields are other `isbits` types. It is defined by-value, and is stored without a type-tag. | | `struct ...; end` | `nothing` | "Singleton" :: a Leaf Type or Struct with no fields. | | `(...)` or `tuple(...)` | `(1, 2, 3)` | "Tuple" :: an immutable data-structure similar to an anonymous struct type, or a constant array. Represented as either an array or a struct. | @@ -292,11 +292,11 @@ same: Exactly corresponds to the `double` type in C (or `REAL*8` in Fortran). - * `Complex64` + * `Complex{Float32}` Exactly corresponds to the `complex float` type in C (or `COMPLEX*8` in Fortran). - * `Complex128` + * `Complex{Float64}` Exactly corresponds to the `complex double` type in C (or `COMPLEX*16` in Fortran). @@ -350,8 +350,8 @@ an `Int` in Julia). | `uintmax_t` |   | `Cuintmax_t` | `UInt64` | | `float` | `REAL*4i` | `Cfloat` | `Float32` | | `double` | `REAL*8` | `Cdouble` | `Float64` | -| `complex float` | `COMPLEX*8` | `Complex64` | `Complex{Float32}` | -| `complex double` | `COMPLEX*16` | `Complex128` | `Complex{Float64}` | +| `complex float` | `COMPLEX*8` | `Complex{Float32}` | `Complex{Float32}` | +| `complex double` | `COMPLEX*16` | `Complex{Float64}` | `Complex{Float64}` | | `ptrdiff_t` |   | `Cptrdiff_t` | `Int` | | `ssize_t` |   | `Cssize_t` | `Int` | | `size_t` |   | `Csize_t` | `UInt` | diff --git a/doc/src/stdlib/linalg.md b/doc/src/stdlib/linalg.md index cb2aa8236a5662..8132438df72499 100644 --- a/doc/src/stdlib/linalg.md +++ b/doc/src/stdlib/linalg.md @@ -189,7 +189,7 @@ linear algebra routines it is useful to call the BLAS functions directly. `Base.LinAlg.BLAS` provides wrappers for some of the BLAS functions. Those BLAS functions that overwrite one of the input arrays have names ending in `'!'`. Usually, a BLAS function has -four methods defined, for [`Float64`](@ref), [`Float32`](@ref), `Complex128`, and `Complex64` arrays. +four methods defined, for [`Float64`](@ref), [`Float32`](@ref), `Complex{Float64}`, and `Complex{Float32}` arrays. ### [BLAS Character Arguments](@id stdlib-blas-chars) Many BLAS functions accept arguments that determine whether to transpose an argument (`trans`), @@ -274,7 +274,7 @@ Base.LinAlg.I Those functions that overwrite one of the input arrays have names ending in `'!'`. Usually a function has 4 methods defined, one each for [`Float64`](@ref), [`Float32`](@ref), -`Complex128` and `Complex64` arrays. +`Complex{Float64}` and `Complex{Float32}` arrays. Note that the LAPACK API provided by Julia can and will change in the future. Since this API is not user-facing, there is no commitment to support/deprecate this specific set of functions in diff --git a/src/abi_win32.cpp b/src/abi_win32.cpp index 9f64a0a0df8fc6..cc2cef066093ed 100644 --- a/src/abi_win32.cpp +++ b/src/abi_win32.cpp @@ -42,7 +42,7 @@ struct ABI_Win32Layout : AbiLayout { bool use_sret(jl_datatype_t *dt) override { // Use sret if the size of the argument is not one of 1, 2, 4, 8 bytes - // This covers the special case of Complex64 + // This covers the special case of Complex{Float32} size_t size = jl_datatype_size(dt); if (size == 1 || size == 2 || size == 4 || size == 8) return false; diff --git a/src/common_symbols2.inc b/src/common_symbols2.inc index 9fd6d0c8aac4c5..9c8c512b1175df 100644 --- a/src/common_symbols2.inc +++ b/src/common_symbols2.inc @@ -36,8 +36,6 @@ jl_symbol("name"), jl_symbol("<="), jl_symbol("or_int"), jl_symbol("similar"), -jl_symbol("Complex64"), -jl_symbol("Complex128"), jl_symbol("isempty"), jl_symbol("#print_to_string#227"), jl_symbol("pointer"), diff --git a/stdlib/SharedArrays/test/runtests.jl b/stdlib/SharedArrays/test/runtests.jl index 249e0cdc1500d3..cccd9755fe239e 100644 --- a/stdlib/SharedArrays/test/runtests.jl +++ b/stdlib/SharedArrays/test/runtests.jl @@ -186,7 +186,7 @@ d = SharedArrays.shmem_fill(1.0, dims) # similar d = SharedArrays.shmem_rand(dims) -@test size(similar(d, Complex128)) == dims +@test size(similar(d, Complex{Float64})) == dims @test size(similar(d, dims)) == dims # issue #6362 diff --git a/test/bitarray.jl b/test/bitarray.jl index 4700eec1e7a176..dfdb79b292f482 100644 --- a/test/bitarray.jl +++ b/test/bitarray.jl @@ -857,7 +857,7 @@ timesofar("unary arithmetic") for (x1,t1) = [(f1, Float64), (ci1, Complex{Int}), (cu1, Complex{UInt8}), - (cf1, Complex128)] + (cf1, Complex{Float64})] @check_bit_operation broadcast(+, x1, b2) Matrix{t1} @check_bit_operation broadcast(-, x1, b2) Matrix{t1} @check_bit_operation broadcast(*, x1, b2) Matrix{t1} @@ -883,9 +883,9 @@ timesofar("unary arithmetic") @check_bit_operation broadcast(div, f1, b2) Matrix{Float64} @check_bit_operation broadcast(mod, f1, b2) Matrix{Float64} - @check_bit_operation broadcast(/, ci1, b2) Matrix{Complex128} - @check_bit_operation broadcast(/, cu1, b2) Matrix{Complex128} - @check_bit_operation broadcast(/, cf1, b2) Matrix{Complex128} + @check_bit_operation broadcast(/, ci1, b2) Matrix{Complex{Float64}} + @check_bit_operation broadcast(/, cu1, b2) Matrix{Complex{Float64}} + @check_bit_operation broadcast(/, cf1, b2) Matrix{Complex{Float64}} b2 = bitrand(n1, n2) @check_bit_operation broadcast(^, false, b2) BitMatrix @@ -897,8 +897,8 @@ timesofar("unary arithmetic") @check_bit_operation broadcast(^, 1, b2) Matrix{Int} @check_bit_operation broadcast(^, 0.0, b2) Matrix{Float64} @check_bit_operation broadcast(^, 1.0, b2) Matrix{Float64} - @check_bit_operation broadcast(^, 0.0im, b2) Matrix{Complex128} - @check_bit_operation broadcast(^, 1.0im, b2) Matrix{Complex128} + @check_bit_operation broadcast(^, 0.0im, b2) Matrix{Complex{Float64}} + @check_bit_operation broadcast(^, 1.0im, b2) Matrix{Complex{Float64}} @check_bit_operation broadcast(^, 0im, b2) Matrix{Complex{Int}} @check_bit_operation broadcast(^, 1im, b2) Matrix{Complex{Int}} @check_bit_operation broadcast(^, 0x0*im, b2) Matrix{Complex{UInt8}} @@ -976,17 +976,17 @@ timesofar("unary arithmetic") @check_bit_operation broadcast(+, b1, ci2) Matrix{Complex{Int}} @check_bit_operation broadcast(-, b1, ci2) Matrix{Complex{Int}} @check_bit_operation broadcast(*, b1, ci2) Matrix{Complex{Int}} - @check_bit_operation broadcast(/, b1, ci2) Matrix{Complex128} + @check_bit_operation broadcast(/, b1, ci2) Matrix{Complex{Float64}} @check_bit_operation broadcast(+, b1, cu2) Matrix{Complex{UInt8}} @check_bit_operation broadcast(-, b1, cu2) Matrix{Complex{UInt8}} @check_bit_operation broadcast(*, b1, cu2) Matrix{Complex{UInt8}} - @check_bit_operation broadcast(/, b1, cu2) Matrix{Complex128} + @check_bit_operation broadcast(/, b1, cu2) Matrix{Complex{Float64}} - @check_bit_operation broadcast(+, b1, cf2) Matrix{Complex128} - @check_bit_operation broadcast(-, b1, cf2) Matrix{Complex128} - @check_bit_operation broadcast(*, b1, cf2) Matrix{Complex128} - @check_bit_operation broadcast(/, b1, cf2) Matrix{Complex128} + @check_bit_operation broadcast(+, b1, cf2) Matrix{Complex{Float64}} + @check_bit_operation broadcast(-, b1, cf2) Matrix{Complex{Float64}} + @check_bit_operation broadcast(*, b1, cf2) Matrix{Complex{Float64}} + @check_bit_operation broadcast(/, b1, cf2) Matrix{Complex{Float64}} @check_bit_operation broadcast(^, b1, false) BitMatrix @check_bit_operation broadcast(^, b1, true) BitMatrix @@ -997,17 +997,17 @@ timesofar("unary arithmetic") @check_bit_operation broadcast(^, b1, -1.0) Matrix{Float64} @check_bit_operation broadcast(^, b1, 0.0) Matrix{Float64} @check_bit_operation broadcast(^, b1, 1.0) Matrix{Float64} - @check_bit_operation broadcast(^, b1, 0.0im) Matrix{Complex128} - @check_bit_operation broadcast(^, b1, 0x0*im) Matrix{Complex128} - @check_bit_operation broadcast(^, b1, 0im) Matrix{Complex128} + @check_bit_operation broadcast(^, b1, 0.0im) Matrix{Complex{Float64}} + @check_bit_operation broadcast(^, b1, 0x0*im) Matrix{Complex{Float64}} + @check_bit_operation broadcast(^, b1, 0im) Matrix{Complex{Float64}} @test_throws DomainError broadcast(^, b1, -1) b1 = trues(n1, n2) - @check_bit_operation broadcast(^, b1, -1.0im) Matrix{Complex128} - @check_bit_operation broadcast(^, b1, 1.0im) Matrix{Complex128} - @check_bit_operation broadcast(^, b1, -1im) Matrix{Complex128} - @check_bit_operation broadcast(^, b1, 1im) Matrix{Complex128} - @check_bit_operation broadcast(^, b1, 0x1*im) Matrix{Complex128} + @check_bit_operation broadcast(^, b1, -1.0im) Matrix{Complex{Float64}} + @check_bit_operation broadcast(^, b1, 1.0im) Matrix{Complex{Float64}} + @check_bit_operation broadcast(^, b1, -1im) Matrix{Complex{Float64}} + @check_bit_operation broadcast(^, b1, 1im) Matrix{Complex{Float64}} + @check_bit_operation broadcast(^, b1, 0x1*im) Matrix{Complex{Float64}} end end diff --git a/test/ccall.jl b/test/ccall.jl index 2f26ba5fae1e1c..7f78e27edc5091 100644 --- a/test/ccall.jl +++ b/test/ccall.jl @@ -90,12 +90,12 @@ end let a, b, x a = 2.84 + 5.2im - x = ccall((:cgtest, libccalltest), Complex128, (Complex128,), a) + x = ccall((:cgtest, libccalltest), Complex{Float64}, (Complex{Float64},), a) @test x == a + 1 - 2im b = [a] # Make sure the array is alive during unsafe_load - x = unsafe_load(ccall((:cgptest, libccalltest), Ptr{Complex128}, (Ptr{Complex128},), b)) + x = unsafe_load(ccall((:cgptest, libccalltest), Ptr{Complex{Float64}}, (Ptr{Complex{Float64}},), b)) @test x == a + 1 - 2im @test a == 2.84 + 5.2im @@ -104,12 +104,12 @@ end let a, b, x a = 3.34f0 + 53.2f0im - x = ccall((:cftest, libccalltest), Complex64, (Complex64,), a) + x = ccall((:cftest, libccalltest), Complex{Float32}, (Complex{Float32},), a) @test x == a + 1 - 2im b = [a] # Make sure the array is alive during unsafe_load - x = unsafe_load(ccall((:cfptest, libccalltest), Ptr{Complex64}, (Ptr{Complex64},), b)) + x = unsafe_load(ccall((:cfptest, libccalltest), Ptr{Complex{Float32}}, (Ptr{Complex{Float32}},), b)) @test x == a + 1 - 2im @test a == 3.34f0 + 53.2f0im @@ -405,10 +405,10 @@ test_struct10(Struct10) test_struct10(Struct10I) mutable struct Struct11 - x::Complex64 + x::Complex{Float32} end struct Struct11I - x::Complex64 + x::Complex{Float32} end function test_struct11(::Type{Struct}) where {Struct} @@ -427,12 +427,12 @@ test_struct11(Struct11) test_struct11(Struct11I) mutable struct Struct12 - x::Complex64 - y::Complex64 + x::Complex{Float32} + y::Complex{Float32} end struct Struct12I - x::Complex64 - y::Complex64 + x::Complex{Float32} + y::Complex{Float32} end function test_struct12(::Type{Struct}) where {Struct} @@ -452,10 +452,10 @@ test_struct12(Struct12) test_struct12(Struct12I) mutable struct Struct13 - x::Complex128 + x::Complex{Float64} end struct Struct13I - x::Complex128 + x::Complex{Float64} end function test_struct13(::Type{Struct}) where {Struct} @@ -761,7 +761,7 @@ s1 = Struct1(352.39422f23, 19.287577) ==(a::Struct1,b::Struct1) = a.x == b.x && a.y == b.y for (t,v) in ((Complex{Int32},:ci32),(Complex{Int64},:ci64), - (Complex64,:cf32),(Complex128,:cf64),(Struct1,:s1)) + (Complex{Float32},:cf32),(Complex{Float64},:cf64),(Struct1,:s1)) fname = Symbol("foo",v) fname1 = Symbol("foo1",v) @eval begin diff --git a/test/complex.jl b/test/complex.jl index e898c1b071c03c..b7749aa9a06c7f 100644 --- a/test/complex.jl +++ b/test/complex.jl @@ -906,12 +906,12 @@ end @test round(float(Complex(π, ℯ)),3) == Complex(3.142, 2.718) end -@testset "Complex32 arithmetic, PR #10003" begin - @test Float16(1)+Float16(1)im === Complex32(1, 1) - @test Float16(1)-Float16(1)im === Float16(1)+Float16(-1)im === Complex32(1, -1) - @test Float16(1)*im === Complex32(im) - @test Float16(1)/im === Complex32(0,-1) - @test Float16(1)^im === Complex32(1) === Float16(1)+Float16(0)im +@testset "Complex{Float16} arithmetic, PR #10003" begin + @test Float16(1)+Float16(1)im === Complex{Float16}(1, 1) + @test Float16(1)-Float16(1)im === Float16(1)+Float16(-1)im === Complex{Float16}(1, -1) + @test Float16(1)*im === Complex{Float16}(im) + @test Float16(1)/im === Complex{Float16}(0,-1) + @test Float16(1)^im === Complex{Float16}(1) === Float16(1)+Float16(0)im end # issue/PR #10148 @@ -961,9 +961,9 @@ end @testset "expm1 type stability" begin x = @inferred expm1(0.1im) - @test x isa Complex128 + @test x isa Complex{Float64} x = @inferred expm1(0.1f0im) - @test x isa Complex64 + @test x isa Complex{Float32} end @testset "array printing with exponent format" begin diff --git a/test/fastmath.jl b/test/fastmath.jl index 274e3c794a8e3c..cbc9221d9a1959 100644 --- a/test/fastmath.jl +++ b/test/fastmath.jl @@ -72,7 +72,7 @@ fm_fast_64_upd(x) = @fastmath (r=x; r+=eps64_2; r+=eps64_2) end end - for T in (Complex64, Complex128, Complex{BigFloat}) + for T in (Complex{Float32}, Complex{Float64}, Complex{BigFloat}) zero = convert(T,0) one = convert(T,1) + im*eps(real(convert(T,1))) two = convert(T,2) + im//10 @@ -139,7 +139,7 @@ end end end @testset "complex arithmetic" begin - for T in (Complex64, Complex128, Complex{BigFloat}) + for T in (Complex{Float32}, Complex{Float64}, Complex{BigFloat}) half = (1+1im)/T(2) third = (1-1im)/T(3) diff --git a/test/inference.jl b/test/inference.jl index c04c6b8c6dcda6..a376911a4e1490 100644 --- a/test/inference.jl +++ b/test/inference.jl @@ -916,19 +916,19 @@ let f(x) = isdefined(x, 2) ? 1 : "" @test Base.return_types(f, (Tuple{Int,},)) == Any[String] end let f(x) = isdefined(x, :re) ? 1 : "" - @test Base.return_types(f, (Complex64,)) == Any[Int] + @test Base.return_types(f, (Complex{Float32},)) == Any[Int] @test Base.return_types(f, (Complex,)) == Any[Int] end let f(x) = isdefined(x, :NonExistentField) ? 1 : "" - @test Base.return_types(f, (Complex64,)) == Any[String] + @test Base.return_types(f, (Complex{Float32},)) == Any[String] @test Union{Int,String} <: Base.return_types(f, (AbstractArray,))[1] end import Core.Inference: isdefined_tfunc -@test isdefined_tfunc(Complex64, Const(())) === Union{} -@test isdefined_tfunc(Complex64, Const(1)) === Const(true) -@test isdefined_tfunc(Complex64, Const(2)) === Const(true) -@test isdefined_tfunc(Complex64, Const(3)) === Const(false) -@test isdefined_tfunc(Complex64, Const(0)) === Const(false) +@test isdefined_tfunc(Complex{Float32}, Const(())) === Union{} +@test isdefined_tfunc(Complex{Float32}, Const(1)) === Const(true) +@test isdefined_tfunc(Complex{Float32}, Const(2)) === Const(true) +@test isdefined_tfunc(Complex{Float32}, Const(3)) === Const(false) +@test isdefined_tfunc(Complex{Float32}, Const(0)) === Const(false) mutable struct SometimesDefined x function SometimesDefined() @@ -1127,7 +1127,7 @@ end push!(constvec, 10) @test @inferred(sizeof_constvec()) == sizeof(Int) * 4 -test_const_return((x)->isdefined(x, :re), Tuple{Complex128}, true) +test_const_return((x)->isdefined(x, :re), Tuple{Complex{Float64}}, true) isdefined_f3(x) = isdefined(x, 3) @test @inferred(isdefined_f3(())) == false @test find_call(first(code_typed(isdefined_f3, Tuple{Tuple{Vararg{Int}}})[1]).code, isdefined, 3) diff --git a/test/linalg/arnoldi.jl b/test/linalg/arnoldi.jl index e6950f32255d44..30050f80ed0358 100644 --- a/test/linalg/arnoldi.jl +++ b/test/linalg/arnoldi.jl @@ -12,8 +12,8 @@ using Test testtol = 1e-6 - @testset for elty in (Float64, Complex128) - if elty == Complex64 || elty == Complex128 + @testset for elty in (Float64, Complex{Float64}) + if elty == Complex{Float32} || elty == Complex{Float64} a = acmplx b = bcmplx else @@ -89,7 +89,7 @@ using Test if elty == Float64 @test_throws ArgumentError eigs(a+a.',which=:SI) @test_throws ArgumentError eigs(a+a.',which=:LI) - @test_throws ArgumentError eigs(a,sigma=rand(Complex64)) + @test_throws ArgumentError eigs(a,sigma=rand(Complex{Float32})) end end end diff --git a/test/linalg/bidiag.jl b/test/linalg/bidiag.jl index 3765c85cd2499e..d9f6f32670f822 100644 --- a/test/linalg/bidiag.jl +++ b/test/linalg/bidiag.jl @@ -156,7 +156,7 @@ srand(1) b += im*convert(Matrix{elty}, rand(1:10, n, 2)) end end - condT = cond(map(Complex128,Tfull)) + condT = cond(map(Complex{Float64},Tfull)) promty = typeof((zero(relty)*zero(relty) + zero(relty)*zero(relty))/one(relty)) if relty != BigFloat x = T.'\c.' @@ -233,7 +233,7 @@ srand(1) @testset "Eigensystems" begin if relty <: AbstractFloat d1, v1 = eig(T) - d2, v2 = eig(map(elty<:Complex ? Complex128 : Float64,Tfull)) + d2, v2 = eig(map(elty<:Complex ? Complex{Float64} : Float64,Tfull)) @test (uplo == :U ? d1 : reverse(d1)) ≈ d2 if elty <: Real Test.test_approx_eq_modphase(v1, uplo == :U ? v2 : v2[:,n:-1:1]) diff --git a/test/linalg/blas.jl b/test/linalg/blas.jl index af92239f48bbc2..03fa4d055b7762 100644 --- a/test/linalg/blas.jl +++ b/test/linalg/blas.jl @@ -4,11 +4,11 @@ import Base.LinAlg, Base.LinAlg.BlasReal, Base.LinAlg.BlasComplex srand(100) ## BLAS tests - testing the interface code to BLAS routines -@testset for elty in [Float32, Float64, Complex64, Complex128] +@testset for elty in [Float32, Float64, Complex{Float32}, Complex{Float64}] @testset "syr2k!" begin U = randn(5,2) V = randn(5,2) - if elty == Complex64 || elty == Complex128 + if elty == Complex{Float32} || elty == Complex{Float64} U = complex.(U, U) V = complex.(V, V) end @@ -20,7 +20,7 @@ srand(100) @test triu(LinAlg.BLAS.syr2k('U','T',U,V)) ≈ triu(U.'*V + V.'*U) end - if elty in (Complex64, Complex128) + if elty in (Complex{Float32}, Complex{Float64}) @testset "her2k!" begin U = randn(5,2) V = randn(5,2) diff --git a/test/linalg/bunchkaufman.jl b/test/linalg/bunchkaufman.jl index 76e1e89ff92c9e..e6f73e78a9726b 100644 --- a/test/linalg/bunchkaufman.jl +++ b/test/linalg/bunchkaufman.jl @@ -19,7 +19,7 @@ a2img = randn(n,n)/2 breal = randn(n,2)/2 bimg = randn(n,2)/2 -@testset "$eltya argument A" for eltya in (Float32, Float64, Complex64, Complex128, Int) +@testset "$eltya argument A" for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) a = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) a2 = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(a2real, a2img) : a2real) asym = a.'+ a # symmetric indefinite @@ -71,7 +71,7 @@ bimg = randn(n,2)/2 end end - @testset "$eltyb argument B" for eltyb in (Float32, Float64, Complex64, Complex128, Int) + @testset "$eltyb argument B" for eltyb in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) b = eltyb == Int ? rand(1:5, n, 2) : convert(Matrix{eltyb}, eltyb <: Complex ? complex.(breal, bimg) : breal) for b in (b, view(b, 1:n, 1:2)) εb = eps(abs(float(one(eltyb)))) @@ -130,7 +130,7 @@ end @testset "test example due to @timholy in PR 15354" begin A = rand(6,5); A = complex(A'*A) # to avoid calling the real-lhs-complex-rhs method F = cholfact(A); - v6 = rand(Complex128, 6) + v6 = rand(Complex{Float64}, 6) v5 = view(v6, 1:5) @test F\v5 == F\v6[1:5] end diff --git a/test/linalg/cholesky.jl b/test/linalg/cholesky.jl index 41b7093f3426ab..95fb2ba169c63a 100644 --- a/test/linalg/cholesky.jl +++ b/test/linalg/cholesky.jl @@ -46,7 +46,7 @@ end breal = randn(n,2)/2 bimg = randn(n,2)/2 - for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int) + for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, BigFloat, Int) a = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) a2 = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(a2real, a2img) : a2real) @@ -73,7 +73,7 @@ end #Test error bound on reconstruction of matrix: LAWNS 14, Lemma 2.1 #these tests were failing on 64-bit linux when inside the inner loop - #for eltya = Complex64 and eltyb = Int. The E[i,j] had NaN32 elements + #for eltya = Complex{Float32} and eltyb = Int. The E[i,j] had NaN32 elements #but only with srand(1234321) set before the loops. E = abs.(apd - r'*r) for i=1:n, j=1:n @@ -138,7 +138,7 @@ end @test cpapd[:P]*cpapd[:L]*cpapd[:U]*cpapd[:P]' ≈ apd end - for eltyb in (Float32, Float64, Complex64, Complex128, Int) + for eltyb in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) b = eltyb == Int ? rand(1:5, n, 2) : convert(Matrix{eltyb}, eltyb <: Complex ? complex.(breal, bimg) : breal) εb = eps(abs(float(one(eltyb)))) ε = max(εa,εb) @@ -253,7 +253,7 @@ end cholfact(Hermitian(apd, :L), Val(true)) \ b r = factorize(apd)[:U] E = abs.(apd - r'*r) - ε = eps(abs(float(one(Complex64)))) + ε = eps(abs(float(one(Complex{Float32})))) n = 10 for i=1:n, j=1:n @test E[i,j] <= (n+1)ε/(1-(n+1)ε)*real(sqrt(apd[i,i]*apd[j,j])) diff --git a/test/linalg/dense.jl b/test/linalg/dense.jl index 954ce9c04af51e..587a6e8e1e39a8 100644 --- a/test/linalg/dense.jl +++ b/test/linalg/dense.jl @@ -18,7 +18,7 @@ srand(1234321) @testset "Matrix condition number" begin ainit = rand(n,n) - @testset "for $elty" for elty in (Float32, Float64, Complex64, Complex128) + @testset "for $elty" for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) ainit = convert(Matrix{elty}, ainit) for a in (copy(ainit), view(ainit, 1:n, 1:n)) @test cond(a,1) ≈ 4.837320054554436e+02 atol=0.01 @@ -37,7 +37,7 @@ a2img = randn(n,n)/2 breal = randn(n,2)/2 bimg = randn(n,2)/2 -@testset "For A containing $eltya" for eltya in (Float32, Float64, Complex64, Complex128, Int) +@testset "For A containing $eltya" for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) ainit = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) ainit2 = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(a2real, a2img) : a2real) ε = εa = eps(abs(float(one(eltya)))) @@ -51,7 +51,7 @@ bimg = randn(n,2)/2 @test isposdef!(copy(apd)) end end - @testset "For b containing $eltyb" for eltyb in (Float32, Float64, Complex64, Complex128, Int) + @testset "For b containing $eltyb" for eltyb in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) binit = eltyb == Int ? rand(1:5, n, 2) : convert(Matrix{eltyb}, eltyb <: Complex ? complex.(breal, bimg) : breal) εb = eps(abs(float(one(eltyb)))) ε = max(εa,εb) @@ -347,7 +347,7 @@ end end @testset "Matrix exponential" begin - @testset "Tests for $elty" for elty in (Float32, Float64, Complex64, Complex128) + @testset "Tests for $elty" for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A1 = convert(Matrix{elty}, [4 2 0; 1 4 1; 1 1 4]) eA1 = convert(Matrix{elty}, [147.866622446369 127.781085523181 127.781085523182; 183.765138646367 183.765138646366 163.679601723179; @@ -415,7 +415,7 @@ end end @testset "Matrix trigonometry" begin - @testset "Tests for $elty" for elty in (Float32, Float64, Complex64, Complex128) + @testset "Tests for $elty" for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A1 = convert(Matrix{elty}, [3 2 0; 1 3 1; 1 1 3]) A2 = convert(Matrix{elty}, [3.975884257819758 0.15631501695814318 -0.4579038628067864; @@ -484,7 +484,7 @@ end end end - @testset "Additional tests for $elty" for elty in (Complex64, Complex128) + @testset "Additional tests for $elty" for elty in (Complex{Float32}, Complex{Float64}) A5 = convert(Matrix{elty}, [1im 2; 0.02+0.5im 3]) @test sincos(A5) == (sin(A5), cos(A5)) @@ -746,7 +746,7 @@ end @testset "Least squares solutions" begin a = [ones(20) 1:20 1:20] b = reshape(eye(8, 5), 20, 2) - @testset "Tests for type $elty" for elty in (Float32, Float64, Complex64, Complex128) + @testset "Tests for type $elty" for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) a = convert(Matrix{elty}, a) b = convert(Matrix{elty}, b) @@ -788,7 +788,7 @@ function test_div_pinv_consistency(a, b) end @testset "/ and \\ consistency with pinv for vectors" begin - @testset "Tests for type $elty" for elty in (Float32, Float64, Complex64, Complex128) + @testset "Tests for type $elty" for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) c = rand(elty, 5) r = rand(elty, 5)' cm = rand(elty, 5, 1) @@ -811,7 +811,7 @@ end end end -@testset "test ops on Numbers for $elty" for elty in [Float32,Float64,Complex64,Complex128] +@testset "test ops on Numbers for $elty" for elty in [Float32,Float64,Complex{Float32},Complex{Float64}] a = rand(elty) @test isposdef(one(elty)) @test lyap(one(elty),a) == -a/2 diff --git a/test/linalg/diagonal.jl b/test/linalg/diagonal.jl index 5319efd7a87428..09f19a48a86afe 100644 --- a/test/linalg/diagonal.jl +++ b/test/linalg/diagonal.jl @@ -30,8 +30,8 @@ srand(1) @testset "Basic properties" begin @test_throws ArgumentError size(D,0) - @test typeof(convert(Diagonal{Complex64},D)) <: Diagonal{Complex64} - @test typeof(convert(AbstractMatrix{Complex64},D)) <: Diagonal{Complex64} + @test typeof(convert(Diagonal{Complex{Float32}},D)) <: Diagonal{Complex{Float32}} + @test typeof(convert(AbstractMatrix{Complex{Float32}},D)) <: Diagonal{Complex{Float32}} @test Array(real(D)) == real(DM) @test Array(abs.(D)) == abs.(DM) @@ -389,7 +389,7 @@ end end @testset "multiplication with Symmetric/Hermitian" begin - for T in (Float64, Complex128) + for T in (Float64, Complex{Float64}) D = Diagonal(randn(T, n)) A = randn(T, n, n); A = A'A S = Symmetric(A) diff --git a/test/linalg/eigen.jl b/test/linalg/eigen.jl index 7e08a700bc9a60..ee1a5e0f404171 100644 --- a/test/linalg/eigen.jl +++ b/test/linalg/eigen.jl @@ -15,7 +15,7 @@ srand(1234321) areal = randn(n,n)/2 aimg = randn(n,n)/2 -@testset for eltya in (Float32, Float64, Complex64, Complex128, Int) +@testset for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) aa = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) asym = aa'+aa # symmetric indefinite apd = aa'*aa # symmetric positive-definite diff --git a/test/linalg/generic.jl b/test/linalg/generic.jl index c79b63ed7e2356..48ebf93c74db14 100644 --- a/test/linalg/generic.jl +++ b/test/linalg/generic.jl @@ -244,7 +244,7 @@ end @test q\qmat ≉ qmat/q end @testset "ops on Numbers" begin - @testset for elty in [Float32,Float64,Complex64,Complex128] + @testset for elty in [Float32,Float64,Complex{Float32},Complex{Float64}] a = rand(elty) @test trace(a) == a @test rank(zero(elty)) == 0 @@ -336,7 +336,7 @@ end @testset "Issue 19035" begin @test Base.LinAlg.promote_leaf_eltypes([1, 2, [3.0, 4.0]]) == Float64 - @test Base.LinAlg.promote_leaf_eltypes([[1,2, [3,4]], 5.0, [6im, [7.0, 8.0]]]) == Complex128 + @test Base.LinAlg.promote_leaf_eltypes([[1,2, [3,4]], 5.0, [6im, [7.0, 8.0]]]) == Complex{Float64} @test [1, 2, 3] ≈ [1, 2, 3] @test [[1, 2], [3, 4]] ≈ [[1, 2], [3, 4]] @test [[1, 2], [3, 4]] ≈ [[1.0-eps(), 2.0+eps()], [3.0+2eps(), 4.0-1e8eps()]] diff --git a/test/linalg/givens.jl b/test/linalg/givens.jl index 92f3216ca002b0..adc98e69b41668 100644 --- a/test/linalg/givens.jl +++ b/test/linalg/givens.jl @@ -3,7 +3,7 @@ using Test # Test givens rotations -@testset for elty in (Float32, Float64, Complex64, Complex128) +@testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) if elty <: Real raw_A = convert(Matrix{elty}, randn(10,10)) else diff --git a/test/linalg/hessenberg.jl b/test/linalg/hessenberg.jl index fad8036024e292..5fbb2f94438230 100644 --- a/test/linalg/hessenberg.jl +++ b/test/linalg/hessenberg.jl @@ -10,7 +10,7 @@ let n = 10 Areal = randn(n,n)/2 Aimg = randn(n,n)/2 - @testset for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int) + @testset for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, BigFloat, Int) A = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? diff --git a/test/linalg/lapack.jl b/test/linalg/lapack.jl index 63cb120a2a7107..13e6e14eccee22 100644 --- a/test/linalg/lapack.jl +++ b/test/linalg/lapack.jl @@ -12,8 +12,8 @@ import Base.LinAlg.BlasInt @testset "syevr" begin guardsrand(123) do Ainit = randn(5,5) - @testset for elty in (Float32, Float64, Complex64, Complex128) - if elty == Complex64 || elty == Complex128 + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) + if elty == Complex{Float32} || elty == Complex{Float64} A = complex.(Ainit, Ainit) else A = Ainit @@ -34,7 +34,7 @@ end @testset "gglse" begin let - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = convert(Array{elty, 2}, [1 1 1 1; 1 3 1 1; 1 -1 3 1; 1 1 1 3; 1 1 1 -1]) c = convert(Array{elty, 1}, [2, 1, 6, 3, 1]) B = convert(Array{elty, 2}, [1 1 1 -1; 1 -1 1 1; 1 1 -1 1]) @@ -80,7 +80,7 @@ end end @testset "geqrt(3)" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) B = copy(A) C,T = LAPACK.geqrt!(A,zeros(elty,10,10)) @@ -90,7 +90,7 @@ end end @testset "gbtrf and gbtrs" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) d = rand(elty,6) dl = rand(elty,5) du = rand(elty,5) @@ -113,7 +113,7 @@ end @testset "geqp3, geqrt error handling" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) @test_throws DimensionMismatch LAPACK.geqlf!(A,zeros(elty,11)) @test_throws DimensionMismatch LAPACK.gelqf!(A,zeros(elty,11)) @@ -128,7 +128,7 @@ end end @testset "gels, gesv, getrs, getri error handling" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) B = rand(elty,11,11) @test_throws DimensionMismatch LAPACK.gels!('N',A,B) @@ -141,7 +141,7 @@ end end @testset "gelsy, gelsd" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) B = rand(elty,10,10) C, j = LAPACK.gelsd!(copy(A),copy(B)) @@ -153,7 +153,7 @@ end end @testset "gglse errors" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) @test_throws DimensionMismatch LAPACK.gglse!(A,zeros(elty,10),rand(elty,12,11),zeros(elty,12)) @test_throws DimensionMismatch LAPACK.gglse!(A,zeros(elty,11),rand(elty,10,10),zeros(elty,10)) @@ -162,7 +162,7 @@ end end @testset "gesvd, ggsvd" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,5) U,S,V = svd(A) lU,lS,lVt = LAPACK.gesvd!('S','S',A) @@ -180,7 +180,7 @@ end end @testset "geevx, ggev errors" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) B = rand(elty,10,10) @test_throws ArgumentError LAPACK.geevx!('M','N','N','N',A) @@ -194,7 +194,7 @@ end end @testset "gebal/gebak" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) * Diagonal(exp10.(linspace(-10,10,10))) B = copy(A) ilo, ihi, scale = LAPACK.gebal!('S',B) @@ -206,7 +206,7 @@ end end @testset "gels" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) X = rand(elty,10) B,Y,z = LAPACK.gels!('N',copy(A),copy(X)) @@ -215,7 +215,7 @@ end end @testset "getrf/getri" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) iA = inv(A) A, ipiv = LAPACK.getrf!(A) @@ -226,7 +226,7 @@ end @testset "geev" begin # complex is easier for now - @testset for elty in (Complex64, Complex128) + @testset for elty in (Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) Aw, Avl, Avr = LAPACK.geev!('N','V',copy(A)) fA = eigfact(A) @@ -236,7 +236,7 @@ end end @testset "gtsv" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) du = rand(elty,9) d = rand(elty,10) dl = rand(elty,9) @@ -252,7 +252,7 @@ end end @testset "gttrs,gttrf errors" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) du = rand(elty,9) d = rand(elty,10) dl = rand(elty,9) @@ -272,7 +272,7 @@ end end @testset "orglq and friends errors" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) A,tau = LAPACK.gelqf!(A) @test_throws DimensionMismatch LAPACK.orglq!(A,tau,11) @@ -350,7 +350,7 @@ end end @testset "sytri, sytrs, and sytrf" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) A = A + A.' #symmetric! B = copy(A) @@ -361,7 +361,7 @@ end end # Rook-pivoting variants - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) A = A + A.' #symmetric! B = copy(A) @@ -388,7 +388,7 @@ end end @testset "hetrf, hetrs" begin - @testset for elty in (Complex64, Complex128) + @testset for elty in (Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) A = A + A' #hermitian! B = copy(A) @@ -411,7 +411,7 @@ end end @testset "trtri & trtrs" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) A = triu(A) B = copy(A) @@ -421,7 +421,7 @@ end end @testset "tgsen, tzrzf, & trsyl" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) Z = zeros(elty,10,10) @test_throws DimensionMismatch LAPACK.tgsen!(zeros(BlasInt,10),Z,zeros(elty,11,11),Z,Z) @test_throws DimensionMismatch LAPACK.tgsen!(zeros(BlasInt,10),Z,Z,zeros(elty,11,11),Z) @@ -432,7 +432,7 @@ end end @testset "sysv" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) guardsrand(123) do A = rand(elty,10,10) A = A + A.' #symmetric! @@ -446,7 +446,7 @@ end end @testset "hesv" begin - @testset for elty in (Complex64, Complex128) + @testset for elty in (Complex{Float32}, Complex{Float64}) guardsrand(935) do A = rand(elty,10,10) A = A + A' #hermitian! @@ -467,7 +467,7 @@ end end @testset "ptsv" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) dv = ones(elty,10) ev = zeros(elty,9) rdv = real(dv) @@ -484,7 +484,7 @@ end end @testset "pttrf and pttrs" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) dv = ones(elty,10) ev = zeros(elty,9) rdv = real(dv) @@ -509,7 +509,7 @@ end end @testset "posv and some errors for friends" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10)/100 A += real(diagm(0 => 10*real(rand(elty,10)))) if elty <: Complex @@ -530,7 +530,7 @@ end end @testset "gesvx" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) B = rand(elty,10,5) C = copy(A) @@ -541,7 +541,7 @@ end end @testset "gees, gges error throwing" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = rand(elty,10,10) B = rand(elty,11,11) @test_throws DimensionMismatch LAPACK.gges!('V','V',A,B) @@ -549,7 +549,7 @@ end end @testset "trrfs & trevc" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) T = triu(rand(elty,10,10)) S = copy(T) select = zeros(Base.LinAlg.BlasInt,10) @@ -570,13 +570,13 @@ end end @testset "laic1" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) @test_throws DimensionMismatch LAPACK.laic1!(1,rand(elty,10),real(rand(elty)),rand(elty,11),rand(elty)) end end @testset "trsen" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) for job in ('N', 'E', 'V', 'B') for c in ('V', 'N') A = convert(Matrix{elty}, [7 2 2 1; 1 5 2 0; 0 3 9 4; 1 1 1 4]) @@ -603,7 +603,7 @@ end end @testset "trexc" begin - @testset for elty in (Float32, Float64, Complex64, Complex128) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) for c in ('V', 'N') A = convert(Matrix{elty}, [7 2 2 1; 1 5 2 0; 0 3 9 4; 1 1 1 4]) T,Q,d = schur(A) diff --git a/test/linalg/lq.jl b/test/linalg/lq.jl index b7c2b2708ecc1c..28b41cb4571dd8 100644 --- a/test/linalg/lq.jl +++ b/test/linalg/lq.jl @@ -24,14 +24,14 @@ bimg = randn(n,2)/2 squareQ(Q::LinAlg.LQPackedQ) = A_mul_B!(Q, eye(eltype(Q), size(Q.factors, 2))) rectangularQ(Q::LinAlg.LQPackedQ) = convert(Array, Q) -@testset for eltya in (Float32, Float64, Complex64, Complex128) +@testset for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}) a = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) a2 = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(a2real, a2img) : a2real) asym = a'+a # symmetric indefinite apd = a'*a # symmetric positive-definite ε = εa = eps(abs(float(one(eltya)))) - @testset for eltyb in (Float32, Float64, Complex64, Complex128, Int) + @testset for eltyb in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) b = eltyb == Int ? rand(1:5, n, 2) : convert(Matrix{eltyb}, eltyb <: Complex ? complex.(breal, bimg) : breal) εb = eps(abs(float(one(eltyb)))) ε = max(εa,εb) diff --git a/test/linalg/lu.jl b/test/linalg/lu.jl index 41d1d2523778b9..f4a6235aa79cfb 100644 --- a/test/linalg/lu.jl +++ b/test/linalg/lu.jl @@ -24,7 +24,7 @@ dlimg = randn(n-1)/2 dreal = randn(n)/2 dimg = randn(n)/2 -@testset for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int) +@testset for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, BigFloat, Int) a = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) d = if eltya == Int @@ -91,7 +91,7 @@ dimg = randn(n)/2 @test lud[:L]*lud[:U] ≈ Array(d)[lud[:p],:] @test AbstractArray(lud) ≈ d end - @testset for eltyb in (Float32, Float64, Complex64, Complex128, Int) + @testset for eltyb in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) b = eltyb == Int ? rand(1:5, n, 2) : convert(Matrix{eltyb}, eltyb <: Complex ? complex.(breal, bimg) : breal) c = eltyb == Int ? rand(1:5, n) : @@ -234,7 +234,7 @@ end end @testset "logdet" begin - @test @inferred(logdet(Complex64[1.0f0 0.5f0; 0.5f0 -1.0f0])) === 0.22314355f0 + 3.1415927f0im + @test @inferred(logdet(Complex{Float32}[1.0f0 0.5f0; 0.5f0 -1.0f0])) === 0.22314355f0 + 3.1415927f0im @test_throws DomainError logdet([1 1; 1 -1]) end diff --git a/test/linalg/matmul.jl b/test/linalg/matmul.jl index 4ceb3b8659be91..5fd6e3a2cc27bc 100644 --- a/test/linalg/matmul.jl +++ b/test/linalg/matmul.jl @@ -14,8 +14,8 @@ using Test @test ones(0,0)*ones(0,0) == zeros(0,0) @test Array{Float64}(5, 0) |> t -> t't == zeros(0,0) @test Array{Float64}(5, 0) |> t -> t*t' == zeros(5,5) - @test Array{Complex128}(5, 0) |> t -> t't == zeros(0,0) - @test Array{Complex128}(5, 0) |> t -> t*t' == zeros(5,5) + @test Array{Complex{Float64}}(5, 0) |> t -> t't == zeros(0,0) + @test Array{Complex{Float64}}(5, 0) |> t -> t*t' == zeros(5,5) end @testset "2x2 matmul" begin AA = [1 2; 3 4] @@ -165,7 +165,7 @@ end @test At_mul_B!(sC, A, B) == A'*B Aim = A .- im - C = zeros(Complex128,8,8) + C = zeros(Complex{Float64},8,8) sC = view(C, 1:2:8, 1:2:8) B = reshape(map(Float64,-9:10),5,4) .+ im @test Ac_mul_B!(sC, Aim, Aim) == Aim'*Aim @@ -213,7 +213,7 @@ end # issue #6450 @test dot(Any[1.0,2.0], Any[3.5,4.5]) === 12.5 -@testset "dot" for elty in (Float32, Float64, Complex64, Complex128) +@testset "dot" for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) x = convert(Vector{elty},[1.0, 2.0, 3.0]) y = convert(Vector{elty},[3.5, 4.5, 5.5]) @test_throws DimensionMismatch dot(x, 1:2, y, 1:3) @@ -260,7 +260,7 @@ end @test_throws ArgumentError Base.LinAlg.copytri!(ones(10,10),'Z') -@testset "gemv! and gemm_wrapper for $elty" for elty in [Float32,Float64,Complex128,Complex64] +@testset "gemv! and gemm_wrapper for $elty" for elty in [Float32,Float64,Complex{Float64},Complex{Float32}] @test_throws DimensionMismatch Base.LinAlg.gemv!(ones(elty,10),'N',rand(elty,10,10),ones(elty,11)) @test_throws DimensionMismatch Base.LinAlg.gemv!(ones(elty,11),'N',rand(elty,10,10),ones(elty,10)) @test Base.LinAlg.gemv!(ones(elty,0),'N',rand(elty,0,0),rand(elty,0)) == ones(elty,0) diff --git a/test/linalg/pinv.jl b/test/linalg/pinv.jl index d8ada553a82d0f..e90da180460ca2 100644 --- a/test/linalg/pinv.jl +++ b/test/linalg/pinv.jl @@ -101,7 +101,7 @@ function test_pinv(a,m,n,tol1,tol2,tol3) @test vecnorm(a*x-b)/vecnorm(b) ≈ 0 atol=tol2 end -@testset for eltya in (Float32, Float64, Complex64, Complex128) +@testset for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}) @testset for (m, n) in [(1000, 100), (100, 100), (100, 1000)] default_tol = (real(one(eltya))) * max(m,n) * 10 tol1 = 1e-2 diff --git a/test/linalg/qr.jl b/test/linalg/qr.jl index 6ef30acf5e8aca..c3fa049f07ccd4 100644 --- a/test/linalg/qr.jl +++ b/test/linalg/qr.jl @@ -23,14 +23,14 @@ bimg = randn(n,2)/2 squareQ(Q::LinAlg.AbstractQ) = A_mul_B!(Q, eye(eltype(Q), size(Q.factors, 1))) rectangularQ(Q::LinAlg.AbstractQ) = convert(Array, Q) -@testset for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int) +@testset for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, BigFloat, Int) raw_a = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) raw_a2 = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(a2real, a2img) : a2real) asym = raw_a' + raw_a # symmetric indefinite apd = raw_a' * raw_a # symmetric positive-definite ε = εa = eps(abs(float(one(eltya)))) - @testset for eltyb in (Float32, Float64, Complex64, Complex128, Int) + @testset for eltyb in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) raw_b = eltyb == Int ? rand(1:5, n, 2) : convert(Matrix{eltyb}, eltyb <: Complex ? complex.(breal, bimg) : breal) εb = eps(abs(float(one(eltyb)))) ε = max(εa, εb) diff --git a/test/linalg/rowvector.jl b/test/linalg/rowvector.jl index 780da554608b9d..f8b66074b9495d 100644 --- a/test/linalg/rowvector.jl +++ b/test/linalg/rowvector.jl @@ -267,7 +267,7 @@ end @test (f20979.(v))[1] == f20979(v[1]) @test f20979.(v) == f20979.(collect(v)) - w = rand(Complex128, 3) + w = rand(Complex{Float64}, 3) @test f20979.(v') == f20979.(collect(v')) == (f20979.(v))' g20979(x, y) = [x[2,1] x[1,2]; y[1,2] y[2,1]] diff --git a/test/linalg/schur.jl b/test/linalg/schur.jl index a5a7b1b2ecc12c..7a25fb289e5f87 100644 --- a/test/linalg/schur.jl +++ b/test/linalg/schur.jl @@ -15,7 +15,7 @@ srand(1234321) areal = randn(n,n)/2 aimg = randn(n,n)/2 -@testset for eltya in (Float32, Float64, Complex64, Complex128, Int) +@testset for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) a = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) asym = a'+a # symmetric indefinite apd = a'*a # symmetric positive-definite diff --git a/test/linalg/svd.jl b/test/linalg/svd.jl index 9ade136c64e226..69ebbef8802d71 100644 --- a/test/linalg/svd.jl +++ b/test/linalg/svd.jl @@ -42,7 +42,7 @@ aimg = randn(n,n)/2 a2real = randn(n,n)/2 a2img = randn(n,n)/2 -@testset for eltya in (Float32, Float64, Complex64, Complex128, Int) +@testset for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) aa = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) aa2 = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(a2real, a2img) : a2real) asym = aa'+aa # symmetric indefinite diff --git a/test/linalg/symmetric.jl b/test/linalg/symmetric.jl index 1c0d04abbf5c9d..395343ed20b14e 100644 --- a/test/linalg/symmetric.jl +++ b/test/linalg/symmetric.jl @@ -30,7 +30,7 @@ end n = 10 areal = randn(n,n)/2 aimg = randn(n,n)/2 - @testset for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int) + @testset for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, BigFloat, Int) a = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal) asym = a.'+a # symmetric indefinite aherm = a'+a # Hermitian indefinite @@ -104,7 +104,7 @@ end end end if eltya <: Complex - typs = [Complex64,Complex128] + typs = [Complex{Float32},Complex{Float64}] for typ in typs @test Symmetric(convert(Matrix{typ},asym)) == convert(Symmetric{typ,Matrix{typ}},Symmetric(asym)) @test Hermitian(convert(Matrix{typ},aherm)) == convert(Hermitian{typ,Matrix{typ}},Hermitian(aherm)) @@ -195,7 +195,7 @@ end if eltya <: Base.LinAlg.BlasComplex @testset "inverse edge case with complex Hermitian" begin # Hermitian matrix, where inv(lufact(A)) generates non-real diagonal elements - for T in (Complex64, Complex128) + for T in (Complex{Float32}, Complex{Float64}) A = T[0.650488+0.0im 0.826686+0.667447im; 0.826686-0.667447im 1.81707+0.0im] H = Hermitian(A) @test inv(H) ≈ inv(A) @@ -435,7 +435,7 @@ end @testset "$HS solver with $RHS RHS - $T" for HS in (Hermitian, Symmetric), RHS in (Hermitian, Symmetric, Diagonal, UpperTriangular, LowerTriangular), - T in (Float64, Complex128) + T in (Float64, Complex{Float64}) D = rand(T, 10, 10); D = D'D A = HS(D) B = RHS(D) @@ -443,7 +443,7 @@ end end @testset "inversion of Hilbert matrix" begin - for T in (Float64, Complex128) + for T in (Float64, Complex{Float64}) H = T[1/(i + j - 1) for i in 1:8, j in 1:8] @test norm(inv(Symmetric(H))*(H*ones(8)) .- 1) ≈ 0 atol = 1e-5 @test norm(inv(Hermitian(H))*(H*ones(8)) .- 1) ≈ 0 atol = 1e-5 diff --git a/test/linalg/triangular.jl b/test/linalg/triangular.jl index b8c7a14d45cd96..82981e4166829d 100644 --- a/test/linalg/triangular.jl +++ b/test/linalg/triangular.jl @@ -14,7 +14,7 @@ debug && println("Test basic type functionality") @test LowerTriangular(randn(3, 3)) |> t -> [size(t, i) for i = 1:3] == [size(Matrix(t), i) for i = 1:3] # The following test block tries to call all methods in base/linalg/triangular.jl in order for a combination of input element types. Keep the ordering when adding code. -for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloat}, Int) +for elty1 in (Float32, Float64, BigFloat, Complex{Float32}, Complex{Float64}, Complex{BigFloat}, Int) # Begin loop for first Triangular matrix for (t1, uplo1) in ((UpperTriangular, :U), (UnitUpperTriangular, :U), @@ -176,7 +176,7 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa end #exp/log - if (elty1 == Float64 || elty1 == Complex128) && (t1 == UpperTriangular || t1 == LowerTriangular) + if (elty1 == Float64 || elty1 == Complex{Float64}) && (t1 == UpperTriangular || t1 == LowerTriangular) @test exp(Matrix(log(A1))) ≈ A1 end @@ -267,7 +267,7 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa end # Begin loop for second Triangular matrix - for elty2 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloat}, Int) + for elty2 in (Float32, Float64, BigFloat, Complex{Float32}, Complex{Float64}, Complex{BigFloat}, Int) for (t2, uplo2) in ((UpperTriangular, :U), (UnitUpperTriangular, :U), (LowerTriangular, :L), @@ -311,7 +311,7 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa end end - for eltyB in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloat}) + for eltyB in (Float32, Float64, BigFloat, Complex{Float32}, Complex{Float64}, Complex{BigFloat}) B = convert(Matrix{eltyB}, elty1 <: Complex ? real(A1)*ones(n, n) : A1*ones(n, n)) debug && println("elty1: $elty1, A1: $t1, B: $eltyB") @@ -407,12 +407,12 @@ Aimg = randn(n, n)/2 A2real = randn(n, n)/2 A2img = randn(n, n)/2 -for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int) +for eltya in (Float32, Float64, Complex{Float32}, Complex{Float64}, BigFloat, Int) A = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(Areal, Aimg) : Areal) # a2 = eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, eltya <: Complex ? complex.(a2real, a2img) : a2real) εa = eps(abs(float(one(eltya)))) - for eltyb in (Float32, Float64, Complex64, Complex128) + for eltyb in (Float32, Float64, Complex{Float32}, Complex{Float64}) εb = eps(abs(float(one(eltyb)))) ε = max(εa,εb) diff --git a/test/linalg/tridiag.jl b/test/linalg/tridiag.jl index 3c1384565284c2..974365b4c75a2c 100644 --- a/test/linalg/tridiag.jl +++ b/test/linalg/tridiag.jl @@ -16,7 +16,7 @@ end guardsrand(123) do n = 12 #Size of matrix problem to test - @testset for elty in (Float32, Float64, Complex64, Complex128, Int) + @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}, Int) if elty == Int srand(61516384) d = rand(1:100, n) @@ -78,7 +78,7 @@ guardsrand(123) do @test Tridiagonal(dl, d, du) + Tridiagonal(du, d, dl) == SymTridiagonal(2d, dl+du) @test SymTridiagonal(d, dl) + Tridiagonal(dl, d, du) == Tridiagonal(dl + dl, d+d, dl+du) @test convert(SymTridiagonal,Tridiagonal(SymTridiagonal(d, dl))) == SymTridiagonal(d, dl) - @test Array(convert(SymTridiagonal{Complex64},Tridiagonal(SymTridiagonal(d, dl)))) == convert(Matrix{Complex64}, SymTridiagonal(d, dl)) + @test Array(convert(SymTridiagonal{Complex{Float32}},Tridiagonal(SymTridiagonal(d, dl)))) == convert(Matrix{Complex{Float32}}, SymTridiagonal(d, dl)) end @testset "tril/triu" begin @test_throws ArgumentError tril!(SymTridiagonal(d, dl), -n - 2) @@ -115,7 +115,7 @@ guardsrand(123) do @testset for mat_type in (Tridiagonal, SymTridiagonal) A = mat_type == Tridiagonal ? mat_type(dl, d, du) : mat_type(d, dl) - fA = map(elty <: Complex ? Complex128 : Float64, Array(A)) + fA = map(elty <: Complex ? Complex{Float64} : Float64, Array(A)) @testset "similar, size, and copy!" begin B = similar(A) @test size(B) == size(A) @@ -196,7 +196,7 @@ guardsrand(123) do end @testset "Binary operations" begin B = mat_type == Tridiagonal ? mat_type(a, b, c) : mat_type(b, a) - fB = map(elty <: Complex ? Complex128 : Float64, Array(B)) + fB = map(elty <: Complex ? Complex{Float64} : Float64, Array(B)) for op in (+, -, *) @test Array(op(A, B)) ≈ op(fA, fB) end diff --git a/test/linalg/uniformscaling.jl b/test/linalg/uniformscaling.jl index c506f7c7ef5e70..866cf8e9bf4257 100644 --- a/test/linalg/uniformscaling.jl +++ b/test/linalg/uniformscaling.jl @@ -12,9 +12,9 @@ srand(123) @test one(UniformScaling{Float32}) == UniformScaling(one(Float32)) @test zero(UniformScaling{Float32}) == UniformScaling(zero(Float32)) @test eltype(one(UniformScaling{Float32})) == Float32 - @test zero(UniformScaling(rand(Complex128))) == zero(UniformScaling{Complex128}) - @test one(UniformScaling(rand(Complex128))) == one(UniformScaling{Complex128}) - @test eltype(one(UniformScaling(rand(Complex128)))) == Complex128 + @test zero(UniformScaling(rand(Complex{Float64}))) == zero(UniformScaling{Complex{Float64}}) + @test one(UniformScaling(rand(Complex{Float64}))) == one(UniformScaling{Complex{Float64}}) + @test eltype(one(UniformScaling(rand(Complex{Float64})))) == Complex{Float64} @test -one(UniformScaling(2)) == UniformScaling(-1) @test sparse(3I,4,5) == sparse(1:4, 1:4, 3, 4, 5) @test sparse(3I,5,4) == sparse(1:4, 1:4, 3, 5, 4) @@ -60,7 +60,7 @@ end end @test copy(UniformScaling(one(Float64))) == UniformScaling(one(Float64)) -@test sprint(show,UniformScaling(one(Complex128))) == "UniformScaling{Complex{Float64}}\n(1.0 + 0.0im)*I" +@test sprint(show,UniformScaling(one(Complex{Float64}))) == "UniformScaling{Complex{Float64}}\n(1.0 + 0.0im)*I" @test sprint(show,UniformScaling(one(Float32))) == "UniformScaling{Float32}\n1.0*I" let @@ -183,7 +183,7 @@ end end @testset "chol" begin - for T in (Float64, Complex64, BigFloat, Int) + for T in (Float64, Complex{Float32}, BigFloat, Int) λ = T(4) @test chol(λ*I) ≈ √λ*I @test_throws LinAlg.PosDefException chol(-λ*I) diff --git a/test/numbers.jl b/test/numbers.jl index a03ebd2a8e9473..df37b3ff042c54 100644 --- a/test/numbers.jl +++ b/test/numbers.jl @@ -2421,8 +2421,8 @@ end @testset "issue #12832" begin @test_throws ErrorException reinterpret(Float64, Complex{Int64}(1)) - @test_throws ErrorException reinterpret(Float64, Complex64(1)) - @test_throws ErrorException reinterpret(Complex64, Float64(1)) + @test_throws ErrorException reinterpret(Float64, Complex{Float32}(1)) + @test_throws ErrorException reinterpret(Complex{Float32}, Float64(1)) @test_throws ErrorException reinterpret(Int32, false) end # issue #41 @@ -2504,8 +2504,8 @@ end zbuf = IOBuffer([0xbf, 0xc0, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x40, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) - z1 = read(zbuf, Complex64) - z2 = read(zbuf, Complex128) + z1 = read(zbuf, Complex{Float32}) + z2 = read(zbuf, Complex{Float64}) @test bswap(z1) === -1.5f0 + 2.5f0im @test bswap(z2) === 3.5 - 4.5im end @@ -2842,7 +2842,7 @@ end let types = (Base.BitInteger_types..., BigInt, Bool, Rational{Int}, Rational{BigInt}, Float16, Float32, Float64, BigFloat, - Complex{Int}, Complex{UInt}, Complex32, Complex64, Complex128) + Complex{Int}, Complex{UInt}, Complex{Float16}, Complex{Float32}, Complex{Float64}) for S in types for op in (+, -) T = @inferred Base.promote_op(op, S) diff --git a/test/perf/shootout/mandelbrot.jl b/test/perf/shootout/mandelbrot.jl index 62e76de8a89e03..faa1826ecc80b0 100644 --- a/test/perf/shootout/mandelbrot.jl +++ b/test/perf/shootout/mandelbrot.jl @@ -7,7 +7,7 @@ const ITER = 50 -function ismandel(z::Complex128) +function ismandel(z::Complex{Float64}) c = z for n = 1:ITER if abs2(z) > 4 diff --git a/test/random.jl b/test/random.jl index 8472c54a177a96..5c0edcafac36d4 100644 --- a/test/random.jl +++ b/test/random.jl @@ -18,7 +18,7 @@ end @test typeof(rand(false:true)) === Bool @test typeof(rand(Char)) === Char @test length(randn(4, 5)) == 20 -@test length(randn(Complex128, 4, 5)) == 20 +@test length(randn(Complex{Float64}, 4, 5)) == 20 @test length(bitrand(4, 5)) == 20 @test rand(MersenneTwister(0)) == 0.8236475079774124 @@ -69,10 +69,10 @@ let A = zeros(2, 2) -0.444383357109696 -0.29948409035891055] end -let B = zeros(Complex128, 2) +let B = zeros(Complex{Float64}, 2) randn!(MersenneTwister(42), B) - @test B == [Complex128(-0.5560268761463861,-0.444383357109696), - Complex128(0.027155338009193845,-0.29948409035891055)] * 0.7071067811865475244008 + @test B == [Complex{Float64}(-0.5560268761463861,-0.444383357109696), + Complex{Float64}(0.027155338009193845,-0.29948409035891055)] * 0.7071067811865475244008 end for T in (Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128, BigInt, @@ -321,7 +321,7 @@ end # test all rand APIs for rng in ([], [MersenneTwister(0)], [RandomDevice()]) ftypes = [Float16, Float32, Float64] - cftypes = [Complex32, Complex64, Complex128, ftypes...] + cftypes = [Complex{Float16}, Complex{Float32}, Complex{Float64}, ftypes...] types = [Bool, Char, BigFloat, Base.BitInteger_types..., ftypes...] randset = Set(rand(Int, 20)) randdict = Dict(zip(rand(Int,10), rand(Int, 10))) diff --git a/test/reducedim.jl b/test/reducedim.jl index 72e9b991a7c4a6..e73a739cc1e5d3 100644 --- a/test/reducedim.jl +++ b/test/reducedim.jl @@ -98,10 +98,10 @@ end @test @inferred(sum(UInt8[1], 1)) == [1] # Complex types -@test typeof(@inferred(sum([1.0+1.0im], 1))) == Vector{Complex128} +@test typeof(@inferred(sum([1.0+1.0im], 1))) == Vector{Complex{Float64}} @test typeof(@inferred(Base.sum(abs, [1.0+1.0im], 1))) == Vector{Float64} @test typeof(@inferred(Base.sum(abs2, [1.0+1.0im], 1))) == Vector{Float64} -@test typeof(@inferred(prod([1.0+1.0im], 1))) == Vector{Complex128} +@test typeof(@inferred(prod([1.0+1.0im], 1))) == Vector{Complex{Float64}} @test typeof(@inferred(Base.prod(abs, [1.0+1.0im], 1))) == Vector{Float64} @test typeof(@inferred(Base.prod(abs2, [1.0+1.0im], 1))) == Vector{Float64} diff --git a/test/reflection.jl b/test/reflection.jl index 87eb59d8344bf3..ccca65df12e6dd 100644 --- a/test/reflection.jl +++ b/test/reflection.jl @@ -548,7 +548,7 @@ for i = 1:100; @eval fLargeTable(::Any, ::Val{$i}) = 2; end fLargeTable(::Any...) = 3 @test length(methods(fLargeTable, Tuple{})) == 1 fLargeTable(::Complex, ::Complex) = 4 -fLargeTable(::Union{Complex64, Complex128}...) = 5 +fLargeTable(::Union{Complex{Float32}, Complex{Float64}}...) = 5 @test length(methods(fLargeTable, Tuple{})) == 1 fLargeTable() = 4 @test length(methods(fLargeTable)) == 204 @@ -707,7 +707,7 @@ struct B20086{T,N} <: A20086{T,N} end # sizeof and nfields @test sizeof(Int16) == 2 -@test sizeof(Complex128) == 16 +@test sizeof(Complex{Float64}) == 16 primitive type ParameterizedByte__{A,B} 8 end @test sizeof(ParameterizedByte__) == 1 @test sizeof(nothing) == 0 @@ -721,7 +721,7 @@ end @test sizeof(Symbol("")) == 0 @test_throws(ErrorException("argument is an abstract type; size is indeterminate"), sizeof(Real)) -@test sizeof(Union{Complex64,Complex128}) == 16 +@test sizeof(Union{Complex{Float32},Complex{Float64}}) == 16 @test sizeof(Union{Int8,UInt8}) == 1 @test_throws ErrorException sizeof(AbstractArray) @test_throws ErrorException sizeof(Tuple) @@ -737,8 +737,8 @@ end @test nfields(1) == 0 @test fieldcount(Union{}) == 0 @test fieldcount(Tuple{Any,Any,T} where T) == 3 -@test fieldcount(Complex) == fieldcount(Complex64) == 2 -@test fieldcount(Union{Complex64,Complex128}) == 2 +@test fieldcount(Complex) == fieldcount(Complex{Float32}) == 2 +@test fieldcount(Union{Complex{Float32},Complex{Float64}}) == 2 @test fieldcount(Int) == 0 @test_throws(ErrorException("type does not have a definite number of fields"), fieldcount(Union{Complex,Pair})) diff --git a/test/sparse/sparse.jl b/test/sparse/sparse.jl index 36b2444411b46c..ef8f35cabb1982 100644 --- a/test/sparse/sparse.jl +++ b/test/sparse/sparse.jl @@ -185,8 +185,8 @@ end b = randn(5,3) + im*randn(5,3) c = randn(5) + im*randn(5) d = randn(5) + im*randn(5) - α = rand(Complex128) - β = rand(Complex128) + α = rand(Complex{Float64}) + β = rand(Complex{Float64}) @test (maximum(abs.(a*b - Array(a)*b)) < 100*eps()) @test (maximum(abs.(A_mul_B!(similar(b), a, b) - Array(a)*b)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually. @test (maximum(abs.(A_mul_B!(similar(c), a, c) - Array(a)*c)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually. @@ -1457,7 +1457,7 @@ end end @testset "diag" begin - for T in (Float64, Complex128) + for T in (Float64, Complex{Float64}) S1 = sprand(T, 5, 5, 0.5) S2 = sprand(T, 10, 5, 0.5) S3 = sprand(T, 5, 10, 0.5) @@ -1537,7 +1537,7 @@ end @test ishermitian(A) == false @test issymmetric(A) == false - A = speye(Complex128, 5,5) + A = speye(Complex{Float64}, 5,5) A[3,2] = 1.0 + im @test ishermitian(A) == false @test issymmetric(A) == false @@ -1550,7 +1550,7 @@ end @test issymmetric(A) == true # explicit zeros - A = speye(Complex128, 5,5) + A = speye(Complex{Float64}, 5,5) A[3,1] = 2 A.nzval[2] = 0.0 @test ishermitian(A) == true @@ -2079,11 +2079,11 @@ end @testset "similar with type conversion" begin local A = speye(5) - @test size(similar(A, Complex128, Int)) == (5, 5) - @test typeof(similar(A, Complex128, Int)) == SparseMatrixCSC{Complex128, Int} - @test size(similar(A, Complex128, Int8)) == (5, 5) - @test typeof(similar(A, Complex128, Int8)) == SparseMatrixCSC{Complex128, Int8} - @test similar(A, Complex128,(6, 6)) == spzeros(Complex128, 6, 6) + @test size(similar(A, Complex{Float64}, Int)) == (5, 5) + @test typeof(similar(A, Complex{Float64}, Int)) == SparseMatrixCSC{Complex{Float64}, Int} + @test size(similar(A, Complex{Float64}, Int8)) == (5, 5) + @test typeof(similar(A, Complex{Float64}, Int8)) == SparseMatrixCSC{Complex{Float64}, Int8} + @test similar(A, Complex{Float64},(6, 6)) == spzeros(Complex{Float64}, 6, 6) @test convert(Matrix, A) == Array(A) # lolwut, are you lost, test? end diff --git a/test/sparse/sparsevector.jl b/test/sparse/sparsevector.jl index c61654377fcb6d..b9267a03561723 100644 --- a/test/sparse/sparsevector.jl +++ b/test/sparse/sparsevector.jl @@ -389,7 +389,7 @@ end # complex acp = complex(af) @test complex(acp) == acp - @test isa(acp, SparseVector{Complex128,Int}) + @test isa(acp, SparseVector{Complex{Float64},Int}) @test exact_equal(acp, SparseVector(8, [2, 5, 6], complex([12., 35., 72.]))) @test sparsevec(adjoint(adjoint(acp))) == acp end @@ -802,8 +802,8 @@ end let x = complex.(sprand(32, 0.6), sprand(32, 0.6)), y = complex.(sprand(32, 0.6), sprand(32, 0.6)) - xf = Array(x)::Vector{Complex128} - yf = Array(y)::Vector{Complex128} + xf = Array(x)::Vector{Complex{Float64}} + yf = Array(y)::Vector{Complex{Float64}} @test dot(x, x) ≈ dot(xf, xf) @test dot(x, y) ≈ dot(xf, yf) end @@ -903,15 +903,15 @@ end x2f = Array(x2) y = A*x - @test isa(y, SparseVector{Complex128,Int}) + @test isa(y, SparseVector{Complex{Float64},Int}) @test Array(y) ≈ Af * xf y = At_mul_B(A, x2) - @test isa(y, SparseVector{Complex128,Int}) + @test isa(y, SparseVector{Complex{Float64},Int}) @test Array(y) ≈ Af.' * x2f y = Ac_mul_B(A, x2) - @test isa(y, SparseVector{Complex128,Int}) + @test isa(y, SparseVector{Complex{Float64},Int}) @test Array(y) ≈ Af'x2f end end @@ -1121,7 +1121,7 @@ end end end @testset "fill!" begin - for Tv in [Float32, Float64, Int64, Int32, Complex128] + for Tv in [Float32, Float64, Int64, Int32, Complex{Float64}] for Ti in [Int16, Int32, Int64, BigInt] sptypes = (SparseMatrixCSC{Tv, Ti}, SparseVector{Tv, Ti}) sizes = [(3, 4), (3,)] diff --git a/test/sparse/umfpack.jl b/test/sparse/umfpack.jl index a99dac1c92413c..c52b2a5f54e4c6 100644 --- a/test/sparse/umfpack.jl +++ b/test/sparse/umfpack.jl @@ -13,7 +13,7 @@ increment!([0,4,0,2,1,2,1,4,3,2,1,2]), [2.,1.,3.,4.,-1.,-3.,3.,6.,2.,1.,4.,2.], 5, 5) - @testset "Core functionality for $Tv elements" for Tv in (Float64, Complex128) + @testset "Core functionality for $Tv elements" for Tv in (Float64, Complex{Float64}) # We might be able to support two index sizes one day for Ti in Base.uniontypes(Base.SparseArrays.UMFPACK.UMFITypes) A = convert(SparseMatrixCSC{Tv,Ti}, A0) @@ -74,7 +74,7 @@ @testset "More tests for complex cases" begin Ac0 = complex.(A0,A0) for Ti in Base.uniontypes(Base.SparseArrays.UMFPACK.UMFITypes) - Ac = convert(SparseMatrixCSC{Complex128,Ti}, Ac0) + Ac = convert(SparseMatrixCSC{Complex{Float64},Ti}, Ac0) x = complex.(ones(size(Ac, 1)), ones(size(Ac,1))) lua = lufact(Ac) L,U,p,q,Rs = lua[:(:)] @@ -88,7 +88,7 @@ end end - @testset "Rectangular cases" for elty in (Float64, Complex128) + @testset "Rectangular cases" for elty in (Float64, Complex{Float64}) for (m, n) in ((10,5), (5, 10)) A = sparse([1:min(m,n); rand(1:m, 10)], [1:min(m,n); rand(1:n, 10)], elty == Float64 ? randn(min(m, n) + 10) : complex.(randn(min(m, n) + 10), randn(min(m, n) + 10))) F = lufact(A) @@ -109,9 +109,9 @@ end @testset "Issue #15099" for (Tin, Tout) in ( - (Complex32, Complex128), - (Complex64, Complex128), - (Complex128, Complex128), + (Complex{Float16}, Complex{Float64}), + (Complex{Float32}, Complex{Float64}), + (Complex{Float64}, Complex{Float64}), (Float16, Float64), (Float32, Float64), (Float64, Float64), diff --git a/test/specificity.jl b/test/specificity.jl index 223ca9d8c10901..73c97390bf2488 100644 --- a/test/specificity.jl +++ b/test/specificity.jl @@ -45,7 +45,7 @@ _z_z_z_(::Int, c...) = 3 @test args_morespecific(Tuple{T,Vararg{T}} where T<:Number, Tuple{Number,Number,Vararg{Number}}) @test !args_morespecific(Tuple{Number,Number,Vararg{Number}}, Tuple{T,Vararg{T}} where T<:Number) -@test args_morespecific(Tuple{Array{T} where T<:Union{Float32,Float64,Complex64,Complex128}, Any}, +@test args_morespecific(Tuple{Array{T} where T<:Union{Float32,Float64,Complex{Float32},Complex{Float64}}, Any}, Tuple{Array{T} where T<:Real, Any}) @test args_morespecific(Tuple{1,T} where T, Tuple{Any}) diff --git a/test/statistics.jl b/test/statistics.jl index 61744de658e2b6..16366915c92663 100644 --- a/test/statistics.jl +++ b/test/statistics.jl @@ -156,7 +156,7 @@ X = [2 3 1 -1; 7 4 5 -4] @test std([1 2 3 4 5; 6 7 8 9 10], 2) ≈ sqrt.([2.5 2.5]') @test std([1 2 3 4 5; 6 7 8 9 10], 2; corrected=false) ≈ sqrt.([2.0 2.0]') -let A = Complex128[exp(i*im) for i in 1:10^4] +let A = Complex{Float64}[exp(i*im) for i in 1:10^4] @test varm(A, 0.) ≈ sum(map(abs2, A)) / (length(A) - 1) @test varm(A, mean(A)) ≈ var(A) end @@ -350,7 +350,7 @@ let y = [0.40003674665581906, 0.4085630862624367, 0.41662034698690303, 0.4166203 end # variance of complex arrays (#13309) -let z = rand(Complex128, 10) +let z = rand(Complex{Float64}, 10) @test var(z) ≈ invoke(var, Tuple{Any}, z) ≈ cov(z) ≈ var(z,1)[1] ≈ sum(abs2, z .- mean(z))/9 @test isa(var(z), Float64) @test isa(invoke(var, Tuple{Any}, z), Float64) diff --git a/test/subtype.jl b/test/subtype.jl index a9d41836c084f3..fb804769e2a972 100644 --- a/test/subtype.jl +++ b/test/subtype.jl @@ -729,13 +729,13 @@ function test_intersection() @testintersect((@UnionAll T Tuple{Type{Array{T,1}},Array{T,1}}), Tuple{Type{AbstractVector},Vector{Int}}, Bottom) - @testintersect(Tuple{Type{Vector{Complex128}}, AbstractVector}, + @testintersect(Tuple{Type{Vector{Complex{Float64}}}, AbstractVector}, (@UnionAll T @UnionAll S @UnionAll N Tuple{Type{Array{T,N}}, Array{S,N}}), - Tuple{Type{Vector{Complex128}},Vector}) + Tuple{Type{Vector{Complex{Float64}}},Vector}) - @testintersect(Tuple{Type{Vector{Complex128}}, AbstractArray}, + @testintersect(Tuple{Type{Vector{Complex{Float64}}}, AbstractArray}, (@UnionAll T @UnionAll S @UnionAll N Tuple{Type{Array{T,N}}, Array{S,N}}), - Tuple{Type{Vector{Complex128}},Vector}) + Tuple{Type{Vector{Complex{Float64}}},Vector}) @testintersect(Type{Array}, Type{AbstractArray}, Bottom) diff --git a/test/threads.jl b/test/threads.jl index 278fa9181c4454..2133bd83a84e0d 100644 --- a/test/threads.jl +++ b/test/threads.jl @@ -173,7 +173,7 @@ end # Ensure only LLVM-supported types can be atomic @test_throws TypeError Atomic{Bool} @test_throws TypeError Atomic{BigInt} -@test_throws TypeError Atomic{Complex128} +@test_throws TypeError Atomic{Complex{Float64}} # Test atomic memory ordering with load/store mutable struct CommBuf