Skip to content

Commit cbbd66e

Browse files
committed
docs
1 parent a9ac7a6 commit cbbd66e

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

base/docs/helpdb/Base.jl

+28-4
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,10 @@ julia> ones(Complex128, 2, 3)
619619
ones(t,dims)
620620

621621
"""
622-
ones(A)
622+
ones(A::AbstractArray, T=eltype(A)::Type, dims=size(A)::DimOrInd)
623623
624-
Create an array of all ones with the same element type and shape as `A`.
624+
Create an array of all ones with the same layout as `A`. Element type and size
625+
can optionally be adjusted.
625626
626627
```jldoctest
627628
julia> A = [1 2; 3 4]
@@ -633,6 +634,17 @@ julia> ones(A)
633634
2×2 Array{Int64,2}:
634635
1 1
635636
1 1
637+
638+
julia> ones(A, Float64)
639+
2×2 Array{Float64,2}:
640+
1. 1.
641+
1. 1.
642+
643+
julia> ones(A, Bool, (3,))
644+
3-element Array{Bool,1}:
645+
true
646+
true
647+
true
636648
```
637649
"""
638650
ones(A)
@@ -2892,9 +2904,10 @@ julia> zeros(Int8, 2, 3)
28922904
zeros(t,dims)
28932905

28942906
"""
2895-
zeros(A)
2907+
zeros(A::AbstractArray, T=eltype(A)::Type, dims=size(A)::DimOrInd)
28962908
2897-
Create an array of all zeros with the same element type and shape as `A`.
2909+
Create an array of all zeros with the same layout as `A`. Element type and size
2910+
can optionally be adjusted.
28982911
28992912
```jldoctest
29002913
julia> A = [1 2; 3 4]
@@ -2906,6 +2919,17 @@ julia> zeros(A)
29062919
2×2 Array{Int64,2}:
29072920
0 0
29082921
0 0
2922+
2923+
julia> zeros(A, Float64)
2924+
2×2 Array{Float64,2}:
2925+
0.0 0.0
2926+
0.0 0.0
2927+
2928+
julia> zeros(A, Bool, (3,))
2929+
3-element Array{Bool,1}:
2930+
false
2931+
false
2932+
false
29092933
```
29102934
"""
29112935
zeros(A)

0 commit comments

Comments
 (0)