From e3b640ee3497df3deed8a4b394fe973649ef0a6a Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Fri, 29 May 2020 10:37:42 -0400 Subject: [PATCH] show: print types using exported type-aliases For example, this prints Array{T,1} as Vector{T} and Array{T,2} as Matrix{T} and Base.GenericIOBuffer{Array{UInt8,1}} as IOBuffer, and generalizes some existing code. Co-authored-by: Kristoffer Carlsson --- base/abstractarray.jl | 54 ++-- base/abstractarraymath.jl | 46 +-- base/abstractdict.jl | 4 +- base/abstractset.jl | 16 +- base/accumulate.jl | 46 +-- base/array.jl | 132 ++++---- base/arraymath.jl | 42 +-- base/arrayshow.jl | 5 +- base/bitarray.jl | 30 +- base/bool.jl | 4 +- base/broadcast.jl | 22 +- base/combinatorics.jl | 10 +- base/complex.jl | 2 +- base/docs/basedocs.jl | 38 +-- base/essentials.jl | 6 +- base/float.jl | 2 +- base/generator.jl | 2 +- base/intfuncs.jl | 10 +- base/io.jl | 4 +- base/iterators.jl | 36 +-- base/math.jl | 4 +- base/missing.jl | 10 +- base/multidimensional.jl | 28 +- base/multimedia.jl | 2 +- base/namedtuple.jl | 4 +- base/number.jl | 2 +- base/operators.jl | 16 +- base/path.jl | 2 +- base/permuteddimsarray.jl | 14 +- base/promotion.jl | 4 +- base/range.jl | 4 +- base/reduce.jl | 4 +- base/reducedim.jl | 112 +++---- base/reflection.jl | 2 +- base/refpointer.jl | 2 +- base/regex.jl | 12 +- base/reinterpretarray.jl | 4 +- base/reshapedarray.jl | 6 +- base/set.jl | 30 +- base/show.jl | 301 +++++++++++++++--- base/sort.jl | 46 +-- base/strings/io.jl | 2 +- base/strings/util.jl | 14 +- base/subarray.jl | 10 +- base/views.jl | 10 +- .../md5 | 1 - .../sha512 | 1 - doc/src/base/sort.md | 6 +- doc/src/devdocs/inference.md | 2 +- doc/src/devdocs/reflection.md | 2 +- doc/src/devdocs/subarrays.md | 4 +- doc/src/manual/arrays.md | 84 ++--- doc/src/manual/calling-c-and-fortran-code.md | 4 +- doc/src/manual/constructors.md | 6 +- doc/src/manual/conversion-and-promotion.md | 4 +- doc/src/manual/faq.md | 8 +- doc/src/manual/functions.md | 28 +- doc/src/manual/interfaces.md | 12 +- doc/src/manual/mathematical-operations.md | 2 +- doc/src/manual/metaprogramming.md | 2 +- doc/src/manual/methods.md | 16 +- doc/src/manual/missing.md | 14 +- doc/src/manual/multi-threading.md | 2 +- doc/src/manual/performance-tips.md | 20 +- doc/src/manual/running-external-programs.md | 10 +- doc/src/manual/strings.md | 14 +- doc/src/manual/types.md | 8 +- doc/src/manual/variables-and-scoping.md | 4 +- stdlib/Base64/src/decode.jl | 2 +- stdlib/Dates/docs/src/index.md | 8 +- stdlib/DelimitedFiles/src/DelimitedFiles.jl | 16 +- stdlib/Distributed/src/pmap.jl | 2 +- .../InteractiveUtils/src/InteractiveUtils.jl | 2 +- stdlib/InteractiveUtils/test/runtests.jl | 2 +- stdlib/LinearAlgebra/docs/src/index.md | 50 +-- stdlib/LinearAlgebra/src/LinearAlgebra.jl | 14 +- stdlib/LinearAlgebra/src/adjtrans.jl | 18 +- stdlib/LinearAlgebra/src/bidiag.jl | 14 +- stdlib/LinearAlgebra/src/blas.jl | 4 +- stdlib/LinearAlgebra/src/bunchkaufman.jl | 50 +-- stdlib/LinearAlgebra/src/cholesky.jl | 32 +- stdlib/LinearAlgebra/src/dense.jl | 104 +++--- stdlib/LinearAlgebra/src/diagonal.jl | 8 +- stdlib/LinearAlgebra/src/eigen.jl | 84 ++--- stdlib/LinearAlgebra/src/generic.jl | 104 +++--- stdlib/LinearAlgebra/src/hessenberg.jl | 14 +- stdlib/LinearAlgebra/src/ldlt.jl | 18 +- stdlib/LinearAlgebra/src/lq.jl | 12 +- stdlib/LinearAlgebra/src/lu.jl | 26 +- stdlib/LinearAlgebra/src/matmul.jl | 14 +- stdlib/LinearAlgebra/src/qr.jl | 18 +- stdlib/LinearAlgebra/src/schur.jl | 36 +-- stdlib/LinearAlgebra/src/svd.jl | 40 +-- stdlib/LinearAlgebra/src/symmetric.jl | 22 +- stdlib/LinearAlgebra/src/transpose.jl | 22 +- stdlib/LinearAlgebra/src/triangular.jl | 16 +- stdlib/LinearAlgebra/src/tridiag.jl | 32 +- stdlib/LinearAlgebra/src/uniformscaling.jl | 12 +- stdlib/LinearAlgebra/test/adjtrans.jl | 4 +- stdlib/LinearAlgebra/test/bidiag.jl | 2 +- stdlib/LinearAlgebra/test/blas.jl | 4 +- stdlib/LinearAlgebra/test/cholesky.jl | 2 +- stdlib/LinearAlgebra/test/dense.jl | 14 +- stdlib/LinearAlgebra/test/diagonal.jl | 4 +- stdlib/LinearAlgebra/test/generic.jl | 14 +- stdlib/LinearAlgebra/test/lapack.jl | 2 +- stdlib/LinearAlgebra/test/lu.jl | 6 +- stdlib/LinearAlgebra/test/special.jl | 2 +- stdlib/LinearAlgebra/test/triangular.jl | 8 +- stdlib/LinearAlgebra/test/uniformscaling.jl | 6 +- stdlib/Logging/docs/src/index.md | 2 +- stdlib/Logging/test/runtests.jl | 6 +- stdlib/Random/docs/src/index.md | 6 +- stdlib/Random/src/RNGs.jl | 4 +- stdlib/Random/src/Random.jl | 2 +- stdlib/Random/src/misc.jl | 20 +- stdlib/Random/src/normal.jl | 8 +- stdlib/SharedArrays/test/runtests.jl | 2 +- stdlib/SparseArrays/docs/src/index.md | 4 +- stdlib/SparseArrays/src/sparsematrix.jl | 6 +- stdlib/SparseArrays/test/sparsevector.jl | 4 +- stdlib/SuiteSparse/src/cholmod.jl | 28 +- stdlib/SuiteSparse/src/spqr.jl | 10 +- stdlib/SuiteSparse/src/umfpack.jl | 2 +- stdlib/SuiteSparse/test/cholmod.jl | 6 +- stdlib/SuiteSparse/test/spqr.jl | 4 +- stdlib/SuiteSparse/test/umfpack.jl | 2 +- test/arrayops.jl | 10 +- test/complex.jl | 14 +- test/core.jl | 8 +- test/errorshow.jl | 12 +- test/iobuffer.jl | 2 +- test/iterators.jl | 6 +- test/math.jl | 8 +- test/missing.jl | 4 +- test/numbers.jl | 4 +- test/offsetarray.jl | 4 +- test/reflection.jl | 2 +- test/reinterpretarray.jl | 2 +- test/show.jl | 150 ++++----- test/subtype.jl | 2 +- 141 files changed, 1422 insertions(+), 1196 deletions(-) delete mode 100644 deps/checksums/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1.tar.gz/md5 delete mode 100644 deps/checksums/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1.tar.gz/sha512 diff --git a/base/abstractarray.jl b/base/abstractarray.jl index 95fb7fdcad943d..b5b86ef15c8444 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -610,7 +610,7 @@ elements since `BitArray`s are both mutable and can support 1-dimensional arrays ```julia-repl julia> similar(trues(10,10), 2) -2-element BitArray{1}: +2-element BitVector: 0 0 ``` @@ -825,7 +825,7 @@ julia> y = zeros(7); julia> copyto!(y, x); julia> y -7-element Array{Float64,1}: +7-element Vector{Float64}: 1.0 0.0 3.0 @@ -955,7 +955,7 @@ julia> tup = (1, 2, 3) (1, 2, 3) julia> Base.copymutable(tup) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -1023,7 +1023,7 @@ Return a subset of array `A` as specified by `inds`, where each `ind` may be an # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 @@ -1031,12 +1031,12 @@ julia> getindex(A, 1) 1 julia> getindex(A, [2, 1]) -2-element Array{Int64,1}: +2-element Vector{Int64}: 3 1 julia> getindex(A, 2:4) -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 2 4 @@ -1131,7 +1131,7 @@ julia> setindex!(A, [10, 20], [1, 2]); julia> A[[3, 4]] = [30, 40]; julia> A -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 10.0 30.0 20.0 40.0 ``` @@ -1188,17 +1188,17 @@ during object creation. If the input is not a wrapped object, return the input i # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> V = view(A, 1:2, :) -2×2 view(::Array{Int64,2}, 1:2, :) with eltype Int64: +2×2 view(::Matrix{Int64}, 1:2, :) with eltype Int64: 1 2 3 4 julia> parent(V) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 ``` @@ -1546,16 +1546,16 @@ Concatenate along dimension 1. # Examples ```jldoctest julia> a = [1 2 3 4 5] -1×5 Array{Int64,2}: +1×5 Matrix{Int64}: 1 2 3 4 5 julia> b = [6 7 8 9 10; 11 12 13 14 15] -2×5 Array{Int64,2}: +2×5 Matrix{Int64}: 6 7 8 9 10 11 12 13 14 15 julia> vcat(a,b) -3×5 Array{Int64,2}: +3×5 Matrix{Int64}: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 @@ -1564,7 +1564,7 @@ julia> c = ([1 2 3], [4 5 6]) ([1 2 3], [4 5 6]) julia> vcat(c...) -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 3 4 5 6 ``` @@ -1578,7 +1578,7 @@ Concatenate along dimension 2. # Examples ```jldoctest julia> a = [1; 2; 3; 4; 5] -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 3 @@ -1586,7 +1586,7 @@ julia> a = [1; 2; 3; 4; 5] 5 julia> b = [6 7; 8 9; 10 11; 12 13; 14 15] -5×2 Array{Int64,2}: +5×2 Matrix{Int64}: 6 7 8 9 10 11 @@ -1594,7 +1594,7 @@ julia> b = [6 7; 8 9; 10 11; 12 13; 14 15] 14 15 julia> hcat(a,b) -5×3 Array{Int64,2}: +5×3 Matrix{Int64}: 1 6 7 2 8 9 3 10 11 @@ -1605,16 +1605,16 @@ julia> c = ([1; 2; 3], [4; 5; 6]) ([1, 2, 3], [4, 5, 6]) julia> hcat(c...) -3×2 Array{Int64,2}: +3×2 Matrix{Int64}: 1 4 2 5 3 6 julia> x = Matrix(undef, 3, 0) # x = [] would have created an Array{Any, 1}, but need an Array{Any, 2} -3×0 Array{Any,2} +3×0 Matrix{Any} julia> hcat(x, [1; 2; 3]) -3×1 Array{Any,2}: +3×1 Matrix{Any}: 1 2 3 @@ -1683,23 +1683,23 @@ julia> a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 (1, 2, 3, 4, 5, 6) julia> [a b c; d e f] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 3 4 5 6 julia> hvcat((3,3), a,b,c,d,e,f) -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 3 4 5 6 julia> [a b;c d; e f] -3×2 Array{Int64,2}: +3×2 Matrix{Int64}: 1 2 3 4 5 6 julia> hvcat((2,2,2), a,b,c,d,e,f) -3×2 Array{Int64,2}: +3×2 Matrix{Int64}: 1 2 3 4 5 6 @@ -2164,13 +2164,13 @@ See also: [`mapslices`](@ref) # Examples ```jldoctest julia> map(x -> x * 2, [1, 2, 3]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 2 4 6 julia> map(+, [1, 2, 3], [10, 20, 30]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 11 22 33 @@ -2223,7 +2223,7 @@ julia> a = zeros(3); julia> map!(x -> x * 2, a, [1, 2, 3]); julia> a -3-element Array{Float64,1}: +3-element Vector{Float64}: 2.0 4.0 6.0 diff --git a/base/abstractarraymath.jl b/base/abstractarraymath.jl index e8d9348da6767f..c03b91ee558966 100644 --- a/base/abstractarraymath.jl +++ b/base/abstractarraymath.jl @@ -19,12 +19,12 @@ mutable, in which case modifying one will also modify the other. # Examples ```jldoctest julia> a = [1 2 3; 4 5 6] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 3 4 5 6 julia> vec(a) -6-element Array{Int64,1}: +6-element Vector{Int64}: 1 4 2 @@ -109,12 +109,12 @@ Equivalent to `view(A,:,:,...,i,:,:,...)` where `i` is in position `d`. # Examples ```jldoctest julia> A = [1 2 3 4; 5 6 7 8] -2×4 Array{Int64,2}: +2×4 Matrix{Int64}: 1 2 3 4 5 6 7 8 julia> selectdim(A, 2, 3) -2-element view(::Array{Int64,2}, :, 3) with eltype Int64: +2-element view(::Matrix{Int64}, :, 3) with eltype Int64: 3 7 ``` @@ -135,12 +135,12 @@ Reverse `A` in dimension `dims`. # Examples ```jldoctest julia> b = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> reverse(b, dims=2) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 1 4 3 ``` @@ -191,28 +191,28 @@ first dimension. # Examples ```jldoctest julia> b = reshape(Vector(1:16), (4,4)) -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 julia> circshift(b, (0,2)) -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 9 13 1 5 10 14 2 6 11 15 3 7 12 16 4 8 julia> circshift(b, (-1,0)) -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 2 6 10 14 3 7 11 15 4 8 12 16 1 5 9 13 julia> a = BitArray([true, true, false, false, true]) -5-element BitArray{1}: +5-element BitVector: 1 1 0 @@ -220,7 +220,7 @@ julia> a = BitArray([true, true, false, false, true]) 1 julia> circshift(a, 1) -5-element BitArray{1}: +5-element BitVector: 1 1 1 @@ -228,7 +228,7 @@ julia> circshift(a, 1) 0 julia> circshift(a, -1) -5-element BitArray{1}: +5-element BitVector: 1 0 0 @@ -252,7 +252,7 @@ Construct an array by repeating array `A` a given number of times in each dimens # Examples ```jldoctest julia> repeat([1, 2, 3], 2) -6-element Array{Int64,1}: +6-element Vector{Int64}: 1 2 3 @@ -261,7 +261,7 @@ julia> repeat([1, 2, 3], 2) 3 julia> repeat([1, 2, 3], 2, 3) -6×3 Array{Int64,2}: +6×3 Matrix{Int64}: 1 1 1 2 2 2 3 3 3 @@ -286,21 +286,21 @@ is performed. # Examples ```jldoctest julia> repeat(1:2, inner=2) -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 1 2 2 julia> repeat(1:2, outer=2) -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 1 2 julia> repeat([1 2; 3 4], inner=(2, 1), outer=(1, 3)) -4×6 Array{Int64,2}: +4×6 Matrix{Int64}: 1 2 1 2 1 2 1 2 1 2 1 2 3 4 3 4 3 4 @@ -451,17 +451,17 @@ See also [`eachcol`](@ref) and [`eachslice`](@ref). ```jldoctest julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> first(eachrow(a)) -2-element view(::Array{Int64,2}, 1, :) with eltype Int64: +2-element view(::Matrix{Int64}, 1, :) with eltype Int64: 1 2 julia> collect(eachrow(a)) -2-element Array{SubArray{Int64,1,Array{Int64,2},Tuple{Int64,Base.Slice{Base.OneTo{Int64}}},true},1}: +2-element Vector{SubArray{Int64,1,Matrix{Int64},Tuple{Int64,Base.Slice{Base.OneTo{Int64}}},true}}: [1, 2] [3, 4] ``` @@ -484,17 +484,17 @@ See also [`eachrow`](@ref) and [`eachslice`](@ref). ```jldoctest julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> first(eachcol(a)) -2-element view(::Array{Int64,2}, :, 1) with eltype Int64: +2-element view(::Matrix{Int64}, :, 1) with eltype Int64: 1 3 julia> collect(eachcol(a)) -2-element Array{SubArray{Int64,1,Array{Int64,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true},1}: +2-element Vector{SubArray{Int64,1,Matrix{Int64},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}}: [1, 3] [2, 4] ``` diff --git a/base/abstractdict.jl b/base/abstractdict.jl index b0f5784daf4533..4fbb54d1327234 100644 --- a/base/abstractdict.jl +++ b/base/abstractdict.jl @@ -91,7 +91,7 @@ Dict{Char,Int64} with 2 entries: 'b' => 3 julia> collect(keys(D)) -2-element Array{Char,1}: +2-element Vector{Char}: 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase) 'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase) ``` @@ -117,7 +117,7 @@ Dict{Char,Int64} with 2 entries: 'b' => 3 julia> collect(values(D)) -2-element Array{Int64,1}: +2-element Vector{Int64}: 2 3 ``` diff --git a/base/abstractset.jl b/base/abstractset.jl index d757df5c85a520..fa047f92ce24de 100644 --- a/base/abstractset.jl +++ b/base/abstractset.jl @@ -16,20 +16,20 @@ Construct the union of sets. Maintain order with arrays. # Examples ```jldoctest julia> union([1, 2], [3, 4]) -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 3 4 julia> union([1, 2], [2, 4]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 4 julia> union([4, 2], 1:2) -3-element Array{Int64,1}: +3-element Vector{Int64}: 4 2 1 @@ -104,11 +104,11 @@ Maintain order with arrays. # Examples ```jldoctest julia> intersect([1, 2, 3], [3, 4, 5]) -1-element Array{Int64,1}: +1-element Vector{Int64}: 3 julia> intersect([1, 4, 4, 5, 6], [4, 6, 6, 7, 8]) -2-element Array{Int64,1}: +2-element Vector{Int64}: 4 6 @@ -148,7 +148,7 @@ Maintain order with arrays. # Examples ```jldoctest julia> setdiff([1,2,3], [3,4,5]) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 ``` @@ -197,13 +197,13 @@ Note that in this case the multiplicity of elements matters. # Examples ```jldoctest julia> symdiff([1,2,3], [3,4,5], [4,5,6]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 6 julia> symdiff([1,2,1], [2, 1, 2]) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 diff --git a/base/accumulate.jl b/base/accumulate.jl index 591885054b7d10..fe06dbc1c2c70d 100644 --- a/base/accumulate.jl +++ b/base/accumulate.jl @@ -71,17 +71,17 @@ the output (e.g. to avoid overflow). # Examples ```jldoctest julia> a = [1 2 3; 4 5 6] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 3 4 5 6 julia> cumsum(a, dims=1) -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 3 5 7 9 julia> cumsum(a, dims=2) -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 3 6 4 9 15 ``` @@ -94,12 +94,12 @@ julia> cumsum(a, dims=2) ```jldoctest julia> cumsum(Int8[100, 28]) - 2-element Array{Int64,1}: + 2-element Vector{Int64}: 100 128 julia> accumulate(+,Int8[100, 28]) - 2-element Array{Int8,1}: + 2-element Vector{Int8}: 100 -128 ``` @@ -126,13 +126,13 @@ output (e.g. to avoid overflow). # Examples ```jldoctest julia> cumsum([1, 1, 1]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 julia> cumsum([fill(1, 2) for i in 1:3]) -3-element Array{Array{Int64,1},1}: +3-element Vector{Vector{Int64}}: [1, 1] [2, 2] [3, 3] @@ -141,7 +141,7 @@ julia> cumsum((1, 1, 1)) (1, 2, 3) julia> cumsum(x^2 for x in 1:3) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 5 14 @@ -178,17 +178,17 @@ to control the precision of the output (e.g. to avoid overflow). # Examples ```jldoctest julia> a = [1 2 3; 4 5 6] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 3 4 5 6 julia> cumprod(a, dims=1) -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 3 4 10 18 julia> cumprod(a, dims=2) -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 6 4 20 120 ``` @@ -210,13 +210,13 @@ to control the precision of the output (e.g. to avoid overflow). # Examples ```jldoctest julia> cumprod(fill(1//2, 3)) -3-element Array{Rational{Int64},1}: +3-element Vector{Rational{Int64}}: 1//2 1//4 1//8 julia> cumprod([fill(1//3, 2, 2) for i in 1:3]) -3-element Array{Array{Rational{Int64},2},1}: +3-element Vector{Matrix{Rational{Int64}}}: [1//3 1//3; 1//3 1//3] [2//9 2//9; 2//9 2//9] [4//27 4//27; 4//27 4//27] @@ -225,7 +225,7 @@ julia> cumprod((1, 2, 1)) (1, 2, 2) julia> cumprod(x^2 for x in 1:3) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 4 36 @@ -250,37 +250,37 @@ there are specialized variants of `accumulate`, see: [`cumsum`](@ref), [`cumprod # Examples ```jldoctest julia> accumulate(+, [1,2,3]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 3 6 julia> accumulate(*, [1,2,3]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 6 julia> accumulate(+, [1,2,3]; init=100) -3-element Array{Int64,1}: +3-element Vector{Int64}: 101 103 106 julia> accumulate(min, [1,2,-1]; init=0) -3-element Array{Int64,1}: +3-element Vector{Int64}: 0 0 -1 julia> accumulate(+, fill(1, 3, 3), dims=1) -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 1 1 2 2 2 3 3 3 julia> accumulate(+, fill(1, 3, 3), dims=2) -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 2 3 1 2 3 1 2 3 @@ -327,7 +327,7 @@ julia> y = [0, 0, 0, 0, 0]; julia> accumulate!(+, y, x); julia> y -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 1 3 @@ -341,14 +341,14 @@ julia> B = [0 0; 0 0]; julia> accumulate!(-, B, A, dims=1); julia> B -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 -2 -2 julia> accumulate!(-, B, A, dims=2); julia> B -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 -1 3 -1 ``` diff --git a/base/array.jl b/base/array.jl index bd6807853c93e8..e7f030ca333b79 100644 --- a/base/array.jl +++ b/base/array.jl @@ -138,7 +138,7 @@ containing the argument list. # Examples ```jldoctest julia> a = Base.vect(UInt8(1), 2.5, 1//2) -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 2.5 0.5 @@ -392,13 +392,13 @@ Construct a 1-d array of the specified type. This is usually called with the syn # Examples ```jldoctest julia> Int8[1, 2, 3] -3-element Array{Int8,1}: +3-element Vector{Int8}: 1 2 3 julia> getindex(Int8, 1, 2, 3) -3-element Array{Int8,1}: +3-element Vector{Int8}: 1 2 3 @@ -447,7 +447,7 @@ the common idiom `fill(x)` creates a zero-dimensional array containing the singl # Examples ```jldoctest julia> fill(1.0, (2,3)) -2×3 Array{Float64,2}: +2×3 Matrix{Float64}: 1.0 1.0 1.0 1.0 1.0 1.0 @@ -463,7 +463,7 @@ julia> A = fill(zeros(2), 2); julia> A[1][1] = 42; # modifies both A[1][1] and A[2][1] julia> A -2-element Array{Array{Float64,1},1}: +2-element Vector{Vector{Float64}}: [42.0, 0.0] [42.0, 0.0] ``` @@ -485,11 +485,11 @@ See also [`fill`](@ref), [`ones`](@ref). # Examples ```jldoctest julia> zeros(1) -1-element Array{Float64,1}: +1-element Vector{Float64}: 0.0 julia> zeros(Int8, 2, 3) -2×3 Array{Int8,2}: +2×3 Matrix{Int8}: 0 0 0 0 0 0 ``` @@ -506,11 +506,11 @@ See also: [`fill`](@ref), [`zeros`](@ref). # Examples ```jldoctest julia> ones(1,2) -1×2 Array{Float64,2}: +1×2 Matrix{Float64}: 1.0 1.0 julia> ones(ComplexF64, 2, 3) -2×3 Array{Complex{Float64},2}: +2×3 Matrix{ComplexF64}: 1.0+0.0im 1.0+0.0im 1.0+0.0im 1.0+0.0im 1.0+0.0im 1.0+0.0im ``` @@ -576,7 +576,7 @@ The result has the same shape and number of dimensions as `collection`. # Examples ```jldoctest julia> collect(Float64, 1:2:5) -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 3.0 5.0 @@ -613,7 +613,7 @@ and number of dimensions as the argument. # Examples ```jldoctest julia> collect(1:2:13) -7-element Array{Int64,1}: +7-element Vector{Int64}: 1 3 5 @@ -916,7 +916,7 @@ the items are inserted at the end (in the given order). # Examples ```jldoctest julia> push!([1, 2, 3], 4, 5, 6) -6-element Array{Int64,1}: +6-element Vector{Int64}: 1 2 3 @@ -953,13 +953,13 @@ For an ordered container `collection`, add the elements of `collection2` to the # Examples ```jldoctest julia> append!([1],[2,3]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 julia> append!([1, 2, 3], [4, 5, 6]) -6-element Array{Int64,1}: +6-element Vector{Int64}: 1 2 3 @@ -1008,7 +1008,7 @@ Insert the elements of `items` to the beginning of `a`. # Examples ```jldoctest julia> prepend!([3],[1,2]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -1061,7 +1061,7 @@ guaranteed to be initialized. # Examples ```jldoctest julia> resize!([6, 5, 4, 3, 2, 1], 3) -3-element Array{Int64,1}: +3-element Vector{Int64}: 6 5 4 @@ -1072,7 +1072,7 @@ julia> length(a) 8 julia> a[1:6] -6-element Array{Int64,1}: +6-element Vector{Int64}: 6 5 4 @@ -1115,7 +1115,7 @@ ordered container, the last item is returned. # Examples ```jldoctest julia> A=[1, 2, 3] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -1124,7 +1124,7 @@ julia> pop!(A) 3 julia> A -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 @@ -1171,7 +1171,7 @@ julia> a = [4, 3, 2, 1]; popat!(a, 2) 3 julia> a -3-element Array{Int64,1}: +3-element Vector{Int64}: 4 2 1 @@ -1180,7 +1180,7 @@ julia> popat!(a, 4, missing) missing julia> popat!(a, 4) -ERROR: BoundsError: attempt to access 3-element Array{Int64,1} at index [4] +ERROR: BoundsError: attempt to access 3-element Vector{Int64} at index [4] [...] ``` """ @@ -1208,7 +1208,7 @@ Insert one or more `items` at the beginning of `collection`. # Examples ```jldoctest julia> pushfirst!([1, 2, 3, 4], 5, 6) -6-element Array{Int64,1}: +6-element Vector{Int64}: 5 6 1 @@ -1232,7 +1232,7 @@ Remove the first `item` from `collection`. # Examples ```jldoctest julia> A = [1, 2, 3, 4, 5, 6] -6-element Array{Int64,1}: +6-element Vector{Int64}: 1 2 3 @@ -1244,7 +1244,7 @@ julia> popfirst!(A) 1 julia> A -5-element Array{Int64,1}: +5-element Vector{Int64}: 2 3 4 @@ -1270,7 +1270,7 @@ the resulting `a`. # Examples ```jldoctest julia> insert!([6, 5, 4, 2, 1], 4, 3) -6-element Array{Int64,1}: +6-element Vector{Int64}: 6 5 4 @@ -1297,7 +1297,7 @@ are shifted to fill the resulting gap. # Examples ```jldoctest julia> deleteat!([6, 5, 4, 3, 2, 1], 2) -5-element Array{Int64,1}: +5-element Vector{Int64}: 6 4 3 @@ -1325,13 +1325,13 @@ or a boolean vector of the same length as `a` with `true` indicating entries to # Examples ```jldoctest julia> deleteat!([6, 5, 4, 3, 2, 1], 1:2:5) -3-element Array{Int64,1}: +3-element Vector{Int64}: 5 3 1 julia> deleteat!([6, 5, 4, 3, 2, 1], [true, false, true, false, true, false]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 5 3 1 @@ -1411,7 +1411,7 @@ julia> A = [6, 5, 4, 3, 2, 1]; splice!(A, 5) 2 julia> A -5-element Array{Int64,1}: +5-element Vector{Int64}: 6 5 4 @@ -1422,7 +1422,7 @@ julia> splice!(A, 5, -1) 1 julia> A -5-element Array{Int64,1}: +5-element Vector{Int64}: 6 5 4 @@ -1433,7 +1433,7 @@ julia> splice!(A, 1, [-1, -2, -3]) 6 julia> A -7-element Array{Int64,1}: +7-element Vector{Int64}: -1 -2 -3 @@ -1485,7 +1485,7 @@ julia> A = [-1, -2, -3, 5, 4, 3, -1]; splice!(A, 4:3, 2) Int64[] julia> A -8-element Array{Int64,1}: +8-element Vector{Int64}: -1 -2 -3 @@ -1559,7 +1559,7 @@ for reverse-order iteration without making a copy. # Examples ```jldoctest julia> A = Vector(1:5) -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 3 @@ -1567,7 +1567,7 @@ julia> A = Vector(1:5) 5 julia> reverse(A) -5-element Array{Int64,1}: +5-element Vector{Int64}: 5 4 3 @@ -1575,7 +1575,7 @@ julia> reverse(A) 1 julia> reverse(A, 1, 4) -5-element Array{Int64,1}: +5-element Vector{Int64}: 4 3 2 @@ -1583,7 +1583,7 @@ julia> reverse(A, 1, 4) 5 julia> reverse(A, 3, 5) -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 5 @@ -1621,7 +1621,7 @@ In-place version of [`reverse`](@ref). # Examples ```jldoctest julia> A = Vector(1:5) -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 3 @@ -1631,7 +1631,7 @@ julia> A = Vector(1:5) julia> reverse!(A); julia> A -5-element Array{Int64,1}: +5-element Vector{Int64}: 5 4 3 @@ -1702,7 +1702,7 @@ and [`pairs(A)`](@ref). # Examples ```jldoctest julia> A = [false, false, true, false] -4-element Array{Bool,1}: +4-element Vector{Bool}: 0 0 1 @@ -1714,7 +1714,7 @@ julia> findnext(A, 1) julia> findnext(A, 4) # returns nothing, but not printed in the REPL julia> A = [false false; true false] -2×2 Array{Bool,2}: +2×2 Matrix{Bool}: 0 0 1 0 @@ -1748,7 +1748,7 @@ and [`pairs(A)`](@ref). # Examples ```jldoctest julia> A = [false, false, true, false] -4-element Array{Bool,1}: +4-element Vector{Bool}: 0 0 1 @@ -1760,7 +1760,7 @@ julia> findfirst(A) julia> findfirst(falses(3)) # returns nothing, but not printed in the REPL julia> A = [false false; true false] -2×2 Array{Bool,2}: +2×2 Matrix{Bool}: 0 0 1 0 @@ -1829,7 +1829,7 @@ and [`pairs(A)`](@ref). # Examples ```jldoctest julia> A = [1, 4, 2, 2] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 4 2 @@ -1844,7 +1844,7 @@ julia> findfirst(isequal(4), A) 2 julia> A = [1 4; 2 2] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 4 2 2 @@ -1889,7 +1889,7 @@ and [`pairs(A)`](@ref). # Examples ```jldoctest julia> A = [false, false, true, true] -4-element Array{Bool,1}: +4-element Vector{Bool}: 0 0 1 @@ -1901,7 +1901,7 @@ julia> findprev(A, 3) julia> findprev(A, 1) # returns nothing, but not printed in the REPL julia> A = [false false; true true] -2×2 Array{Bool,2}: +2×2 Matrix{Bool}: 0 0 1 1 @@ -1934,7 +1934,7 @@ and [`pairs(A)`](@ref). # Examples ```jldoctest julia> A = [true, false, true, false] -4-element Array{Bool,1}: +4-element Vector{Bool}: 1 0 1 @@ -1948,7 +1948,7 @@ julia> A = falses(2,2); julia> findlast(A) # returns nothing, but not printed in the REPL julia> A = [true false; true false] -2×2 Array{Bool,2}: +2×2 Matrix{Bool}: 1 0 1 0 @@ -1980,7 +1980,7 @@ and [`pairs(A)`](@ref). # Examples ```jldoctest julia> A = [4, 6, 1, 2] -4-element Array{Int64,1}: +4-element Vector{Int64}: 4 6 1 @@ -1992,7 +1992,7 @@ julia> findprev(isodd, A, 3) 3 julia> A = [4 6; 1 2] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 6 1 2 @@ -2025,7 +2025,7 @@ and [`pairs(A)`](@ref). # Examples ```jldoctest julia> A = [1, 2, 3, 4] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 3 @@ -2037,7 +2037,7 @@ julia> findlast(isodd, A) julia> findlast(x -> x > 5, A) # returns nothing, but not printed in the REPL julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 @@ -2068,27 +2068,27 @@ and [`pairs(A)`](@ref). # Examples ```jldoctest julia> x = [1, 3, 4] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 3 4 julia> findall(isodd, x) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 julia> A = [1 2 0; 3 4 0] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 0 3 4 0 julia> findall(isodd, A) -2-element Array{CartesianIndex{2},1}: +2-element Vector{CartesianIndex{2}}: CartesianIndex(1, 1) CartesianIndex(2, 1) julia> findall(!iszero, A) -4-element Array{CartesianIndex{2},1}: +4-element Vector{CartesianIndex{2}}: CartesianIndex(1, 1) CartesianIndex(2, 1) CartesianIndex(1, 2) @@ -2101,7 +2101,7 @@ Dict{Symbol,Int64} with 3 entries: :C => 0 julia> findall(x -> x >= 0, d) -2-element Array{Symbol,1}: +2-element Vector{Symbol}: :A :C @@ -2122,24 +2122,24 @@ and [`pairs(A)`](@ref). # Examples ```jldoctest julia> A = [true, false, false, true] -4-element Array{Bool,1}: +4-element Vector{Bool}: 1 0 0 1 julia> findall(A) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 4 julia> A = [true false; false true] -2×2 Array{Bool,2}: +2×2 Matrix{Bool}: 1 0 0 1 julia> findall(A) -2-element Array{CartesianIndex{2},1}: +2-element Vector{CartesianIndex{2}}: CartesianIndex(1, 1) CartesianIndex(2, 2) @@ -2317,7 +2317,7 @@ julia> a = ['a', 'b', 'c', 'b', 'd', 'a']; julia> b = ['a', 'b', 'c']; julia> indexin(a, b) -6-element Array{Union{Nothing, Int64},1}: +6-element Vector{Union{Nothing, Int64}}: 1 2 3 @@ -2326,7 +2326,7 @@ julia> indexin(a, b) 1 julia> indexin(b, a) -3-element Array{Union{Nothing, Int64},1}: +3-element Vector{Union{Nothing, Int64}}: 1 2 3 @@ -2448,7 +2448,7 @@ julia> a = 1:10 1:10 julia> filter(isodd, a) -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 3 5 @@ -2494,7 +2494,7 @@ The function `f` is passed one argument. # Examples ```jldoctest julia> filter!(isodd, Vector(1:10)) -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 3 5 diff --git a/base/arraymath.jl b/base/arraymath.jl index dfea81dd9d35fc..2538ad361c672e 100644 --- a/base/arraymath.jl +++ b/base/arraymath.jl @@ -12,14 +12,14 @@ See also [`conj`](@ref). # Examples ```jldoctest julia> A = [1+im 2-im; 2+2im 3+im] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 1+1im 2-1im 2+2im 3+1im julia> conj!(A); julia> A -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 1-1im 2+1im 2-2im 3-1im ``` @@ -127,12 +127,12 @@ Rotate matrix `A` left 90 degrees. # Examples ```jldoctest julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> rotl90(a) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 4 1 3 ``` @@ -155,12 +155,12 @@ Rotate matrix `A` right 90 degrees. # Examples ```jldoctest julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> rotr90(a) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 3 1 4 2 ``` @@ -182,12 +182,12 @@ Rotate matrix `A` 180 degrees. # Examples ```jldoctest julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> rot180(a) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 3 2 1 ``` @@ -210,27 +210,27 @@ If `k` is a multiple of four (including zero), this is equivalent to a `copy`. # Examples ```jldoctest julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> rotl90(a,1) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 4 1 3 julia> rotl90(a,2) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 3 2 1 julia> rotl90(a,3) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 3 1 4 2 julia> rotl90(a,4) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 ``` @@ -250,27 +250,27 @@ If `k` is a multiple of four (including zero), this is equivalent to a `copy`. # Examples ```jldoctest julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> rotr90(a,1) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 3 1 4 2 julia> rotr90(a,2) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 3 2 1 julia> rotr90(a,3) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 4 1 3 julia> rotr90(a,4) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 ``` @@ -285,17 +285,17 @@ If `k` is even, this is equivalent to a `copy`. # Examples ```jldoctest julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> rot180(a,1) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 3 2 1 julia> rot180(a,2) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 ``` diff --git a/base/arrayshow.jl b/base/arrayshow.jl index d57320dfdfb24c..0d64a761135b1d 100644 --- a/base/arrayshow.jl +++ b/base/arrayshow.jl @@ -423,7 +423,10 @@ _show_nonempty(::IO, ::AbstractVector, ::String) = _show_nonempty(io::IO, X::AbstractArray{T,0} where T, prefix::String) = print_array(io, X) # NOTE: it's not clear how this method could use the :typeinfo attribute -_show_empty(io::IO, X::Array{T}) where {T} = print(io, "Array{", T, "}(undef,", join(size(X),','), ')') +function _show_empty(io::IO, X::Array) + show_datatype(io, typeof(X)) + print(io, "(undef, ", join(size(X),", "), ')') +end _show_empty(io, X::AbstractArray) = summary(io, X) # typeinfo aware (necessarily) diff --git a/base/bitarray.jl b/base/bitarray.jl index 42b299f3b65eca..74fb318e67fa1b 100644 --- a/base/bitarray.jl +++ b/base/bitarray.jl @@ -55,12 +55,12 @@ Behaves identically to the [`Array`](@ref) constructor. See [`undef`](@ref). # Examples ```julia-repl julia> BitArray(undef, 2, 2) -2×2 BitArray{2}: +2×2 BitMatrix: 0 0 0 0 julia> BitArray(undef, (3, 1)) -3×1 BitArray{2}: +3×1 BitMatrix: 0 0 0 @@ -74,7 +74,7 @@ BitArray{N}(::UndefInitializer, dims::NTuple{N,Integer}) where {N} = BitArray{N} const BitVector = BitArray{1} const BitMatrix = BitArray{2} -BitVector() = BitArray{1}(undef, 0) +BitVector() = BitVector(undef, 0) """ BitVector(nt::Tuple{Vararg{Bool}}) @@ -86,7 +86,7 @@ julia> nt = (true, false, true, false) (true, false, true, false) julia> BitVector(nt) -4-element BitArray{1}: +4-element BitVector: 1 0 1 @@ -395,7 +395,7 @@ Create a `BitArray` with all values set to `false`. # Examples ```jldoctest julia> falses(2,3) -2×3 BitArray{2}: +2×3 BitMatrix: 0 0 0 0 0 0 ``` @@ -413,7 +413,7 @@ Create a `BitArray` with all values set to `true`. # Examples ```jldoctest julia> trues(2,3) -2×3 BitArray{2}: +2×3 BitMatrix: 1 1 1 1 1 1 ``` @@ -550,17 +550,17 @@ The shape is inferred from the `itr` object. # Examples ```jldoctest julia> BitArray([1 0; 0 1]) -2×2 BitArray{2}: +2×2 BitMatrix: 1 0 0 1 julia> BitArray(x+y == 3 for x = 1:2, y = 1:3) -2×3 BitArray{2}: +2×3 BitMatrix: 0 1 0 1 0 0 julia> BitArray(x+y == 3 for x = 1:2 for y = 1:3) -6-element BitArray{1}: +6-element BitVector: 0 1 0 @@ -1276,7 +1276,7 @@ values. If `n < 0`, elements are shifted backwards. Equivalent to # Examples ```jldoctest julia> B = BitVector([true, false, true, false, false]) -5-element BitArray{1}: +5-element BitVector: 1 0 1 @@ -1284,7 +1284,7 @@ julia> B = BitVector([true, false, true, false, false]) 0 julia> B >> 1 -5-element BitArray{1}: +5-element BitVector: 0 1 0 @@ -1292,7 +1292,7 @@ julia> B >> 1 0 julia> B >> -1 -5-element BitArray{1}: +5-element BitVector: 0 1 0 @@ -1314,7 +1314,7 @@ values. If `n < 0`, elements are shifted forwards. Equivalent to # Examples ```jldoctest julia> B = BitVector([true, false, true, false, false]) -5-element BitArray{1}: +5-element BitVector: 1 0 1 @@ -1322,7 +1322,7 @@ julia> B = BitVector([true, false, true, false, false]) 0 julia> B << 1 -5-element BitArray{1}: +5-element BitVector: 0 1 0 @@ -1330,7 +1330,7 @@ julia> B << 1 0 julia> B << -1 -5-element BitArray{1}: +5-element BitVector: 0 1 0 diff --git a/base/bool.jl b/base/bool.jl index 871c7e83fbbc20..7d1e7b54970a13 100644 --- a/base/bool.jl +++ b/base/bool.jl @@ -26,7 +26,7 @@ julia> !missing missing julia> .![true false true] -1×3 BitArray{2}: +1×3 BitMatrix: 0 1 0 ``` """ @@ -66,7 +66,7 @@ julia> false ⊻ false false julia> [true; true; false] .⊻ [true; false; false] -3-element BitArray{1}: +3-element BitVector: 0 1 0 diff --git a/base/broadcast.jl b/base/broadcast.jl index 168431b5566d97..fb9c5948af4e62 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -663,7 +663,7 @@ Further, if `x` defines its own [`BroadcastStyle`](@ref), then it must define it # Examples ```jldoctest julia> Broadcast.broadcastable([1,2,3]) # like `identity` since arrays already support axes and indexing -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -724,7 +724,7 @@ single broadcast loop. # Examples ```jldoctest julia> A = [1, 2, 3, 4, 5] -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 3 @@ -732,7 +732,7 @@ julia> A = [1, 2, 3, 4, 5] 5 julia> B = [1 2; 3 4; 5 6; 7 8; 9 10] -5×2 Array{Int64,2}: +5×2 Matrix{Int64}: 1 2 3 4 5 6 @@ -740,7 +740,7 @@ julia> B = [1 2; 3 4; 5 6; 7 8; 9 10] 9 10 julia> broadcast(+, A, B) -5×2 Array{Int64,2}: +5×2 Matrix{Int64}: 2 3 5 6 8 9 @@ -748,7 +748,7 @@ julia> broadcast(+, A, B) 14 15 julia> parse.(Int, ["1", "2"]) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 @@ -759,12 +759,12 @@ julia> broadcast(+, 1.0, (0, -2.0)) (1.0, -1.0) julia> (+).([[0,2], [1,3]], Ref{Vector{Int}}([1,-1])) -2-element Array{Array{Int64,1},1}: +2-element Vector{Vector{Int64}}: [1, 1] [2, 2] julia> string.(("one","two","three","four"), ": ", 1:4) -4-element Array{String,1}: +4-element Vector{String}: "one: 1" "two: 2" "three: 3" @@ -794,19 +794,19 @@ julia> A = [1.0; 0.0]; B = [0.0; 0.0]; julia> broadcast!(+, B, A, (0, -2.0)); julia> B -2-element Array{Float64,1}: +2-element Vector{Float64}: 1.0 -2.0 julia> A -2-element Array{Float64,1}: +2-element Vector{Float64}: 1.0 0.0 julia> broadcast!(+, A, A, (0, -2.0)); julia> A -2-element Array{Float64,1}: +2-element Vector{Float64}: 1.0 -2.0 ``` @@ -1232,7 +1232,7 @@ If you want to *avoid* adding dots for selected function calls in julia> x = 1.0:3.0; y = similar(x); julia> @. y = x + 3 * sin(x) -3-element Array{Float64,1}: +3-element Vector{Float64}: 3.5244129544236893 4.727892280477045 3.4233600241796016 diff --git a/base/combinatorics.jl b/base/combinatorics.jl index 04080000507103..9469452735da23 100644 --- a/base/combinatorics.jl +++ b/base/combinatorics.jl @@ -166,7 +166,7 @@ julia> perm = [2, 4, 3, 1]; julia> permute!(A, perm); julia> A -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 4 3 @@ -213,7 +213,7 @@ julia> perm = [2, 4, 3, 1]; julia> invpermute!(A, perm); julia> A -4-element Array{Int64,1}: +4-element Vector{Int64}: 4 1 3 @@ -233,7 +233,7 @@ If `B = A[v]`, then `A == B[invperm(v)]`. julia> v = [2; 4; 3; 1]; julia> invperm(v) -4-element Array{Int64,1}: +4-element Vector{Int64}: 4 1 3 @@ -242,14 +242,14 @@ julia> invperm(v) julia> A = ['a','b','c','d']; julia> B = A[v] -4-element Array{Char,1}: +4-element Vector{Char}: 'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase) 'd': ASCII/Unicode U+0064 (category Ll: Letter, lowercase) 'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase) 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase) julia> B[invperm(v)] -4-element Array{Char,1}: +4-element Vector{Char}: 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase) 'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase) 'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase) diff --git a/base/complex.jl b/base/complex.jl index f0402a713a14b5..8aec9cf1301ee1 100644 --- a/base/complex.jl +++ b/base/complex.jl @@ -149,7 +149,7 @@ julia> complex(7) 7 + 0im julia> complex([1, 2, 3]) -3-element Array{Complex{Int64},1}: +3-element Vector{Complex{Int64}}: 1 + 0im 2 + 0im 3 + 0im diff --git a/base/docs/basedocs.jl b/base/docs/basedocs.jl index fd8240cba9a326..b03b10d5834255 100644 --- a/base/docs/basedocs.jl +++ b/base/docs/basedocs.jl @@ -1309,24 +1309,18 @@ An indexing operation into an array, `a`, tried to access an out-of-bounds eleme julia> A = fill(1.0, 7); julia> A[8] -ERROR: BoundsError: attempt to access 7-element Array{Float64,1} at index [8] -Stacktrace: - [1] getindex(::Array{Float64,1}, ::Int64) at ./array.jl:660 - [2] top-level scope +ERROR: BoundsError: attempt to access 7-element Vector{Float64} at index [8] + julia> B = fill(1.0, (2,3)); julia> B[2, 4] -ERROR: BoundsError: attempt to access 2×3 Array{Float64,2} at index [2, 4] -Stacktrace: - [1] getindex(::Array{Float64,2}, ::Int64, ::Int64) at ./array.jl:661 - [2] top-level scope +ERROR: BoundsError: attempt to access 2×3 Matrix{Float64} at index [2, 4] + julia> B[9] -ERROR: BoundsError: attempt to access 2×3 Array{Float64,2} at index [9] -Stacktrace: - [1] getindex(::Array{Float64,2}, ::Int64) at ./array.jl:660 - [2] top-level scope +ERROR: BoundsError: attempt to access 2×3 Matrix{Float64} at index [9] + ``` """ BoundsError @@ -1830,7 +1824,7 @@ Rational{Int64} julia> M = [1 2; 3.5 4]; julia> typeof(M) -Array{Float64,2} +Matrix{Float64} = Array{Float64,2} ``` """ typeof @@ -1899,7 +1893,7 @@ these values, i.e. `Nothing <: T`. # Examples ```jldoctest julia> Vector{Union{Nothing, String}}(nothing, 2) -2-element Array{Union{Nothing, String},1}: +2-element Vector{Union{Nothing, String}}: nothing nothing ``` @@ -1916,7 +1910,7 @@ these values, i.e. `Missing <: T`. # Examples ```jldoctest julia> Vector{Union{Missing, String}}(missing, 2) -2-element Array{Union{Missing, String},1}: +2-element Vector{Union{Missing, String}}: missing missing ``` @@ -1948,7 +1942,7 @@ these values, i.e. `Nothing <: T`. # Examples ```jldoctest julia> Matrix{Union{Nothing, String}}(nothing, 2, 3) -2×3 Array{Union{Nothing, String},2}: +2×3 Matrix{Union{Nothing, String}}: nothing nothing nothing nothing nothing nothing ``` @@ -1965,7 +1959,7 @@ these values, i.e. `Missing <: T`. # Examples ```jldoctest julia> Matrix{Union{Missing, String}}(missing, 2, 3) -2×3 Array{Union{Missing, String},2}: +2×3 Matrix{Union{Missing, String}}: missing missing missing missing missing missing ``` @@ -2009,12 +2003,12 @@ to hold these values, i.e. `Nothing <: T`. # Examples ```jldoctest julia> Array{Union{Nothing, String}}(nothing, 2) -2-element Array{Union{Nothing, String},1}: +2-element Vector{Union{Nothing, String}}: nothing nothing julia> Array{Union{Nothing, Int}}(nothing, 2, 3) -2×3 Array{Union{Nothing, Int64},2}: +2×3 Matrix{Union{Nothing, Int64}}: nothing nothing nothing nothing nothing nothing ``` @@ -2033,12 +2027,12 @@ to hold these values, i.e. `Missing <: T`. # Examples ```jldoctest julia> Array{Union{Missing, String}}(missing, 2) -2-element Array{Union{Missing, String},1}: +2-element Vector{Union{Missing, String}}: missing missing julia> Array{Union{Missing, Int}}(missing, 2, 3) -2×3 Array{Union{Missing, Int64},2}: +2×3 Matrix{Union{Missing, Int64}}: missing missing missing missing missing missing ``` @@ -2118,7 +2112,7 @@ julia> -(2) -2 julia> -[1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: -1 -2 -3 -4 ``` diff --git a/base/essentials.jl b/base/essentials.jl index 6a74e99c32a24a..bd5e5ec18c1d3c 100644 --- a/base/essentials.jl +++ b/base/essentials.jl @@ -407,7 +407,7 @@ julia> reinterpret(Float32, UInt32(7)) 1.0f-44 julia> reinterpret(Float32, UInt32[1 2 3 4 5]) -1×5 reinterpret(Float32, ::Array{UInt32,2}): +1×5 reinterpret(Float32, ::Matrix{UInt32}): 1.0f-45 3.0f-45 4.0f-45 6.0f-45 7.0f-45 ``` """ @@ -634,7 +634,7 @@ false julia> mutable struct Foo end julia> v = similar(rand(3), Foo) -3-element Array{Foo,1}: +3-element Vector{Foo}: #undef #undef #undef @@ -755,7 +755,7 @@ Base.ValueIterator for a Dict{String,Int64} with 2 entries. Values: 1 julia> values([2]) -1-element Array{Int64,1}: +1-element Vector{Int64}: 2 ``` """ diff --git a/base/float.jl b/base/float.jl index 42b298ebec595f..14f8b9fa749253 100644 --- a/base/float.jl +++ b/base/float.jl @@ -285,7 +285,7 @@ Equivalent to `typeof(float(zero(T)))`. # Examples ```jldoctest julia> float(Complex{Int}) -Complex{Float64} +ComplexF64 = Complex{Float64} julia> float(Int) Float64 diff --git a/base/generator.jl b/base/generator.jl index 7cd075d255b018..18087c083bf02c 100644 --- a/base/generator.jl +++ b/base/generator.jl @@ -21,7 +21,7 @@ julia> for x in g 25 julia> collect(g) -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 4 16 diff --git a/base/intfuncs.jl b/base/intfuncs.jl index b99bbb6f7410b4..ea10bfacfe0628 100644 --- a/base/intfuncs.jl +++ b/base/intfuncs.jl @@ -742,19 +742,19 @@ higher indices, such that `n == sum([digits[k]*base^(k-1) for k=1:length(digits) # Examples ```jldoctest julia> digits(10, base = 10) -2-element Array{Int64,1}: +2-element Vector{Int64}: 0 1 julia> digits(10, base = 2) -4-element Array{Int64,1}: +4-element Vector{Int64}: 0 1 0 1 julia> digits(10, base = 2, pad = 6) -6-element Array{Int64,1}: +6-element Vector{Int64}: 0 1 0 @@ -788,14 +788,14 @@ the array length. If the array length is excessive, the excess portion is filled # Examples ```jldoctest julia> digits!([2,2,2,2], 10, base = 2) -4-element Array{Int64,1}: +4-element Vector{Int64}: 0 1 0 1 julia> digits!([2,2,2,2,2,2], 10, base = 2) -6-element Array{Int64,1}: +6-element Vector{Int64}: 0 1 0 diff --git a/base/io.jl b/base/io.jl index 61c686a38529b4..3d29839a532777 100644 --- a/base/io.jl +++ b/base/io.jl @@ -512,12 +512,12 @@ julia> open("my_file.txt", "w") do io 57 julia> readlines("my_file.txt") -2-element Array{String,1}: +2-element Vector{String}: "JuliaLang is a GitHub organization." "It has many members." julia> readlines("my_file.txt", keep=true) -2-element Array{String,1}: +2-element Vector{String}: "JuliaLang is a GitHub organization.\\n" "It has many members.\\n" diff --git a/base/iterators.jl b/base/iterators.jl index fe5146f7585ab2..468232340ac00d 100644 --- a/base/iterators.jl +++ b/base/iterators.jl @@ -300,7 +300,7 @@ julia> a = 1:5 1:5 julia> b = ["e","d","b","c","a"] -5-element Array{String,1}: +5-element Vector{String}: "e" "d" "b" @@ -435,7 +435,7 @@ See [`Base.filter`](@ref) for an eager implementation of filtering for arrays. # Examples ```jldoctest julia> f = Iterators.filter(isodd, [1, 2, 3, 4, 5]) -Base.Iterators.Filter{typeof(isodd),Array{Int64,1}}(isodd, [1, 2, 3, 4, 5]) +Base.Iterators.Filter{typeof(isodd),Vector{Int64}}(isodd, [1, 2, 3, 4, 5]) julia> foreach(println, f) 1 @@ -541,7 +541,7 @@ An iterator that yields the same elements as `iter`, but starting at the given ` # Examples ```jldoctest julia> collect(Iterators.rest([1,2,3,4], 2)) -3-element Array{Int64,1}: +3-element Vector{Int64}: 2 3 4 @@ -564,7 +564,7 @@ julia> a 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase) julia> collect(rest) -2-element Array{Char,1}: +2-element Vector{Char}: 'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase) 'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase) ``` @@ -640,7 +640,7 @@ julia> a = 1:2:11 1:2:11 julia> collect(a) -6-element Array{Int64,1}: +6-element Vector{Int64}: 1 3 5 @@ -649,7 +649,7 @@ julia> collect(a) 11 julia> collect(Iterators.take(a,3)) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 3 5 @@ -697,7 +697,7 @@ julia> a = 1:2:11 1:2:11 julia> collect(a) -6-element Array{Int64,1}: +6-element Vector{Int64}: 1 3 5 @@ -706,7 +706,7 @@ julia> collect(a) 11 julia> collect(Iterators.drop(a,4)) -2-element Array{Int64,1}: +2-element Vector{Int64}: 9 11 ``` @@ -755,7 +755,7 @@ afterwards, drops every element. ```jldoctest julia> s = collect(1:5) -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 3 @@ -763,7 +763,7 @@ julia> s = collect(1:5) 5 julia> collect(Iterators.takewhile(<(3),s)) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 ``` @@ -802,7 +802,7 @@ afterwards, returns every element. ```jldoctest julia> s = collect(1:5) -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 3 @@ -810,7 +810,7 @@ julia> s = collect(1:5) 5 julia> collect(Iterators.dropwhile(<(3),s)) -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 4 5 @@ -889,7 +889,7 @@ many times (equivalent to `take(repeated(x), n)`). julia> a = Iterators.repeated([1 2], 4); julia> collect(a) -4-element Array{Array{Int64,2},1}: +4-element Vector{Matrix{Int64}}: [1 2] [1 2] [1 2] @@ -922,7 +922,7 @@ changes the fastest. # Examples ```jldoctest julia> collect(Iterators.product(1:2, 3:5)) -2×3 Array{Tuple{Int64,Int64},2}: +2×3 Matrix{Tuple{Int64,Int64}}: (1, 3) (1, 4) (1, 5) (2, 3) (2, 4) (2, 5) ``` @@ -1044,7 +1044,7 @@ Put differently, the elements of the argument iterator are concatenated. # Examples ```jldoctest julia> collect(Iterators.flatten((1:2, 8:9))) -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 8 @@ -1106,7 +1106,7 @@ Iterate over a collection `n` elements at a time. # Examples ```jldoctest julia> collect(Iterators.partition([1,2,3,4,5], 2)) -3-element Array{SubArray{Int64,1,Array{Int64,1},Tuple{UnitRange{Int64}},true},1}: +3-element Vector{SubArray{Int64,1,Vector{Int64},Tuple{UnitRange{Int64}},true}}: [1, 2] [3, 4] [5] @@ -1209,13 +1209,13 @@ julia> popfirst!(a) 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase) julia> collect(Iterators.take(a, 3)) -3-element Array{Char,1}: +3-element Vector{Char}: 'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase) 'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase) 'd': ASCII/Unicode U+0064 (category Ll: Letter, lowercase) julia> collect(a) -2-element Array{Char,1}: +2-element Vector{Char}: 'e': ASCII/Unicode U+0065 (category Ll: Letter, lowercase) 'f': ASCII/Unicode U+0066 (category Ll: Letter, lowercase) ``` diff --git a/base/math.jl b/base/math.jl index 768c556e0fcb4b..d55fc6d5650622 100644 --- a/base/math.jl +++ b/base/math.jl @@ -50,13 +50,13 @@ are promoted to a common type. # Examples ```jldoctest julia> clamp.([pi, 1.0, big(10.)], 2., 9.) -3-element Array{BigFloat,1}: +3-element Vector{BigFloat}: 3.141592653589793238462643383279502884197169399375105820974944592307816406286198 2.0 9.0 julia> clamp.([11,8,5],10,6) # an example where lo > hi -3-element Array{Int64,1}: +3-element Vector{Int64}: 6 6 10 diff --git a/base/missing.jl b/base/missing.jl index 403a1092a63fe1..63b876d2e17d79 100644 --- a/base/missing.jl +++ b/base/missing.jl @@ -212,17 +212,17 @@ julia> argmax(x) 3 julia> collect(keys(x)) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 3 julia> collect(skipmissing([1, missing, 2])) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 julia> collect(skipmissing([1 missing; 2 missing])) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 ``` @@ -368,12 +368,12 @@ but with all missing elements and those for which `f` returns `false` removed. # Examples ```jldoctest julia> x = [1 2; missing 4] -2×2 Array{Union{Missing, Int64},2}: +2×2 Matrix{Union{Missing, Int64}}: 1 2 missing 4 julia> filter(isodd, skipmissing(x)) -1-element Array{Int64,1}: +1-element Vector{Int64}: 1 ``` """ diff --git a/base/multidimensional.jl b/base/multidimensional.jl index 51de7184cb92f6..e2ec52bcf724ca 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -846,17 +846,17 @@ keyword argument. # Examples ```jldoctest julia> a = [2 4; 6 16] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 4 6 16 julia> diff(a, dims=2) -2×1 Array{Int64,2}: +2×1 Matrix{Int64}: 2 10 julia> diff(vec(a)) -3-element Array{Int64,1}: +3-element Vector{Int64}: 4 -2 12 @@ -940,23 +940,23 @@ the same object. `fill!(A, Foo())` will return `A` filled with the result of eva # Examples ```jldoctest julia> A = zeros(2,3) -2×3 Array{Float64,2}: +2×3 Matrix{Float64}: 0.0 0.0 0.0 0.0 0.0 0.0 julia> fill!(A, 2.) -2×3 Array{Float64,2}: +2×3 Matrix{Float64}: 2.0 2.0 2.0 2.0 2.0 2.0 julia> a = [1, 1, 1]; A = fill!(Vector{Vector{Int}}(undef, 3), a); a[1] = 2; A -3-element Array{Array{Int64,1},1}: +3-element Vector{Vector{Int64}}: [2, 1, 1] [2, 1, 1] [2, 1, 1] julia> x = 0; f() = (global x += 1; x); fill!(Vector{Int}(undef, 3), f()) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 1 1 @@ -1470,7 +1470,7 @@ julia> A = map(isodd, reshape(Vector(1:8), (2,2,2))) 0 0 julia> unique(A) -2-element Array{Bool,1}: +2-element Vector{Bool}: 1 0 @@ -1669,37 +1669,37 @@ For the remaining keyword arguments, see the documentation of [`sort!`](@ref). # Examples ```jldoctest julia> sortslices([7 3 5; -1 6 4; 9 -2 8], dims=1) # Sort rows -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: -1 6 4 7 3 5 9 -2 8 julia> sortslices([7 3 5; -1 6 4; 9 -2 8], dims=1, lt=(x,y)->isless(x[2],y[2])) -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 9 -2 8 7 3 5 -1 6 4 julia> sortslices([7 3 5; -1 6 4; 9 -2 8], dims=1, rev=true) -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 9 -2 8 7 3 5 -1 6 4 julia> sortslices([7 3 5; 6 -1 -4; 9 -2 8], dims=2) # Sort columns -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 3 5 7 -1 -4 6 -2 8 9 julia> sortslices([7 3 5; 6 -1 -4; 9 -2 8], dims=2, alg=InsertionSort, lt=(x,y)->isless(x[2],y[2])) -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 5 3 7 -4 -1 6 8 -2 9 julia> sortslices([7 3 5; 6 -1 -4; 9 -2 8], dims=2, rev=true) -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 7 5 3 6 -4 -1 9 8 -2 diff --git a/base/multimedia.jl b/base/multimedia.jl index 576623202c7f81..45e6b9532e9fae 100644 --- a/base/multimedia.jl +++ b/base/multimedia.jl @@ -141,7 +141,7 @@ the value of `x` would be entered in Julia. julia> A = [1 2; 3 4]; julia> repr("text/plain", A) -"2×2 Array{Int64,2}:\\n 1 2\\n 3 4" +"2×2 Matrix{Int64}:\\n 1 2\\n 3 4" ``` """ repr(m::MIME, x; context=nothing) = istextmime(m) ? _textrepr(m, x, context) : _binrepr(m, x, context) diff --git a/base/namedtuple.jl b/base/namedtuple.jl index f341291a7f00e1..c154ae9de889a2 100644 --- a/base/namedtuple.jl +++ b/base/namedtuple.jl @@ -37,12 +37,12 @@ julia> values(x) (1, 2) julia> collect(x) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 julia> collect(pairs(x)) -2-element Array{Pair{Symbol,Int64},1}: +2-element Vector{Pair{Symbol,Int64}}: :a => 1 :b => 2 ``` diff --git a/base/number.jl b/base/number.jl index 298e72fc258c64..99cf9d03188b57 100644 --- a/base/number.jl +++ b/base/number.jl @@ -235,7 +235,7 @@ julia> zero(big"2.0") 0.0 julia> zero(rand(2,2)) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.0 0.0 0.0 0.0 ``` diff --git a/base/operators.jl b/base/operators.jl index 605c0775ad00fe..c8e44e7c816eb9 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -563,12 +563,12 @@ julia> inv(3) * 6 julia> A = [4 3; 2 1]; x = [5, 6]; julia> A \\ x -2-element Array{Float64,1}: +2-element Vector{Float64}: 6.5 -7.0 julia> inv(A) * x -2-element Array{Float64,1}: +2-element Vector{Float64}: 6.5 -7.0 ``` @@ -856,7 +856,7 @@ and splatting `∘(fs...)` for composing an iterable collection of functions. # Examples ```jldoctest julia> map(uppercase∘first, ["apple", "banana", "carrot"]) -3-element Array{Char,1}: +3-element Vector{Char}: 'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase) 'B': ASCII/Unicode U+0042 (category Lu: Letter, uppercase) 'C': ASCII/Unicode U+0043 (category Lu: Letter, uppercase) @@ -1049,7 +1049,7 @@ passes a tuple as that single argument. # Example usage: ```jldoctest julia> map(Base.splat(+), zip(1:3,4:6)) -3-element Array{Int64,1}: +3-element Vector{Int64}: 5 7 9 @@ -1148,12 +1148,12 @@ julia> !(19 in a) false julia> [1, 2] .∈ [2, 3] -2-element BitArray{1}: +2-element BitVector: 0 0 julia> [1, 2] .∈ ([2, 3],) -2-element BitArray{1}: +2-element BitVector: 0 1 ``` @@ -1183,12 +1183,12 @@ julia> 1 ∉ 1:3 false julia> [1, 2] .∉ [2, 3] -2-element BitArray{1}: +2-element BitVector: 1 1 julia> [1, 2] .∉ ([2, 3],) -2-element BitArray{1}: +2-element BitVector: 1 0 ``` diff --git a/base/path.jl b/base/path.jl index ebad466848f155..d8d9565b838e67 100644 --- a/base/path.jl +++ b/base/path.jl @@ -214,7 +214,7 @@ the path, including the root directory if present. # Examples ```jldoctest julia> splitpath("/home/myuser/example.jl") -4-element Array{String,1}: +4-element Vector{String}: "/" "home" "myuser" diff --git a/base/permuteddimsarray.jl b/base/permuteddimsarray.jl index 348d4ad449a538..32c2f6a4904d7f 100644 --- a/base/permuteddimsarray.jl +++ b/base/permuteddimsarray.jl @@ -133,17 +133,17 @@ julia> c = [9 10; 11 12]; julia> d = [13 14; 15 16]; julia> X = [[a] [b]; [c] [d]] -2×2 Array{Array{Int64,2},2}: +2×2 Matrix{Matrix{Int64}}: [1 2; 3 4] [5 6; 7 8] [9 10; 11 12] [13 14; 15 16] julia> permutedims(X) -2×2 Array{Array{Int64,2},2}: +2×2 Matrix{Matrix{Int64}}: [1 2; 3 4] [9 10; 11 12] [5 6; 7 8] [13 14; 15 16] julia> transpose(X) -2×2 Transpose{Transpose{Int64,Array{Int64,2}},Array{Array{Int64,2},2}}: +2×2 Transpose{Transpose{Int64,Matrix{Int64}},Matrix{Matrix{Int64}}}: [1 3; 2 4] [9 11; 10 12] [5 7; 6 8] [13 15; 14 16] ``` @@ -160,20 +160,20 @@ the operation is not recursive. # Examples ```jldoctest; setup = :(using LinearAlgebra) julia> permutedims([1, 2, 3, 4]) -1×4 Array{Int64,2}: +1×4 Matrix{Int64}: 1 2 3 4 julia> V = [[[1 2; 3 4]]; [[5 6; 7 8]]] -2-element Array{Array{Int64,2},1}: +2-element Vector{Matrix{Int64}}: [1 2; 3 4] [5 6; 7 8] julia> permutedims(V) -1×2 Array{Array{Int64,2},2}: +1×2 Matrix{Matrix{Int64}}: [1 2; 3 4] [5 6; 7 8] julia> transpose(V) -1×2 Transpose{Transpose{Int64,Array{Int64,2}},Array{Array{Int64,2},1}}: +1×2 Transpose{Transpose{Int64,Matrix{Int64}},Vector{Matrix{Int64}}}: [1 3; 2 4] [5 7; 6 8] ``` """ diff --git a/base/promotion.jl b/base/promotion.jl index 6436ee3982dcd7..bbdf8e651708dc 100644 --- a/base/promotion.jl +++ b/base/promotion.jl @@ -330,12 +330,12 @@ julia> 3^5 243 julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> A^3 -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 37 54 81 118 ``` diff --git a/base/range.jl b/base/range.jl index 2319372847c162..308b8a4b314e68 100644 --- a/base/range.jl +++ b/base/range.jl @@ -182,7 +182,7 @@ and `a`, `b`, and `c` all integers creates a `StepRange`. # Examples ```jldoctest julia> collect(StepRange(1, Int8(2), 10)) -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 3 5 @@ -265,7 +265,7 @@ The syntax `a:b` with `a` and `b` both `Integer`s creates a `UnitRange`. # Examples ```jldoctest julia> collect(UnitRange(2.3, 5.2)) -3-element Array{Float64,1}: +3-element Vector{Float64}: 2.3 3.3 4.3 diff --git a/base/reduce.jl b/base/reduce.jl index c73caaeac7a973..7946667d025e98 100644 --- a/base/reduce.jl +++ b/base/reduce.jl @@ -777,7 +777,7 @@ values are `false` (or equivalently, if the input contains no `true` value), fol # Examples ```jldoctest julia> a = [true,false,false,true] -4-element Array{Bool,1}: +4-element Vector{Bool}: 1 0 0 @@ -812,7 +812,7 @@ values are `true` (or equivalently, if the input contains no `false` value), fol # Examples ```jldoctest julia> a = [true,false,false,true] -4-element Array{Bool,1}: +4-element Vector{Bool}: 1 0 0 diff --git a/base/reducedim.jl b/base/reducedim.jl index 8b0d8327f4e396..8980bd22c9c5e4 100644 --- a/base/reducedim.jl +++ b/base/reducedim.jl @@ -292,18 +292,18 @@ faster because the intermediate array is avoided. # Examples ```jldoctest julia> a = reshape(Vector(1:16), (4,4)) -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 julia> mapreduce(isodd, *, a, dims=1) -1×4 Array{Bool,2}: +1×4 Matrix{Bool}: 0 0 0 0 julia> mapreduce(isodd, |, a, dims=1) -1×4 Array{Bool,2}: +1×4 Matrix{Bool}: 1 1 1 1 ``` """ @@ -338,21 +338,21 @@ associativity, e.g. left-to-right, you should write your own loop or consider us # Examples ```jldoctest julia> a = reshape(Vector(1:16), (4,4)) -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 julia> reduce(max, a, dims=2) -4×1 Array{Int64,2}: +4×1 Matrix{Int64}: 13 14 15 16 julia> reduce(max, a, dims=1) -1×4 Array{Int64,2}: +1×4 Matrix{Int64}: 4 8 12 16 ``` """ @@ -372,16 +372,16 @@ dimensions. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> count(<=(2), A, dims=1) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 1 1 julia> count(<=(2), A, dims=2) -2×1 Array{Int64,2}: +2×1 Matrix{Int64}: 2 0 ``` @@ -401,16 +401,16 @@ singleton dimensions of `r`, writing the result into `r` in-place. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> count!(<=(2), [1 1], A) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 1 1 julia> count!(<=(2), [1; 1], A) -2-element Array{Int64,1}: +2-element Vector{Int64}: 2 0 ``` @@ -427,16 +427,16 @@ Sum elements of an array over the given dimensions. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> sum(A, dims=1) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 4 6 julia> sum(A, dims=2) -2×1 Array{Int64,2}: +2×1 Matrix{Int64}: 3 7 ``` @@ -451,17 +451,17 @@ Sum elements of `A` over the singleton dimensions of `r`, and write results to ` # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> sum!([1; 1], A) -2-element Array{Int64,1}: +2-element Vector{Int64}: 3 7 julia> sum!([1 1], A) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 4 6 ``` """ @@ -475,16 +475,16 @@ Multiply elements of an array over the given dimensions. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> prod(A, dims=1) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 3 8 julia> prod(A, dims=2) -2×1 Array{Int64,2}: +2×1 Matrix{Int64}: 2 12 ``` @@ -499,17 +499,17 @@ Multiply elements of `A` over the singleton dimensions of `r`, and write results # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> prod!([1; 1], A) -2-element Array{Int64,1}: +2-element Vector{Int64}: 2 12 julia> prod!([1 1], A) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 3 8 ``` """ @@ -525,16 +525,16 @@ which can be applied elementwise to arrays via `max.(a,b)`. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> maximum(A, dims=1) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 3 4 julia> maximum(A, dims=2) -2×1 Array{Int64,2}: +2×1 Matrix{Int64}: 2 4 ``` @@ -549,17 +549,17 @@ Compute the maximum value of `A` over the singleton dimensions of `r`, and write # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> maximum!([1; 1], A) -2-element Array{Int64,1}: +2-element Vector{Int64}: 2 4 julia> maximum!([1 1], A) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 3 4 ``` """ @@ -575,16 +575,16 @@ which can be applied elementwise to arrays via `min.(a,b)`. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> minimum(A, dims=1) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 1 2 julia> minimum(A, dims=2) -2×1 Array{Int64,2}: +2×1 Matrix{Int64}: 1 3 ``` @@ -599,17 +599,17 @@ Compute the minimum value of `A` over the singleton dimensions of `r`, and write # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> minimum!([1; 1], A) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 3 julia> minimum!([1 1], A) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 1 2 ``` """ @@ -623,16 +623,16 @@ Test whether all values along the given dimensions of an array are `true`. # Examples ```jldoctest julia> A = [true false; true true] -2×2 Array{Bool,2}: +2×2 Matrix{Bool}: 1 0 1 1 julia> all(A, dims=1) -1×2 Array{Bool,2}: +1×2 Matrix{Bool}: 1 0 julia> all(A, dims=2) -2×1 Array{Bool,2}: +2×1 Matrix{Bool}: 0 1 ``` @@ -647,17 +647,17 @@ Test whether all values in `A` along the singleton dimensions of `r` are `true`, # Examples ```jldoctest julia> A = [true false; true false] -2×2 Array{Bool,2}: +2×2 Matrix{Bool}: 1 0 1 0 julia> all!([1; 1], A) -2-element Array{Int64,1}: +2-element Vector{Int64}: 0 0 julia> all!([1 1], A) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 1 0 ``` """ @@ -671,16 +671,16 @@ Test whether any values along the given dimensions of an array are `true`. # Examples ```jldoctest julia> A = [true false; true false] -2×2 Array{Bool,2}: +2×2 Matrix{Bool}: 1 0 1 0 julia> any(A, dims=1) -1×2 Array{Bool,2}: +1×2 Matrix{Bool}: 1 0 julia> any(A, dims=2) -2×1 Array{Bool,2}: +2×1 Matrix{Bool}: 1 1 ``` @@ -696,17 +696,17 @@ results to `r`. # Examples ```jldoctest julia> A = [true false; true false] -2×2 Array{Bool,2}: +2×2 Matrix{Bool}: 1 0 1 0 julia> any!([1; 1], A) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 1 julia> any!([1 1], A) -1×2 Array{Int64,2}: +1×2 Matrix{Int64}: 1 0 ``` """ @@ -821,7 +821,7 @@ For an array input, returns the value and index of the minimum over the given di # Examples ```jldoctest julia> A = [1.0 2; 3 4] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 3.0 4.0 @@ -870,7 +870,7 @@ For an array input, returns the value and index of the maximum over the given di # Examples ```jldoctest julia> A = [1.0 2; 3 4] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 3.0 4.0 @@ -907,16 +907,16 @@ For an array input, return the indices of the minimum elements over the given di # Examples ```jldoctest julia> A = [1.0 2; 3 4] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 3.0 4.0 julia> argmin(A, dims=1) -1×2 Array{CartesianIndex{2},2}: +1×2 Matrix{CartesianIndex{2}}: CartesianIndex(1, 1) CartesianIndex(1, 2) julia> argmin(A, dims=2) -2×1 Array{CartesianIndex{2},2}: +2×1 Matrix{CartesianIndex{2}}: CartesianIndex(1, 1) CartesianIndex(2, 1) ``` @@ -932,16 +932,16 @@ For an array input, return the indices of the maximum elements over the given di # Examples ```jldoctest julia> A = [1.0 2; 3 4] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 3.0 4.0 julia> argmax(A, dims=1) -1×2 Array{CartesianIndex{2},2}: +1×2 Matrix{CartesianIndex{2}}: CartesianIndex(2, 1) CartesianIndex(2, 2) julia> argmax(A, dims=2) -2×1 Array{CartesianIndex{2},2}: +2×1 Matrix{CartesianIndex{2}}: CartesianIndex(1, 2) CartesianIndex(2, 2) ``` diff --git a/base/reflection.jl b/base/reflection.jl index 96035b178ffded..41544b2f66fc36 100644 --- a/base/reflection.jl +++ b/base/reflection.jl @@ -604,7 +604,7 @@ use it in the following manner to summarize information about a struct: julia> structinfo(T) = [(fieldoffset(T,i), fieldname(T,i), fieldtype(T,i)) for i = 1:fieldcount(T)]; julia> structinfo(Base.Filesystem.StatStruct) -12-element Array{Tuple{UInt64,Symbol,DataType},1}: +12-element Vector{Tuple{UInt64,Symbol,DataType}}: (0x0000000000000000, :device, UInt64) (0x0000000000000008, :inode, UInt64) (0x0000000000000010, :mode, UInt64) diff --git a/base/refpointer.jl b/base/refpointer.jl index 0a67a8bb240cf7..04610a8646679e 100644 --- a/base/refpointer.jl +++ b/base/refpointer.jl @@ -24,7 +24,7 @@ a `ccall` Ref argument. ```jldoctest julia> isa.(Ref([1,2,3]), [Array, Dict, Int]) -3-element BitArray{1}: +3-element BitVector: 1 0 0 diff --git a/base/regex.jl b/base/regex.jl index 1c94e245e3189d..83452cd0aeaac8 100644 --- a/base/regex.jl +++ b/base/regex.jl @@ -259,7 +259,7 @@ julia> m = match(rx, "cabac") RegexMatch("aba", 1="b") julia> m.captures -1-element Array{Union{Nothing, SubString{String}},1}: +1-element Vector{Union{Nothing, SubString{String}}}: "b" julia> m.match @@ -344,15 +344,15 @@ original string, otherwise they must be from disjoint character ranges. # Examples ```jldoctest julia> findall("a", "apple") -1-element Array{UnitRange{Int64},1}: +1-element Vector{UnitRange{Int64}}: 1:1 julia> findall("nana", "banana") -1-element Array{UnitRange{Int64},1}: +1-element Vector{UnitRange{Int64}}: 3:6 julia> findall("a", "banana") -3-element Array{UnitRange{Int64},1}: +3-element Vector{UnitRange{Int64}}: 2:2 4:4 6:6 @@ -595,12 +595,12 @@ julia> m = eachmatch(rx, "a1a2a3a") Base.RegexMatchIterator(r"a.a", "a1a2a3a", false) julia> collect(m) -2-element Array{RegexMatch,1}: +2-element Vector{RegexMatch}: RegexMatch("a1a") RegexMatch("a3a") julia> collect(eachmatch(rx, "a1a2a3a", overlap = true)) -3-element Array{RegexMatch,1}: +3-element Vector{RegexMatch}: RegexMatch("a1a") RegexMatch("a2a") RegexMatch("a3a") diff --git a/base/reinterpretarray.jl b/base/reinterpretarray.jl index c74efcc2bfb355..3b1f5a4cbfdb4c 100644 --- a/base/reinterpretarray.jl +++ b/base/reinterpretarray.jl @@ -54,8 +54,8 @@ StridedReshapedArray{T,N,A<:Union{DenseArray,StridedFastContiguousSubArray,Strid StridedSubArray{T,N,A<:Union{DenseArray,StridedReshapedArray,StridedReinterpretArray}, I<:Tuple{Vararg{Union{RangeIndex, ReshapedUnitRange, AbstractCartesianIndex}}}} = SubArray{T,N,A,I} StridedArray{T,N} = Union{DenseArray{T,N}, StridedSubArray{T,N}, StridedReshapedArray{T,N}, StridedReinterpretArray{T,N}} -StridedVector{T} = Union{DenseArray{T,1}, StridedSubArray{T,1}, StridedReshapedArray{T,1}, StridedReinterpretArray{T,1}} -StridedMatrix{T} = Union{DenseArray{T,2}, StridedSubArray{T,2}, StridedReshapedArray{T,2}, StridedReinterpretArray{T,2}} +StridedVector{T} = StridedArray{T,1} +StridedMatrix{T} = StridedArray{T,2} StridedVecOrMat{T} = Union{StridedVector{T}, StridedMatrix{T}} # the definition of strides for Array{T,N} is tuple() if N = 0, otherwise it is diff --git a/base/reshapedarray.jl b/base/reshapedarray.jl index 2a50c32eaf2c36..c137afc06e5e42 100644 --- a/base/reshapedarray.jl +++ b/base/reshapedarray.jl @@ -69,7 +69,7 @@ the specified dimensions is equal to the length of the original array # Examples ```jldoctest julia> A = Vector(1:16) -16-element Array{Int64,1}: +16-element Vector{Int64}: 1 2 3 @@ -88,14 +88,14 @@ julia> A = Vector(1:16) 16 julia> reshape(A, (4, 4)) -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 julia> reshape(A, 2, :) -2×8 Array{Int64,2}: +2×8 Matrix{Int64}: 1 3 5 7 9 11 13 15 2 4 6 8 10 12 14 16 diff --git a/base/set.jl b/base/set.jl index b98e65c844a1c0..ca152aedb5e57e 100644 --- a/base/set.jl +++ b/base/set.jl @@ -108,13 +108,13 @@ input is preserved. # Examples ```jldoctest julia> unique([1, 2, 6, 2]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 6 julia> unique(Real[1, 1.0, 2]) -2-element Array{Real,1}: +2-element Vector{Real}: 1 2 ``` @@ -175,7 +175,7 @@ applied to elements of `itr`. # Examples ```jldoctest julia> unique(x -> x^2, [1, -1, 3, -3, 4]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 3 4 @@ -240,19 +240,19 @@ elements of `A` , then return the modified A. # Examples ```jldoctest julia> unique!(x -> x^2, [1, -1, 3, -3, 4]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 3 4 julia> unique!(n -> n%3, [5, 1, 8, 9, 3, 4, 10, 7, 2, 6]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 5 1 9 julia> unique!(iseven, [2, 3, 5, 7, 9]) -2-element Array{Int64,1}: +2-element Vector{Int64}: 2 3 ``` @@ -329,13 +329,13 @@ more efficient as long as the elements of `A` can be sorted. # Examples ```jldoctest julia> unique!([1, 1, 1]) -1-element Array{Int64,1}: +1-element Vector{Int64}: 1 julia> A = [7, 3, 2, 3, 7, 5]; julia> unique!(A) -4-element Array{Int64,1}: +4-element Vector{Int64}: 7 3 2 @@ -346,7 +346,7 @@ julia> B = [7, 6, 42, 6, 7, 42]; julia> sort!(B); # unique! is able to process sorted data much more efficiently. julia> unique!(B) -3-element Array{Int64,1}: +3-element Vector{Int64}: 6 7 42 @@ -380,7 +380,7 @@ Return `true` if all values from `itr` are distinct when compared with [`isequal # Examples ```jldoctest julia> a = [1; 2; 3] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -461,7 +461,7 @@ See also [`replace`](@ref replace(A, old_new::Pair...)). # Examples ```jldoctest julia> replace!([1, 2, 1, 3], 1=>0, 2=>4, count=2) -4-element Array{Int64,1}: +4-element Vector{Int64}: 0 4 1 @@ -497,7 +497,7 @@ If `count` is specified, then replace at most `count` values in total # Examples ```jldoctest julia> replace!(x -> isodd(x) ? 2x : x, [1, 2, 3, 4]) -4-element Array{Int64,1}: +4-element Vector{Int64}: 2 2 6 @@ -539,14 +539,14 @@ See also [`replace!`](@ref). # Examples ```jldoctest julia> replace([1, 2, 1, 3], 1=>0, 2=>4, count=2) -4-element Array{Int64,1}: +4-element Vector{Int64}: 0 4 1 3 julia> replace([1, missing], missing=>0) -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 0 ``` @@ -587,7 +587,7 @@ If `count` is specified, then replace at most `count` values in total # Examples ```jldoctest julia> replace(x -> isodd(x) ? 2x : x, [1, 2, 3, 4]) -4-element Array{Int64,1}: +4-element Vector{Int64}: 2 2 6 diff --git a/base/show.jl b/base/show.jl index 300acd186e14be..222c2af88cda57 100644 --- a/base/show.jl +++ b/base/show.jl @@ -475,11 +475,8 @@ show(io::IO, ::Core.TypeofBottom) = print(io, "Union{}") show(io::IO, ::MIME"text/plain", ::Core.TypeofBottom) = print(io, "Union{}") function print_without_params(@nospecialize(x)) - if isa(x,UnionAll) - b = unwrap_unionall(x) - return isa(b,DataType) && b.name.wrapper === x - end - return false + b = unwrap_unionall(x) + return isa(b, DataType) && b.name.wrapper === x end has_typevar(@nospecialize(t), v::TypeVar) = ccall(:jl_has_typevar, Cint, (Any, Any), t, v)!=0 @@ -494,37 +491,265 @@ function io_has_tvar_name(io::IOContext, name::Symbol, @nospecialize(x)) end io_has_tvar_name(io::IO, name::Symbol, @nospecialize(x)) = false -function show(io::IO, @nospecialize(x::Type)) +modulesof!(s::Set{Any}, x::TypeVar) = modulesof!(s, x.ub) +function modulesof!(s::Set{Any}, x::Type) + x = unwrap_unionall(x) if x isa DataType - show_datatype(io, x) - return + push!(s, x.name.module) elseif x isa Union - if x.a isa DataType && Core.Compiler.typename(x.a) === Core.Compiler.typename(DenseArray) - T, N = x.a.parameters - if x == StridedArray{T,N} - print(io, "StridedArray") - show_delim_array(io, (T,N), '{', ',', '}', false) - return - elseif x == StridedVecOrMat{T} - print(io, "StridedVecOrMat") - show_delim_array(io, (T,), '{', ',', '}', false) - return - elseif StridedArray{T,N} <: x - print(io, "Union") - show_delim_array(io, vcat(StridedArray{T,N}, uniontypes(Core.Compiler.typesubtract(x, StridedArray{T,N}))), '{', ',', '}', false) - return + modulesof!(s, x.a) + modulesof!(s, x.b) + end + s +end + +# given an IO context for printing a type, reconstruct the proper type that +# we're attempting to represent. +# Union{T} where T is a degenerate case and is equal to T.ub, but we don't want +# to print them that way, so filter those out from our aliases completely. +function makeproper(io::IO, x::Type) + properx = x + x = unwrap_unionall(x) + if io isa IOContext + for (key, val) in io.dict + if key === :unionall_env && val isa TypeVar + properx = UnionAll(val, properx) end end - print(io, "Union") - show_delim_array(io, uniontypes(x), '{', ',', '}', false) - return end - x::UnionAll + if x isa Union + y = [] + normal = true + for typ in uniontypes(x) + if isa(typ, TypeVar) + normal = false + else + push!(y, typ) + end + end + normal || (x = Union{y...}) + properx = rewrap_unionall(x, properx) + end + has_free_typevars(properx) && return Any + return properx +end + +function make_typealias(x::Type) + Any <: x && return + x <: Tuple && return + mods = modulesof!(Set(), x) + Core in mods && push!(mods, Base) + aliases = Tuple{GlobalRef,SimpleVector}[] + xenv = UnionAll[] + for p in uniontypes(unwrap_unionall(x)) + p isa UnionAll && push!(xenv, p) + end + x isa UnionAll && push!(xenv, x) + for mod in mods + for name in names(mod) + if isdefined(mod, name) && !isdeprecated(mod, name) && isconst(mod, name) + alias = getfield(mod, name) + if alias isa Type && !has_free_typevars(alias) && !isvarargtype(alias) && !print_without_params(alias) && x <: alias + if alias isa UnionAll + (ti, env) = ccall(:jl_type_intersection_with_env, Any, (Any, Any), x, alias)::SimpleVector + # ti === Union{} && continue # impossible, since we already checked that x <: alias + env = env::SimpleVector + # TODO: In some cases (such as the following), the `env` is over-approximated. + # We'd like to disable `fix_inferred_var_bound` since we'll already do that fix-up here. + # (or detect and reverse the compution of it here). + # T = Array{Array{T,1}, 1} where T + # (ti, env) = ccall(:jl_type_intersection_with_env, Any, (Any, Any), T, Vector) + # env[1].ub.var == T.var + applied = alias{env...} + for p in xenv + applied = rewrap_unionall(applied, p) + end + has_free_typevars(applied) && continue + applied == x || continue # it couldn't figure out the parameter matching + elseif alias <: x + env = Core.svec() + else + continue # not a complete match + end + push!(aliases, (GlobalRef(mod, name), env)) + end + end + end + end + if length(aliases) == 1 # TODO: select the type with the "best" (shortest?) environment + return aliases[1] + end +end + +function show_typealias(io::IO, name::GlobalRef, x::Type, env::SimpleVector) + if !(get(io, :compact, false)::Bool) + # Print module prefix unless alias is visible from module passed to + # IOContext. If :module is not set, default to Main. nothing can be used + # to force printing prefix. + from = get(io, :module, Main) + if (from === nothing || !isvisible(name.name, name.mod, from)) + show(io, name.mod) + print(io, ".") + end + end + print(io, name.name) + n = length(env) + n == 0 && return + print(io, "{") + let io = IOContext(io) + for i = n:-1:1 + p = env[i] + if p isa TypeVar + io = IOContext(io, :unionall_env => p) + end + end + for i = 1:n + p = env[i] + show(io, p) + i < n && print(io, ",") + end + end + print(io, "}") + for i = n:-1:1 + p = env[i] + if p isa TypeVar && !io_has_tvar_name(io, p.name, x) + print(io, " where ") + show(io, p) + end + end +end + +function show_typealias(io::IO, x::Type) + properx = makeproper(io, x) + alias = make_typealias(properx) + alias === nothing && return false + show_typealias(io, alias[1], x, alias[2]) + return true +end + +function make_typealiases(x::Type) + Any <: x && return Core.svec(), Union{} + x <: Tuple && return Core.svec(), Union{} + mods = modulesof!(Set(), x) + Core in mods && push!(mods, Base) + aliases = SimpleVector[] + vars = Dict{Symbol,TypeVar}() + xenv = UnionAll[] + for p in uniontypes(unwrap_unionall(x)) + p isa UnionAll && push!(xenv, p) + end + x isa UnionAll && push!(xenv, x) + for mod in mods + for name in names(mod) + if isdefined(mod, name) && !isdeprecated(mod, name) && isconst(mod, name) + alias = getfield(mod, name) + if alias isa Type && !has_free_typevars(alias) && !isvarargtype(alias) && !print_without_params(alias) && !(alias <: Tuple) + (ti, env) = ccall(:jl_type_intersection_with_env, Any, (Any, Any), x, alias)::SimpleVector + ti === Union{} && continue + mod in modulesof!(Set(), alias) || continue # make sure this alias wasn't from an unrelated part of the Union + env = env::SimpleVector + applied = isempty(env) ? alias : alias{env...} + ul = unionlen(applied) + for p in xenv + applied = rewrap_unionall(applied, p) + end + has_free_typevars(applied) && continue + applied <: x || continue # parameter matching didn't make a subtype + print_without_params(x) && (env = Core.svec()) + push!(aliases, Core.svec(GlobalRef(mod, name), env, applied, (ul, -length(env)))) + end + end + end + end + if isempty(aliases) + return Core.svec(), Union{} + end + sort!(aliases, by = x -> x[4], rev = true) # heuristic sort by "best" environment + let applied = Union{} + applied1 = Union{} + keep = SimpleVector[] + prev = (0, 0) + for alias in aliases + if alias[4][1] < 2 + if !(alias[3] <: applied) + applied1 = Union{applied1, alias[3]} + push!(keep, alias) + end + elseif alias[4] == prev || !(alias[3] <: applied) + applied = applied1 = Union{applied1, alias[3]} + push!(keep, alias) + prev = alias[4] + end + end + return keep, applied1 + end +end + +function show_unionaliases(io::IO, x::Union) + properx = makeproper(io, x) + aliases, applied = make_typealiases(properx) + first = true + for typ in uniontypes(x) + if !isa(typ, TypeVar) && rewrap_unionall(typ, properx) <: applied + continue + end + print(io, first ? "Union{" : ", ") + first = false + show(io, typ) + end + if first && length(aliases) == 1 + alias = aliases[1] + show_typealias(io, alias[1], x, alias[2]) + else + for alias in aliases + print(io, first ? "Union{" : ", ") + first = false + env = alias[2] + show_typealias(io, alias[1], x, alias[2]) + end + print(io, "}") + end +end + +function show(io::IO, ::MIME"text/plain", @nospecialize(x::Type)) + show(io, x) + if !print_without_params(x) && get(io, :compact, true) + properx = makeproper(io, x) + if make_typealias(properx) !== nothing || x <: make_typealiases(properx)[2] + print(io, " = ") + show(IOContext(io, :compact => false), x) + end + end + + #s1 = sprint(show, x, context = io) + #s2 = sprint(show, x, context = IOContext(io, :compact => false)) + #print(io, s1) + #if s1 != s2 + # print(io, " = ", s2) + #end +end + +function show(io::IO, @nospecialize(x::Type)) if print_without_params(x) - return show(io, unwrap_unionall(x).name) + show_type_name(io, unwrap_unionall(x).name) + return + elseif get(io, :compact, true) && show_typealias(io, x) + return + elseif x isa DataType + show_datatype(io, x) + return + elseif x isa Union + if get(io, :compact, true) + show_unionaliases(io, x) + else + print(io, "Union") + show_delim_array(io, uniontypes(x), '{', ',', '}', false) + end + return end + x = x::UnionAll if x.var.name === :_ || io_has_tvar_name(io, x.var.name, x) counter = 1 while true @@ -593,31 +818,31 @@ function show_type_name(io::IO, tn::Core.TypeName) show_sym(io, sym) quo && print(io, ")") globfunc && print(io, ")") + nothing end function show_datatype(io::IO, x::DataType) istuple = x.name === Tuple.name - if (!isempty(x.parameters) || istuple) && x !== Tuple - n = length(x.parameters)::Int + n = length(x.parameters)::Int - # Print homogeneous tuples with more than 3 elements compactly as NTuple{N, T} - if istuple && n > 3 && all(i -> (x.parameters[1] === i), x.parameters) - print(io, "NTuple{", n, ',', x.parameters[1], "}") - else - show_type_name(io, x.name) + # Print homogeneous tuples with more than 3 elements compactly as NTuple{N, T} + if istuple && n > 3 && all(i -> (x.parameters[1] === i), x.parameters) + print(io, "NTuple{", n, ',', x.parameters[1], "}") + else + show_type_name(io, x.name) + if (n > 0 || istuple) && x !== Tuple # Do not print the type parameters for the primary type if we are # printing a method signature or type parameter. # Always print the type parameter if we are printing the type directly # since this information is still useful. print(io, '{') - for (i, p) in enumerate(x.parameters) + for i = 1:n + p = x.parameters[i] show(io, p) i < n && print(io, ',') end print(io, '}') end - else - show_type_name(io, x.name) end end @@ -2183,7 +2408,7 @@ julia> summary(1) "Int64" julia> summary(zeros(2)) -"2-element Array{Float64,1}" +"2-element Vector{Float64}" ``` """ summary(io::IO, x) = print(io, typeof(x)) diff --git a/base/sort.jl b/base/sort.jl index ff8edf15bd645d..12c82bcb6b5183 100644 --- a/base/sort.jl +++ b/base/sort.jl @@ -113,7 +113,7 @@ array. # Examples ```jldoctest julia> a = [1, 2, 4, 3, 4] -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 4 @@ -124,7 +124,7 @@ julia> partialsort!(a, 4) 4 julia> a -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 3 @@ -132,7 +132,7 @@ julia> a 4 julia> a = [1, 2, 4, 3, 4] -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 4 @@ -143,7 +143,7 @@ julia> partialsort!(a, 4, rev=true) 2 julia> a -5-element Array{Int64,1}: +5-element Vector{Int64}: 4 4 3 @@ -688,25 +688,25 @@ and `lt` are specified, the `lt` function is applied to the result of the `by` f # Examples ```jldoctest julia> v = [3, 1, 2]; sort!(v); v -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 julia> v = [3, 1, 2]; sort!(v, rev = true); v -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 2 1 julia> v = [(1, "c"), (3, "a"), (2, "b")]; sort!(v, by = x -> x[1]); v -3-element Array{Tuple{Int64,String},1}: +3-element Vector{Tuple{Int64,String}}: (1, "c") (2, "b") (3, "a") julia> v = [(1, "c"), (3, "a"), (2, "b")]; sort!(v, by = x -> x[2]); v -3-element Array{Tuple{Int64,String},1}: +3-element Vector{Tuple{Int64,String}}: (3, "a") (2, "b") (1, "c") @@ -765,13 +765,13 @@ Variant of [`sort!`](@ref) that returns a sorted copy of `v` leaving `v` itself julia> v = [3, 1, 2]; julia> sort(v) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 julia> v -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 1 2 @@ -800,13 +800,13 @@ julia> v[partialsortperm(v, 1)] 1 julia> p = partialsortperm(v, 1:3) -3-element view(::Array{Int64,1}, 1:3) with eltype Int64: +3-element view(::Vector{Int64}, 1:3) with eltype Int64: 2 4 3 julia> v[p] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 1 2 @@ -855,7 +855,7 @@ julia> partialsortperm!(ix, v, 1) julia> ix = [1:4;]; julia> partialsortperm!(ix, v, 2:3, initialized=true) -2-element view(::Array{Int64,1}, 2:3) with eltype Int64: +2-element view(::Vector{Int64}, 2:3) with eltype Int64: 4 3 ``` @@ -900,13 +900,13 @@ See also [`sortperm!`](@ref). julia> v = [3, 1, 2]; julia> p = sortperm(v) -3-element Array{Int64,1}: +3-element Vector{Int64}: 2 3 1 julia> v[p] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -950,13 +950,13 @@ Like [`sortperm`](@ref), but accepts a preallocated index vector `ix`. If `init julia> v = [3, 1, 2]; p = zeros(Int, 3); julia> sortperm!(p, v); p -3-element Array{Int64,1}: +3-element Vector{Int64}: 2 3 1 julia> v[p] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -1020,17 +1020,17 @@ To sort slices of an array, refer to [`sortslices`](@ref). # Examples ```jldoctest julia> A = [4 3; 1 2] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 3 1 2 julia> sort(A, dims = 1) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 4 3 julia> sort(A, dims = 2) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 3 4 1 2 ``` @@ -1080,17 +1080,17 @@ To sort slices of an array, refer to [`sortslices`](@ref). # Examples ```jldoctest julia> A = [4 3; 1 2] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 3 1 2 julia> sort!(A, dims = 1); A -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 4 3 julia> sort!(A, dims = 2); A -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 ``` diff --git a/base/strings/io.jl b/base/strings/io.jl index 22a8d109cf0e76..37b80f80571194 100644 --- a/base/strings/io.jl +++ b/base/strings/io.jl @@ -94,7 +94,7 @@ julia> sprint(show, 66.66666; context=:compact => true) "66.6667" julia> sprint(showerror, BoundsError([1], 100)) -"BoundsError: attempt to access 1-element Array{Int64,1} at index [100]" +"BoundsError: attempt to access 1-element Vector{Int64} at index [100]" ``` """ function sprint(f::Function, args...; context=nothing, sizehint::Integer=0) diff --git a/base/strings/util.jl b/base/strings/util.jl index e7abfa0bf3f98f..3a0c26a9a54cc2 100644 --- a/base/strings/util.jl +++ b/base/strings/util.jl @@ -369,7 +369,7 @@ julia> a = "Ma.rch" "Ma.rch" julia> split(a, ".") -2-element Array{SubString{String},1}: +2-element Vector{SubString{String}}: "Ma" "rch" ``` @@ -431,7 +431,7 @@ julia> a = "M.a.r.c.h" "M.a.r.c.h" julia> rsplit(a, ".") -5-element Array{SubString{String},1}: +5-element Vector{SubString{String}}: "M" "a" "r" @@ -439,11 +439,11 @@ julia> rsplit(a, ".") "h" julia> rsplit(a, "."; limit=1) -1-element Array{SubString{String},1}: +1-element Vector{SubString{String}}: "M.a.r.c.h" julia> rsplit(a, "."; limit=2) -2-element Array{SubString{String},1}: +2-element Vector{SubString{String}}: "M.a.r.c" "h" ``` @@ -582,7 +582,7 @@ julia> s = string(12345, base = 16) "3039" julia> hex2bytes(s) -2-element Array{UInt8,1}: +2-element Vector{UInt8}: 0x30 0x39 @@ -596,7 +596,7 @@ julia> a = b"01abEF" 0x46 julia> hex2bytes(a) -3-element Array{UInt8,1}: +3-element Vector{UInt8}: 0x01 0xab 0xef @@ -651,7 +651,7 @@ julia> a = string(12345, base = 16) "3039" julia> b = hex2bytes(a) -2-element Array{UInt8,1}: +2-element Vector{UInt8}: 0x30 0x39 diff --git a/base/subarray.jl b/base/subarray.jl index ba891183924bbb..1f741c5c63c892 100644 --- a/base/subarray.jl +++ b/base/subarray.jl @@ -81,7 +81,7 @@ Return the indices in the [`parent`](@ref) which correspond to the array view `A julia> A = [1 2; 3 4]; julia> V = view(A, 1, :) -2-element view(::Array{Int64,2}, 1, :) with eltype Int64: +2-element view(::Matrix{Int64}, 1, :) with eltype Int64: 1 2 @@ -129,22 +129,22 @@ indices to the parent array on the fly without checking bounds. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> b = view(A, :, 1) -2-element view(::Array{Int64,2}, :, 1) with eltype Int64: +2-element view(::Matrix{Int64}, :, 1) with eltype Int64: 1 3 julia> fill!(b, 0) -2-element view(::Array{Int64,2}, :, 1) with eltype Int64: +2-element view(::Matrix{Int64}, :, 1) with eltype Int64: 0 0 julia> A # Note A has changed even though we modified b -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 0 2 0 4 ``` diff --git a/base/views.jl b/base/views.jl index b82513d73ed8bb..0d6a9200f7c769 100644 --- a/base/views.jl +++ b/base/views.jl @@ -89,22 +89,22 @@ to switch an entire block of code to use views for slicing. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> b = @view A[:, 1] -2-element view(::Array{Int64,2}, :, 1) with eltype Int64: +2-element view(::Matrix{Int64}, :, 1) with eltype Int64: 1 3 julia> fill!(b, 0) -2-element view(::Array{Int64,2}, :, 1) with eltype Int64: +2-element view(::Matrix{Int64}, :, 1) with eltype Int64: 0 0 julia> A -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 0 2 0 4 ``` @@ -217,7 +217,7 @@ julia> @views for row in 1:3 end julia> A -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 1.0 1.0 2.0 2.0 2.0 3.0 3.0 3.0 diff --git a/deps/checksums/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1.tar.gz/md5 b/deps/checksums/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1.tar.gz/md5 deleted file mode 100644 index a7f8d6e48bf8bb..00000000000000 --- a/deps/checksums/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -f038b99cd73f2ed8d132b88676b4ec64 diff --git a/deps/checksums/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1.tar.gz/sha512 b/deps/checksums/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1.tar.gz/sha512 deleted file mode 100644 index 3c6eb1a4a45cd7..00000000000000 --- a/deps/checksums/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -7c3b7086e74e53465405c7130182c8016d894151a89f16af8037018aebde495cf599edfd631c7fc14faca5a5052c168b1f0373bc124bec3c0ac7851667689bcf diff --git a/doc/src/base/sort.md b/doc/src/base/sort.md index 17a9b8c5ed97d9..f4c07b1e138e80 100644 --- a/doc/src/base/sort.md +++ b/doc/src/base/sort.md @@ -5,7 +5,7 @@ values. By default, Julia picks reasonable algorithms and sorts in standard asce ```jldoctest julia> sort([2,3,1]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -15,7 +15,7 @@ You can easily sort in reverse order as well: ```jldoctest julia> sort([2,3,1], rev=true) -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 2 1 @@ -29,7 +29,7 @@ julia> a = [2,3,1]; julia> sort!(a); julia> a -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 diff --git a/doc/src/devdocs/inference.md b/doc/src/devdocs/inference.md index 6c8383d19c5d11..8cf3ec8a3af78b 100644 --- a/doc/src/devdocs/inference.md +++ b/doc/src/devdocs/inference.md @@ -117,7 +117,7 @@ cst = map(cost, ci.code) # output -31-element Array{Int64,1}: +31-element Vector{Int64}: 0 0 20 diff --git a/doc/src/devdocs/reflection.md b/doc/src/devdocs/reflection.md index 726be76ec3b203..fbf0fd58d86a44 100644 --- a/doc/src/devdocs/reflection.md +++ b/doc/src/devdocs/reflection.md @@ -52,7 +52,7 @@ the abstract `DataType` [`AbstractFloat`](@ref) has four (concrete) subtypes: ```jldoctest; setup = :(using InteractiveUtils) julia> subtypes(AbstractFloat) -4-element Array{Any,1}: +4-element Vector{Any}: BigFloat Float16 Float32 diff --git a/doc/src/devdocs/subarrays.md b/doc/src/devdocs/subarrays.md index c86fdb07b76d5e..245bc0b7dcee7a 100644 --- a/doc/src/devdocs/subarrays.md +++ b/doc/src/devdocs/subarrays.md @@ -154,7 +154,7 @@ julia> A = reshape(1:4*2, 4, 2) 4 8 julia> diff(A[2:2:4,:][:]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 2 2 2 @@ -174,7 +174,7 @@ julia> A = reshape(1:5*2, 5, 2) 5 10 julia> diff(A[2:2:4,:][:]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 2 3 2 diff --git a/doc/src/manual/arrays.md b/doc/src/manual/arrays.md index e7f4e9fc55e4cf..095f594ada1dbf 100644 --- a/doc/src/manual/arrays.md +++ b/doc/src/manual/arrays.md @@ -76,17 +76,17 @@ omitted it will default to [`Float64`](@ref). To see the various ways we can pass dimensions to these functions, consider the following examples: ```jldoctest julia> zeros(Int8, 2, 3) -2×3 Array{Int8,2}: +2×3 Matrix{Int8}: 0 0 0 0 0 0 julia> zeros(Int8, (2, 3)) -2×3 Array{Int8,2}: +2×3 Matrix{Int8}: 0 0 0 0 0 0 julia> zeros((2, 3)) -2×3 Array{Float64,2}: +2×3 Matrix{Float64}: 0.0 0.0 0.0 0.0 0.0 0.0 ``` @@ -106,7 +106,7 @@ where no arguments are given. ```jldoctest julia> [1,2,3] # An array of `Int`s -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -115,7 +115,7 @@ julia> promote(1, 2.3, 4//5) # This combination of Int, Float64 and Rational pro (1.0, 2.3, 0.8) julia> [1, 2.3, 4//5] # Thus that's the element type of this Array -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 2.3 0.8 @@ -132,12 +132,12 @@ the arguments being used as elements themselves. ```jldoctest julia> [1:2, 4:5] # Has a comma, so no concatenation occurs. The ranges are themselves the elements -2-element Array{UnitRange{Int64},1}: +2-element Vector{UnitRange{Int64}}: 1:2 4:5 julia> [1:2; 4:5] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 4 @@ -146,7 +146,7 @@ julia> [1:2; 4:5] julia> [1:2 4:5 6] -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 4 @@ -159,17 +159,17 @@ _horizontally concatenated_ together. ```jldoctest julia> [1:2 4:5 7:8] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 4 7 2 5 8 julia> [[1,2] [4,5] [7,8]] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 4 7 2 5 8 julia> [1 2 3] # Numbers can also be horizontally concatenated -1×3 Array{Int64,2}: +1×3 Matrix{Int64}: 1 2 3 ``` @@ -179,13 +179,13 @@ both horizontally and vertically at the same time. ```jldoctest julia> [1 2 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> [zeros(Int, 2, 2) [1; 2] [3 4] 5] -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 0 0 1 0 0 2 3 4 5 @@ -212,11 +212,11 @@ result. ```jldoctest julia> [[1 2] [3 4]] -1×4 Array{Int64,2}: +1×4 Matrix{Int64}: 1 2 3 4 julia> Int8[[1 2] [3 4]] -1×4 Array{Int8,2}: +1×4 Matrix{Int8}: 1 2 3 4 ``` @@ -293,7 +293,7 @@ us add a third argument to [`map`](@ref): ```jldoctest julia> map(tuple, (1/(i+j) for i=1:2, j=1:2), [1 3; 2 4]) -2×2 Array{Tuple{Float64,Int64},2}: +2×2 Matrix{Tuple{Float64,Int64}}: (0.5, 1) (0.333333, 3) (0.333333, 2) (0.25, 4) ``` @@ -311,7 +311,7 @@ keywords: ```jldoctest julia> [(i,j) for i=1:3 for j=1:i] -6-element Array{Tuple{Int64,Int64},1}: +6-element Vector{Tuple{Int64,Int64}}: (1, 1) (2, 1) (2, 2) @@ -326,7 +326,7 @@ Generated values can be filtered using the `if` keyword: ```jldoctest julia> [(i,j) for i=1:3 for j=1:i if i+j == 4] -2-element Array{Tuple{Int64,Int64},1}: +2-element Vector{Tuple{Int64,Int64}}: (2, 2) (3, 1) ``` @@ -408,12 +408,12 @@ Example: julia> A = reshape(collect(1:16), (2, 2, 2, 2)); julia> A[[1 2; 1 2]] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 1 2 julia> A[[1 2; 1 2], 1, 2, 1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 5 6 5 6 ``` @@ -441,12 +441,12 @@ julia> x = reshape(1:16, 4, 4) 4 8 12 16 julia> x[2:3, 2:end-1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 6 10 7 11 julia> x[1, [2 3; 4 1]] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 5 9 13 1 ``` @@ -496,7 +496,7 @@ Example: ```jldoctest julia> x = collect(reshape(1:9, 3, 3)) -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 4 7 2 5 8 3 6 9 @@ -506,7 +506,7 @@ julia> x[3, 3] = -9; julia> x[1:2, 1:2] = [-1 -4; -2 -5]; julia> x -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: -1 -4 7 -2 -5 8 3 6 -9 @@ -534,7 +534,7 @@ indices and can be converted to such by [`to_indices`](@ref): Some examples: ```jldoctest julia> A = reshape(collect(1:2:18), (3, 3)) -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 7 13 3 9 15 5 11 17 @@ -543,13 +543,13 @@ julia> A[4] 7 julia> A[[2, 5, 8]] -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 9 15 julia> A[[1 4; 3 8]] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 7 5 15 @@ -557,19 +557,19 @@ julia> A[[]] Int64[] julia> A[1:2:5] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 5 9 julia> A[2, :] -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 9 15 julia> A[:, 3] -3-element Array{Int64,1}: +3-element Vector{Int64}: 13 15 17 @@ -605,7 +605,7 @@ accessing the diagonal elements from the first "page" of `A` from above: ```jldoctest cartesianindex julia> page = A[:,:,1] -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 1 5 9 13 2 6 10 14 3 7 11 15 @@ -615,7 +615,7 @@ julia> page[[CartesianIndex(1,1), CartesianIndex(2,2), CartesianIndex(3,3), CartesianIndex(4,4)]] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 6 11 @@ -629,14 +629,14 @@ to extract both diagonals from the two pages at the same time: ```jldoctest cartesianindex julia> A[CartesianIndex.(axes(A, 1), axes(A, 2)), 1] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 6 11 16 julia> A[CartesianIndex.(axes(A, 1), axes(A, 2)), :] -4×2 Array{Int64,2}: +4×2 Matrix{Int64}: 1 17 6 22 11 27 @@ -671,19 +671,19 @@ julia> x = reshape(1:16, 4, 4) 4 8 12 16 julia> x[[false, true, true, false], :] -2×4 Array{Int64,2}: +2×4 Matrix{Int64}: 2 6 10 14 3 7 11 15 julia> mask = map(ispow2, x) -4×4 Array{Bool,2}: +4×4 Matrix{Bool}: 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 julia> x[mask] -5-element Array{Int64,1}: +5-element Vector{Int64}: 1 2 4 @@ -710,7 +710,7 @@ one-dimensional vector with [`vec`](@ref). ```jldoctest linindexing julia> A = [2 6; 4 7; 3 1] -3×2 Array{Int64,2}: +3×2 Matrix{Int64}: 2 6 4 7 3 1 @@ -795,7 +795,7 @@ allows vectors to be indexed like one-column matrices, for example: ```jldoctest julia> A = [8,6,7] -3-element Array{Int64,1}: +3-element Vector{Int64}: 8 6 7 @@ -929,17 +929,17 @@ iterated over or indexed into elementwise. ```jldoctest julia> convert.(Float32, [1, 2]) -2-element Array{Float32,1}: +2-element Vector{Float32}: 1.0 2.0 julia> ceil.(UInt8, [1.2 3.4; 5.6 6.7]) -2×2 Array{UInt8,2}: +2×2 Matrix{UInt8}: 0x02 0x04 0x06 0x07 julia> string.(1:3, ". ", ["First", "Second", "Third"]) -3-element Array{String,1}: +3-element Vector{String}: "1. First" "2. Second" "3. Third" diff --git a/doc/src/manual/calling-c-and-fortran-code.md b/doc/src/manual/calling-c-and-fortran-code.md index 40a4591c6e7ffa..30a36e9af7d50d 100644 --- a/doc/src/manual/calling-c-and-fortran-code.md +++ b/doc/src/manual/calling-c-and-fortran-code.md @@ -226,7 +226,7 @@ The final call to `qsort` looks like this: ```jldoctest mycompare julia> A = [1.3, -2.7, 4.4, 3.1] -4-element Array{Float64,1}: +4-element Vector{Float64}: 1.3 -2.7 4.4 @@ -236,7 +236,7 @@ julia> ccall(:qsort, Cvoid, (Ptr{Cdouble}, Csize_t, Csize_t, Ptr{Cvoid}), A, length(A), sizeof(eltype(A)), mycompare_c) julia> A -4-element Array{Float64,1}: +4-element Vector{Float64}: -2.7 1.3 3.1 diff --git a/doc/src/manual/constructors.md b/doc/src/manual/constructors.md index 31c0576e748be7..fd9afeea0e8a89 100644 --- a/doc/src/manual/constructors.md +++ b/doc/src/manual/constructors.md @@ -548,9 +548,11 @@ julia> struct SummedArray{T<:Number,S<:Number} end julia> SummedArray(Int32[1; 2; 3], Int32(6)) -ERROR: MethodError: no method matching SummedArray(::Array{Int32,1}, ::Int32) +ERROR: MethodError: no method matching SummedArray(::Vector{Int32}, ::Int32) Closest candidates are: - SummedArray(::Array{T,1}) where T at none:4 + SummedArray(::Vector{T}) where T at none:4 +Stacktrace: + [1] top-level scope at none:1 ``` This constructor will be invoked by the syntax `SummedArray(a)`. The syntax `new{T,S}` allows diff --git a/doc/src/manual/conversion-and-promotion.md b/doc/src/manual/conversion-and-promotion.md index 109287fd9d2055..69e99548ff91c5 100644 --- a/doc/src/manual/conversion-and-promotion.md +++ b/doc/src/manual/conversion-and-promotion.md @@ -73,12 +73,12 @@ julia> typeof(xf) Float64 julia> a = Any[1 2 3; 4 5 6] -2×3 Array{Any,2}: +2×3 Matrix{Any}: 1 2 3 4 5 6 julia> convert(Array{Float64}, a) -2×3 Array{Float64,2}: +2×3 Matrix{Float64}: 1.0 2.0 3.0 4.0 5.0 6.0 ``` diff --git a/doc/src/manual/faq.md b/doc/src/manual/faq.md index c3ef33c3d098e2..af45a6a9a08139 100644 --- a/doc/src/manual/faq.md +++ b/doc/src/manual/faq.md @@ -147,7 +147,7 @@ but you *can* change its content. For example: ```jldoctest julia> x = [1,2,3] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -161,7 +161,7 @@ julia> change_array!(x) 5 julia> x -3-element Array{Int64,1}: +3-element Vector{Int64}: 5 2 3 @@ -253,7 +253,7 @@ julia> function threeargs(a, b, c) threeargs (generic function with 1 method) julia> x = [1, 2, 3] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -308,7 +308,7 @@ julia> threetup() (3, 3) julia> threearr() -2-element Array{Int64,1}: +2-element Vector{Int64}: 3 3 ``` diff --git a/doc/src/manual/functions.md b/doc/src/manual/functions.md index aa7766f2b97a1a..6dcec615d29948 100644 --- a/doc/src/manual/functions.md +++ b/doc/src/manual/functions.md @@ -242,7 +242,7 @@ an array and returns a new array containing the resulting values: ```jldoctest julia> map(round, [1.2, 3.5, 1.7]) -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 4.0 2.0 @@ -255,7 +255,7 @@ without needing a name: ```jldoctest julia> map(x -> x^2 + 2x - 1, [1, 3, -1]) -3-element Array{Int64,1}: +3-element Vector{Int64}: 2 14 -2 @@ -462,7 +462,7 @@ Furthermore, the iterable object splatted into a function call need not be a tup ```jldoctest barfunc julia> x = [3,4] -2-element Array{Int64,1}: +2-element Vector{Int64}: 3 4 @@ -470,7 +470,7 @@ julia> bar(1,2,x...) (1, 2, (3, 4)) julia> x = [1,2,3,4] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 3 @@ -487,7 +487,7 @@ often is): julia> baz(a,b) = a + b; julia> args = [1,2] -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 @@ -495,7 +495,7 @@ julia> baz(args...) 3 julia> args = [1,2,3] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -747,7 +747,7 @@ The next example composes three functions and maps the result over an array of s ```jldoctest julia> map(first ∘ reverse ∘ uppercase, split("you can compose functions like this")) -6-element Array{Char,1}: +6-element Vector{Char}: 'U': ASCII/Unicode U+0055 (category Lu: Letter, uppercase) 'N': ASCII/Unicode U+004E (category Lu: Letter, uppercase) 'E': ASCII/Unicode U+0045 (category Lu: Letter, uppercase) @@ -774,7 +774,7 @@ The pipe operator can also be used with broadcasting, as `.|>`, to provide a use ```jldoctest julia> ["a", "list", "of", "strings"] .|> [uppercase, reverse, titlecase, length] -4-element Array{Any,1}: +4-element Vector{Any}: "A" "tsil" "Of" @@ -795,13 +795,13 @@ For example, `sin` can be applied to all elements in the vector `A` like so: ```jldoctest julia> A = [1.0, 2.0, 3.0] -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 2.0 3.0 julia> sin.(A) -3-element Array{Float64,1}: +3-element Vector{Float64}: 0.8414709848078965 0.9092974268256817 0.1411200080598672 @@ -826,13 +826,13 @@ julia> A = [1.0, 2.0, 3.0]; julia> B = [4.0, 5.0, 6.0]; julia> f.(pi, A) -3-element Array{Float64,1}: +3-element Vector{Float64}: 13.42477796076938 17.42477796076938 21.42477796076938 julia> f.(A, B) -3-element Array{Float64,1}: +3-element Vector{Float64}: 19.0 26.0 33.0 @@ -869,7 +869,7 @@ julia> Y = [1.0, 2.0, 3.0, 4.0]; julia> X = similar(Y); # pre-allocate output array julia> @. X = sin(cos(Y)) # equivalent to X .= sin.(cos.(Y)) -4-element Array{Float64,1}: +4-element Vector{Float64}: 0.5143952585235492 -0.4042391538522658 -0.8360218615377305 @@ -884,7 +884,7 @@ they are equivalent to `broadcast` calls and are fused with other nested "dot" c You can also combine dot operations with function chaining using [`|>`](@ref), as in this example: ```jldoctest julia> [1:5;] .|> [x->x^2, inv, x->2*x, -, isodd] -5-element Array{Real,1}: +5-element Vector{Real}: 1 0.5 6 diff --git a/doc/src/manual/interfaces.md b/doc/src/manual/interfaces.md index a8306ae4f4c34a..d32bab5e6977cf 100644 --- a/doc/src/manual/interfaces.md +++ b/doc/src/manual/interfaces.md @@ -117,7 +117,7 @@ of the right size instead of naively [`push!`](@ref)ing each element into a `Vec ```jldoctest squaretype julia> collect(Squares(4)) -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 4 9 @@ -151,7 +151,7 @@ In our `Squares` example, we would implement `Iterators.Reverse{Squares}` method julia> Base.iterate(rS::Iterators.Reverse{Squares}, state=rS.itr.count) = state < 1 ? nothing : (state*state, state-1) julia> collect(Iterators.reverse(Squares(4))) -4-element Array{Int64,1}: +4-element Vector{Int64}: 16 9 4 @@ -203,7 +203,7 @@ julia> Base.getindex(S::Squares, i::Number) = S[convert(Int, i)] julia> Base.getindex(S::Squares, I) = [S[i] for i in I] julia> Squares(10)[[3,4.,5]] -3-element Array{Int64,1}: +3-element Vector{Int64}: 9 16 25 @@ -289,19 +289,19 @@ julia> s = SquaresVector(4) 16 julia> s[s .> 8] -2-element Array{Int64,1}: +2-element Vector{Int64}: 9 16 julia> s + s -4-element Array{Int64,1}: +4-element Vector{Int64}: 2 8 18 32 julia> sin.(s) -4-element Array{Float64,1}: +4-element Vector{Float64}: 0.8414709848078965 -0.7568024953079282 0.4121184852417566 diff --git a/doc/src/manual/mathematical-operations.md b/doc/src/manual/mathematical-operations.md index 54f0b36413c58f..7e7ff5e5300f50 100644 --- a/doc/src/manual/mathematical-operations.md +++ b/doc/src/manual/mathematical-operations.md @@ -164,7 +164,7 @@ applies the operator elementwise. ```jldoctest julia> [1,2,3] .^ 3 -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 8 27 diff --git a/doc/src/manual/metaprogramming.md b/doc/src/manual/metaprogramming.md index 9d8039cee5e416..c34ef496e9f0bd 100644 --- a/doc/src/manual/metaprogramming.md +++ b/doc/src/manual/metaprogramming.md @@ -47,7 +47,7 @@ julia> ex1.head ```jldoctest prog julia> ex1.args -3-element Array{Any,1}: +3-element Vector{Any}: :+ 1 1 diff --git a/doc/src/manual/methods.md b/doc/src/manual/methods.md index 6ab162e591e135..18d0a77f0fad6c 100644 --- a/doc/src/manual/methods.md +++ b/doc/src/manual/methods.md @@ -325,28 +325,32 @@ julia> myappend(v::Vector{T}, x::T) where {T} = [v..., x] myappend (generic function with 1 method) julia> myappend([1,2,3],4) -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 3 4 julia> myappend([1,2,3],2.5) -ERROR: MethodError: no method matching myappend(::Array{Int64,1}, ::Float64) +ERROR: MethodError: no method matching myappend(::Vector{Int64}, ::Float64) Closest candidates are: - myappend(::Array{T,1}, !Matched::T) where T at none:1 + myappend(::Vector{T}, !Matched::T) where T at none:1 +Stacktrace: + [1] top-level scope at none:1 julia> myappend([1.0,2.0,3.0],4.0) -4-element Array{Float64,1}: +4-element Vector{Float64}: 1.0 2.0 3.0 4.0 julia> myappend([1.0,2.0,3.0],4) -ERROR: MethodError: no method matching myappend(::Array{Float64,1}, ::Int64) +ERROR: MethodError: no method matching myappend(::Vector{Float64}, ::Int64) Closest candidates are: - myappend(::Array{T,1}, !Matched::T) where T at none:1 + myappend(::Vector{T}, !Matched::T) where T at none:1 +Stacktrace: + [1] top-level scope at none:1 ``` As you can see, the type of the appended element must match the element type of the vector it diff --git a/doc/src/manual/missing.md b/doc/src/manual/missing.md index 3d7b5a7d28ec93..57ebb37952a624 100644 --- a/doc/src/manual/missing.md +++ b/doc/src/manual/missing.md @@ -237,7 +237,7 @@ false Arrays containing missing values can be created like other arrays ```jldoctest julia> [1, missing] -2-element Array{Union{Missing, Int64},1}: +2-element Vector{Union{Missing, Int64}}: 1 missing ``` @@ -254,7 +254,7 @@ Use `Array{Union{Missing, T}}(missing, dims)` to create arrays filled with missing values: ```jldoctest julia> Array{Union{Missing, String}}(missing, 2, 3) -2×3 Array{Union{Missing, String},2}: +2×3 Matrix{Union{Missing, String}}: missing missing missing missing missing missing ``` @@ -265,17 +265,17 @@ can be converted back to an array which does not allow for missing values using during conversion ```jldoctest julia> x = Union{Missing, String}["a", "b"] -2-element Array{Union{Missing, String},1}: +2-element Vector{Union{Missing, String}}: "a" "b" julia> convert(Array{String}, x) -2-element Array{String,1}: +2-element Vector{String}: "a" "b" julia> y = Union{Missing, String}[missing, "b"] -2-element Array{Union{Missing, String},1}: +2-element Vector{Union{Missing, String}}: missing "b" @@ -332,7 +332,7 @@ valid for the object returned by `skipmissing` which are also the indices of the matching entries *in the parent array* ```jldoctest skipmissing julia> findall(==(1), x) -1-element Array{Int64,1}: +1-element Vector{Int64}: 4 julia> findfirst(!iszero, x) @@ -345,7 +345,7 @@ julia> argmax(x) Use [`collect`](@ref) to extract non-`missing` values and store them in an array ```jldoctest skipmissing julia> collect(x) -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 2 1 diff --git a/doc/src/manual/multi-threading.md b/doc/src/manual/multi-threading.md index c3ba2ef33e681d..66d8d7c0aeb185 100644 --- a/doc/src/manual/multi-threading.md +++ b/doc/src/manual/multi-threading.md @@ -114,7 +114,7 @@ Let's work a simple example using our native threads. Let us create an array of ```jldoctest julia> a = zeros(10) -10-element Array{Float64,1}: +10-element Vector{Float64}: 0.0 0.0 0.0 diff --git a/doc/src/manual/performance-tips.md b/doc/src/manual/performance-tips.md index 3297e8f3a346bb..74b5a7d9c61805 100644 --- a/doc/src/manual/performance-tips.md +++ b/doc/src/manual/performance-tips.md @@ -163,7 +163,7 @@ julia> a = Real[] Real[] julia> push!(a, 1); push!(a, 2.0); push!(a, π) -3-element Array{Real,1}: +3-element Vector{Real}: 1 2.0 π = 3.1415926535897... @@ -180,7 +180,7 @@ julia> a = Float64[] Float64[] julia> push!(a, 1); push!(a, 2.0); push!(a, π) -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 2.0 3.141592653589793 @@ -356,7 +356,7 @@ MySimpleContainer{UnitRange{Int64}} julia> c = MySimpleContainer([1:3;]); julia> typeof(c) -MySimpleContainer{Array{Int64,1}} +MySimpleContainer{Vector{Int64}} julia> b = MyAmbiguousContainer(1:3); @@ -637,7 +637,7 @@ julia> function strange_twos(n) end; julia> strange_twos(3) -3-element Array{Float64,1}: +3-element Vector{Float64}: 2.0 2.0 2.0 @@ -659,7 +659,7 @@ julia> function strange_twos(n) end; julia> strange_twos(3) -3-element Array{Float64,1}: +3-element Vector{Float64}: 2.0 2.0 2.0 @@ -686,7 +686,7 @@ can be created like this: ```jldoctest julia> A = fill(5.0, (3, 3)) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 @@ -707,7 +707,7 @@ julia> function array3(fillval, N) array3 (generic function with 1 method) julia> array3(5.0, 2) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 @@ -731,7 +731,7 @@ julia> function array3(fillval, ::Val{N}) where N array3 (generic function with 1 method) julia> array3(5.0, Val(2)) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 @@ -824,12 +824,12 @@ as shown below (notice that the array is ordered `[1 3 2 4]`, not `[1 2 3 4]`): ```jldoctest julia> x = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> x[:] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 3 2 diff --git a/doc/src/manual/running-external-programs.md b/doc/src/manual/running-external-programs.md index 2441b54fb78175..67d2f1d7aae94e 100644 --- a/doc/src/manual/running-external-programs.md +++ b/doc/src/manual/running-external-programs.md @@ -64,7 +64,7 @@ The program name and the individual arguments in a command can be accessed and iterated over as if the command were an array of strings: ```jldoctest julia> collect(`echo "foo bar"`) -2-element Array{String,1}: +2-element Vector{String}: "echo" "foo bar" @@ -124,7 +124,7 @@ to interpolate multiple words? In that case, just use an array (or any other ite ```jldoctest julia> files = ["/etc/passwd","/Volumes/External HD/data.csv"] -2-element Array{String,1}: +2-element Vector{String}: "/etc/passwd" "/Volumes/External HD/data.csv" @@ -137,7 +137,7 @@ generation: ```jldoctest julia> names = ["foo","bar","baz"] -3-element Array{String,1}: +3-element Vector{String}: "foo" "bar" "baz" @@ -151,13 +151,13 @@ generation behavior is emulated: ```jldoctest julia> names = ["foo","bar","baz"] -3-element Array{String,1}: +3-element Vector{String}: "foo" "bar" "baz" julia> exts = ["aux","log"] -2-element Array{String,1}: +2-element Vector{String}: "aux" "log" diff --git a/doc/src/manual/strings.md b/doc/src/manual/strings.md index 9f73a48a47254e..119cd599f2cd39 100644 --- a/doc/src/manual/strings.md +++ b/doc/src/manual/strings.md @@ -379,7 +379,7 @@ You can also use the [`eachindex`](@ref) function to iterate over the valid char ```jldoctest unicodestring julia> collect(eachindex(s)) -7-element Array{Int64,1}: +7-element Vector{Int64}: 1 4 5 @@ -548,7 +548,7 @@ they are entered as literal expressions: ```jldoctest julia> v = [1,2,3] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -842,7 +842,7 @@ julia> m.match "acd" julia> m.captures -3-element Array{Union{Nothing, SubString{String}},1}: +3-element Vector{Union{Nothing, SubString{String}}}: "a" "c" "d" @@ -851,7 +851,7 @@ julia> m.offset 1 julia> m.offsets -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -863,7 +863,7 @@ julia> m.match "ad" julia> m.captures -3-element Array{Union{Nothing, SubString{String}},1}: +3-element Vector{Union{Nothing, SubString{String}}}: "a" nothing "d" @@ -872,7 +872,7 @@ julia> m.offset 1 julia> m.offsets -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 0 2 @@ -1068,7 +1068,7 @@ ERROR: setindex! not defined for Base.CodeUnits{UInt8,String} [...] julia> Vector{UInt8}(x) -3-element Array{UInt8,1}: +3-element Vector{UInt8}: 0x31 0x32 0x33 diff --git a/doc/src/manual/types.md b/doc/src/manual/types.md index 30813b71d4ab0e..fc2470374bb5db 100644 --- a/doc/src/manual/types.md +++ b/doc/src/manual/types.md @@ -1101,10 +1101,10 @@ consider the two types created by the following declarations: ```jldoctest julia> const T1 = Array{Array{T,1} where T, 1} -Array{Array{T,1} where T,1} +Vector{Vector{T} where T} = Array{Array{T,1} where T,1} julia> const T2 = Array{Array{T,1}, 1} where T -Array{Array{T,1},1} where T +Array{Vector{T},1} where T ``` Type `T1` defines a 1-dimensional array of 1-dimensional arrays; each @@ -1284,7 +1284,7 @@ Polar{Float64} complex number: 3.0 * exp(4.0im) julia> [Polar(3, 4.0), Polar(4.0,5.3)] -2-element Array{Polar{Float64},1}: +2-element Vector{Polar{Float64}}: 3.0 * exp(4.0im) 4.0 * exp(5.3im) ``` @@ -1389,7 +1389,7 @@ julia> show(IOContext(stdout, :compact=>true), Polar(3, 4.0)) 3.0ℯ4.0im julia> [Polar(3, 4.0) Polar(4.0,5.3)] -1×2 Array{Polar{Float64},2}: +1×2 Matrix{Polar{Float64}}: 3.0ℯ4.0im 4.0ℯ5.3im ``` diff --git a/doc/src/manual/variables-and-scoping.md b/doc/src/manual/variables-and-scoping.md index 7be28e45118894..78a1d372200a8d 100644 --- a/doc/src/manual/variables-and-scoping.md +++ b/doc/src/manual/variables-and-scoping.md @@ -665,12 +665,12 @@ julia> pointer.([s1, s2], 1) However, for mutable objects the warning is printed as expected: ```jldoctest julia> const a = [1] -1-element Array{Int64,1}: +1-element Vector{Int64}: 1 julia> a = [1] WARNING: redefinition of constant a. This may fail, cause incorrect answers, or produce other errors. -1-element Array{Int64,1}: +1-element Vector{Int64}: 1 ``` diff --git a/stdlib/Base64/src/decode.jl b/stdlib/Base64/src/decode.jl index f997daee286b27..2af3333e9e4d61 100644 --- a/stdlib/Base64/src/decode.jl +++ b/stdlib/Base64/src/decode.jl @@ -196,7 +196,7 @@ See also [`base64encode`](@ref). # Examples ```jldoctest julia> b = base64decode("SGVsbG8h") -6-element Array{UInt8,1}: +6-element Vector{UInt8}: 0x48 0x65 0x6c diff --git a/stdlib/Dates/docs/src/index.md b/stdlib/Dates/docs/src/index.md index 1111f3441e077d..b328b2212a2299 100644 --- a/stdlib/Dates/docs/src/index.md +++ b/stdlib/Dates/docs/src/index.md @@ -331,7 +331,7 @@ function `dayabbr` will error. ```jldoctest tdate2 julia> Dates.dayabbr(t;locale="french") -ERROR: BoundsError: attempt to access 1-element Array{String,1} at index [5] +ERROR: BoundsError: attempt to access 1-element Vector{String} at index [5] Stacktrace: [...] ``` @@ -403,7 +403,7 @@ julia> dr = Date(2014,1,29):Day(1):Date(2014,2,3) Date("2014-01-29"):Day(1):Date("2014-02-03") julia> collect(dr) -6-element Array{Date,1}: +6-element Vector{Date}: 2014-01-29 2014-01-30 2014-01-31 @@ -415,7 +415,7 @@ julia> dr = Date(2014,1,29):Dates.Month(1):Date(2014,07,29) Date("2014-01-29"):Month(1):Date("2014-07-29") julia> collect(dr) -7-element Array{Date,1}: +7-element Vector{Date}: 2014-01-29 2014-02-28 2014-03-29 @@ -491,7 +491,7 @@ julia> filter(dr) do x Dates.April <= Dates.month(x) <= Dates.Nov && Dates.dayofweekofmonth(x) == 2 end -8-element Array{Date,1}: +8-element Vector{Date}: 2014-04-08 2014-05-13 2014-06-10 diff --git a/stdlib/DelimitedFiles/src/DelimitedFiles.jl b/stdlib/DelimitedFiles/src/DelimitedFiles.jl index 38dffbff17632e..b13eae35052135 100644 --- a/stdlib/DelimitedFiles/src/DelimitedFiles.jl +++ b/stdlib/DelimitedFiles/src/DelimitedFiles.jl @@ -38,14 +38,14 @@ julia> open("delim_file.txt", "w") do io end; julia> readdlm("delim_file.txt", Int64) -4×2 Array{Int64,2}: +4×2 Matrix{Int64}: 1 5 2 6 3 7 4 8 julia> readdlm("delim_file.txt", Float64) -4×2 Array{Float64,2}: +4×2 Matrix{Float64}: 1.0 5.0 2.0 6.0 3.0 7.0 @@ -74,7 +74,7 @@ julia> open("delim_file.txt", "w") do io end; julia> readdlm("delim_file.txt", ',', Float64) -4×2 Array{Float64,2}: +4×2 Matrix{Float64}: 1.0 1.1 2.0 2.2 3.0 3.3 @@ -106,7 +106,7 @@ julia> open("delim_file.txt", "w") do io end; julia> readdlm("delim_file.txt") -4×2 Array{Any,2}: +4×2 Matrix{Any}: 1 "a" 2 "b" 3 "c" @@ -137,7 +137,7 @@ julia> open("delim_file.txt", "w") do io end; julia> readdlm("delim_file.txt", ',') -4×2 Array{Float64,2}: +4×2 Matrix{Float64}: 1.0 1.1 2.0 2.2 3.0 3.3 @@ -150,7 +150,7 @@ julia> open("delim_file.txt", "w") do io end; julia> readdlm("delim_file.txt", ',') -4×2 Array{Any,2}: +4×2 Matrix{Any}: 1 "a" 2 "b" 3 "c" @@ -213,7 +213,7 @@ julia> open("delim_file.txt", "w") do io end julia> readdlm("delim_file.txt", '\\t', Int, '\\n') -4×2 Array{Int64,2}: +4×2 Matrix{Int64}: 1 5 2 6 3 7 @@ -814,7 +814,7 @@ julia> open("delim_file.txt", "w") do io end julia> readdlm("delim_file.txt", '\\t', Int, '\\n') -4×2 Array{Int64,2}: +4×2 Matrix{Int64}: 1 5 2 6 3 7 diff --git a/stdlib/Distributed/src/pmap.jl b/stdlib/Distributed/src/pmap.jl index db3dde9ecb5733..8111223fdd3f1d 100644 --- a/stdlib/Distributed/src/pmap.jl +++ b/stdlib/Distributed/src/pmap.jl @@ -242,7 +242,7 @@ julia> b, c = Distributed.head_and_tail(1:10, 3) ([1, 2, 3], Base.Iterators.Rest{UnitRange{Int64},Int64}(1:10, 3)) julia> collect(c) -7-element Array{Int64,1}: +7-element Vector{Int64}: 4 5 6 diff --git a/stdlib/InteractiveUtils/src/InteractiveUtils.jl b/stdlib/InteractiveUtils/src/InteractiveUtils.jl index a2abf8730cd846..c79787a3dc0d86 100644 --- a/stdlib/InteractiveUtils/src/InteractiveUtils.jl +++ b/stdlib/InteractiveUtils/src/InteractiveUtils.jl @@ -233,7 +233,7 @@ are included, including those not visible in the current module. # Examples ```jldoctest julia> subtypes(Integer) -3-element Array{Any,1}: +3-element Vector{Any}: Bool Signed Unsigned diff --git a/stdlib/InteractiveUtils/test/runtests.jl b/stdlib/InteractiveUtils/test/runtests.jl index be4c1ea42d5383..b9030c940bd951 100644 --- a/stdlib/InteractiveUtils/test/runtests.jl +++ b/stdlib/InteractiveUtils/test/runtests.jl @@ -173,7 +173,7 @@ module Tmp14173 end varinfo(Tmp14173) # warm up const MEMDEBUG = ccall(:jl_is_memdebug, Bool, ()) -@test @allocated(varinfo(Tmp14173)) < (MEMDEBUG ? 60000 : 20000) +@test @allocated(varinfo(Tmp14173)) < (MEMDEBUG ? 300000 : 100000) # PR #24997: test that `varinfo` doesn't fail when encountering `missing` module A diff --git a/stdlib/LinearAlgebra/docs/src/index.md b/stdlib/LinearAlgebra/docs/src/index.md index a1e8b9b95972d0..6587e3fae55d7b 100644 --- a/stdlib/LinearAlgebra/docs/src/index.md +++ b/stdlib/LinearAlgebra/docs/src/index.md @@ -10,7 +10,7 @@ and [`inv`](@ref) are all supported: ```jldoctest julia> A = [1 2 3; 4 1 6; 7 8 1] -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 2 3 4 1 6 7 8 1 @@ -22,7 +22,7 @@ julia> det(A) 104.0 julia> inv(A) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: -0.451923 0.211538 0.0865385 0.365385 -0.192308 0.0576923 0.240385 0.0576923 -0.0673077 @@ -32,17 +32,17 @@ As well as other useful operations, such as finding eigenvalues or eigenvectors: ```jldoctest julia> A = [-4. -17.; 2. 2.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: -4.0 -17.0 2.0 2.0 julia> eigvals(A) -2-element Array{Complex{Float64},1}: +2-element Vector{ComplexF64}: -1.0 - 5.0im -1.0 + 5.0im julia> eigvecs(A) -2×2 Array{Complex{Float64},2}: +2×2 Matrix{ComplexF64}: 0.945905-0.0im 0.945905+0.0im -0.166924+0.278207im -0.166924-0.278207im ``` @@ -54,20 +54,20 @@ for more information. As an example: ```jldoctest julia> A = [1.5 2 -4; 3 -1 -6; -10 2.3 4] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.5 2.0 -4.0 3.0 -1.0 -6.0 -10.0 2.3 4.0 julia> factorize(A) -LU{Float64,Array{Float64,2}} +LU{Float64,Matrix{Float64}} L factor: -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 0.0 0.0 -0.15 1.0 0.0 -0.3 -0.132196 1.0 U factor: -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: -10.0 2.3 4.0 0.0 2.345 -3.4 0.0 0.0 -5.24947 @@ -78,25 +78,25 @@ best we can do. Compare with: ```jldoctest julia> B = [1.5 2 -4; 2 -1 -3; -4 -3 5] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.5 2.0 -4.0 2.0 -1.0 -3.0 -4.0 -3.0 5.0 julia> factorize(B) -BunchKaufman{Float64,Array{Float64,2}} +BunchKaufman{Float64,Matrix{Float64}} D factor: -3×3 Tridiagonal{Float64,Array{Float64,1}}: +3×3 Tridiagonal{Float64,Vector{Float64}}: -1.64286 0.0 ⋅ 0.0 -2.8 0.0 ⋅ 0.0 5.0 U factor: -3×3 UnitUpperTriangular{Float64,Array{Float64,2}}: +3×3 UnitUpperTriangular{Float64,Matrix{Float64}}: 1.0 0.142857 -0.8 ⋅ 1.0 -0.6 ⋅ ⋅ 1.0 permutation: -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -109,13 +109,13 @@ these properties. For instance: ```jldoctest julia> B = [1.5 2 -4; 2 -1 -3; -4 -3 5] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.5 2.0 -4.0 2.0 -1.0 -3.0 -4.0 -3.0 5.0 julia> sB = Symmetric(B) -3×3 Symmetric{Float64,Array{Float64,2}}: +3×3 Symmetric{Float64,Matrix{Float64}}: 1.5 2.0 -4.0 2.0 -1.0 -3.0 -4.0 -3.0 5.0 @@ -127,25 +127,25 @@ half of it. For example: ```jldoctest julia> B = [1.5 2 -4; 2 -1 -3; -4 -3 5] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.5 2.0 -4.0 2.0 -1.0 -3.0 -4.0 -3.0 5.0 julia> sB = Symmetric(B) -3×3 Symmetric{Float64,Array{Float64,2}}: +3×3 Symmetric{Float64,Matrix{Float64}}: 1.5 2.0 -4.0 2.0 -1.0 -3.0 -4.0 -3.0 5.0 julia> x = [1; 2; 3] -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 julia> sB\x -3-element Array{Float64,1}: +3-element Vector{Float64}: -1.7391304347826084 -1.1086956521739126 -1.4565217391304346 @@ -241,27 +241,27 @@ To see the `UniformScaling` operator in action: julia> U = UniformScaling(2); julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> a + U -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 3 2 3 6 julia> a * U -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 4 6 8 julia> [a U] -2×4 Array{Int64,2}: +2×4 Matrix{Int64}: 1 2 2 0 3 4 0 2 julia> b = [1 2 3; 4 5 6] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 3 4 5 6 diff --git a/stdlib/LinearAlgebra/src/LinearAlgebra.jl b/stdlib/LinearAlgebra/src/LinearAlgebra.jl index e9476645d5e89d..2b0d6e15f62693 100644 --- a/stdlib/LinearAlgebra/src/LinearAlgebra.jl +++ b/stdlib/LinearAlgebra/src/LinearAlgebra.jl @@ -176,7 +176,7 @@ in dimension 1 in units of element size. # Examples ```jldoctest julia> A = [1,2,3,4] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 3 @@ -186,7 +186,7 @@ julia> LinearAlgebra.stride1(A) 1 julia> B = view(A, 2:2:4) -2-element view(::Array{Int64,1}, 2:2:4) with eltype Int64: +2-element view(::Vector{Int64}, 2:2:4) with eltype Int64: 2 4 @@ -213,7 +213,7 @@ For multiple arguments, return a vector. julia> A = fill(1, (4,4)); B = fill(1, (5,5)); julia> LinearAlgebra.checksquare(A, B) -2-element Array{Int64,1}: +2-element Vector{Int64}: 4 5 ``` @@ -280,13 +280,13 @@ julia> Y = zero(X); julia> ldiv!(Y, qr(A), X); julia> Y -3-element Array{Float64,1}: +3-element Vector{Float64}: 0.7128099173553719 -0.051652892561983674 0.10020661157024757 julia> A\\X -3-element Array{Float64,1}: +3-element Vector{Float64}: 0.7128099173553719 -0.05165289256198333 0.10020661157024785 @@ -317,13 +317,13 @@ julia> Y = copy(X); julia> ldiv!(qr(A), X); julia> X -3-element Array{Float64,1}: +3-element Vector{Float64}: 0.7128099173553719 -0.051652892561983674 0.10020661157024757 julia> A\\Y -3-element Array{Float64,1}: +3-element Vector{Float64}: 0.7128099173553719 -0.05165289256198333 0.10020661157024785 diff --git a/stdlib/LinearAlgebra/src/adjtrans.jl b/stdlib/LinearAlgebra/src/adjtrans.jl index e3952d02618364..50f0994658bbe7 100644 --- a/stdlib/LinearAlgebra/src/adjtrans.jl +++ b/stdlib/LinearAlgebra/src/adjtrans.jl @@ -22,12 +22,12 @@ This type is intended for linear algebra usage - for general data manipulation s # Examples ```jldoctest julia> A = [3+2im 9+2im; 8+7im 4+6im] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3+2im 9+2im 8+7im 4+6im julia> adjoint(A) -2×2 Adjoint{Complex{Int64},Array{Complex{Int64},2}}: +2×2 Adjoint{Complex{Int64},Matrix{Complex{Int64}}}: 3-2im 8-7im 9-2im 4-6im ``` @@ -53,12 +53,12 @@ This type is intended for linear algebra usage - for general data manipulation s # Examples ```jldoctest julia> A = [3+2im 9+2im; 8+7im 4+6im] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3+2im 9+2im 8+7im 4+6im julia> transpose(A) -2×2 Transpose{Complex{Int64},Array{Complex{Int64},2}}: +2×2 Transpose{Complex{Int64},Matrix{Complex{Int64}}}: 3+2im 8+7im 9+2im 4+6im ``` @@ -115,17 +115,17 @@ This operation is intended for linear algebra usage - for general data manipulat # Examples ```jldoctest julia> A = [3+2im 9+2im; 8+7im 4+6im] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3+2im 9+2im 8+7im 4+6im julia> adjoint(A) -2×2 Adjoint{Complex{Int64},Array{Complex{Int64},2}}: +2×2 Adjoint{Complex{Int64},Matrix{Complex{Int64}}}: 3-2im 8-7im 9-2im 4-6im julia> x = [3, 4im] -2-element Array{Complex{Int64},1}: +2-element Vector{Complex{Int64}}: 3 + 0im 0 + 4im @@ -148,12 +148,12 @@ This operation is intended for linear algebra usage - for general data manipulat # Examples ```jldoctest julia> A = [3+2im 9+2im; 8+7im 4+6im] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3+2im 9+2im 8+7im 4+6im julia> transpose(A) -2×2 Transpose{Complex{Int64},Array{Complex{Int64},2}}: +2×2 Transpose{Complex{Int64},Matrix{Complex{Int64}}}: 3+2im 8+7im 9+2im 4+6im ``` diff --git a/stdlib/LinearAlgebra/src/bidiag.jl b/stdlib/LinearAlgebra/src/bidiag.jl index 3f7218a61eb274..19011c030a0be2 100644 --- a/stdlib/LinearAlgebra/src/bidiag.jl +++ b/stdlib/LinearAlgebra/src/bidiag.jl @@ -34,27 +34,27 @@ must be one less than the length of `dv`. # Examples ```jldoctest julia> dv = [1, 2, 3, 4] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 3 4 julia> ev = [7, 8, 9] -3-element Array{Int64,1}: +3-element Vector{Int64}: 7 8 9 julia> Bu = Bidiagonal(dv, ev, :U) # ev is on the first superdiagonal -4×4 Bidiagonal{Int64,Array{Int64,1}}: +4×4 Bidiagonal{Int64,Vector{Int64}}: 1 7 ⋅ ⋅ ⋅ 2 8 ⋅ ⋅ ⋅ 3 9 ⋅ ⋅ ⋅ 4 julia> Bl = Bidiagonal(dv, ev, :L) # ev is on the first subdiagonal -4×4 Bidiagonal{Int64,Array{Int64,1}}: +4×4 Bidiagonal{Int64,Vector{Int64}}: 1 ⋅ ⋅ ⋅ 7 2 ⋅ ⋅ ⋅ 8 3 ⋅ @@ -77,21 +77,21 @@ its first super- (if `uplo=:U`) or sub-diagonal (if `uplo=:L`). # Examples ```jldoctest julia> A = [1 1 1 1; 2 2 2 2; 3 3 3 3; 4 4 4 4] -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 julia> Bidiagonal(A, :U) # contains the main diagonal and first superdiagonal of A -4×4 Bidiagonal{Int64,Array{Int64,1}}: +4×4 Bidiagonal{Int64,Vector{Int64}}: 1 1 ⋅ ⋅ ⋅ 2 2 ⋅ ⋅ ⋅ 3 3 ⋅ ⋅ ⋅ 4 julia> Bidiagonal(A, :L) # contains the main diagonal and first subdiagonal of A -4×4 Bidiagonal{Int64,Array{Int64,1}}: +4×4 Bidiagonal{Int64,Vector{Int64}}: 1 ⋅ ⋅ ⋅ 2 2 ⋅ ⋅ ⋅ 3 3 ⋅ diff --git a/stdlib/LinearAlgebra/src/blas.jl b/stdlib/LinearAlgebra/src/blas.jl index a2367d7ee4b90f..d4e3df91852419 100644 --- a/stdlib/LinearAlgebra/src/blas.jl +++ b/stdlib/LinearAlgebra/src/blas.jl @@ -465,7 +465,7 @@ julia> x = [1; 2; 3]; julia> y = [4; 5; 6]; julia> BLAS.axpy!(2, x, y) -3-element Array{Int64,1}: +3-element Vector{Int64}: 6 9 12 @@ -534,7 +534,7 @@ julia> x = [1., 2, 3]; julia> y = [4., 5, 6]; julia> BLAS.axpby!(2., x, 3., y) -3-element Array{Float64,1}: +3-element Vector{Float64}: 14.0 19.0 24.0 diff --git a/stdlib/LinearAlgebra/src/bunchkaufman.jl b/stdlib/LinearAlgebra/src/bunchkaufman.jl index 7c9024920aaeb1..db63850c492fba 100644 --- a/stdlib/LinearAlgebra/src/bunchkaufman.jl +++ b/stdlib/LinearAlgebra/src/bunchkaufman.jl @@ -23,22 +23,22 @@ as appropriate given `S.uplo`, and `S.p`. # Examples ```jldoctest julia> A = [1 2; 2 3] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 3 julia> S = bunchkaufman(A) # A gets wrapped internally by Symmetric(A) -BunchKaufman{Float64,Array{Float64,2}} +BunchKaufman{Float64,Matrix{Float64}} D factor: -2×2 Tridiagonal{Float64,Array{Float64,1}}: +2×2 Tridiagonal{Float64,Vector{Float64}}: -0.333333 0.0 0.0 3.0 U factor: -2×2 UnitUpperTriangular{Float64,Array{Float64,2}}: +2×2 UnitUpperTriangular{Float64,Matrix{Float64}}: 1.0 0.666667 ⋅ 1.0 permutation: -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 @@ -48,17 +48,17 @@ julia> d == S.D && u == S.U && p == S.p true julia> S = bunchkaufman(Symmetric(A, :L)) -BunchKaufman{Float64,Array{Float64,2}} +BunchKaufman{Float64,Matrix{Float64}} D factor: -2×2 Tridiagonal{Float64,Array{Float64,1}}: +2×2 Tridiagonal{Float64,Vector{Float64}}: 3.0 0.0 0.0 -0.333333 L factor: -2×2 UnitLowerTriangular{Float64,Array{Float64,2}}: +2×2 UnitLowerTriangular{Float64,Matrix{Float64}}: 1.0 ⋅ 0.666667 1.0 permutation: -2-element Array{Int64,1}: +2-element Vector{Int64}: 2 1 ``` @@ -143,22 +143,22 @@ The following functions are available for `BunchKaufman` objects: # Examples ```jldoctest julia> A = [1 2; 2 3] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 3 julia> S = bunchkaufman(A) # A gets wrapped internally by Symmetric(A) -BunchKaufman{Float64,Array{Float64,2}} +BunchKaufman{Float64,Matrix{Float64}} D factor: -2×2 Tridiagonal{Float64,Array{Float64,1}}: +2×2 Tridiagonal{Float64,Vector{Float64}}: -0.333333 0.0 0.0 3.0 U factor: -2×2 UnitUpperTriangular{Float64,Array{Float64,2}}: +2×2 UnitUpperTriangular{Float64,Matrix{Float64}}: 1.0 0.666667 ⋅ 1.0 permutation: -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 @@ -168,17 +168,17 @@ julia> d == S.D && u == S.U && p == S.p true julia> S = bunchkaufman(Symmetric(A, :L)) -BunchKaufman{Float64,Array{Float64,2}} +BunchKaufman{Float64,Matrix{Float64}} D factor: -2×2 Tridiagonal{Float64,Array{Float64,1}}: +2×2 Tridiagonal{Float64,Vector{Float64}}: 3.0 0.0 0.0 -0.333333 L factor: -2×2 UnitLowerTriangular{Float64,Array{Float64,2}}: +2×2 UnitLowerTriangular{Float64,Matrix{Float64}}: 1.0 ⋅ 0.666667 1.0 permutation: -2-element Array{Int64,1}: +2-element Vector{Int64}: 2 1 ``` @@ -244,31 +244,31 @@ where `P` is a (symmetric) permutation matrix, `L` is a [`UnitLowerTriangular`]( # Examples ```jldoctest julia> A = [1 2 3; 2 1 2; 3 2 1] -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 2 3 2 1 2 3 2 1 julia> F = bunchkaufman(Symmetric(A, :L)) -BunchKaufman{Float64,Array{Float64,2}} +BunchKaufman{Float64,Matrix{Float64}} D factor: -3×3 Tridiagonal{Float64,Array{Float64,1}}: +3×3 Tridiagonal{Float64,Vector{Float64}}: 1.0 3.0 ⋅ 3.0 1.0 0.0 ⋅ 0.0 -1.0 L factor: -3×3 UnitLowerTriangular{Float64,Array{Float64,2}}: +3×3 UnitLowerTriangular{Float64,Matrix{Float64}}: 1.0 ⋅ ⋅ 0.0 1.0 ⋅ 0.5 0.5 1.0 permutation: -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 3 2 julia> F.L*F.D*F.L' - A[F.p, F.p] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 @@ -276,7 +276,7 @@ julia> F.L*F.D*F.L' - A[F.p, F.p] julia> F = bunchkaufman(Symmetric(A)); julia> F.U*F.D*F.U' - F.P*A*F.P' -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 diff --git a/stdlib/LinearAlgebra/src/cholesky.jl b/stdlib/LinearAlgebra/src/cholesky.jl index c9a28b25050010..f2e489dbc74967 100644 --- a/stdlib/LinearAlgebra/src/cholesky.jl +++ b/stdlib/LinearAlgebra/src/cholesky.jl @@ -8,7 +8,7 @@ # complicated and some explanation is therefore provided in the following # # In the methods below, LAPACK is called when possible, i.e. StridedMatrices with Float32, -# Float64, Complex{Float32}, and Complex{Float64} element types. For other element or +# Float64, ComplexF32, and ComplexF64 element types. For other element or # matrix types, the unblocked Julia implementation in _chol! is used. For cholesky # and cholesky! pivoting is supported through a Val(Bool) argument. A type argument is # necessary for type stability since the output of cholesky and cholesky! is either @@ -40,27 +40,27 @@ via `F.L` and `F.U`. # Examples ```jldoctest julia> A = [4. 12. -16.; 12. 37. -43.; -16. -43. 98.] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 4.0 12.0 -16.0 12.0 37.0 -43.0 -16.0 -43.0 98.0 julia> C = cholesky(A) -Cholesky{Float64,Array{Float64,2}} +Cholesky{Float64,Matrix{Float64}} U factor: -3×3 UpperTriangular{Float64,Array{Float64,2}}: +3×3 UpperTriangular{Float64,Matrix{Float64}}: 2.0 6.0 -8.0 ⋅ 1.0 5.0 ⋅ ⋅ 3.0 julia> C.U -3×3 UpperTriangular{Float64,Array{Float64,2}}: +3×3 UpperTriangular{Float64,Matrix{Float64}}: 2.0 6.0 -8.0 ⋅ 1.0 5.0 ⋅ ⋅ 3.0 julia> C.L -3×3 LowerTriangular{Float64,Array{Float64,2}}: +3×3 LowerTriangular{Float64,Matrix{Float64}}: 2.0 ⋅ ⋅ 6.0 1.0 ⋅ -8.0 5.0 3.0 @@ -97,20 +97,20 @@ via `F.L` and `F.U`. # Examples ```jldoctest julia> A = [4. 12. -16.; 12. 37. -43.; -16. -43. 98.] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 4.0 12.0 -16.0 12.0 37.0 -43.0 -16.0 -43.0 98.0 julia> C = cholesky(A, Val(true)) -CholeskyPivoted{Float64,Array{Float64,2}} +CholeskyPivoted{Float64,Matrix{Float64}} U factor with rank 3: -3×3 UpperTriangular{Float64,Array{Float64,2}}: +3×3 UpperTriangular{Float64,Matrix{Float64}}: 9.89949 -4.34366 -1.61624 ⋅ 4.25825 1.1694 ⋅ ⋅ 0.142334 permutation: -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 2 1 @@ -232,7 +232,7 @@ the factorization produces a number not representable by the element type of # Examples ```jldoctest julia> A = [1 2; 2 50] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 50 @@ -311,27 +311,27 @@ validity (via [`issuccess`](@ref)) lies with the user. # Examples ```jldoctest julia> A = [4. 12. -16.; 12. 37. -43.; -16. -43. 98.] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 4.0 12.0 -16.0 12.0 37.0 -43.0 -16.0 -43.0 98.0 julia> C = cholesky(A) -Cholesky{Float64,Array{Float64,2}} +Cholesky{Float64,Matrix{Float64}} U factor: -3×3 UpperTriangular{Float64,Array{Float64,2}}: +3×3 UpperTriangular{Float64,Matrix{Float64}}: 2.0 6.0 -8.0 ⋅ 1.0 5.0 ⋅ ⋅ 3.0 julia> C.U -3×3 UpperTriangular{Float64,Array{Float64,2}}: +3×3 UpperTriangular{Float64,Matrix{Float64}}: 2.0 6.0 -8.0 ⋅ 1.0 5.0 ⋅ ⋅ 3.0 julia> C.L -3×3 LowerTriangular{Float64,Array{Float64,2}}: +3×3 LowerTriangular{Float64,Matrix{Float64}}: 2.0 ⋅ ⋅ 6.0 1.0 ⋅ -8.0 5.0 3.0 diff --git a/stdlib/LinearAlgebra/src/dense.jl b/stdlib/LinearAlgebra/src/dense.jl index 4ea27e26bc7b89..83e9a4e63234b1 100644 --- a/stdlib/LinearAlgebra/src/dense.jl +++ b/stdlib/LinearAlgebra/src/dense.jl @@ -62,7 +62,7 @@ julia> isposdef!(A) true julia> A -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 2.0 6.78233 ``` @@ -80,7 +80,7 @@ See also [`isposdef!`](@ref) # Examples ```jldoctest julia> A = [1 2; 2 50] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 50 @@ -114,7 +114,7 @@ overwriting `M` in the process. # Examples ```jldoctest julia> M = [1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5] -5×5 Array{Int64,2}: +5×5 Matrix{Int64}: 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 @@ -122,7 +122,7 @@ julia> M = [1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5] 1 2 3 4 5 julia> triu!(M, 1) -5×5 Array{Int64,2}: +5×5 Matrix{Int64}: 0 2 3 4 5 0 0 3 4 5 0 0 0 4 5 @@ -152,7 +152,7 @@ the process. # Examples ```jldoctest julia> M = [1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5] -5×5 Array{Int64,2}: +5×5 Matrix{Int64}: 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 @@ -160,7 +160,7 @@ julia> M = [1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5; 1 2 3 4 5] 1 2 3 4 5 julia> tril!(M, 2) -5×5 Array{Int64,2}: +5×5 Matrix{Int64}: 1 2 3 0 0 1 2 3 4 0 1 2 3 4 5 @@ -208,7 +208,7 @@ An `AbstractRange` giving the indices of the `k`th diagonal of the matrix `M`. # Examples ```jldoctest julia> A = [1 2 3; 4 5 6; 7 8 9] -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 2 3 4 5 6 7 8 9 @@ -232,13 +232,13 @@ See also: [`diagm`](@ref) # Examples ```jldoctest julia> A = [1 2 3; 4 5 6; 7 8 9] -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 2 3 4 5 6 7 8 9 julia> diag(A,1) -2-element Array{Int64,1}: +2-element Vector{Int64}: 2 6 ``` @@ -262,14 +262,14 @@ versions with fast arithmetic, see [`Diagonal`](@ref), [`Bidiagonal`](@ref) # Examples ```jldoctest julia> diagm(1 => [1,2,3]) -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 0 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 julia> diagm(1 => [1,2,3], -1 => [4,5]) -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 0 1 0 0 4 0 2 0 0 5 0 3 @@ -320,7 +320,7 @@ by passing `m,n` as the first arguments. # Examples ```jldoctest julia> diagm([1,2,3]) -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 0 0 0 2 0 0 0 3 @@ -376,17 +376,17 @@ For complex vectors, the outer product `w * v'` also differs by conjugation of ` # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> B = [im 1; 1 -im] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 0+1im 1+0im 1+0im 0-1im julia> kron(A, B) -4×4 Array{Complex{Int64},2}: +4×4 Matrix{Complex{Int64}}: 0+1im 1+0im 0+2im 2+0im 1+0im 0-1im 2+0im 0-2im 0+3im 3+0im 0+4im 4+0im @@ -395,13 +395,13 @@ julia> kron(A, B) julia> v = [1, 2]; w = [3, 4, 5]; julia> w*transpose(v) -3×2 Array{Int64,2}: +3×2 Matrix{Int64}: 3 6 4 8 5 10 julia> reshape(kron(v,w), (length(w), length(v))) -3×2 Array{Int64,2}: +3×2 Matrix{Int64}: 3 6 4 8 5 10 @@ -514,7 +514,7 @@ Matrix power, equivalent to ``\\exp(p\\log(A))`` # Examples ```jldoctest julia> [1 2; 0 3]^3 -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 26 0 27 ``` @@ -540,12 +540,12 @@ used, otherwise the scaling and squaring algorithm (see [^H05]) is chosen. # Examples ```jldoctest julia> A = Matrix(1.0I, 2, 2) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.0 1.0 julia> exp(A) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.71828 0.0 0.0 2.71828 ``` @@ -565,12 +565,12 @@ Matrix exponential, equivalent to ``\\exp(\\log(b)A)``. # Examples ```jldoctest julia> 2^[1 2; 0 3] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.0 6.0 0.0 8.0 julia> ℯ^[1 2; 0 3] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.71828 17.3673 0.0 20.0855 ``` @@ -695,12 +695,12 @@ triangular factor. # Examples ```jldoctest julia> A = Matrix(2.7182818*I, 2, 2) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.71828 0.0 0.0 2.71828 julia> log(A) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.0 1.0 ``` @@ -761,12 +761,12 @@ and then the complex square root of the triangular factor. # Examples ```jldoctest julia> A = [4 0; 0 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 0 0 4 julia> sqrt(A) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.0 0.0 0.0 2.0 ``` @@ -825,7 +825,7 @@ compute the cosine. Otherwise, the cosine is determined by calling [`exp`](@ref) # Examples ```jldoctest julia> cos(fill(1.0, (2,2))) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.291927 -0.708073 -0.708073 0.291927 ``` @@ -858,7 +858,7 @@ compute the sine. Otherwise, the sine is determined by calling [`exp`](@ref). # Examples ```jldoctest julia> sin(fill(1.0, (2,2))) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.454649 0.454649 0.454649 0.454649 ``` @@ -894,12 +894,12 @@ Compute the matrix sine and cosine of a square matrix `A`. julia> S, C = sincos(fill(1.0, (2,2))); julia> S -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.454649 0.454649 0.454649 0.454649 julia> C -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.291927 -0.708073 -0.708073 0.291927 ``` @@ -944,7 +944,7 @@ compute the tangent. Otherwise, the tangent is determined by calling [`exp`](@re # Examples ```jldoctest julia> tan(fill(1.0, (2,2))) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: -1.09252 -1.09252 -1.09252 -1.09252 ``` @@ -1021,7 +1021,7 @@ this function, see [^AH16_1]. # Examples ```jldoctest julia> acos(cos([0.5 0.1; -0.2 0.3])) -2×2 Array{Complex{Float64},2}: +2×2 Matrix{ComplexF64}: 0.5-8.32667e-17im 0.1+0.0im -0.2+2.63678e-16im 0.3-3.46945e-16im ``` @@ -1052,7 +1052,7 @@ see [^AH16_2]. # Examples ```jldoctest julia> asin(sin([0.5 0.1; -0.2 0.3])) -2×2 Array{Complex{Float64},2}: +2×2 Matrix{ComplexF64}: 0.5-4.16334e-17im 0.1-5.55112e-17im -0.2+9.71445e-17im 0.3-1.249e-16im ``` @@ -1083,7 +1083,7 @@ compute the inverse tangent. Otherwise, the inverse tangent is determined by usi # Examples ```jldoctest julia> atan(tan([0.5 0.1; -0.2 0.3])) -2×2 Array{Complex{Float64},2}: +2×2 Matrix{ComplexF64}: 0.5+1.38778e-17im 0.1-2.77556e-17im -0.2+6.93889e-17im 0.3-4.16334e-17im ``` @@ -1216,7 +1216,7 @@ will return a Cholesky factorization. # Examples ```jldoctest julia> A = Array(Bidiagonal(fill(1.0, (5, 5)), :U)) -5×5 Array{Float64,2}: +5×5 Matrix{Float64}: 1.0 1.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0 @@ -1224,7 +1224,7 @@ julia> A = Array(Bidiagonal(fill(1.0, (5, 5)), :U)) 0.0 0.0 0.0 0.0 1.0 julia> factorize(A) # factorize will check to see that A is already factorized -5×5 Bidiagonal{Float64,Array{Float64,1}}: +5×5 Bidiagonal{Float64,Vector{Float64}}: 1.0 1.0 ⋅ ⋅ ⋅ ⋅ 1.0 1.0 ⋅ ⋅ ⋅ ⋅ 1.0 1.0 ⋅ @@ -1338,17 +1338,17 @@ For more information, see [^issue8859], [^B96], [^S84], [^KY88]. # Examples ```jldoctest julia> M = [1.5 1.3; 1.2 1.9] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.5 1.3 1.2 1.9 julia> N = pinv(M) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.47287 -1.00775 -0.930233 1.16279 julia> M * N -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 -2.22045e-16 4.44089e-16 1.0 ``` @@ -1414,25 +1414,25 @@ the element type of `M`. # Examples ```jldoctest julia> M = [1 0 0; 0 1 0; 0 0 0] -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 0 0 0 1 0 0 0 0 julia> nullspace(M) -3×1 Array{Float64,2}: +3×1 Matrix{Float64}: 0.0 0.0 1.0 julia> nullspace(M, rtol=3) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 0.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 julia> nullspace(M, atol=0.95) -3×1 Array{Float64,2}: +3×1 Matrix{Float64}: 0.0 0.0 1.0 @@ -1489,27 +1489,27 @@ Computes the solution `X` to the Sylvester equation `AX + XB + C = 0`, where `A` # Examples ```jldoctest julia> A = [3. 4.; 5. 6] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 3.0 4.0 5.0 6.0 julia> B = [1. 1.; 1. 2.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 1.0 1.0 2.0 julia> C = [1. 2.; -2. 1] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 -2.0 1.0 julia> X = sylvester(A, B, C) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: -4.46667 1.93333 3.73333 -1.8 julia> A*X + X*B + C -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.66454e-15 1.77636e-15 -3.77476e-15 4.44089e-16 ``` @@ -1538,22 +1538,22 @@ conjugates of each other. # Examples ```jldoctest julia> A = [3. 4.; 5. 6] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 3.0 4.0 5.0 6.0 julia> B = [1. 1.; 1. 2.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 1.0 1.0 2.0 julia> X = lyap(A, B) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.5 -0.5 -0.5 0.25 julia> A*X + X*A' + B -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.0 6.66134e-16 6.66134e-16 8.88178e-16 ``` diff --git a/stdlib/LinearAlgebra/src/diagonal.jl b/stdlib/LinearAlgebra/src/diagonal.jl index 09ac42e34f0e20..62528032a6c6f1 100644 --- a/stdlib/LinearAlgebra/src/diagonal.jl +++ b/stdlib/LinearAlgebra/src/diagonal.jl @@ -21,13 +21,13 @@ Construct a matrix from the diagonal of `A`. # Examples ```jldoctest julia> A = [1 2 3; 4 5 6; 7 8 9] -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 2 3 4 5 6 7 8 9 julia> Diagonal(A) -3×3 Diagonal{Int64,Array{Int64,1}}: +3×3 Diagonal{Int64,Vector{Int64}}: 1 ⋅ ⋅ ⋅ 5 ⋅ ⋅ ⋅ 9 @@ -43,12 +43,12 @@ Construct a matrix with `V` as its diagonal. # Examples ```jldoctest julia> V = [1, 2] -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 julia> Diagonal(V) -2×2 Diagonal{Int64,Array{Int64,1}}: +2×2 Diagonal{Int64,Vector{Int64}}: 1 ⋅ ⋅ 2 ``` diff --git a/stdlib/LinearAlgebra/src/eigen.jl b/stdlib/LinearAlgebra/src/eigen.jl index d956988cee61f4..d7f52c2049117f 100644 --- a/stdlib/LinearAlgebra/src/eigen.jl +++ b/stdlib/LinearAlgebra/src/eigen.jl @@ -17,26 +17,26 @@ Iterating the decomposition produces the components `F.values` and `F.vectors`. # Examples ```jldoctest julia> F = eigen([1.0 0.0 0.0; 0.0 3.0 0.0; 0.0 0.0 18.0]) -Eigen{Float64,Float64,Array{Float64,2},Array{Float64,1}} +Eigen{Float64,Float64,Matrix{Float64},Vector{Float64}} values: -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 3.0 18.0 vectors: -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 julia> F.values -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 3.0 18.0 julia> F.vectors -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 @@ -73,33 +73,33 @@ Iterating the decomposition produces the components `F.values` and `F.vectors`. # Examples ```jldoctest julia> A = [1 0; 0 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 0 0 -1 julia> B = [0 1; 1 0] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 0 1 1 0 julia> F = eigen(A, B) -GeneralizedEigen{Complex{Float64},Complex{Float64},Array{Complex{Float64},2},Array{Complex{Float64},1}} +GeneralizedEigen{ComplexF64,ComplexF64,Matrix{ComplexF64},Vector{ComplexF64}} values: -2-element Array{Complex{Float64},1}: +2-element Vector{ComplexF64}: 0.0 - 1.0im 0.0 + 1.0im vectors: -2×2 Array{Complex{Float64},2}: +2×2 Matrix{ComplexF64}: 0.0+1.0im 0.0-1.0im -1.0+0.0im -1.0-0.0im julia> F.values -2-element Array{Complex{Float64},1}: +2-element Vector{ComplexF64}: 0.0 - 1.0im 0.0 + 1.0im julia> F.vectors -2×2 Array{Complex{Float64},2}: +2×2 Matrix{ComplexF64}: 0.0+1.0im 0.0-1.0im -1.0+0.0im -1.0-0.0im @@ -201,26 +201,26 @@ accept a `sortby` keyword. # Examples ```jldoctest julia> F = eigen([1.0 0.0 0.0; 0.0 3.0 0.0; 0.0 0.0 18.0]) -Eigen{Float64,Float64,Array{Float64,2},Array{Float64,1}} +Eigen{Float64,Float64,Matrix{Float64},Vector{Float64}} values: -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 3.0 18.0 vectors: -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 julia> F.values -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.0 3.0 18.0 julia> F.vectors -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 @@ -248,7 +248,7 @@ for [`eigen`](@ref). # Examples ```jldoctest julia> eigvecs([1.0 0.0 0.0; 0.0 3.0 0.0; 0.0 0.0 18.0]) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 @@ -273,17 +273,17 @@ The `permute`, `scale`, and `sortby` keywords are the same as for [`eigen`](@ref # Examples ```jldoctest julia> A = [1. 2.; 3. 4.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 3.0 4.0 julia> eigvals!(A) -2-element Array{Float64,1}: +2-element Vector{Float64}: -0.3722813232690143 5.372281323269014 julia> A -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: -0.372281 -1.0 0.0 5.37228 ``` @@ -313,12 +313,12 @@ the same as for [`eigen!`](@ref). # Examples ```jldoctest julia> diag_matrix = [1 0; 0 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 0 0 4 julia> eigvals(diag_matrix) -2-element Array{Float64,1}: +2-element Vector{Float64}: 1.0 4.0 ``` @@ -351,7 +351,7 @@ be sorted. # Examples ```jldoctest julia> A = [0 im; -im 0] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 0+0im 0+1im 0-1im 0+0im @@ -359,7 +359,7 @@ julia> eigmax(A) 1.0 julia> A = [0 im; -1 0] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 0+0im 0+1im -1+0im 0+0im @@ -392,7 +392,7 @@ be sorted. # Examples ```jldoctest julia> A = [0 im; -im 0] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 0+0im 0+1im 0-1im 0+0im @@ -400,7 +400,7 @@ julia> eigmin(A) -1.0 julia> A = [0 im; -1 0] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 0+0im 0+1im -1+0im 0+0im @@ -469,24 +469,24 @@ Any keyword arguments passed to `eigen` are passed through to the lower-level # Examples ```jldoctest julia> A = [1 0; 0 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 0 0 -1 julia> B = [0 1; 1 0] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 0 1 1 0 julia> F = eigen(A, B); julia> F.values -2-element Array{Complex{Float64},1}: +2-element Vector{ComplexF64}: 0.0 - 1.0im 0.0 + 1.0im julia> F.vectors -2×2 Array{Complex{Float64},2}: +2×2 Matrix{ComplexF64}: 0.0+1.0im 0.0-1.0im -1.0+0.0im -1.0-0.0im @@ -516,27 +516,27 @@ instead of creating copies. # Examples ```jldoctest julia> A = [1. 0.; 0. -1.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.0 -1.0 julia> B = [0. 1.; 1. 0.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.0 1.0 1.0 0.0 julia> eigvals!(A, B) -2-element Array{Complex{Float64},1}: +2-element Vector{ComplexF64}: 0.0 - 1.0im 0.0 + 1.0im julia> A -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: -0.0 -1.0 1.0 -0.0 julia> B -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.0 1.0 ``` @@ -560,17 +560,17 @@ Computes the generalized eigenvalues of `A` and `B`. # Examples ```jldoctest julia> A = [1 0; 0 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 0 0 -1 julia> B = [0 1; 1 0] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 0 1 1 0 julia> eigvals(A,B) -2-element Array{Complex{Float64},1}: +2-element Vector{ComplexF64}: 0.0 - 1.0im 0.0 + 1.0im ``` @@ -589,17 +589,17 @@ be obtained from the slice `M[:, k]`.) # Examples ```jldoctest julia> A = [1 0; 0 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 0 0 -1 julia> B = [0 1; 1 0] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 0 1 1 0 julia> eigvecs(A, B) -2×2 Array{Complex{Float64},2}: +2×2 Matrix{ComplexF64}: 0.0+1.0im 0.0-1.0im -1.0+0.0im -1.0-0.0im ``` diff --git a/stdlib/LinearAlgebra/src/generic.jl b/stdlib/LinearAlgebra/src/generic.jl index e5555da909d108..ba7c5f21baa67e 100644 --- a/stdlib/LinearAlgebra/src/generic.jl +++ b/stdlib/LinearAlgebra/src/generic.jl @@ -68,7 +68,7 @@ julia> _add = MulAddMul(1, 0); julia> _modify!(_add, 123, C, 1) julia> C -1-element Array{BigFloat,1}: +1-element Vector{BigFloat}: 123.0 ``` """ @@ -144,17 +144,17 @@ multiplication involving non-finite numbers such as `NaN` and `±Inf`. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> rmul!(A, 2) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 4 6 8 julia> rmul!([NaN], 0.0) -1-element Array{Float64,1}: +1-element Vector{Float64}: NaN ``` """ @@ -182,17 +182,17 @@ multiplication involving non-finite numbers such as `NaN` and `±Inf`. # Examples ```jldoctest julia> B = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> lmul!(2, B) -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 4 6 8 julia> lmul!(0.0, [Inf]) -1-element Array{Float64,1}: +1-element Vector{Float64}: NaN ``` """ @@ -212,12 +212,12 @@ in-place. Use [`ldiv!`](@ref) to divide scalar from left. # Examples ```jldoctest julia> A = [1.0 2.0; 3.0 4.0] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 3.0 4.0 julia> rdiv!(A, 2.0) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.5 1.0 1.5 2.0 ``` @@ -238,12 +238,12 @@ in-place. Use [`rdiv!`](@ref) to divide scalar from right. # Examples ```jldoctest julia> B = [1.0 2.0; 3.0 4.0] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 3.0 4.0 julia> ldiv!(2.0, B) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.5 1.0 1.5 2.0 ``` @@ -269,19 +269,19 @@ Compute the cross product of two 3-vectors. # Examples ```jldoctest julia> a = [0;1;0] -3-element Array{Int64,1}: +3-element Vector{Int64}: 0 1 0 julia> b = [0;0;1] -3-element Array{Int64,1}: +3-element Vector{Int64}: 0 0 1 julia> cross(a,b) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 0 0 @@ -304,14 +304,14 @@ Upper triangle of a matrix. # Examples ```jldoctest julia> a = fill(1.0, (4,4)) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 julia> triu(a) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 1.0 1.0 1.0 0.0 1.0 1.0 1.0 0.0 0.0 1.0 1.0 @@ -328,14 +328,14 @@ Lower triangle of a matrix. # Examples ```jldoctest julia> a = fill(1.0, (4,4)) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 julia> tril(a) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 1.0 0.0 @@ -352,21 +352,21 @@ Returns the upper triangle of `M` starting from the `k`th superdiagonal. # Examples ```jldoctest julia> a = fill(1.0, (4,4)) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 julia> triu(a,3) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 julia> triu(a,-3) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 @@ -383,21 +383,21 @@ Returns the lower triangle of `M` starting from the `k`th superdiagonal. # Examples ```jldoctest julia> a = fill(1.0, (4,4)) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 julia> tril(a,3) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 julia> tril(a,-3) -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 @@ -568,7 +568,7 @@ Use [`opnorm`](@ref) to compute the operator norm of a matrix. # Examples ```jldoctest julia> v = [3, -2, 6] -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 -2 6 @@ -731,7 +731,7 @@ When `p=Inf`, the operator norm is the maximum absolute row sum of `A`: # Examples ```jldoctest julia> A = [1 -2 -3; 2 3 -1] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 -2 -3 2 3 -1 @@ -996,7 +996,7 @@ Matrix trace. Sums the diagonal elements of `M`. # Examples ```jldoctest julia> A = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 @@ -1026,12 +1026,12 @@ Computed by solving the left-division # Examples ```jldoctest julia> M = [2 5; 1 3] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 5 1 3 julia> N = inv(M) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 3.0 -5.0 -1.0 2.0 @@ -1091,7 +1091,7 @@ procedure can fail even for invertible matrices. julia> A = [1 0; 1 -2]; B = [32; -4]; julia> X = A \\ B -2-element Array{Float64,1}: +2-element Vector{Float64}: 32.0 18.0 @@ -1164,7 +1164,7 @@ Test whether a matrix is symmetric. # Examples ```jldoctest julia> a = [1 2; 2 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 -1 @@ -1172,7 +1172,7 @@ julia> issymmetric(a) true julia> b = [1 im; -im 1] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 1+0im 0+1im 0-1im 1+0im @@ -1203,7 +1203,7 @@ Test whether a matrix is Hermitian. # Examples ```jldoctest julia> a = [1 2; 2 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 -1 @@ -1211,7 +1211,7 @@ julia> ishermitian(a) true julia> b = [1 im; -im 1] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 1+0im 0+1im 0-1im 1+0im @@ -1242,7 +1242,7 @@ Test whether `A` is upper triangular starting from the `k`th superdiagonal. # Examples ```jldoctest julia> a = [1 2; 2 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 -1 @@ -1253,7 +1253,7 @@ julia> istriu(a, -1) true julia> b = [1 im; 0 -1] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 1+0im 0+1im 0+0im -1+0im @@ -1284,7 +1284,7 @@ Test whether `A` is lower triangular starting from the `k`th superdiagonal. # Examples ```jldoctest julia> a = [1 2; 2 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 -1 @@ -1295,7 +1295,7 @@ julia> istril(a, 1) true julia> b = [1 0; -im -1] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 1+0im 0+0im 0-1im -1+0im @@ -1327,7 +1327,7 @@ and upper bandwidth extending through the `ku`th superdiagonal. # Examples ```jldoctest julia> a = [1 2; 2 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 -1 @@ -1338,7 +1338,7 @@ julia> LinearAlgebra.isbanded(a, -1, 1) true julia> b = [1 0; -im -1] # lower bidiagonal -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 1+0im 0+0im 0-1im -1+0im @@ -1359,7 +1359,7 @@ Test whether a matrix is diagonal. # Examples ```jldoctest julia> a = [1 2; 2 -1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 2 -1 @@ -1367,7 +1367,7 @@ julia> isdiag(a) false julia> b = [im 0; 0 -im] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 0+1im 0+0im 0+0im 0-1im @@ -1522,7 +1522,7 @@ Matrix determinant. # Examples ```jldoctest julia> M = [1 0; 2 2] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 0 2 2 @@ -1548,7 +1548,7 @@ Log of absolute value of matrix determinant. Equivalent to # Examples ```jldoctest julia> A = [-1. 0.; 0. 1.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: -1.0 0.0 0.0 1.0 @@ -1559,7 +1559,7 @@ julia> logabsdet(A) (0.0, -1.0) julia> B = [2. 0.; 0. 1.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.0 0.0 0.0 1.0 @@ -1581,7 +1581,7 @@ increased accuracy and/or speed. # Examples ```jldoctest julia> M = [1 0; 2 2] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 0 2 2 @@ -1611,13 +1611,13 @@ Currently supports only numeric leaf elements. # Examples ```jldoctest julia> a = [[1,2, [3,4]], 5.0, [6im, [7.0, 8.0]]] -3-element Array{Any,1}: +3-element Vector{Any}: Any[1, 2, [3, 4]] 5.0 Any[0 + 6im, [7.0, 8.0]] julia> LinearAlgebra.promote_leaf_eltypes(a) -Complex{Float64} +ComplexF64 = Complex{Float64} ``` """ promote_leaf_eltypes(x::Union{AbstractArray{T},Tuple{T,Vararg{T}}}) where {T<:Number} = T @@ -1682,7 +1682,7 @@ See also [`normalize!`](@ref) and [`norm`](@ref). julia> a = [1,2,4]; julia> b = normalize(a) -3-element Array{Float64,1}: +3-element Vector{Float64}: 0.2182178902359924 0.4364357804719848 0.8728715609439696 @@ -1691,7 +1691,7 @@ julia> norm(b) 1.0 julia> c = normalize(a, 1) -3-element Array{Float64,1}: +3-element Vector{Float64}: 0.14285714285714285 0.2857142857142857 0.5714285714285714 @@ -1700,7 +1700,7 @@ julia> norm(c, 1) 1.0 julia> a = [1 2 4 ; 1 2 4] -2×3 Array{Int64,2}: +2×3 Matrix{Int64}: 1 2 4 1 2 4 @@ -1708,7 +1708,7 @@ julia> norm(a) 6.48074069840786 julia> normalize(a) -2×3 Array{Float64,2}: +2×3 Matrix{Float64}: 0.154303 0.308607 0.617213 0.154303 0.308607 0.617213 diff --git a/stdlib/LinearAlgebra/src/hessenberg.jl b/stdlib/LinearAlgebra/src/hessenberg.jl index c64c2f55669cd6..98701c84d2ef55 100644 --- a/stdlib/LinearAlgebra/src/hessenberg.jl +++ b/stdlib/LinearAlgebra/src/hessenberg.jl @@ -24,14 +24,14 @@ Iterating the decomposition produces the factors `F.Q` and `F.H`. # Examples ```jldoctest julia> A = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16] -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 julia> UpperHessenberg(A) -4×4 UpperHessenberg{Int64,Array{Int64,2}}: +4×4 UpperHessenberg{Int64,Matrix{Int64}}: 1 2 3 4 5 6 7 8 ⋅ 10 11 12 @@ -388,26 +388,26 @@ Iterating the decomposition produces the factors `F.Q, F.H, F.μ`. # Examples ```jldoctest julia> A = [4. 9. 7.; 4. 4. 1.; 4. 3. 2.] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 4.0 9.0 7.0 4.0 4.0 1.0 4.0 3.0 2.0 julia> F = hessenberg(A) -Hessenberg{Float64,UpperHessenberg{Float64,Array{Float64,2}},Array{Float64,2},Array{Float64,1},Bool} +Hessenberg{Float64,UpperHessenberg{Float64,Matrix{Float64}},Matrix{Float64},Vector{Float64},Bool} Q factor: -3×3 LinearAlgebra.HessenbergQ{Float64,Array{Float64,2},Array{Float64,1},false}: +3×3 LinearAlgebra.HessenbergQ{Float64,Matrix{Float64},Vector{Float64},false}: 1.0 0.0 0.0 0.0 -0.707107 -0.707107 0.0 -0.707107 0.707107 H factor: -3×3 UpperHessenberg{Float64,Array{Float64,2}}: +3×3 UpperHessenberg{Float64,Matrix{Float64}}: 4.0 -11.3137 -1.41421 -5.65685 5.0 2.0 ⋅ -8.88178e-16 1.0 julia> F.Q * F.H * F.Q' -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 4.0 9.0 7.0 4.0 4.0 1.0 4.0 3.0 2.0 diff --git a/stdlib/LinearAlgebra/src/ldlt.jl b/stdlib/LinearAlgebra/src/ldlt.jl index de3716948f65d8..facf2c563b01d6 100644 --- a/stdlib/LinearAlgebra/src/ldlt.jl +++ b/stdlib/LinearAlgebra/src/ldlt.jl @@ -21,20 +21,20 @@ The individual components of the factorization `F::LDLt` can be accessed via `ge # Examples ```jldoctest julia> S = SymTridiagonal([3., 4., 5.], [1., 2.]) -3×3 SymTridiagonal{Float64,Array{Float64,1}}: +3×3 SymTridiagonal{Float64,Vector{Float64}}: 3.0 1.0 ⋅ 1.0 4.0 2.0 ⋅ 2.0 5.0 julia> F = ldlt(S) -LDLt{Float64,SymTridiagonal{Float64,Array{Float64,1}}} +LDLt{Float64,SymTridiagonal{Float64,Vector{Float64}}} L factor: -3×3 UnitLowerTriangular{Float64,SymTridiagonal{Float64,Array{Float64,1}}}: +3×3 UnitLowerTriangular{Float64,SymTridiagonal{Float64,Vector{Float64}}}: 1.0 ⋅ ⋅ 0.333333 1.0 ⋅ 0.0 0.545455 1.0 D factor: -3×3 Diagonal{Float64,Array{Float64,1}}: +3×3 Diagonal{Float64,Vector{Float64}}: 3.0 ⋅ ⋅ ⋅ 3.66667 ⋅ ⋅ ⋅ 3.90909 @@ -94,7 +94,7 @@ Same as [`ldlt`](@ref), but saves space by overwriting the input `S`, instead of # Examples ```jldoctest julia> S = SymTridiagonal([3., 4., 5.], [1., 2.]) -3×3 SymTridiagonal{Float64,Array{Float64,1}}: +3×3 SymTridiagonal{Float64,Vector{Float64}}: 3.0 1.0 ⋅ 1.0 4.0 2.0 ⋅ 2.0 5.0 @@ -105,7 +105,7 @@ julia> ldltS === S false julia> S -3×3 SymTridiagonal{Float64,Array{Float64,1}}: +3×3 SymTridiagonal{Float64,Vector{Float64}}: 3.0 0.333333 ⋅ 0.333333 3.66667 0.545455 ⋅ 0.545455 3.90909 @@ -132,7 +132,7 @@ factorization `F = ldlt(S)` is to solve the linear system of equations `Sx = b` # Examples ```jldoctest julia> S = SymTridiagonal([3., 4., 5.], [1., 2.]) -3×3 SymTridiagonal{Float64,Array{Float64,1}}: +3×3 SymTridiagonal{Float64,Vector{Float64}}: 3.0 1.0 ⋅ 1.0 4.0 2.0 ⋅ 2.0 5.0 @@ -142,13 +142,13 @@ julia> ldltS = ldlt(S); julia> b = [6., 7., 8.]; julia> ldltS \\ b -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.7906976744186047 0.627906976744186 1.3488372093023255 julia> S \\ b -3-element Array{Float64,1}: +3-element Vector{Float64}: 1.7906976744186047 0.627906976744186 1.3488372093023255 diff --git a/stdlib/LinearAlgebra/src/lq.jl b/stdlib/LinearAlgebra/src/lq.jl index 345dea87c0884d..14d42bfb6ee643 100644 --- a/stdlib/LinearAlgebra/src/lq.jl +++ b/stdlib/LinearAlgebra/src/lq.jl @@ -17,17 +17,17 @@ Iterating the decomposition produces the components `S.L` and `S.Q`. # Examples ```jldoctest julia> A = [5. 7.; -2. -4.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 5.0 7.0 -2.0 -4.0 julia> S = lq(A) -LQ{Float64,Array{Float64,2}} with factors L and Q: +LQ{Float64,Matrix{Float64}} with factors L and Q: [-8.60233 0.0; 4.41741 -0.697486] [-0.581238 -0.813733; -0.813733 0.581238] julia> S.L * S.Q -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 5.0 7.0 -2.0 -4.0 @@ -87,17 +87,17 @@ system of equations (`A` has more columns than rows, but has full row rank). # Examples ```jldoctest julia> A = [5. 7.; -2. -4.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 5.0 7.0 -2.0 -4.0 julia> S = lq(A) -LQ{Float64,Array{Float64,2}} with factors L and Q: +LQ{Float64,Matrix{Float64}} with factors L and Q: [-8.60233 0.0; 4.41741 -0.697486] [-0.581238 -0.813733; -0.813733 0.581238] julia> S.L * S.Q -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 5.0 7.0 -2.0 -4.0 diff --git a/stdlib/LinearAlgebra/src/lu.jl b/stdlib/LinearAlgebra/src/lu.jl index c770f478d4f4a6..54d421441b9ded 100644 --- a/stdlib/LinearAlgebra/src/lu.jl +++ b/stdlib/LinearAlgebra/src/lu.jl @@ -23,18 +23,18 @@ Iterating the factorization produces the components `F.L`, `F.U`, and `F.p`. # Examples ```jldoctest julia> A = [4 3; 6 3] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 3 6 3 julia> F = lu(A) -LU{Float64,Array{Float64,2}} +LU{Float64,Matrix{Float64}} L factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.666667 1.0 U factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 6.0 3.0 0.0 1.0 @@ -101,23 +101,23 @@ element type of `A`, e.g. for integer types. # Examples ```jldoctest julia> A = [4. 3.; 6. 3.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 4.0 3.0 6.0 3.0 julia> F = lu!(A) -LU{Float64,Array{Float64,2}} +LU{Float64,Matrix{Float64}} L factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.666667 1.0 U factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 6.0 3.0 0.0 1.0 julia> iA = [4 3; 6 3] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 3 6 3 @@ -243,18 +243,18 @@ The relationship between `F` and `A` is # Examples ```jldoctest julia> A = [4 3; 6 3] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 4 3 6 3 julia> F = lu(A) -LU{Float64,Array{Float64,2}} +LU{Float64,Matrix{Float64}} L factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.666667 1.0 U factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 6.0 3.0 0.0 1.0 diff --git a/stdlib/LinearAlgebra/src/matmul.jl b/stdlib/LinearAlgebra/src/matmul.jl index 66242177f2ea6b..f208ad8feefa8c 100644 --- a/stdlib/LinearAlgebra/src/matmul.jl +++ b/stdlib/LinearAlgebra/src/matmul.jl @@ -143,7 +143,7 @@ Matrix multiplication. # Examples ```jldoctest julia> [1 1; 0 1] * [1 0; 1 1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 1 1 1 ``` @@ -194,7 +194,7 @@ overwriting the existing value of `Y`. Note that `Y` must not be aliased with ei julia> A=[1.0 2.0; 3.0 4.0]; B=[1.0 1.0; 1.0 1.0]; Y = similar(B); mul!(Y, A, B); julia> Y -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 3.0 3.0 7.0 7.0 ``` @@ -226,7 +226,7 @@ julia> mul!(C, A, B, 100.0, 10.0) === C true julia> C -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 310.0 320.0 730.0 740.0 ``` @@ -252,7 +252,7 @@ julia> B = LinearAlgebra.UpperTriangular([1 2; 0 3]); julia> LinearAlgebra.rmul!(A, B); julia> A -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 0 3 1 2 @@ -261,7 +261,7 @@ julia> A = [1.0 2.0; 3.0 4.0]; julia> F = qr([0 1; -1 0]); julia> rmul!(A, F.Q) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.0 1.0 4.0 3.0 ``` @@ -285,7 +285,7 @@ julia> A = LinearAlgebra.UpperTriangular([1 2; 0 3]); julia> LinearAlgebra.lmul!(A, B); julia> B -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 2 1 3 0 @@ -294,7 +294,7 @@ julia> B = [1.0 2.0; 3.0 4.0]; julia> F = qr([0 1; -1 0]); julia> lmul!(F.Q, B) -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 3.0 4.0 1.0 2.0 ``` diff --git a/stdlib/LinearAlgebra/src/qr.jl b/stdlib/LinearAlgebra/src/qr.jl index d60fc2458dea3c..c0107037a1e0da 100644 --- a/stdlib/LinearAlgebra/src/qr.jl +++ b/stdlib/LinearAlgebra/src/qr.jl @@ -266,23 +266,23 @@ representable by the element type of `A`, e.g. for integer types. # Examples ```jldoctest julia> a = [1. 2.; 3. 4.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 3.0 4.0 julia> qr!(a) -LinearAlgebra.QRCompactWY{Float64,Array{Float64,2}} +LinearAlgebra.QRCompactWY{Float64,Matrix{Float64}} Q factor: -2×2 LinearAlgebra.QRCompactWYQ{Float64,Array{Float64,2}}: +2×2 LinearAlgebra.QRCompactWYQ{Float64,Matrix{Float64}}: -0.316228 -0.948683 -0.948683 0.316228 R factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: -3.16228 -4.42719 0.0 -0.632456 julia> a = [1 2; 3 4] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 @@ -349,20 +349,20 @@ It is ignored when `blocksize > minimum(size(A))`. See [`QRCompactWY`](@ref). # Examples ```jldoctest julia> A = [3.0 -6.0; 4.0 -8.0; 0.0 1.0] -3×2 Array{Float64,2}: +3×2 Matrix{Float64}: 3.0 -6.0 4.0 -8.0 0.0 1.0 julia> F = qr(A) -LinearAlgebra.QRCompactWY{Float64,Array{Float64,2}} +LinearAlgebra.QRCompactWY{Float64,Matrix{Float64}} Q factor: -3×3 LinearAlgebra.QRCompactWYQ{Float64,Array{Float64,2}}: +3×3 LinearAlgebra.QRCompactWYQ{Float64,Matrix{Float64}}: -0.6 0.0 0.8 -0.8 0.0 -0.6 0.0 -1.0 0.0 R factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: -5.0 10.0 0.0 -1.0 diff --git a/stdlib/LinearAlgebra/src/schur.jl b/stdlib/LinearAlgebra/src/schur.jl index d32ee8aeff5044..836f99d96c99c9 100644 --- a/stdlib/LinearAlgebra/src/schur.jl +++ b/stdlib/LinearAlgebra/src/schur.jl @@ -17,27 +17,27 @@ Iterating the decomposition produces the components `F.T`, `F.Z`, and `F.values` # Examples ```jldoctest julia> A = [5. 7.; -2. -4.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 5.0 7.0 -2.0 -4.0 julia> F = schur(A) -Schur{Float64,Array{Float64,2}} +Schur{Float64,Matrix{Float64}} T factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 3.0 9.0 0.0 -2.0 Z factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.961524 0.274721 -0.274721 0.961524 eigenvalues: -2-element Array{Float64,1}: +2-element Vector{Float64}: 3.0 -2.0 julia> F.vectors * F.Schur * F.vectors' -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 5.0 7.0 -2.0 -4.0 @@ -69,27 +69,27 @@ Same as [`schur`](@ref) but uses the input argument `A` as workspace. # Examples ```jldoctest julia> A = [5. 7.; -2. -4.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 5.0 7.0 -2.0 -4.0 julia> F = schur!(A) -Schur{Float64,Array{Float64,2}} +Schur{Float64,Matrix{Float64}} T factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 3.0 9.0 0.0 -2.0 Z factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.961524 0.274721 -0.274721 0.961524 eigenvalues: -2-element Array{Float64,1}: +2-element Vector{Float64}: 3.0 -2.0 julia> A -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 3.0 9.0 0.0 -2.0 ``` @@ -109,27 +109,27 @@ Iterating the decomposition produces the components `F.T`, `F.Z`, and `F.values` # Examples ```jldoctest julia> A = [5. 7.; -2. -4.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 5.0 7.0 -2.0 -4.0 julia> F = schur(A) -Schur{Float64,Array{Float64,2}} +Schur{Float64,Matrix{Float64}} T factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 3.0 9.0 0.0 -2.0 Z factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.961524 0.274721 -0.274721 0.961524 eigenvalues: -2-element Array{Float64,1}: +2-element Vector{Float64}: 3.0 -2.0 julia> F.vectors * F.Schur * F.vectors' -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 5.0 7.0 -2.0 -4.0 diff --git a/stdlib/LinearAlgebra/src/svd.jl b/stdlib/LinearAlgebra/src/svd.jl index 9eb153d916e660..778d21b36575d1 100644 --- a/stdlib/LinearAlgebra/src/svd.jl +++ b/stdlib/LinearAlgebra/src/svd.jl @@ -16,35 +16,35 @@ Iterating the decomposition produces the components `U`, `S`, and `V`. # Examples ```jldoctest julia> A = [1. 0. 0. 0. 2.; 0. 0. 3. 0. 0.; 0. 0. 0. 0. 0.; 0. 2. 0. 0. 0.] -4×5 Array{Float64,2}: +4×5 Matrix{Float64}: 1.0 0.0 0.0 0.0 2.0 0.0 0.0 3.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.0 0.0 0.0 0.0 julia> F = svd(A) -SVD{Float64,Float64,Array{Float64,2}} +SVD{Float64,Float64,Matrix{Float64}} U factor: -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 1.0 0.0 singular values: -4-element Array{Float64,1}: +4-element Vector{Float64}: 3.0 2.23606797749979 2.0 0.0 Vt factor: -4×5 Array{Float64,2}: +4×5 Matrix{Float64}: -0.0 0.0 1.0 -0.0 0.0 0.447214 0.0 0.0 0.0 0.894427 -0.0 1.0 0.0 -0.0 0.0 0.0 0.0 0.0 1.0 0.0 julia> F.U * Diagonal(F.S) * F.Vt -4×5 Array{Float64,2}: +4×5 Matrix{Float64}: 1.0 0.0 0.0 0.0 2.0 0.0 0.0 3.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 @@ -201,14 +201,14 @@ Return the singular values of `A` in descending order. # Examples ```jldoctest julia> A = [1. 0. 0. 0. 2.; 0. 0. 3. 0. 0.; 0. 0. 0. 0. 0.; 0. 2. 0. 0. 0.] -4×5 Array{Float64,2}: +4×5 Matrix{Float64}: 1.0 0.0 0.0 0.0 2.0 0.0 0.0 3.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.0 0.0 0.0 0.0 julia> svdvals(A) -4-element Array{Float64,1}: +4-element Vector{Float64}: 3.0 2.23606797749979 2.0 @@ -278,27 +278,27 @@ routine which is called underneath (in LAPACK 3.6.0 and newer). # Examples ```jldoctest julia> A = [1. 0.; 0. -1.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.0 -1.0 julia> B = [0. 1.; 1. 0.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.0 1.0 1.0 0.0 julia> F = svd(A, B) -GeneralizedSVD{Float64,Array{Float64,2}} +GeneralizedSVD{Float64,Matrix{Float64}} U factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.0 1.0 V factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: -0.0 -1.0 1.0 0.0 Q factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.0 1.0 D1 factor: @@ -310,17 +310,17 @@ D2 factor: 0.707107 ⋅ ⋅ 0.707107 R0 factor: -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.41421 0.0 0.0 -1.41421 julia> F.U*F.D1*F.R0*F.Q' -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.0 -1.0 julia> F.V*F.D2*F.R0*F.Q' -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.0 1.0 1.0 0.0 ``` @@ -518,17 +518,17 @@ decomposition of `A` and `B`. See also [`svd`](@ref). # Examples ```jldoctest julia> A = [1. 0.; 0. -1.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 0.0 0.0 -1.0 julia> B = [0. 1.; 1. 0.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 0.0 1.0 1.0 0.0 julia> svdvals(A, B) -2-element Array{Float64,1}: +2-element Vector{Float64}: 1.0 1.0 ``` diff --git a/stdlib/LinearAlgebra/src/symmetric.jl b/stdlib/LinearAlgebra/src/symmetric.jl index b29aab58b8baac..082ea68e4a48b3 100644 --- a/stdlib/LinearAlgebra/src/symmetric.jl +++ b/stdlib/LinearAlgebra/src/symmetric.jl @@ -19,7 +19,7 @@ triangle of the matrix `A`. # Examples ```jldoctest julia> A = [1 0 2 0 3; 0 4 0 5 0; 6 0 7 0 8; 0 9 0 1 0; 2 0 3 0 4] -5×5 Array{Int64,2}: +5×5 Matrix{Int64}: 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 @@ -27,7 +27,7 @@ julia> A = [1 0 2 0 3; 0 4 0 5 0; 6 0 7 0 8; 0 9 0 1 0; 2 0 3 0 4] 2 0 3 0 4 julia> Supper = Symmetric(A) -5×5 Symmetric{Int64,Array{Int64,2}}: +5×5 Symmetric{Int64,Matrix{Int64}}: 1 0 2 0 3 0 4 0 5 0 2 0 7 0 8 @@ -35,7 +35,7 @@ julia> Supper = Symmetric(A) 3 0 8 0 4 julia> Slower = Symmetric(A, :L) -5×5 Symmetric{Int64,Array{Int64,2}}: +5×5 Symmetric{Int64,Matrix{Int64}}: 1 0 6 0 2 0 4 0 9 0 6 0 7 0 3 @@ -102,7 +102,7 @@ triangle of the matrix `A`. julia> A = [1 0 2+2im 0 3-3im; 0 4 0 5 0; 6-6im 0 7 0 8+8im; 0 9 0 1 0; 2+2im 0 3-3im 0 4]; julia> Hupper = Hermitian(A) -5×5 Hermitian{Complex{Int64},Array{Complex{Int64},2}}: +5×5 Hermitian{Complex{Int64},Matrix{Complex{Int64}}}: 1+0im 0+0im 2+2im 0+0im 3-3im 0+0im 4+0im 0+0im 5+0im 0+0im 2-2im 0+0im 7+0im 0+0im 8+8im @@ -110,7 +110,7 @@ julia> Hupper = Hermitian(A) 3+3im 0+0im 8-8im 0+0im 4+0im julia> Hlower = Hermitian(A, :L) -5×5 Hermitian{Complex{Int64},Array{Complex{Int64},2}}: +5×5 Hermitian{Complex{Int64},Matrix{Complex{Int64}}}: 1+0im 0+0im 6+6im 0+0im 2-2im 0+0im 4+0im 0+0im 9+0im 0+0im 6-6im 0+0im 7+0im 0+0im 3+3im @@ -756,17 +756,17 @@ e.g. the 2nd to 8th eigenvalues. # Examples ```jldoctest julia> A = SymTridiagonal([1.; 2.; 1.], [2.; 3.]) -3×3 SymTridiagonal{Float64,Array{Float64,1}}: +3×3 SymTridiagonal{Float64,Vector{Float64}}: 1.0 2.0 ⋅ 2.0 2.0 3.0 ⋅ 3.0 1.0 julia> eigvals(A, 2:2) -1-element Array{Float64,1}: +1-element Vector{Float64}: 0.9999999999999996 julia> eigvals(A) -3-element Array{Float64,1}: +3-element Vector{Float64}: -2.1400549446402604 1.0000000000000002 5.140054944640259 @@ -796,17 +796,17 @@ by specifying a pair `vl` and `vu` for the lower and upper boundaries of the eig # Examples ```jldoctest julia> A = SymTridiagonal([1.; 2.; 1.], [2.; 3.]) -3×3 SymTridiagonal{Float64,Array{Float64,1}}: +3×3 SymTridiagonal{Float64,Vector{Float64}}: 1.0 2.0 ⋅ 2.0 2.0 3.0 ⋅ 3.0 1.0 julia> eigvals(A, -1, 2) -1-element Array{Float64,1}: +1-element Vector{Float64}: 1.0000000000000009 julia> eigvals(A) -3-element Array{Float64,1}: +3-element Vector{Float64}: -2.1400549446402604 1.0000000000000002 5.140054944640259 diff --git a/stdlib/LinearAlgebra/src/transpose.jl b/stdlib/LinearAlgebra/src/transpose.jl index 4b4658df551343..401a3a966ebf4e 100644 --- a/stdlib/LinearAlgebra/src/transpose.jl +++ b/stdlib/LinearAlgebra/src/transpose.jl @@ -16,24 +16,24 @@ regions. # Examples ```jldoctest julia> A = [3+2im 9+2im; 8+7im 4+6im] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3+2im 9+2im 8+7im 4+6im julia> B = zeros(Complex{Int64}, 2, 2) -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 0+0im 0+0im 0+0im 0+0im julia> transpose!(B, A); julia> B -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3+2im 8+7im 9+2im 4+6im julia> A -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3+2im 9+2im 8+7im 4+6im ``` @@ -51,24 +51,24 @@ regions. # Examples ```jldoctest julia> A = [3+2im 9+2im; 8+7im 4+6im] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3+2im 9+2im 8+7im 4+6im julia> B = zeros(Complex{Int64}, 2, 2) -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 0+0im 0+0im 0+0im 0+0im julia> adjoint!(B, A); julia> B -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3-2im 8-7im 9-2im 4-6im julia> A -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 3+2im 9+2im 8+7im 4+6im ``` @@ -158,17 +158,17 @@ This operation is intended for linear algebra usage - for general data manipulat # Examples ```jldoctest julia> A = [1 2im; -3im 4] -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 1+0im 0+2im 0-3im 4+0im julia> T = transpose(A) -2×2 Transpose{Complex{Int64},Array{Complex{Int64},2}}: +2×2 Transpose{Complex{Int64},Matrix{Complex{Int64}}}: 1+0im 0-3im 0+2im 4+0im julia> copy(T) -2×2 Array{Complex{Int64},2}: +2×2 Matrix{Complex{Int64}}: 1+0im 0-3im 0+2im 4+0im ``` diff --git a/stdlib/LinearAlgebra/src/triangular.jl b/stdlib/LinearAlgebra/src/triangular.jl index 106443a0df6484..a351da8edeab2a 100644 --- a/stdlib/LinearAlgebra/src/triangular.jl +++ b/stdlib/LinearAlgebra/src/triangular.jl @@ -68,13 +68,13 @@ Construct a `LowerTriangular` view of the matrix `A`. # Examples ```jldoctest julia> A = [1.0 2.0 3.0; 4.0 5.0 6.0; 7.0 8.0 9.0] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 julia> LowerTriangular(A) -3×3 LowerTriangular{Float64,Array{Float64,2}}: +3×3 LowerTriangular{Float64,Matrix{Float64}}: 1.0 ⋅ ⋅ 4.0 5.0 ⋅ 7.0 8.0 9.0 @@ -89,13 +89,13 @@ Construct an `UpperTriangular` view of the matrix `A`. # Examples ```jldoctest julia> A = [1.0 2.0 3.0; 4.0 5.0 6.0; 7.0 8.0 9.0] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 julia> UpperTriangular(A) -3×3 UpperTriangular{Float64,Array{Float64,2}}: +3×3 UpperTriangular{Float64,Matrix{Float64}}: 1.0 2.0 3.0 ⋅ 5.0 6.0 ⋅ ⋅ 9.0 @@ -112,13 +112,13 @@ of `A` on its diagonal. # Examples ```jldoctest julia> A = [1.0 2.0 3.0; 4.0 5.0 6.0; 7.0 8.0 9.0] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 julia> UnitLowerTriangular(A) -3×3 UnitLowerTriangular{Float64,Array{Float64,2}}: +3×3 UnitLowerTriangular{Float64,Matrix{Float64}}: 1.0 ⋅ ⋅ 4.0 1.0 ⋅ 7.0 8.0 1.0 @@ -135,13 +135,13 @@ of `A` on its diagonal. # Examples ```jldoctest julia> A = [1.0 2.0 3.0; 4.0 5.0 6.0; 7.0 8.0 9.0] -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 julia> UnitUpperTriangular(A) -3×3 UnitUpperTriangular{Float64,Array{Float64,2}}: +3×3 UnitUpperTriangular{Float64,Matrix{Float64}}: 1.0 2.0 3.0 ⋅ 1.0 6.0 ⋅ ⋅ 1.0 diff --git a/stdlib/LinearAlgebra/src/tridiag.jl b/stdlib/LinearAlgebra/src/tridiag.jl index ffa7cdeeff091a..23cdd0bc083bee 100644 --- a/stdlib/LinearAlgebra/src/tridiag.jl +++ b/stdlib/LinearAlgebra/src/tridiag.jl @@ -30,20 +30,20 @@ subdiagonal are (materialized) transpose of the corresponding superdiagonal bloc # Examples ```jldoctest julia> dv = [1, 2, 3, 4] -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 2 3 4 julia> ev = [7, 8, 9] -3-element Array{Int64,1}: +3-element Vector{Int64}: 7 8 9 julia> SymTridiagonal(dv, ev) -4×4 SymTridiagonal{Int64,Array{Int64,1}}: +4×4 SymTridiagonal{Int64,Vector{Int64}}: 1 7 ⋅ ⋅ 7 2 8 ⋅ ⋅ 8 3 9 @@ -52,17 +52,17 @@ julia> SymTridiagonal(dv, ev) julia> A = SymTridiagonal(fill([1 2; 3 4], 3), fill([1 2; 3 4], 2)); julia> A[1,1] -2×2 Symmetric{Int64,Array{Int64,2}}: +2×2 Symmetric{Int64,Matrix{Int64}}: 1 2 2 4 julia> A[1,2] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 2 3 4 julia> A[2,1] -2×2 Array{Int64,2}: +2×2 Matrix{Int64}: 1 3 2 4 ``` @@ -83,13 +83,13 @@ of the symmetric matrix `A`. # Examples ```jldoctest julia> A = [1 2 3; 2 4 5; 3 5 6] -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 1 2 3 2 4 5 3 5 6 julia> SymTridiagonal(A) -3×3 SymTridiagonal{Int64,Array{Int64,1}}: +3×3 SymTridiagonal{Int64,Vector{Int64}}: 1 2 ⋅ 2 4 5 ⋅ 5 6 @@ -97,7 +97,7 @@ julia> SymTridiagonal(A) julia> B = reshape([[1 2; 2 3], [1 2; 3 4], [1 3; 2 4], [1 2; 2 3]], 2, 2); julia> SymTridiagonal(B) -2×2 SymTridiagonal{Array{Int64,2},Array{Array{Int64,2},1}}: +2×2 SymTridiagonal{Matrix{Int64},Vector{Matrix{Int64}}}: [1 2; 2 3] [1 3; 2 4] [1 2; 3 4] [1 2; 2 3] ``` @@ -321,25 +321,25 @@ returns the specific corresponding eigenvectors. # Examples ```jldoctest julia> A = SymTridiagonal([1.; 2.; 1.], [2.; 3.]) -3×3 SymTridiagonal{Float64,Array{Float64,1}}: +3×3 SymTridiagonal{Float64,Vector{Float64}}: 1.0 2.0 ⋅ 2.0 2.0 3.0 ⋅ 3.0 1.0 julia> eigvals(A) -3-element Array{Float64,1}: +3-element Vector{Float64}: -2.1400549446402604 1.0000000000000002 5.140054944640259 julia> eigvecs(A) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 0.418304 -0.83205 0.364299 -0.656749 -7.39009e-16 0.754109 0.627457 0.5547 0.546448 julia> eigvecs(A, [1.]) -3×1 Array{Float64,2}: +3×1 Matrix{Float64}: 0.8320502943378438 4.263514128092366e-17 -0.5547001962252291 @@ -507,7 +507,7 @@ julia> du = [4, 5, 6]; julia> d = [7, 8, 9, 0]; julia> Tridiagonal(dl, d, du) -4×4 Tridiagonal{Int64,Array{Int64,1}}: +4×4 Tridiagonal{Int64,Vector{Int64}}: 7 4 ⋅ ⋅ 1 8 5 ⋅ ⋅ 2 9 6 @@ -529,14 +529,14 @@ diagonal and first super-diagonal of the matrix `A`. # Examples ```jldoctest julia> A = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4] -4×4 Array{Int64,2}: +4×4 Matrix{Int64}: 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 julia> Tridiagonal(A) -4×4 Tridiagonal{Int64,Array{Int64,1}}: +4×4 Tridiagonal{Int64,Vector{Int64}}: 1 2 ⋅ ⋅ 1 2 3 ⋅ ⋅ 2 3 4 diff --git a/stdlib/LinearAlgebra/src/uniformscaling.jl b/stdlib/LinearAlgebra/src/uniformscaling.jl index 6a49fff137c885..5afc778a7d18b0 100644 --- a/stdlib/LinearAlgebra/src/uniformscaling.jl +++ b/stdlib/LinearAlgebra/src/uniformscaling.jl @@ -21,17 +21,17 @@ UniformScaling{Float64} 2.0*I julia> A = [1. 2.; 3. 4.] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 1.0 2.0 3.0 4.0 julia> J*A -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.0 4.0 6.0 8.0 julia> J[1:2, 1:2] -2×2 Array{Float64,2}: +2×2 Matrix{Float64}: 2.0 0.0 0.0 2.0 ``` @@ -51,7 +51,7 @@ julia> fill(1, (5,6)) * I == fill(1, (5,6)) true julia> [1 2im 3; 1im 2 3] * I -2×3 Array{Complex{Int64},2}: +2×3 Matrix{Complex{Int64}}: 1+0im 0+2im 3+0im 0+1im 2+0im 3+0im ``` @@ -69,13 +69,13 @@ Construct a `Diagonal` matrix from a `UniformScaling`. # Examples ```jldoctest julia> I(3) -3×3 Diagonal{Bool,Array{Bool,1}}: +3×3 Diagonal{Bool,Vector{Bool}}: 1 ⋅ ⋅ ⋅ 1 ⋅ ⋅ ⋅ 1 julia> (0.7*I)(3) -3×3 Diagonal{Float64,Array{Float64,1}}: +3×3 Diagonal{Float64,Vector{Float64}}: 0.7 ⋅ ⋅ ⋅ 0.7 ⋅ ⋅ ⋅ 0.7 diff --git a/stdlib/LinearAlgebra/test/adjtrans.jl b/stdlib/LinearAlgebra/test/adjtrans.jl index f5a1cda458b86b..fa670a91b38e94 100644 --- a/stdlib/LinearAlgebra/test/adjtrans.jl +++ b/stdlib/LinearAlgebra/test/adjtrans.jl @@ -380,8 +380,8 @@ end # TODO tighten type asserts once pinv yields Transpose/Adjoint @test pinv(Adjoint(realvec))::Vector{Float64} ≈ pinv(rowrealvec) @test pinv(Transpose(realvec))::Vector{Float64} ≈ pinv(rowrealvec) - @test pinv(Adjoint(complexvec))::Vector{Complex{Float64}} ≈ pinv(conj(rowcomplexvec)) - @test pinv(Transpose(complexvec))::Vector{Complex{Float64}} ≈ pinv(rowcomplexvec) + @test pinv(Adjoint(complexvec))::Vector{ComplexF64} ≈ pinv(conj(rowcomplexvec)) + @test pinv(Transpose(complexvec))::Vector{ComplexF64} ≈ pinv(rowcomplexvec) end @testset "Adjoint/Transpose-wrapped vector left-division" begin diff --git a/stdlib/LinearAlgebra/test/bidiag.jl b/stdlib/LinearAlgebra/test/bidiag.jl index 4d6fefdeb52e9c..b2ad5f5778787d 100644 --- a/stdlib/LinearAlgebra/test/bidiag.jl +++ b/stdlib/LinearAlgebra/test/bidiag.jl @@ -379,7 +379,7 @@ Random.seed!(1) @test factorize(T) === T end BD = Bidiagonal(dv, ev, :U) - @test Matrix{Complex{Float64}}(BD) == BD + @test Matrix{ComplexF64}(BD) == BD end # Issue 10742 and similar diff --git a/stdlib/LinearAlgebra/test/blas.jl b/stdlib/LinearAlgebra/test/blas.jl index 23c6d68cdc9979..074dec3198530c 100644 --- a/stdlib/LinearAlgebra/test/blas.jl +++ b/stdlib/LinearAlgebra/test/blas.jl @@ -431,7 +431,7 @@ Random.seed!(100) end end -@testset "syr for eltype $elty" for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) +@testset "syr for eltype $elty" for elty in (Float32, Float64, ComplexF32, ComplexF64) A = rand(elty, 5, 5) @test triu(A[1,:] * transpose(A[1,:])) ≈ BLAS.syr!('U', one(elty), A[1,:], zeros(elty, 5, 5)) @test tril(A[1,:] * transpose(A[1,:])) ≈ BLAS.syr!('L', one(elty), A[1,:], zeros(elty, 5, 5)) @@ -439,7 +439,7 @@ end @test tril(A[1,:] * transpose(A[1,:])) ≈ BLAS.syr!('L', one(elty), view(A, 1, :), zeros(elty, 5, 5)) end -@testset "her for eltype $elty" for elty in (Complex{Float32}, Complex{Float64}) +@testset "her for eltype $elty" for elty in (ComplexF32, ComplexF64) A = rand(elty, 5, 5) @test triu(A[1,:] * A[1,:]') ≈ BLAS.her!('U', one(real(elty)), A[1,:], zeros(elty, 5, 5)) @test tril(A[1,:] * A[1,:]') ≈ BLAS.her!('L', one(real(elty)), A[1,:], zeros(elty, 5, 5)) diff --git a/stdlib/LinearAlgebra/test/cholesky.jl b/stdlib/LinearAlgebra/test/cholesky.jl index 3d9cac4cc9a68c..7f3dae37b84c74 100644 --- a/stdlib/LinearAlgebra/test/cholesky.jl +++ b/stdlib/LinearAlgebra/test/cholesky.jl @@ -359,7 +359,7 @@ end D = complex(D) CD = cholesky(D) CM = cholesky(Matrix(D)) - @test CD isa Cholesky{Complex{Float64}} + @test CD isa Cholesky{ComplexF64} @test CD.U ≈ Diagonal(.√d) ≈ CM.U @test D ≈ CD.L * CD.U @test CD.info == 0 diff --git a/stdlib/LinearAlgebra/test/dense.jl b/stdlib/LinearAlgebra/test/dense.jl index 2dec8e95402d7f..2274a7a1f83bfc 100644 --- a/stdlib/LinearAlgebra/test/dense.jl +++ b/stdlib/LinearAlgebra/test/dense.jl @@ -215,7 +215,7 @@ end nnorm = 10 mmat = 10 nmat = 8 - @testset "For $elty" for elty in (Float32, Float64, BigFloat, Complex{Float32}, Complex{Float64}, Complex{BigFloat}, Int32, Int64, BigInt) + @testset "For $elty" for elty in (Float32, Float64, BigFloat, ComplexF32, ComplexF64, Complex{BigFloat}, Int32, Int64, BigInt) x = fill(elty(1),10) @testset "Vector" begin xs = view(x,1:2:10) @@ -458,7 +458,7 @@ end 0 -0.000000000000002 3.000000000000000]) end - @testset "Additional tests for $elty" for elty in (Float64, Complex{Float64}) + @testset "Additional tests for $elty" for elty in (Float64, ComplexF64) A4 = convert(Matrix{elty}, [1/2 1/3 1/4 1/5+eps(); 1/3 1/4 1/5 1/6; 1/4 1/5 1/6 1/7; @@ -476,7 +476,7 @@ end end @testset "Integer promotion tests" begin - for (elty1, elty2) in ((Int64, Float64), (Complex{Int64}, Complex{Float64})) + for (elty1, elty2) in ((Int64, Float64), (Complex{Int64}, ComplexF64)) A4int = convert(Matrix{elty1}, [1 2; 3 4]) A4float = convert(Matrix{elty2}, A4int) @test exp(A4int) == exp(A4float) @@ -632,7 +632,7 @@ end end end - @testset "Inverse functions for $elty" for elty in (Complex{Float32}, Complex{Float64}) + @testset "Inverse functions for $elty" for elty in (ComplexF32, ComplexF64) A1 = convert(Matrix{elty}, [ 0.143721-0.0im -0.138386-0.106905im; -0.138386+0.106905im 0.306224-0.0im]) A2 = convert(Matrix{elty}, [1im 2; 0.02+0.5im 3]) @@ -691,12 +691,12 @@ end @test exp(A10) ≈ eA10 end -@testset "Additional matrix logarithm tests" for elty in (Float64, Complex{Float64}) +@testset "Additional matrix logarithm tests" for elty in (Float64, ComplexF64) A11 = convert(Matrix{elty}, [3 2; -5 -3]) @test exp(log(A11)) ≈ A11 A12 = convert(Matrix{elty}, [1 -1; 1 -1]) - @test typeof(log(A12)) == Array{Complex{Float64}, 2} + @test typeof(log(A12)) == Array{ComplexF64, 2} A13 = convert(Matrix{elty}, [2 0; 0 2]) @test typeof(log(A13)) == Array{elty, 2} @@ -754,7 +754,7 @@ end @test diag(zeros(0,1),2) == [] end -@testset "Matrix to real power" for elty in (Float64, Complex{Float64}) +@testset "Matrix to real power" for elty in (Float64, ComplexF64) # Tests proposed at Higham, Deadman: Testing Matrix Function Algorithms Using Identities, March 2014 #Aa : only positive real eigenvalues Aa = convert(Matrix{elty}, [5 4 2 1; 0 1 -1 -1; -1 -1 3 0; 1 1 -1 2]) diff --git a/stdlib/LinearAlgebra/test/diagonal.jl b/stdlib/LinearAlgebra/test/diagonal.jl index dd109cbb74890e..913c8e3f83a801 100644 --- a/stdlib/LinearAlgebra/test/diagonal.jl +++ b/stdlib/LinearAlgebra/test/diagonal.jl @@ -466,7 +466,7 @@ end @test all(Diagonal(range(1, stop=3, length=3)) .== Diagonal([1.0,2.0,3.0])) # Issue 12803 -for t in (Float32, Float64, Int, Complex{Float64}, Rational{Int}) +for t in (Float32, Float64, Int, ComplexF64, Rational{Int}) @test Diagonal(Matrix{t}[fill(t(1), 2, 2), fill(t(1), 3, 3)])[2,1] == zeros(t, 3, 2) end @@ -600,7 +600,7 @@ end end @testset "multiplication of transposes of Diagonal (#22428)" begin - for T in (Float64, Complex{Float64}) + for T in (Float64, ComplexF64) D = Diagonal(randn(T, 5, 5)) B = Diagonal(randn(T, 5, 5)) DD = Diagonal([randn(T, 2, 2), rand(T, 2, 2)]) diff --git a/stdlib/LinearAlgebra/test/generic.jl b/stdlib/LinearAlgebra/test/generic.jl index 9ca508d9a9908b..2c2c9cc1a59a4a 100644 --- a/stdlib/LinearAlgebra/test/generic.jl +++ b/stdlib/LinearAlgebra/test/generic.jl @@ -17,7 +17,7 @@ Random.seed!(123) n = 5 # should be odd -@testset for elty in (Int, Rational{BigInt}, Float32, Float64, BigFloat, Complex{Float32}, Complex{Float64}, Complex{BigFloat}) +@testset for elty in (Int, Rational{BigInt}, Float32, Float64, BigFloat, ComplexF32, ComplexF64, Complex{BigFloat}) # In the long run, these tests should step through Strang's # axiomatic definition of determinants. # If all axioms are satisfied and all the composition rules work, @@ -152,11 +152,11 @@ end @testset "scale real matrix by complex type" begin @test_throws InexactError rmul!([1.0], 2.0im) - @test isequal([1.0] * 2.0im, Complex{Float64}[2.0im]) - @test isequal(2.0im * [1.0], Complex{Float64}[2.0im]) - @test isequal(Float32[1.0] * 2.0f0im, Complex{Float32}[2.0im]) - @test isequal(Float32[1.0] * 2.0im, Complex{Float64}[2.0im]) - @test isequal(Float64[1.0] * 2.0f0im, Complex{Float64}[2.0im]) + @test isequal([1.0] * 2.0im, ComplexF64[2.0im]) + @test isequal(2.0im * [1.0], ComplexF64[2.0im]) + @test isequal(Float32[1.0] * 2.0f0im, ComplexF32[2.0im]) + @test isequal(Float32[1.0] * 2.0im, ComplexF64[2.0im]) + @test isequal(Float64[1.0] * 2.0f0im, ComplexF64[2.0im]) @test isequal(Float32[1.0] * big(2.0)im, Complex{BigFloat}[2.0im]) @test isequal(Float64[1.0] * big(2.0)im, Complex{BigFloat}[2.0im]) @test isequal(BigFloat[1.0] * 2.0im, Complex{BigFloat}[2.0im]) @@ -454,7 +454,7 @@ end end @testset "generalized dot #32739" begin - for elty in (Int, Float32, Float64, BigFloat, Complex{Float32}, Complex{Float64}, Complex{BigFloat}) + for elty in (Int, Float32, Float64, BigFloat, ComplexF32, ComplexF64, Complex{BigFloat}) n = 10 if elty <: Int A = rand(-n:n, n, n) diff --git a/stdlib/LinearAlgebra/test/lapack.jl b/stdlib/LinearAlgebra/test/lapack.jl index 8f7ffff22d95e0..207d95de17d158 100644 --- a/stdlib/LinearAlgebra/test/lapack.jl +++ b/stdlib/LinearAlgebra/test/lapack.jl @@ -668,7 +668,7 @@ end @testset "Julia vs LAPACK" begin # Test our own linear algebra functionality against LAPACK - @testset for elty in (Float32, Float64, Complex{Float32}, Complex{Float64}) + @testset for elty in (Float32, Float64, ComplexF32, ComplexF64) for nn in (5,10,15) if elty <: Real A = convert(Matrix{elty}, randn(10,nn)) diff --git a/stdlib/LinearAlgebra/test/lu.jl b/stdlib/LinearAlgebra/test/lu.jl index 722a69aae6ea72..1f5f2892947dca 100644 --- a/stdlib/LinearAlgebra/test/lu.jl +++ b/stdlib/LinearAlgebra/test/lu.jl @@ -284,15 +284,15 @@ end show(bf, "text/plain", lu(Matrix(I, 4, 4))) seekstart(bf) @test String(take!(bf)) == """ -LinearAlgebra.LU{Float64,Array{Float64,2}} +LinearAlgebra.LU{Float64,Matrix{Float64}} L factor: -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 U factor: -4×4 Array{Float64,2}: +4×4 Matrix{Float64}: 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 diff --git a/stdlib/LinearAlgebra/test/special.jl b/stdlib/LinearAlgebra/test/special.jl index 36e4790fc2d542..c23371f3d072e0 100644 --- a/stdlib/LinearAlgebra/test/special.jl +++ b/stdlib/LinearAlgebra/test/special.jl @@ -159,7 +159,7 @@ end @testset "+ and - among structured matrices with different container types" begin diag = 1:5 offdiag = 1:4 - uniformscalingmats = [UniformScaling(3), UniformScaling(1.0), UniformScaling(3//5), UniformScaling(Complex{Float64}(1.3, 3.5))] + uniformscalingmats = [UniformScaling(3), UniformScaling(1.0), UniformScaling(3//5), UniformScaling(ComplexF64(1.3, 3.5))] mats = [Diagonal(diag), Bidiagonal(diag, offdiag, 'U'), Bidiagonal(diag, offdiag, 'L'), Tridiagonal(offdiag, diag, offdiag), SymTridiagonal(diag, offdiag)] for T in [ComplexF64, Int64, Rational{Int64}, Float64] push!(mats, Diagonal(Vector{T}(diag))) diff --git a/stdlib/LinearAlgebra/test/triangular.jl b/stdlib/LinearAlgebra/test/triangular.jl index cee96ba9f7266d..178ea445bc228c 100644 --- a/stdlib/LinearAlgebra/test/triangular.jl +++ b/stdlib/LinearAlgebra/test/triangular.jl @@ -606,13 +606,13 @@ end end @testset "special printing of Lower/UpperTriangular" begin - @test occursin(r"3×3 (LinearAlgebra\.)?LowerTriangular{Int64,Array{Int64,2}}:\n 2 ⋅ ⋅\n 2 2 ⋅\n 2 2 2", + @test occursin(r"3×3 (LinearAlgebra\.)?LowerTriangular{Int64,Matrix{Int64}}:\n 2 ⋅ ⋅\n 2 2 ⋅\n 2 2 2", sprint(show, MIME"text/plain"(), LowerTriangular(2ones(Int64,3,3)))) - @test occursin(r"3×3 (LinearAlgebra\.)?UnitLowerTriangular{Int64,Array{Int64,2}}:\n 1 ⋅ ⋅\n 2 1 ⋅\n 2 2 1", + @test occursin(r"3×3 (LinearAlgebra\.)?UnitLowerTriangular{Int64,Matrix{Int64}}:\n 1 ⋅ ⋅\n 2 1 ⋅\n 2 2 1", sprint(show, MIME"text/plain"(), UnitLowerTriangular(2ones(Int64,3,3)))) - @test occursin(r"3×3 (LinearAlgebra\.)?UpperTriangular{Int64,Array{Int64,2}}:\n 2 2 2\n ⋅ 2 2\n ⋅ ⋅ 2", + @test occursin(r"3×3 (LinearAlgebra\.)?UpperTriangular{Int64,Matrix{Int64}}:\n 2 2 2\n ⋅ 2 2\n ⋅ ⋅ 2", sprint(show, MIME"text/plain"(), UpperTriangular(2ones(Int64,3,3)))) - @test occursin(r"3×3 (LinearAlgebra\.)?UnitUpperTriangular{Int64,Array{Int64,2}}:\n 1 2 2\n ⋅ 1 2\n ⋅ ⋅ 1", + @test occursin(r"3×3 (LinearAlgebra\.)?UnitUpperTriangular{Int64,Matrix{Int64}}:\n 1 2 2\n ⋅ 1 2\n ⋅ ⋅ 1", sprint(show, MIME"text/plain"(), UnitUpperTriangular(2ones(Int64,3,3)))) end diff --git a/stdlib/LinearAlgebra/test/uniformscaling.jl b/stdlib/LinearAlgebra/test/uniformscaling.jl index 5e4aa22620225f..5c2fb17bc012f0 100644 --- a/stdlib/LinearAlgebra/test/uniformscaling.jl +++ b/stdlib/LinearAlgebra/test/uniformscaling.jl @@ -101,7 +101,7 @@ end @test conj(UniformScaling(1))::UniformScaling{Int} == UniformScaling(1) @test conj(UniformScaling(1.0))::UniformScaling{Float64} == UniformScaling(1.0) @test conj(UniformScaling(1+1im))::UniformScaling{Complex{Int}} == UniformScaling(1-1im) - @test conj(UniformScaling(1.0+1.0im))::UniformScaling{Complex{Float64}} == UniformScaling(1.0-1.0im) + @test conj(UniformScaling(1.0+1.0im))::UniformScaling{ComplexF64} == UniformScaling(1.0-1.0im) end @testset "isdiag, istriu, istril, issymmetric, ishermitian, isposdef, isapprox" begin @@ -167,9 +167,9 @@ end end @test copy(UniformScaling(one(Float64))) == UniformScaling(one(Float64)) -@test sprint(show,MIME"text/plain"(),UniformScaling(one(ComplexF64))) == "LinearAlgebra.UniformScaling{Complex{Float64}}\n(1.0 + 0.0im)*I" +@test sprint(show,MIME"text/plain"(),UniformScaling(one(ComplexF64))) == "LinearAlgebra.UniformScaling{ComplexF64}\n(1.0 + 0.0im)*I" @test sprint(show,MIME"text/plain"(),UniformScaling(one(Float32))) == "LinearAlgebra.UniformScaling{Float32}\n1.0*I" -@test sprint(show,UniformScaling(one(ComplexF64))) == "LinearAlgebra.UniformScaling{Complex{Float64}}(1.0 + 0.0im)" +@test sprint(show,UniformScaling(one(ComplexF64))) == "LinearAlgebra.UniformScaling{ComplexF64}(1.0 + 0.0im)" @test sprint(show,UniformScaling(one(Float32))) == "LinearAlgebra.UniformScaling{Float32}(1.0f0)" let diff --git a/stdlib/Logging/docs/src/index.md b/stdlib/Logging/docs/src/index.md index 4d6512d367c5d5..e1d60223615ef9 100644 --- a/stdlib/Logging/docs/src/index.md +++ b/stdlib/Logging/docs/src/index.md @@ -38,7 +38,7 @@ v = ones(100) # output ┌ Info: Some variables │ A = -│ 4×4 Array{Int64,2}: +│ 4×4 Matrix{Int64}: │ 1 1 1 1 │ 1 1 1 1 │ 1 1 1 1 diff --git a/stdlib/Logging/test/runtests.jl b/stdlib/Logging/test/runtests.jl index fb4f6d6197b352..373038844fb17e 100644 --- a/stdlib/Logging/test/runtests.jl +++ b/stdlib/Logging/test/runtests.jl @@ -209,7 +209,7 @@ end replace(""" ┌ PREFIX msg │ a = - │ 100×100 Array{Float64,2}: + │ 100×100 Matrix{Float64}: │ 1.00001 1.00001 1.00001 1.00001 … 1.00001 1.00001 1.00001 │ 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 │ 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 @@ -217,7 +217,7 @@ end │ 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 │ 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 │ b = - │ 10×10 Array{Float64,2}: + │ 10×10 Matrix{Float64}: │ 2.00002 2.00002 2.00002 2.00002 … 2.00002 2.00002 2.00002 │ 2.00002 2.00002 2.00002 2.00002 2.00002 2.00002 2.00002 │ 2.00002 2.00002 2.00002 2.00002 2.00002 2.00002 2.00002 @@ -231,7 +231,7 @@ end """ ┌ PREFIX msg │ a = - │ 10×10 Array{Float64,2}: + │ 10×10 Matrix{Float64}: │ 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 │ 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 │ 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 1.00001 diff --git a/stdlib/Random/docs/src/index.md b/stdlib/Random/docs/src/index.md index 06fbfb0ea98809..1e84db45dcb325 100644 --- a/stdlib/Random/docs/src/index.md +++ b/stdlib/Random/docs/src/index.md @@ -151,13 +151,13 @@ julia> rand(MersenneTwister(0), Die) Die(16) julia> rand(Die, 3) -3-element Array{Die,1}: +3-element Vector{Die}: Die(5) Die(20) Die(9) julia> a = Vector{Die}(undef, 3); rand!(a) -3-element Array{Die,1}: +3-element Vector{Die}: Die(11) Die(20) Die(10) @@ -176,7 +176,7 @@ julia> rand(Die(4)) 2 julia> rand(Die(4), 3) -3-element Array{Any,1}: +3-element Vector{Any}: 1 4 2 diff --git a/stdlib/Random/src/RNGs.jl b/stdlib/Random/src/RNGs.jl index 3ac2c3394a51c8..281acad533dad9 100644 --- a/stdlib/Random/src/RNGs.jl +++ b/stdlib/Random/src/RNGs.jl @@ -121,14 +121,14 @@ See the [`seed!`](@ref) function for reseeding an already existing julia> rng = MersenneTwister(1234); julia> x1 = rand(rng, 2) -2-element Array{Float64,1}: +2-element Vector{Float64}: 0.5908446386657102 0.7667970365022592 julia> rng = MersenneTwister(1234); julia> x2 = rand(rng, 2) -2-element Array{Float64,1}: +2-element Vector{Float64}: 0.5908446386657102 0.7667970365022592 diff --git a/stdlib/Random/src/Random.jl b/stdlib/Random/src/Random.jl index 707e90d67c08a9..ab0561276fdfce 100644 --- a/stdlib/Random/src/Random.jl +++ b/stdlib/Random/src/Random.jl @@ -365,7 +365,7 @@ but without allocating a new array. julia> rng = MersenneTwister(1234); julia> rand!(rng, zeros(5)) -5-element Array{Float64,1}: +5-element Vector{Float64}: 0.5908446386657102 0.7667970365022592 0.5662374165061859 diff --git a/stdlib/Random/src/misc.jl b/stdlib/Random/src/misc.jl index dffaab89de3b23..465ba27b393322 100644 --- a/stdlib/Random/src/misc.jl +++ b/stdlib/Random/src/misc.jl @@ -20,7 +20,7 @@ Generate a `BitArray` of random boolean values. julia> rng = MersenneTwister(1234); julia> bitrand(rng, 10) -10-element BitArray{1}: +10-element BitVector: 0 1 1 @@ -133,12 +133,12 @@ julia> rng = MersenneTwister(1234); julia> S = Int64[]; julia> randsubseq!(rng, S, 1:8, 0.3) -2-element Array{Int64,1}: +2-element Vector{Int64}: 7 8 julia> S -2-element Array{Int64,1}: +2-element Vector{Int64}: 7 8 ``` @@ -161,7 +161,7 @@ large.) Technically, this process is known as "Bernoulli sampling" of `A`. julia> rng = MersenneTwister(1234); julia> randsubseq(rng, 1:8, 0.3) -2-element Array{Int64,1}: +2-element Vector{Int64}: 7 8 ``` @@ -187,7 +187,7 @@ optionally supplying the random-number generator `rng`. julia> rng = MersenneTwister(1234); julia> shuffle!(rng, Vector(1:16)) -16-element Array{Int64,1}: +16-element Vector{Int64}: 2 15 5 @@ -235,7 +235,7 @@ indices, see [`randperm`](@ref). julia> rng = MersenneTwister(1234); julia> shuffle(rng, Vector(1:10)) -10-element Array{Int64,1}: +10-element Vector{Int64}: 6 1 10 @@ -272,7 +272,7 @@ To randomly permute an arbitrary vector, see [`shuffle`](@ref) or # Examples ```jldoctest julia> randperm(MersenneTwister(1234), 4) -4-element Array{Int64,1}: +4-element Vector{Int64}: 2 1 4 @@ -293,7 +293,7 @@ optional `rng` argument specifies a random number generator (see # Examples ```jldoctest julia> randperm!(MersenneTwister(1234), Vector{Int}(undef, 4)) -4-element Array{Int64,1}: +4-element Vector{Int64}: 2 1 4 @@ -336,7 +336,7 @@ The element type of the result is the same as the type of `n`. # Examples ```jldoctest julia> randcycle(MersenneTwister(1234), 6) -6-element Array{Int64,1}: +6-element Vector{Int64}: 3 5 4 @@ -358,7 +358,7 @@ The optional `rng` argument specifies a random number generator, see # Examples ```jldoctest julia> randcycle!(MersenneTwister(1234), Vector{Int}(undef, 6)) -6-element Array{Int64,1}: +6-element Vector{Int64}: 3 5 4 diff --git a/stdlib/Random/src/normal.jl b/stdlib/Random/src/normal.jl index a3eb77fc5b69d9..dc5ac5101e39d3 100644 --- a/stdlib/Random/src/normal.jl +++ b/stdlib/Random/src/normal.jl @@ -30,7 +30,7 @@ julia> randn(rng, ComplexF64) 0.6133070881429037 - 0.6376291670853887im julia> randn(rng, ComplexF32, (2, 3)) -2×3 Array{Complex{Float32},2}: +2×3 Matrix{ComplexF32}: -0.349649-0.638457im 0.376756-0.192146im -0.396334-0.0136413im 0.611224+1.56403im 0.355204-0.365563im 0.0905552+1.31012im ``` @@ -91,7 +91,7 @@ julia> randexp(rng, Float32) 2.4835055f0 julia> randexp(rng, 3, 3) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.5167 1.30652 0.344435 0.604436 2.78029 0.418516 0.695867 0.693292 0.643644 @@ -133,7 +133,7 @@ Also see the [`rand`](@ref) function. julia> rng = MersenneTwister(1234); julia> randn!(rng, zeros(5)) -5-element Array{Float64,1}: +5-element Vector{Float64}: 0.8673472019512456 -0.9017438158568171 -0.4944787535042339 @@ -154,7 +154,7 @@ Fill the array `A` with random numbers following the exponential distribution julia> rng = MersenneTwister(1234); julia> randexp!(rng, zeros(5)) -5-element Array{Float64,1}: +5-element Vector{Float64}: 2.4835053723904896 1.516703605376473 0.6044364871025417 diff --git a/stdlib/SharedArrays/test/runtests.jl b/stdlib/SharedArrays/test/runtests.jl index 481f36b81516f0..58a4e9d2a672f1 100644 --- a/stdlib/SharedArrays/test/runtests.jl +++ b/stdlib/SharedArrays/test/runtests.jl @@ -306,7 +306,7 @@ end let S = SharedArray(Int64[]) # Issue #26582 @test sprint(show, S) == "Int64[]" - @test sprint(show, "text/plain", S, context = :module=>@__MODULE__) == "0-element SharedArray{Int64,1}:\n" + @test sprint(show, "text/plain", S, context = :module=>@__MODULE__) == "0-element SharedVector{Int64}:\n" end #28133 diff --git a/stdlib/SparseArrays/docs/src/index.md b/stdlib/SparseArrays/docs/src/index.md index 5984720a6bca20..28b1a0638fcb1d 100644 --- a/stdlib/SparseArrays/docs/src/index.md +++ b/stdlib/SparseArrays/docs/src/index.md @@ -127,7 +127,7 @@ julia> findnz(S) ([1, 4, 5, 3], [4, 7, 9, 18], [1, 2, 3, -5]) julia> findall(!iszero, S) -4-element Array{CartesianIndex{2},1}: +4-element Vector{CartesianIndex{2}}: CartesianIndex(1, 4) CartesianIndex(4, 7) CartesianIndex(5, 9) @@ -137,7 +137,7 @@ julia> findnz(R) ([1, 3, 4, 5], [1, -5, 2, 3]) julia> findall(!iszero, R) -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 3 4 diff --git a/stdlib/SparseArrays/src/sparsematrix.jl b/stdlib/SparseArrays/src/sparsematrix.jl index 78ad80101dd8e9..450d65f553f3f4 100644 --- a/stdlib/SparseArrays/src/sparsematrix.jl +++ b/stdlib/SparseArrays/src/sparsematrix.jl @@ -137,7 +137,7 @@ julia> A = sparse(2I, 3, 3) ⋅ ⋅ 2 julia> nonzeros(A) -3-element Array{Int64,1}: +3-element Vector{Int64}: 2 2 2 @@ -165,7 +165,7 @@ julia> A = sparse(2I, 3, 3) ⋅ ⋅ 2 julia> rowvals(A) -3-element Array{Int64,1}: +3-element Vector{Int64}: 1 2 3 @@ -665,7 +665,7 @@ Convert an AbstractMatrix `A` into a sparse matrix. # Examples ```jldoctest julia> A = Matrix(1.0I, 3, 3) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 diff --git a/stdlib/SparseArrays/test/sparsevector.jl b/stdlib/SparseArrays/test/sparsevector.jl index b69db8fdb1e2c7..5458e0ecc1c337 100644 --- a/stdlib/SparseArrays/test/sparsevector.jl +++ b/stdlib/SparseArrays/test/sparsevector.jl @@ -1039,11 +1039,11 @@ end denseintmat = I*10m + rand(1:m, m, m) densefloatmat = I + randn(m, m)/(2m) - densecomplexmat = I + randn(Complex{Float64}, m, m)/(4m) + densecomplexmat = I + randn(ComplexF64, m, m)/(4m) inttypes = (Int32, Int64, BigInt) floattypes = (Float32, Float64, BigFloat) - complextypes = (Complex{Float32}, Complex{Float64}) + complextypes = (ComplexF32, ComplexF64) eltypes = (inttypes..., floattypes..., complextypes...) for eltypemat in eltypes diff --git a/stdlib/SuiteSparse/src/cholmod.jl b/stdlib/SuiteSparse/src/cholmod.jl index fc7419e3e3296f..457cef2529100b 100644 --- a/stdlib/SuiteSparse/src/cholmod.jl +++ b/stdlib/SuiteSparse/src/cholmod.jl @@ -289,7 +289,7 @@ function Sparse(p::Ptr{C_Sparse{Cvoid}}) "unknown reasons. Please submit a bug report.")) end s = unsafe_load(p) - Tv = s.xtype == REAL ? Float64 : Complex{Float64} + Tv = s.xtype == REAL ? Float64 : ComplexF64 Sparse(convert(Ptr{C_Sparse{Tv}}, p)) end @@ -1060,12 +1060,12 @@ function sparse(A::Sparse{Float64}) # Notice! Cannot be type stable because of s end return Symmetric{Float64,SparseMatrixCSC{Float64,SuiteSparse_long}}(A) end -function sparse(A::Sparse{Complex{Float64}}) # Notice! Cannot be type stable because of stype +function sparse(A::Sparse{ComplexF64}) # Notice! Cannot be type stable because of stype s = unsafe_load(pointer(A)) if s.stype == 0 - return SparseMatrixCSC{Complex{Float64},SuiteSparse_long}(A) + return SparseMatrixCSC{ComplexF64,SuiteSparse_long}(A) end - return Hermitian{Complex{Float64},SparseMatrixCSC{Complex{Float64},SuiteSparse_long}}(A) + return Hermitian{ComplexF64,SparseMatrixCSC{ComplexF64,SuiteSparse_long}}(A) end function sparse(F::Factor) s = unsafe_load(pointer(F)) @@ -1383,7 +1383,7 @@ If `perm` is set to `1:3` to enforce no permutation, the number of nonzero elements in the factor is 6. ```jldoctest julia> A = [2 1 1; 1 2 0; 1 0 2] -3×3 Array{Int64,2}: +3×3 Matrix{Int64}: 2 1 1 1 2 0 1 0 2 @@ -1397,7 +1397,7 @@ nnz: 5 success: true julia> C.p -3-element Array{Int64,1}: +3-element Vector{Int64}: 3 2 1 @@ -1405,7 +1405,7 @@ julia> C.p julia> L = sparse(C.L); julia> Matrix(L) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.41421 0.0 0.0 0.0 1.41421 0.0 0.707107 0.707107 1.0 @@ -1433,7 +1433,7 @@ success: true julia> L = sparse(C.L); julia> Matrix(L) -3×3 Array{Float64,2}: +3×3 Matrix{Float64}: 1.41421 0.0 0.0 0.707107 1.22474 0.0 0.707107 -0.408248 1.1547 @@ -1732,7 +1732,7 @@ end const RealHermSymComplexHermF64SSL = Union{ Symmetric{Float64,SparseMatrixCSC{Float64,SuiteSparse_long}}, Hermitian{Float64,SparseMatrixCSC{Float64,SuiteSparse_long}}, - Hermitian{Complex{Float64},SparseMatrixCSC{Complex{Float64},SuiteSparse_long}}} + Hermitian{ComplexF64,SparseMatrixCSC{ComplexF64,SuiteSparse_long}}} const StridedVecOrMatInclAdjAndTrans = Union{StridedVecOrMat, Adjoint{<:Any, <:StridedVecOrMat}, Transpose{<:Any, <:StridedVecOrMat}} function \(A::RealHermSymComplexHermF64SSL, B::StridedVecOrMatInclAdjAndTrans) F = cholesky(A; check = false) @@ -1840,7 +1840,7 @@ function ishermitian(A::Sparse{Float64}) return i == MM_SYMMETRIC || i == MM_SYMMETRIC_POSDIAG end end -function ishermitian(A::Sparse{Complex{Float64}}) +function ishermitian(A::Sparse{ComplexF64}) s = unsafe_load(pointer(A)) if s.stype != 0 return true @@ -1856,15 +1856,15 @@ end (*)(A::Symmetric{Float64,SparseMatrixCSC{Float64,Ti}}, B::SparseVecOrMat{Float64,Ti}) where {Ti} = sparse(Sparse(A)*Sparse(B)) -(*)(A::Hermitian{Complex{Float64},SparseMatrixCSC{Complex{Float64},Ti}}, - B::SparseVecOrMat{Complex{Float64},Ti}) where {Ti} = sparse(Sparse(A)*Sparse(B)) +(*)(A::Hermitian{ComplexF64,SparseMatrixCSC{ComplexF64,Ti}}, + B::SparseVecOrMat{ComplexF64,Ti}) where {Ti} = sparse(Sparse(A)*Sparse(B)) (*)(A::Hermitian{Float64,SparseMatrixCSC{Float64,Ti}}, B::SparseVecOrMat{Float64,Ti}) where {Ti} = sparse(Sparse(A)*Sparse(B)) (*)(A::SparseVecOrMat{Float64,Ti}, B::Symmetric{Float64,SparseMatrixCSC{Float64,Ti}}) where {Ti} = sparse(Sparse(A)*Sparse(B)) -(*)(A::SparseVecOrMat{Complex{Float64},Ti}, - B::Hermitian{Complex{Float64},SparseMatrixCSC{Complex{Float64},Ti}}) where {Ti} = sparse(Sparse(A)*Sparse(B)) +(*)(A::SparseVecOrMat{ComplexF64,Ti}, + B::Hermitian{ComplexF64,SparseMatrixCSC{ComplexF64,Ti}}) where {Ti} = sparse(Sparse(A)*Sparse(B)) (*)(A::SparseVecOrMat{Float64,Ti}, B::Hermitian{Float64,SparseMatrixCSC{Float64,Ti}}) where {Ti} = sparse(Sparse(A)*Sparse(B)) diff --git a/stdlib/SuiteSparse/src/spqr.jl b/stdlib/SuiteSparse/src/spqr.jl index bdfe3fb3795eff..a7de8fd104faa5 100644 --- a/stdlib/SuiteSparse/src/spqr.jl +++ b/stdlib/SuiteSparse/src/spqr.jl @@ -183,13 +183,13 @@ R factor: -1.41421 ⋅ ⋅ -1.41421 Row permutation: -4-element Array{Int64,1}: +4-element Vector{Int64}: 1 3 4 2 Column permutation: -2-element Array{Int64,1}: +2-element Vector{Int64}: 1 2 ``` @@ -316,14 +316,14 @@ julia> F.R ⋅ ⋅ ⋅ 1.0 julia> F.prow -4-element Array{Int64,1}: +4-element Vector{Int64}: 2 3 4 1 julia> F.pcol -4-element Array{Int64,1}: +4-element Vector{Int64}: 2 3 4 @@ -448,7 +448,7 @@ julia> A = sparse([1,2,4], [1,1,1], [1.0,1.0,1.0], 4, 2) 1.0 ⋅ julia> qr(A)\\fill(1.0, 4) -2-element Array{Float64,1}: +2-element Vector{Float64}: 1.0 0.0 ``` diff --git a/stdlib/SuiteSparse/src/umfpack.jl b/stdlib/SuiteSparse/src/umfpack.jl index 3cdbee54cea64f..0f8a0bf06118c8 100644 --- a/stdlib/SuiteSparse/src/umfpack.jl +++ b/stdlib/SuiteSparse/src/umfpack.jl @@ -208,7 +208,7 @@ julia> B = sparse(Float64[1.0 1.0; 0.0 1.0]); julia> lu!(F, B); julia> F \\ ones(2) -2-element Array{Float64,1}: +2-element Vector{Float64}: 0.0 1.0 ``` diff --git a/stdlib/SuiteSparse/test/cholmod.jl b/stdlib/SuiteSparse/test/cholmod.jl index 419efc70f303cb..4ca98cabf2b3e6 100644 --- a/stdlib/SuiteSparse/test/cholmod.jl +++ b/stdlib/SuiteSparse/test/cholmod.jl @@ -278,7 +278,7 @@ end # Test Dense wrappers (only Float64 supported a present) -@testset "High level interface" for elty in (Float64, Complex{Float64}) +@testset "High level interface" for elty in (Float64, ComplexF64) local A, b if elty == Float64 A = randn(5, 5) @@ -325,7 +325,7 @@ end @test CHOLMOD.free!(p) end -@testset "Core functionality" for elty in (Float64, Complex{Float64}) +@testset "Core functionality" for elty in (Float64, ComplexF64) A1 = sparse([1:5; 1], [1:5; 2], elty == Float64 ? randn(6) : complex.(randn(6), randn(6))) A2 = sparse([1:5; 1], [1:5; 2], elty == Float64 ? randn(6) : complex.(randn(6), randn(6))) A1pd = A1'A1 @@ -352,7 +352,7 @@ end if elty <: Real @test_throws ArgumentError convert(Symmetric{Float64,SparseMatrixCSC{Float64,Int}}, A1Sparse) else - @test_throws ArgumentError convert(Hermitian{Complex{Float64},SparseMatrixCSC{Complex{Float64},Int}}, A1Sparse) + @test_throws ArgumentError convert(Hermitian{ComplexF64,SparseMatrixCSC{ComplexF64,Int}}, A1Sparse) end @test copy(A1Sparse) == A1Sparse @test size(A1Sparse, 3) == 1 diff --git a/stdlib/SuiteSparse/test/spqr.jl b/stdlib/SuiteSparse/test/spqr.jl index 107e510f7b3a40..d008bd58201b41 100644 --- a/stdlib/SuiteSparse/test/spqr.jl +++ b/stdlib/SuiteSparse/test/spqr.jl @@ -10,7 +10,7 @@ nn = 100 @test size(qr(sprandn(m, n, 0.1)).Q) == (m, m) -@testset "element type of A: $eltyA" for eltyA in (Float64, Complex{Float64}) +@testset "element type of A: $eltyA" for eltyA in (Float64, ComplexF64) if eltyA <: Real A = sparse([1:n; rand(1:m, nn - n)], [1:n; rand(1:n, nn - n)], randn(nn), m, n) else @@ -49,7 +49,7 @@ nn = 100 @test_throws DimensionMismatch rmul!(offsizeA, adjoint(Q)) end - @testset "element type of B: $eltyB" for eltyB in (Int, Float64, Complex{Float64}) + @testset "element type of B: $eltyB" for eltyB in (Int, Float64, ComplexF64) if eltyB == Int B = rand(1:10, m, 2) elseif eltyB <: Real diff --git a/stdlib/SuiteSparse/test/umfpack.jl b/stdlib/SuiteSparse/test/umfpack.jl index 5f479cb2559ade..dc17d71a727e02 100644 --- a/stdlib/SuiteSparse/test/umfpack.jl +++ b/stdlib/SuiteSparse/test/umfpack.jl @@ -162,7 +162,7 @@ using LinearAlgebra: Adjoint, Transpose, SingularException N = 10 p = 0.5 A = N*I + sprand(N, N, p) - X = zeros(Complex{Float64}, N, N) + X = zeros(ComplexF64, N, N) B = complex.(rand(N, N), rand(N, N)) luA, lufA = lu(A), lu(Array(A)) @test LinearAlgebra.ldiv!(copy(X), luA, B) ≈ LinearAlgebra.ldiv!(copy(X), lufA, B) diff --git a/test/arrayops.jl b/test/arrayops.jl index 1c176f01b9887f..53f5822bf18b93 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -2797,27 +2797,27 @@ end b = IOBuffer() showerror(b, err) @test String(take!(b)) == - "BoundsError: attempt to access 2×2 Array{Float64,2} at index [10, 1:2]" + "BoundsError: attempt to access 2×2 Matrix{Float64} at index [10, 1:2]" err = try x[10, trues(2)]; catch err; err; end b = IOBuffer() showerror(b, err) @test String(take!(b)) == - "BoundsError: attempt to access 2×2 Array{Float64,2} at index [10, Bool[1, 1]]" + "BoundsError: attempt to access 2×2 Matrix{Float64} at index [10, Bool[1, 1]]" # Also test : directly for custom types for which it may appear as-is err = BoundsError(x, (10, :)) showerror(b, err) @test String(take!(b)) == - "BoundsError: attempt to access 2×2 Array{Float64,2} at index [10, :]" + "BoundsError: attempt to access 2×2 Matrix{Float64} at index [10, :]" err = BoundsError(x, "bad index") showerror(b, err) @test String(take!(b)) == - "BoundsError: attempt to access 2×2 Array{Float64,2} at index [\"bad index\"]" + "BoundsError: attempt to access 2×2 Matrix{Float64} at index [\"bad index\"]" err = BoundsError(x, (10, "bad index")) showerror(b, err) @test String(take!(b)) == - "BoundsError: attempt to access 2×2 Array{Float64,2} at index [10, \"bad index\"]" + "BoundsError: attempt to access 2×2 Matrix{Float64} at index [10, \"bad index\"]" end diff --git a/test/complex.jl b/test/complex.jl index 0f419539a70272..537504c4a249a2 100644 --- a/test/complex.jl +++ b/test/complex.jl @@ -833,9 +833,9 @@ end @test complex.([1.0, 1.0], 1.0) == [complex(1.0, 1.0), complex(1.0, 1.0)] # robust division of Float64 # hard complex divisions from Fig 6 of arxiv.1210.4539 -z7 = Complex{Float64}(3.898125604559113300e289, 8.174961907852353577e295) -z9 = Complex{Float64}(0.001953125, -0.001953125) -z10 = Complex{Float64}( 1.02951151789360578e-84, 6.97145987515076231e-220) +z7 = ComplexF64(3.898125604559113300e289, 8.174961907852353577e295) +z9 = ComplexF64(0.001953125, -0.001953125) +z10 = ComplexF64( 1.02951151789360578e-84, 6.97145987515076231e-220) harddivs = ((1.0+im*1.0, 1.0+im*2^1023.0, 2^-1023.0-im*2^-1023.0), #1 (1.0+im*1.0, 2^-1023.0+im*2^-1023.0, 2^1023.0+im*0.0), #2 (2^1023.0+im*2^-1023.0, 2^677.0+im*2^-677.0, 2^346.0-im*2^-1008.0), #3 @@ -868,8 +868,8 @@ end # division of non-Float64 function cdiv_test(a,b) - c=convert(Complex{Float64},a)/convert(Complex{Float64},b) - 50 <= sb_accuracy(c,convert(Complex{Float64},a/b)) + c=convert(ComplexF64,a)/convert(ComplexF64,b) + 50 <= sb_accuracy(c,convert(ComplexF64,a/b)) end @test cdiv_test(complex(1//2, 3//4), complex(17//13, 4//5)) @test cdiv_test(complex(1,2), complex(8997,2432)) @@ -958,7 +958,7 @@ end @test typeof(Int8(1) - im) == Complex{Int8} # issue #10926 -@test typeof(π - 1im) == Complex{Float64} +@test typeof(π - 1im) == ComplexF64 @testset "issue #15969" begin # specialized muladd for complex types @@ -1012,7 +1012,7 @@ end a = [1.0 + 1e-10im, 2.0e-15 - 2.0e-5im, 1.0e-15 + 2im, 1.0 + 2e-15im] @test sprint((io, x) -> show(io, MIME("text/plain"), x), a) == join([ - "4-element Array{Complex{Float64},1}:", + "4-element Vector{ComplexF64}:", " 1.0 + 1.0e-10im", " 2.0e-15 - 2.0e-5im", " 1.0e-15 + 2.0im", diff --git a/test/core.jl b/test/core.jl index 790ea3cd081653..2367b8b4bedb1d 100644 --- a/test/core.jl +++ b/test/core.jl @@ -234,12 +234,12 @@ end mutable struct A3890{T1} x::Matrix{Complex{T1}} end -@test A3890{Float64}.types[1] === Array{Complex{Float64},2} +@test A3890{Float64}.types[1] === Array{ComplexF64,2} # make sure the field type Matrix{Complex{T1}} isn't cached mutable struct B3890{T2} x::Matrix{Complex{T2}} end -@test B3890{Float64}.types[1] === Array{Complex{Float64},2} +@test B3890{Float64}.types[1] === Array{ComplexF64,2} # issue #786 mutable struct Node{T} @@ -301,7 +301,7 @@ function bar(x::T) where T end @test bar(3.0) == Complex(3.0,0.0) -z = convert(Complex{Float64},2) +z = convert(ComplexF64,2) @test z == Complex(2.0,0.0) function typeassert_instead_of_decl() @@ -2263,7 +2263,7 @@ end @test ttt7049(init="a") == "init=a" # issue #7074 -let z(A::StridedMatrix{T}) where {T<:Union{Float64,Complex{Float64},Float32,Complex{Float32}}} = T, +let z(A::StridedMatrix{T}) where {T<:Union{Float64,ComplexF64,Float32,ComplexF32}} = T, S = zeros(Complex,2,2) @test_throws MethodError z(S) end diff --git a/test/errorshow.jl b/test/errorshow.jl index 1cc7c1d603a10d..16876f1fe5a441 100644 --- a/test/errorshow.jl +++ b/test/errorshow.jl @@ -294,9 +294,9 @@ let undefvar @test err_str == "BoundsError: attempt to access (1, 2, 3) at index [4]" err_str = @except_str [5, 4, 3][-2, 1] BoundsError - @test err_str == "BoundsError: attempt to access 3-element Array{$Int,1} at index [-2, 1]" + @test err_str == "BoundsError: attempt to access 3-element Vector{$Int} at index [-2, 1]" err_str = @except_str [5, 4, 3][1:5] BoundsError - @test err_str == "BoundsError: attempt to access 3-element Array{$Int,1} at index [1:5]" + @test err_str == "BoundsError: attempt to access 3-element Vector{$Int} at index [1:5]" err_str = @except_str Bounded(2)[3] BoundsError @test err_str == "BoundsError: attempt to access 2-size Bounded at index [3]" @@ -370,10 +370,10 @@ let err_str, err_str = @except_str FunctionLike()() MethodError @test occursin("MethodError: no method matching (::$(curmod_prefix)FunctionLike)()", err_str) err_str = @except_str [1,2](1) MethodError - @test occursin("MethodError: objects of type Array{$Int,1} are not callable\nUse square brackets [] for indexing an Array.", err_str) + @test occursin("MethodError: objects of type Vector{$Int} are not callable\nUse square brackets [] for indexing an Array.", err_str) # Issue 14940 err_str = @except_str randn(1)() MethodError - @test occursin("MethodError: objects of type Array{Float64,1} are not callable", err_str) + @test occursin("MethodError: objects of type Vector{Float64} are not callable", err_str) end @test repr("text/plain", FunctionLike()) == "(::$(curmod_prefix)FunctionLike) (generic function with 0 methods)" @test occursin(r"^@doc \(macro with \d+ method[s]?\)$", repr("text/plain", getfield(Base, Symbol("@doc")))) @@ -381,10 +381,10 @@ end # Issue 34636 let err_str err_str = @except_str 1 + rand(5) MethodError - @test occursin("MethodError: no method matching +(::$Int, ::Array{Float64,1})", err_str) + @test occursin("MethodError: no method matching +(::$Int, ::Vector{Float64})", err_str) @test occursin("For element-wise addition, use broadcasting with dot syntax: scalar .+ array", err_str) err_str = @except_str rand(5) - 1//3 MethodError - @test occursin("MethodError: no method matching -(::Array{Float64,1}, ::Rational{$Int})", err_str) + @test occursin("MethodError: no method matching -(::Vector{Float64}, ::Rational{$Int})", err_str) @test occursin("For element-wise subtraction, use broadcasting with dot syntax: array .- scalar", err_str) end diff --git a/test/iobuffer.jl b/test/iobuffer.jl index fa2ca77aef072f..1d781d0a1b8744 100644 --- a/test/iobuffer.jl +++ b/test/iobuffer.jl @@ -44,7 +44,7 @@ bufcontents(io::Base.GenericIOBuffer) = unsafe_string(pointer(io.data), io.size) @test write(io,"boston\ncambridge\n") > 0 @test String(take!(io)) == "boston\ncambridge\n" @test String(take!(io)) == "" - @test write(io, Complex{Float64}(0)) === 16 + @test write(io, ComplexF64(0)) === 16 @test write(io, Rational{Int64}(1//2)) === 16 close(io) @test_throws ArgumentError write(io,UInt8[0]) diff --git a/test/iterators.jl b/test/iterators.jl index 7137e70b5958f0..b9bec84bf9a581 100644 --- a/test/iterators.jl +++ b/test/iterators.jl @@ -645,13 +645,13 @@ end let io = IOBuffer() Base.showarg(io, pairs([1,2,3]), true) - @test String(take!(io)) == "pairs(::Array{$Int,1})" + @test String(take!(io)) == "pairs(::Vector{$Int})" Base.showarg(io, pairs((a=1, b=2)), true) @test String(take!(io)) == "pairs(::NamedTuple)" Base.showarg(io, pairs(IndexLinear(), zeros(3,3)), true) - @test String(take!(io)) == "pairs(IndexLinear(), ::Array{Float64,2})" + @test String(take!(io)) == "pairs(IndexLinear(), ::Matrix{Float64})" Base.showarg(io, pairs(IndexCartesian(), zeros(3)), true) - @test String(take!(io)) == "pairs(IndexCartesian(), ::Array{Float64,1})" + @test String(take!(io)) == "pairs(IndexCartesian(), ::Vector{Float64})" end end diff --git a/test/math.jl b/test/math.jl index d98da02958941c..51306dc2574c87 100644 --- a/test/math.jl +++ b/test/math.jl @@ -466,10 +466,10 @@ end @test cospi(x) ≈ Float64(cospi(big(x))) @test sinc(x) ≈ Float64(sinc(big(x))) @test cosc(x) ≈ Float64(cosc(big(x))) - @test sinpi(complex(x, x)) ≈ Complex{Float64}(sinpi(complex(big(x), big(x)))) - @test cospi(complex(x, x)) ≈ Complex{Float64}(cospi(complex(big(x), big(x)))) - @test sinc(complex(x, x)) ≈ Complex{Float64}(sinc(complex(big(x), big(x)))) - @test cosc(complex(x, x)) ≈ Complex{Float64}(cosc(complex(big(x), big(x)))) + @test sinpi(complex(x, x)) ≈ ComplexF64(sinpi(complex(big(x), big(x)))) + @test cospi(complex(x, x)) ≈ ComplexF64(cospi(complex(big(x), big(x)))) + @test sinc(complex(x, x)) ≈ ComplexF64(sinc(complex(big(x), big(x)))) + @test cosc(complex(x, x)) ≈ ComplexF64(cosc(complex(big(x), big(x)))) end end diff --git a/test/missing.jl b/test/missing.jl index 850482585b2cd8..02df70af26c56e 100644 --- a/test/missing.jl +++ b/test/missing.jl @@ -225,10 +225,10 @@ end @test sprint(show, [1 missing]) == "$(Union{Int, Missing})[1 missing]" b = IOBuffer() display(TextDisplay(b), [missing]) - @test String(take!(b)) == "1-element Array{$Missing,1}:\n missing" + @test String(take!(b)) == "1-element Vector{$Missing}:\n missing" b = IOBuffer() display(TextDisplay(b), [1 missing]) - @test String(take!(b)) == "1×2 Array{$(Union{Int, Missing}),2}:\n 1 missing" + @test String(take!(b)) == "1×2 Matrix{$(Union{Int, Missing})}:\n 1 missing" end @testset "arrays with missing values" begin diff --git a/test/numbers.jl b/test/numbers.jl index 00aaf80957f9c0..5a6d0197397f57 100644 --- a/test/numbers.jl +++ b/test/numbers.jl @@ -460,7 +460,7 @@ end @test sign(-1//0) == -1 @test isa(sign(2//3), Rational{Int}) @test isa(2//3 + 2//3im, Complex{Rational{Int}}) - @test isa(sign(2//3 + 2//3im), Complex{Float64}) + @test isa(sign(2//3 + 2//3im), ComplexF64) @test sign(one(UInt)) == 1 @test sign(zero(UInt)) == 0 @@ -2535,7 +2535,7 @@ Base.literal_pow(::typeof(^), ::PR20530, ::Val{p}) where {p} = 2 @test x^p == 1 @test x^2 == 2 @test [x, x, x].^2 == [2, 2, 2] - for T in (Float16, Float32, Float64, BigFloat, Int8, Int, BigInt, Complex{Int}, Complex{Float64}) + for T in (Float16, Float32, Float64, BigFloat, Int8, Int, BigInt, Complex{Int}, ComplexF64) for p in -4:4 v = eval(:($T(2)^$p)) @test 2.0^p == v diff --git a/test/offsetarray.jl b/test/offsetarray.jl index 7479821be8268d..3d801a238f1c3b 100644 --- a/test/offsetarray.jl +++ b/test/offsetarray.jl @@ -216,8 +216,8 @@ cmp_showf(Base.print_matrix, io, OffsetArray(reshape(range(-0.212121212121, stop cmp_showf(show, io, OffsetArray(collect(1:100), (100,))) # issue #31641 targets1 = ["0-dimensional $OAs_name.OffsetArray{Float64,0,Array{Float64,0}}:\n1.0", - "1-element $OAs_name.OffsetArray{Float64,1,Array{Float64,1}} with indices 2:2:\n 1.0", - "1×1 $OAs_name.OffsetArray{Float64,2,Array{Float64,2}} with indices 2:2×3:3:\n 1.0", + "1-element $OAs_name.OffsetArray{Float64,1,Vector{Float64}} with indices 2:2:\n 1.0", + "1×1 $OAs_name.OffsetArray{Float64,2,Matrix{Float64}} with indices 2:2×3:3:\n 1.0", "1×1×1 $OAs_name.OffsetArray{Float64,3,Array{Float64,3}} with indices 2:2×3:3×4:4:\n[:, :, 4] =\n 1.0", "1×1×1×1 $OAs_name.OffsetArray{Float64,4,Array{Float64,4}} with indices 2:2×3:3×4:4×5:5:\n[:, :, 4, 5] =\n 1.0"] targets2 = ["(fill(1.0), fill(1.0))", diff --git a/test/reflection.jl b/test/reflection.jl index 9e47a3a0b508a5..2ce4840521c00b 100644 --- a/test/reflection.jl +++ b/test/reflection.jl @@ -214,7 +214,7 @@ let ex = :(a + b) end foo13825(::Array{T, N}, ::Array, ::Vector) where {T, N} = nothing @test startswith(string(first(methods(foo13825))), - "foo13825(::Array{T,N}, ::Array, ::Array{T,1} where T)") + "foo13825(::Array{T,N}, ::Array, ::Vector{T} where T)") mutable struct TLayout x::Int8 diff --git a/test/reinterpretarray.jl b/test/reinterpretarray.jl index 0ce0d94f710c62..c7cdbd0f88e7f6 100644 --- a/test/reinterpretarray.jl +++ b/test/reinterpretarray.jl @@ -22,7 +22,7 @@ let Ac = copy(A), Bc = copy(B) @test Bc == Complex{Int64}[1+2im, 3+4im, 5+6im] A1 = reinterpret(Float64, A) - A2 = reinterpret(Complex{Float64}, A) + A2 = reinterpret(ComplexF64, A) A1[1] = 1.0 @test real(A2[1]) == 1.0 end diff --git a/test/show.jl b/test/show.jl index fc186ec5081e5d..f9de1541dc3452 100644 --- a/test/show.jl +++ b/test/show.jl @@ -22,10 +22,10 @@ showstr(x, kv::Pair...) = sprint((io,x) -> show(IOContext(io, :limit => true, :d :y => 2) end -@test replstr(Array{Any}(undef, 2)) == "2-element Array{Any,1}:\n #undef\n #undef" -@test replstr(Array{Any}(undef, 2,2)) == "2×2 Array{Any,2}:\n #undef #undef\n #undef #undef" +@test replstr(Array{Any}(undef, 2)) == "2-element Vector{Any}:\n #undef\n #undef" +@test replstr(Array{Any}(undef, 2,2)) == "2×2 Matrix{Any}:\n #undef #undef\n #undef #undef" @test replstr(Array{Any}(undef, 2,2,2)) == "2×2×2 Array{Any,3}:\n[:, :, 1] =\n #undef #undef\n #undef #undef\n\n[:, :, 2] =\n #undef #undef\n #undef #undef" -@test replstr([1f10]) == "1-element Array{Float32,1}:\n 1.0f10" +@test replstr([1f10]) == "1-element Vector{Float32}:\n 1.0f10" struct T5589 names::Vector{String} @@ -767,31 +767,31 @@ Base.methodloc_callback[] = nothing # calling show. This also indirectly tests print_matrix_row, which # is used repeatedly by print_matrix. # This fits on screen: - @test replstr(Matrix(1.0I, 10, 10)) == "10×10 Array{Float64,2}:\n 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0" + @test replstr(Matrix(1.0I, 10, 10)) == "10×10 Matrix{Float64}:\n 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0\n 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0" # an array too long vertically to fit on screen, and too long horizontally: - @test replstr(Vector(1.:100.)) == "100-element Array{Float64,1}:\n 1.0\n 2.0\n 3.0\n 4.0\n 5.0\n 6.0\n 7.0\n 8.0\n 9.0\n 10.0\n ⋮\n 92.0\n 93.0\n 94.0\n 95.0\n 96.0\n 97.0\n 98.0\n 99.0\n 100.0" - @test occursin(r"1×100 (LinearAlgebra\.)?Adjoint{Float64,Array{Float64,1}}:\n 1.0 2.0 3.0 4.0 5.0 6.0 7.0 … 95.0 96.0 97.0 98.0 99.0 100.0", replstr(Vector(1.:100.)')) + @test replstr(Vector(1.:100.)) == "100-element Vector{Float64}:\n 1.0\n 2.0\n 3.0\n 4.0\n 5.0\n 6.0\n 7.0\n 8.0\n 9.0\n 10.0\n ⋮\n 92.0\n 93.0\n 94.0\n 95.0\n 96.0\n 97.0\n 98.0\n 99.0\n 100.0" + @test occursin(r"1×100 (LinearAlgebra\.)?Adjoint{Float64,Vector{Float64}}:\n 1.0 2.0 3.0 4.0 5.0 6.0 7.0 … 95.0 96.0 97.0 98.0 99.0 100.0", replstr(Vector(1.:100.)')) # too big in both directions to fit on screen: - @test replstr((1.:100.)*(1:100)') == "100×100 Array{Float64,2}:\n 1.0 2.0 3.0 4.0 5.0 6.0 … 97.0 98.0 99.0 100.0\n 2.0 4.0 6.0 8.0 10.0 12.0 194.0 196.0 198.0 200.0\n 3.0 6.0 9.0 12.0 15.0 18.0 291.0 294.0 297.0 300.0\n 4.0 8.0 12.0 16.0 20.0 24.0 388.0 392.0 396.0 400.0\n 5.0 10.0 15.0 20.0 25.0 30.0 485.0 490.0 495.0 500.0\n 6.0 12.0 18.0 24.0 30.0 36.0 … 582.0 588.0 594.0 600.0\n 7.0 14.0 21.0 28.0 35.0 42.0 679.0 686.0 693.0 700.0\n 8.0 16.0 24.0 32.0 40.0 48.0 776.0 784.0 792.0 800.0\n 9.0 18.0 27.0 36.0 45.0 54.0 873.0 882.0 891.0 900.0\n 10.0 20.0 30.0 40.0 50.0 60.0 970.0 980.0 990.0 1000.0\n ⋮ ⋮ ⋱ \n 92.0 184.0 276.0 368.0 460.0 552.0 8924.0 9016.0 9108.0 9200.0\n 93.0 186.0 279.0 372.0 465.0 558.0 9021.0 9114.0 9207.0 9300.0\n 94.0 188.0 282.0 376.0 470.0 564.0 9118.0 9212.0 9306.0 9400.0\n 95.0 190.0 285.0 380.0 475.0 570.0 9215.0 9310.0 9405.0 9500.0\n 96.0 192.0 288.0 384.0 480.0 576.0 … 9312.0 9408.0 9504.0 9600.0\n 97.0 194.0 291.0 388.0 485.0 582.0 9409.0 9506.0 9603.0 9700.0\n 98.0 196.0 294.0 392.0 490.0 588.0 9506.0 9604.0 9702.0 9800.0\n 99.0 198.0 297.0 396.0 495.0 594.0 9603.0 9702.0 9801.0 9900.0\n 100.0 200.0 300.0 400.0 500.0 600.0 9700.0 9800.0 9900.0 10000.0" + @test replstr((1.:100.)*(1:100)') == "100×100 Matrix{Float64}:\n 1.0 2.0 3.0 4.0 5.0 6.0 … 97.0 98.0 99.0 100.0\n 2.0 4.0 6.0 8.0 10.0 12.0 194.0 196.0 198.0 200.0\n 3.0 6.0 9.0 12.0 15.0 18.0 291.0 294.0 297.0 300.0\n 4.0 8.0 12.0 16.0 20.0 24.0 388.0 392.0 396.0 400.0\n 5.0 10.0 15.0 20.0 25.0 30.0 485.0 490.0 495.0 500.0\n 6.0 12.0 18.0 24.0 30.0 36.0 … 582.0 588.0 594.0 600.0\n 7.0 14.0 21.0 28.0 35.0 42.0 679.0 686.0 693.0 700.0\n 8.0 16.0 24.0 32.0 40.0 48.0 776.0 784.0 792.0 800.0\n 9.0 18.0 27.0 36.0 45.0 54.0 873.0 882.0 891.0 900.0\n 10.0 20.0 30.0 40.0 50.0 60.0 970.0 980.0 990.0 1000.0\n ⋮ ⋮ ⋱ \n 92.0 184.0 276.0 368.0 460.0 552.0 8924.0 9016.0 9108.0 9200.0\n 93.0 186.0 279.0 372.0 465.0 558.0 9021.0 9114.0 9207.0 9300.0\n 94.0 188.0 282.0 376.0 470.0 564.0 9118.0 9212.0 9306.0 9400.0\n 95.0 190.0 285.0 380.0 475.0 570.0 9215.0 9310.0 9405.0 9500.0\n 96.0 192.0 288.0 384.0 480.0 576.0 … 9312.0 9408.0 9504.0 9600.0\n 97.0 194.0 291.0 388.0 485.0 582.0 9409.0 9506.0 9603.0 9700.0\n 98.0 196.0 294.0 392.0 490.0 588.0 9506.0 9604.0 9702.0 9800.0\n 99.0 198.0 297.0 396.0 495.0 594.0 9603.0 9702.0 9801.0 9900.0\n 100.0 200.0 300.0 400.0 500.0 600.0 9700.0 9800.0 9900.0 10000.0" # test that no spurious visual lines are added when one element spans multiple lines v = fill!(Array{Any}(undef, 9), 0) v[1] = "look I'm wide! --- " ^ 9 - @test replstr(v) == "9-element Array{Any,1}:\n \"look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- \"\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0" - @test replstr([fill(0, 9) v]) == "9×2 Array{Any,2}:\n 0 … \"look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- \"\n 0 0\n 0 0\n 0 0\n 0 0\n 0 … 0\n 0 0\n 0 0\n 0 0" + @test replstr(v) == "9-element Vector{Any}:\n \"look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- \"\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0" + @test replstr([fill(0, 9) v]) == "9×2 Matrix{Any}:\n 0 … \"look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- \"\n 0 0\n 0 0\n 0 0\n 0 0\n 0 … 0\n 0 0\n 0 0\n 0 0" # test vertical/diagonal ellipsis v = fill!(Array{Any}(undef, 50), 0) v[1] = "look I'm wide! --- " ^ 9 - @test replstr(v) == "50-element Array{Any,1}:\n \"look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- \"\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n ⋮\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0" - @test replstr([fill(0, 50) v]) == "50×2 Array{Any,2}:\n 0 … \"look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- \"\n 0 0\n 0 0\n 0 0\n 0 0\n 0 … 0\n 0 0\n 0 0\n 0 0\n 0 0\n ⋮ ⋱ \n 0 0\n 0 0\n 0 0\n 0 0\n 0 … 0\n 0 0\n 0 0\n 0 0\n 0 0" + @test replstr(v) == "50-element Vector{Any}:\n \"look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- \"\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n ⋮\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0\n 0" + @test replstr([fill(0, 50) v]) == "50×2 Matrix{Any}:\n 0 … \"look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- look I'm wide! --- \"\n 0 0\n 0 0\n 0 0\n 0 0\n 0 … 0\n 0 0\n 0 0\n 0 0\n 0 0\n ⋮ ⋱ \n 0 0\n 0 0\n 0 0\n 0 0\n 0 … 0\n 0 0\n 0 0\n 0 0\n 0 0" # issue #34659 @test replstr(Int32[]) == "Int32[]" - @test replstr([Int32[]]) == "1-element Array{Array{Int32,1},1}:\n []" - @test replstr(permutedims([Int32[],Int32[]])) == "1×2 Array{Array{Int32,1},2}:\n [] []" - @test replstr(permutedims([Dict(),Dict()])) == "1×2 Array{Dict{Any,Any},2}:\n Dict() Dict()" - @test replstr(permutedims([undef,undef])) == "1×2 Array{UndefInitializer,2}:\n UndefInitializer() UndefInitializer()" - @test replstr([zeros(3,0),zeros(2,0)]) == "2-element Array{Array{Float64,2},1}:\n 3×0 Array{Float64,2}\n 2×0 Array{Float64,2}" + @test replstr([Int32[]]) == "1-element Vector{Vector{Int32}}:\n []" + @test replstr(permutedims([Int32[],Int32[]])) == "1×2 Matrix{Vector{Int32}}:\n [] []" + @test replstr(permutedims([Dict(),Dict()])) == "1×2 Matrix{Dict{Any,Any}}:\n Dict() Dict()" + @test replstr(permutedims([undef,undef])) == "1×2 Matrix{UndefInitializer}:\n UndefInitializer() UndefInitializer()" + @test replstr([zeros(3,0),zeros(2,0)]) == "2-element Vector{Matrix{Float64}}:\n 3×0 Matrix{Float64}\n 2×0 Matrix{Float64}" end # Issue 14121 @@ -838,13 +838,13 @@ end # test structured zero matrix printing for select structured types let A = reshape(1:16, 4, 4) - @test occursin(r"4×4 (LinearAlgebra\.)?Diagonal{Int(32|64),Array{Int(32|64),1}}:\n 1 ⋅ ⋅ ⋅\n ⋅ 6 ⋅ ⋅\n ⋅ ⋅ 11 ⋅\n ⋅ ⋅ ⋅ 16", replstr(Diagonal(A))) - @test occursin(r"4×4 (LinearAlgebra\.)?Bidiagonal{Int(32|64),Array{Int(32|64),1}}:\n 1 5 ⋅ ⋅\n ⋅ 6 10 ⋅\n ⋅ ⋅ 11 15\n ⋅ ⋅ ⋅ 16", replstr(Bidiagonal(A, :U))) - @test occursin(r"4×4 (LinearAlgebra\.)?Bidiagonal{Int(32|64),Array{Int(32|64),1}}:\n 1 ⋅ ⋅ ⋅\n 2 6 ⋅ ⋅\n ⋅ 7 11 ⋅\n ⋅ ⋅ 12 16", replstr(Bidiagonal(A, :L))) - @test occursin(r"4×4 (LinearAlgebra\.)?SymTridiagonal{Int(32|64),Array{Int(32|64),1}}:\n 2 7 ⋅ ⋅\n 7 12 17 ⋅\n ⋅ 17 22 27\n ⋅ ⋅ 27 32", replstr(SymTridiagonal(A + A'))) - @test occursin(r"4×4 (LinearAlgebra\.)?Tridiagonal{Int(32|64),Array{Int(32|64),1}}:\n 1 5 ⋅ ⋅\n 2 6 10 ⋅\n ⋅ 7 11 15\n ⋅ ⋅ 12 16", replstr(Tridiagonal(diag(A, -1), diag(A), diag(A, +1)))) - @test occursin(r"4×4 (LinearAlgebra\.)?UpperTriangular{Int(32|64),Array{Int(32|64),2}}:\n 1 5 9 13\n ⋅ 6 10 14\n ⋅ ⋅ 11 15\n ⋅ ⋅ ⋅ 16", replstr(UpperTriangular(copy(A)))) - @test occursin(r"4×4 (LinearAlgebra\.)?LowerTriangular{Int(32|64),Array{Int(32|64),2}}:\n 1 ⋅ ⋅ ⋅\n 2 6 ⋅ ⋅\n 3 7 11 ⋅\n 4 8 12 16", replstr(LowerTriangular(copy(A)))) + @test occursin(r"4×4 (LinearAlgebra\.)?Diagonal{Int(32|64),Vector{Int(32|64)}}:\n 1 ⋅ ⋅ ⋅\n ⋅ 6 ⋅ ⋅\n ⋅ ⋅ 11 ⋅\n ⋅ ⋅ ⋅ 16", replstr(Diagonal(A))) + @test occursin(r"4×4 (LinearAlgebra\.)?Bidiagonal{Int(32|64),Vector{Int(32|64)}}:\n 1 5 ⋅ ⋅\n ⋅ 6 10 ⋅\n ⋅ ⋅ 11 15\n ⋅ ⋅ ⋅ 16", replstr(Bidiagonal(A, :U))) + @test occursin(r"4×4 (LinearAlgebra\.)?Bidiagonal{Int(32|64),Vector{Int(32|64)}}:\n 1 ⋅ ⋅ ⋅\n 2 6 ⋅ ⋅\n ⋅ 7 11 ⋅\n ⋅ ⋅ 12 16", replstr(Bidiagonal(A, :L))) + @test occursin(r"4×4 (LinearAlgebra\.)?SymTridiagonal{Int(32|64),Vector{Int(32|64)}}:\n 2 7 ⋅ ⋅\n 7 12 17 ⋅\n ⋅ 17 22 27\n ⋅ ⋅ 27 32", replstr(SymTridiagonal(A + A'))) + @test occursin(r"4×4 (LinearAlgebra\.)?Tridiagonal{Int(32|64),Vector{Int(32|64)}}:\n 1 5 ⋅ ⋅\n 2 6 10 ⋅\n ⋅ 7 11 15\n ⋅ ⋅ 12 16", replstr(Tridiagonal(diag(A, -1), diag(A), diag(A, +1)))) + @test occursin(r"4×4 (LinearAlgebra\.)?UpperTriangular{Int(32|64),Matrix{Int(32|64)}}:\n 1 5 9 13\n ⋅ 6 10 14\n ⋅ ⋅ 11 15\n ⋅ ⋅ ⋅ 16", replstr(UpperTriangular(copy(A)))) + @test occursin(r"4×4 (LinearAlgebra\.)?LowerTriangular{Int(32|64),Matrix{Int(32|64)}}:\n 1 ⋅ ⋅ ⋅\n 2 6 ⋅ ⋅\n 3 7 11 ⋅\n 4 8 12 16", replstr(LowerTriangular(copy(A)))) end # Vararg methods in method tables @@ -1101,14 +1101,14 @@ let x = [], y = [], z = Base.ImmutableDict(x => y) push!(x, y) push!(y, x) push!(y, z) - @test replstr(x) == "1-element Array{Any,1}:\n Any[Any[#= circular reference @-2 =#], Base.ImmutableDict{Array{Any,1},Array{Any,1}}([#= circular reference @-3 =#] => [#= circular reference @-2 =#])]" - @test repr(z) == "Base.ImmutableDict{Array{Any,1},Array{Any,1}}([Any[Any[#= circular reference @-2 =#], Base.ImmutableDict{Array{Any,1},Array{Any,1}}(#= circular reference @-3 =#)]] => [Any[Any[#= circular reference @-2 =#]], Base.ImmutableDict{Array{Any,1},Array{Any,1}}(#= circular reference @-2 =#)])" + @test replstr(x) == "1-element Vector{Any}:\n Any[Any[#= circular reference @-2 =#], Base.ImmutableDict{Vector{Any},Vector{Any}}([#= circular reference @-3 =#] => [#= circular reference @-2 =#])]" + @test repr(z) == "Base.ImmutableDict{Vector{Any},Vector{Any}}([Any[Any[#= circular reference @-2 =#], Base.ImmutableDict{Vector{Any},Vector{Any}}(#= circular reference @-3 =#)]] => [Any[Any[#= circular reference @-2 =#]], Base.ImmutableDict{Vector{Any},Vector{Any}}(#= circular reference @-2 =#)])" @test sprint(dump, x) == """ Array{Any}((1,)) 1: Array{Any}((2,)) 1: Array{Any}((1,))#= circular reference @-2 =# - 2: Base.ImmutableDict{Array{Any,1},Array{Any,1}} - parent: Base.ImmutableDict{Array{Any,1},Array{Any,1}} + 2: Base.ImmutableDict{Vector{Any},Vector{Any}} + parent: Base.ImmutableDict{Vector{Any},Vector{Any}} parent: #undef key: #undef value: #undef @@ -1299,7 +1299,7 @@ end @test sprint(show, Main) == "Main" @test sprint(Base.show_supertypes, Int64) == "Int64 <: Signed <: Integer <: Real <: Number <: Any" -@test sprint(Base.show_supertypes, Vector{String}) == "Array{String,1} <: DenseArray{String,1} <: AbstractArray{String,1} <: Any" +@test sprint(Base.show_supertypes, Vector{String}) == "Vector{String} <: DenseVector{String} <: AbstractVector{String} <: Any" # static_show @@ -1385,20 +1385,20 @@ end end @testset "alignment for pairs" begin # (#22899) - @test replstr([1=>22,33=>4]) == "2-element Array{Pair{$Int,$Int},1}:\n 1 => 22\n 33 => 4" + @test replstr([1=>22,33=>4]) == "2-element Vector{Pair{$Int,$Int}}:\n 1 => 22\n 33 => 4" # first field may have "=>" in its representation @test replstr(Pair[(1=>2)=>3, 4=>5]) == - "2-element Array{Pair,1}:\n (1 => 2) => 3\n 4 => 5" + "2-element Vector{Pair}:\n (1 => 2) => 3\n 4 => 5" @test replstr(Any[Dict(1=>2)=> (3=>4), 1=>2]) == - "2-element Array{Any,1}:\n Dict(1 => 2) => (3 => 4)\n 1 => 2" + "2-element Vector{Any}:\n Dict(1 => 2) => (3 => 4)\n 1 => 2" # left-alignment when not using the "=>" symbol @test replstr(Any[Pair{Integer,Int64}(1, 2), Pair{Integer,Int64}(33, 4)]) == - "2-element Array{Any,1}:\n Pair{Integer,Int64}(1, 2)\n Pair{Integer,Int64}(33, 4)" + "2-element Vector{Any}:\n Pair{Integer,Int64}(1, 2)\n Pair{Integer,Int64}(33, 4)" end @testset "alignment for complex arrays" begin # (#34763) - @test replstr([ 1e-7 + 2.0e-11im, 2.0e-5 + 4e0im]) == "2-element Array{Complex{Float64},1}:\n 1.0e-7 + 2.0e-11im\n 2.0e-5 + 4.0im" - @test replstr([ 1f-7 + 2.0f-11im, 2.0f-5 + 4f0im]) == "2-element Array{Complex{Float32},1}:\n 1.0f-7 + 2.0f-11im\n 2.0f-5 + 4.0f0im" + @test replstr([ 1e-7 + 2.0e-11im, 2.0e-5 + 4e0im]) == "2-element Vector{ComplexF64}:\n 1.0e-7 + 2.0e-11im\n 2.0e-5 + 4.0im" + @test replstr([ 1f-7 + 2.0f-11im, 2.0f-5 + 4f0im]) == "2-element Vector{ComplexF32}:\n 1.0f-7 + 2.0f-11im\n 2.0f-5 + 4.0f0im" end @testset "display arrays non-compactly when size(⋅, 2) == 1" begin @@ -1408,16 +1408,16 @@ end @test replstr(A) == "0-dimensional Array{Pair,0}:\n1 => 2" # 1-dim @test replstr(zeros(Complex{Int}, 2)) == - "2-element Array{Complex{$Int},1}:\n 0 + 0im\n 0 + 0im" - @test replstr([1=>2, 3=>4]) == "2-element Array{Pair{$Int,$Int},1}:\n 1 => 2\n 3 => 4" + "2-element Vector{Complex{$Int}}:\n 0 + 0im\n 0 + 0im" + @test replstr([1=>2, 3=>4]) == "2-element Vector{Pair{$Int,$Int}}:\n 1 => 2\n 3 => 4" # 2-dim @test replstr(zeros(Complex{Int}, 2, 1)) == - "2×1 Array{Complex{$Int},2}:\n 0 + 0im\n 0 + 0im" + "2×1 Matrix{Complex{$Int}}:\n 0 + 0im\n 0 + 0im" @test replstr(zeros(Complex{Int}, 1, 2)) == - "1×2 Array{Complex{$Int},2}:\n 0+0im 0+0im" - @test replstr([1=>2 3=>4]) == "1×2 Array{Pair{$Int,$Int},2}:\n 1=>2 3=>4" + "1×2 Matrix{Complex{$Int}}:\n 0+0im 0+0im" + @test replstr([1=>2 3=>4]) == "1×2 Matrix{Pair{$Int,$Int}}:\n 1=>2 3=>4" @test replstr([1=>2 for x in 1:2, y in 1:1]) == - "2×1 Array{Pair{$Int,$Int},2}:\n 1 => 2\n 1 => 2" + "2×1 Matrix{Pair{$Int,$Int}}:\n 1 => 2\n 1 => 2" # 3-dim @test replstr(zeros(Complex{Int}, 1, 1, 1)) == "1×1×1 Array{Complex{$Int},3}:\n[:, :, 1] =\n 0 + 0im" @@ -1436,10 +1436,10 @@ end "[3.141592653589793 3.141592653589793; 3.141592653589793 3.141592653589793]" @test replstr([x, x], :compact => false) == "2-element Array{Float64,1}:\n 3.141592653589793\n 3.141592653589793" - @test replstr([x, x]) == "2-element Array{Float64,1}:\n 3.141592653589793\n 3.141592653589793" - @test replstr([x, x], :compact => true) == "2-element Array{Float64,1}:\n 3.14159\n 3.14159" + @test replstr([x, x]) == "2-element Vector{Float64}:\n 3.141592653589793\n 3.141592653589793" + @test replstr([x, x], :compact => true) == "2-element Vector{Float64}:\n 3.14159\n 3.14159" @test replstr([x x; x x]) == replstr([x x; x x], :compact => true) == - "2×2 Array{Float64,2}:\n 3.14159 3.14159\n 3.14159 3.14159" + "2×2 Matrix{Float64}:\n 3.14159 3.14159\n 3.14159 3.14159" @test showstr([x x; x x], :compact => false) == "[3.141592653589793 3.141592653589793; 3.141592653589793 3.141592653589793]" end @@ -1452,21 +1452,21 @@ end end end A = Int64[1] - @test arrstr(A, 4) == "1-element Array{Int64,1}: …" - @test arrstr(A, 5) == "1-element Array{Int64,1}:\n 1" + @test arrstr(A, 4) == "1-element Vector{Int64}: …" + @test arrstr(A, 5) == "1-element Vector{Int64}:\n 1" push!(A, 2) - @test arrstr(A, 5) == "2-element Array{Int64,1}:\n ⋮" - @test arrstr(A, 6) == "2-element Array{Int64,1}:\n 1\n 2" + @test arrstr(A, 5) == "2-element Vector{Int64}:\n ⋮" + @test arrstr(A, 6) == "2-element Vector{Int64}:\n 1\n 2" push!(A, 3) - @test arrstr(A, 6) == "3-element Array{Int64,1}:\n 1\n ⋮" + @test arrstr(A, 6) == "3-element Vector{Int64}:\n 1\n ⋮" - @test arrstr(zeros(4, 3), 4) == "4×3 Array{Float64,2}: …" - @test arrstr(zeros(4, 30), 4) == "4×30 Array{Float64,2}: …" - @test arrstr(zeros(4, 3), 5) == "4×3 Array{Float64,2}:\n ⋮ ⋱ " - @test arrstr(zeros(4, 30), 5) == "4×30 Array{Float64,2}:\n ⋮ ⋱ " - @test arrstr(zeros(4, 3), 6) == "4×3 Array{Float64,2}:\n 0.0 0.0 0.0\n ⋮ " + @test arrstr(zeros(4, 3), 4) == "4×3 Matrix{Float64}: …" + @test arrstr(zeros(4, 30), 4) == "4×30 Matrix{Float64}: …" + @test arrstr(zeros(4, 3), 5) == "4×3 Matrix{Float64}:\n ⋮ ⋱ " + @test arrstr(zeros(4, 30), 5) == "4×30 Matrix{Float64}:\n ⋮ ⋱ " + @test arrstr(zeros(4, 3), 6) == "4×3 Matrix{Float64}:\n 0.0 0.0 0.0\n ⋮ " @test arrstr(zeros(4, 30), 6) == - string("4×30 Array{Float64,2}:\n", + string("4×30 Matrix{Float64}:\n", " 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n", " ⋮ ⋮ ⋱ ⋮ ") end @@ -1562,25 +1562,25 @@ end end @testset "typeinfo" begin - @test replstr([[Int16(1)]]) == "1-element Array{Array{Int16,1},1}:\n [1]" - @test showstr([[Int16(1)]]) == "Array{Int16,1}[[1]]" - @test showstr(Set([[Int16(1)]])) == "Set(Array{Int16,1}[[1]])" + @test replstr([[Int16(1)]]) == "1-element Vector{Vector{Int16}}:\n [1]" + @test showstr([[Int16(1)]]) == "Vector{Int16}[[1]]" + @test showstr(Set([[Int16(1)]])) == "Set(Vector{Int16}[[1]])" @test showstr([Float16(1)]) == "Float16[1.0]" - @test showstr([[Float16(1)]]) == "Array{Float16,1}[[1.0]]" - @test replstr(Real[Float16(1)]) == "1-element Array{Real,1}:\n Float16(1.0)" - @test replstr(Array{Real}[Real[1]]) == "1-element Array{Array{Real,N} where N,1}:\n [1]" + @test showstr([[Float16(1)]]) == "Vector{Float16}[[1.0]]" + @test replstr(Real[Float16(1)]) == "1-element Vector{Real}:\n Float16(1.0)" + @test replstr(Array{Real}[Real[1]]) == "1-element Vector{Array{Real,N} where N}:\n [1]" # printing tuples (Issue #25042) @test replstr(fill((Int64(1), zeros(Float16, 3)), 1)) == - "1-element Array{Tuple{Int64,Array{Float16,1}},1}:\n (1, [0.0, 0.0, 0.0])" + "1-element Vector{Tuple{Int64,Vector{Float16}}}:\n (1, [0.0, 0.0, 0.0])" @testset "nested Any eltype" begin x = Any[Any[Any[1]]] # The element of x (i.e. x[1]) has an eltype which can't be deduced # from eltype(x), so this must also be printed - @test replstr(x) == "1-element Array{Any,1}:\n Any[Any[1]]" + @test replstr(x) == "1-element Vector{Any}:\n Any[Any[1]]" end # Issue #25038 A = [0.0, 1.0] - @test replstr(view(A, [1], :)) == "1×1 view(::Array{Float64,2}, [1], :) with eltype Float64:\n 0.0" + @test replstr(view(A, [1], :)) == "1×1 view(::Matrix{Float64}, [1], :) with eltype Float64:\n 0.0" # issue #27680 @test showstr(Set([(1.0,1.0), (2.0,2.0), (3.0, 3.0)])) == (sizeof(Int) == 8 ? @@ -1590,20 +1590,20 @@ end # issue #27747 let t = (x = Integer[1, 2],) v = [t, t] - @test showstr(v) == "NamedTuple{(:x,),Tuple{Array{Integer,1}}}[(x = [1, 2],), (x = [1, 2],)]" - @test replstr(v) == "2-element Array{NamedTuple{(:x,),Tuple{Array{Integer,1}}},1}:\n (x = [1, 2],)\n (x = [1, 2],)" + @test showstr(v) == "NamedTuple{(:x,),Tuple{Vector{Integer}}}[(x = [1, 2],), (x = [1, 2],)]" + @test replstr(v) == "2-element Vector{NamedTuple{(:x,),Tuple{Vector{Integer}}}}:\n (x = [1, 2],)\n (x = [1, 2],)" end # issue #25857 @test repr([(1,),(1,2),(1,2,3)]) == "Tuple{$Int,Vararg{$Int,N} where N}[(1,), (1, 2), (1, 2, 3)]" # issues #25466 & #26256 - @test replstr([:A => [1]]) == "1-element Array{Pair{Symbol,Array{$Int,1}},1}:\n :A => [1]" + @test replstr([:A => [1]]) == "1-element Vector{Pair{Symbol,Vector{$Int}}}:\n :A => [1]" # issue #26881 @test showstr([keys(Dict('a' => 'b'))]) == "Base.KeySet{Char,Dict{Char,Char}}[['a']]" @test showstr([values(Dict('a' => 'b'))]) == "Base.ValueIterator{Dict{Char,Char}}[['b']]" - @test replstr([keys(Dict('a' => 'b'))]) == "1-element Array{Base.KeySet{Char,Dict{Char,Char}},1}:\n ['a']" + @test replstr([keys(Dict('a' => 'b'))]) == "1-element Vector{Base.KeySet{Char,Dict{Char,Char}}}:\n ['a']" @test showstr(Pair{Integer,Integer}(1, 2), :typeinfo => Pair{Integer,Integer}) == "1 => 2" @test showstr([Pair{Integer,Integer}(1, 2)]) == "Pair{Integer,Integer}[1 => 2]" @@ -1612,14 +1612,14 @@ end @test showstr(Dict((1 => 2) => (3 => 4))) == "Dict((1 => 2) => (3 => 4))" # issue #27979 (dislaying arrays of pairs containing arrays as first member) - @test replstr([[1.0]=>1.0]) == "1-element Array{Pair{Array{Float64,1},Float64},1}:\n [1.0] => 1.0" + @test replstr([[1.0]=>1.0]) == "1-element Vector{Pair{Vector{Float64},Float64}}:\n [1.0] => 1.0" # issue #28159 - @test replstr([(a=1, b=2), (a=3,c=4)]) == "2-element Array{NamedTuple{names,Tuple{$Int,$Int}} where names,1}:\n (a = 1, b = 2)\n (a = 3, c = 4)" + @test replstr([(a=1, b=2), (a=3,c=4)]) == "2-element Vector{NamedTuple{names,Tuple{$Int,$Int}} where names}:\n (a = 1, b = 2)\n (a = 3, c = 4)" - @test replstr(Vector[Any[1]]) == "1-element Array{Array{T,1} where T,1}:\n Any[1]" + @test replstr(Vector[Any[1]]) == "1-element Vector{Vector{T} where T}:\n Any[1]" @test replstr(AbstractDict{Integer,Integer}[Dict{Integer,Integer}(1=>2)]) == - "1-element Array{AbstractDict{Integer,Integer},1}:\n Dict(1 => 2)" + "1-element Vector{AbstractDict{Integer,Integer}}:\n Dict(1 => 2)" # issue #34343 @test showstr([[1], Int[]]) == "[[1], $Int[]]" @@ -1687,7 +1687,7 @@ end end @testset "repr(mime, x)" begin - @test repr("text/plain", UInt8[1 2;3 4]) == "2×2 Array{UInt8,2}:\n 0x01 0x02\n 0x03 0x04" + @test repr("text/plain", UInt8[1 2;3 4]) == "2×2 Matrix{UInt8}:\n 0x01 0x02\n 0x03 0x04" @test repr("text/html", "raw html data") == "raw html data" @test repr("text/plain", "string") == "\"string\"" @test repr("image/png", UInt8[2,3,4,7]) == UInt8[2,3,4,7] @@ -1838,7 +1838,7 @@ end @testset """printing "Any" is not skipped with nested arrays""" begin @test replstr(Union{X28004,Vector}[X28004(Any[X28004(1)])], :compact => true) == - "1-element Array{Union{X28004, Array{T,1} where T},1}:\n X(Any[X(1)])" + "1-element Vector{Union{X28004, Vector{T} where T}}:\n X(Any[X(1)])" end # Issue 25589 - Underlines in cmd printing @@ -1881,8 +1881,8 @@ Z = Array{Float64}(undef,0,0) vec_initialisers = fill(undef, 2) @test showstr(vec_undefined) == "Any[#undef, #undef]" @test showstr(vec_initialisers) == "[$undef, $undef]" - @test replstr(vec_undefined) == "2-element Array{Any,1}:\n #undef\n #undef" - @test replstr(vec_initialisers) == "2-element Array{UndefInitializer,1}:\n UndefInitializer(): array initializer with undefined values\n UndefInitializer(): array initializer with undefined values" + @test replstr(vec_undefined) == "2-element Vector{Any}:\n #undef\n #undef" + @test replstr(vec_initialisers) == "2-element Vector{UndefInitializer}:\n UndefInitializer(): array initializer with undefined values\n UndefInitializer(): array initializer with undefined values" end # issue #31065, do not print parentheses for nested dot expressions diff --git a/test/subtype.jl b/test/subtype.jl index d528a2230fca94..78f88d8a63a860 100644 --- a/test/subtype.jl +++ b/test/subtype.jl @@ -1108,7 +1108,7 @@ f18348(::Type{T}, x::T) where {T<:Any} = 2 # Issue #13165 @test Symmetric{Float64,Matrix{Float64}} <: LinearAlgebra.RealHermSymComplexHerm @test Hermitian{Float64,Matrix{Float64}} <: LinearAlgebra.RealHermSymComplexHerm -@test Hermitian{Complex{Float64},Matrix{Complex{Float64}}} <: LinearAlgebra.RealHermSymComplexHerm +@test Hermitian{ComplexF64,Matrix{ComplexF64}} <: LinearAlgebra.RealHermSymComplexHerm # Issue #12721 f12721(::T) where {T<:Type{Int}} = true