Skip to content

Commit f62b373

Browse files
committed
clean the base manual and base doctests from LinearAlgebra specific things
1 parent 0a42222 commit f62b373

File tree

14 files changed

+97
-110
lines changed

14 files changed

+97
-110
lines changed

base/docs/basedocs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ callable with no arguments). The task exits when this function returns.
988988
989989
# Examples
990990
```jldoctest
991-
julia> a() = det(rand(1000, 1000));
991+
julia> a() = sum(i for i in 1:1000);
992992
993993
julia> b = Task(a);
994994
```

base/event.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ If a second argument `val` is provided, it will be passed to the task (via the r
118118
the woken task.
119119
120120
```jldoctest
121-
julia> a5() = det(rand(1000, 1000));
121+
julia> a5() = sum(i for i in 1:1000);
122122
123123
julia> b = Task(a5);
124124

base/number.jl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -171,28 +171,6 @@ copysign(x::Real, y::Real) = ifelse(signbit(x)!=signbit(y), -x, +x)
171171

172172
conj(x::Real) = x
173173
transpose(x::Number) = x
174-
"""
175-
adjoint(A)
176-
177-
Lazy adjoint (conjugate transposition) (also postfix `'`). Note that `adjoint` is applied recursively to
178-
elements.
179-
180-
This operation is intended for linear algebra usage - for general data manipulation see
181-
[`permutedims`](@ref).
182-
183-
# Examples
184-
```jldoctest
185-
julia> A = [3+2im 9+2im; 8+7im 4+6im]
186-
2×2 Array{Complex{Int64},2}:
187-
3+2im 9+2im
188-
8+7im 4+6im
189-
190-
julia> adjoint(A)
191-
2×2 Adjoint{Complex{Int64},Array{Complex{Int64},2}}:
192-
3-2im 8-7im
193-
9-2im 4-6im
194-
```
195-
"""
196174
adjoint(x::Number) = conj(x)
197175
angle(z::Real) = atan2(zero(z), z)
198176

base/permuteddimsarray.jl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ end
117117
permutedims(m::AbstractMatrix)
118118
119119
Permute the dimensions of the matrix `m`, by flipping the elements across the diagonal of
120-
the matrix. Differs from [`transpose`](@ref) in that the operation is not recursive.
120+
the matrix. Differs from `LinearAlgebra`'s [`transpose`](@ref) in that the
121+
operation is not recursive.
121122
122123
# Examples
123124
```jldoctest
@@ -140,7 +141,7 @@ julia> permutedims(X)
140141
[5 6; 7 8] [13 14; 15 16]
141142
142143
julia> transpose(X)
143-
2×2 Array{Array{Int64,2},2}:
144+
2×2 LinearAlgebra.Transpose{LinearAlgebra.Transpose{Int64,Array{Int64,2}},Array{Array{Int64,2},2}}:
144145
[1 3; 2 4] [9 11; 10 12]
145146
[5 7; 6 8] [13 15; 14 16]
146147
```
@@ -151,19 +152,16 @@ permutedims(A::AbstractMatrix) = permutedims(A, (2,1))
151152
permutedims(v::AbstractVector)
152153
153154
Reshape vector `v` into a `1 × length(v)` row matrix.
154-
Differs from [`transpose`](@ref) in that the operation is not recursive.
155+
Differs from `LinearAlgebra`'s [`transpose`](@ref) in that
156+
the operation is not recursive.
155157
156158
# Examples
157159
```jldoctest
158-
julia> permutedims(v)
160+
julia> permutedims([1, 2, 3, 4])
159161
1×4 Array{Int64,2}:
160162
1 2 3 4
161163
162-
julia> a = [1 2; 3 4];
163-
164-
julia> b = [5 6; 7 8];
165-
166-
julia> V = [[a]; [b]]
164+
julia> V = [[[1 2; 3 4]]; [[5 6; 7 8]]]
167165
2-element Array{Array{Int64,2},1}:
168166
[1 2; 3 4]
169167
[5 6; 7 8]
@@ -173,7 +171,7 @@ julia> permutedims(V)
173171
[1 2; 3 4] [5 6; 7 8]
174172
175173
julia> transpose(V)
176-
1×2 Transpose{Transpose{Int64,Array{Int64,2}},Array{Array{Int64,2},1}}:
174+
1×2 LinearAlgebra.Transpose{LinearAlgebra.Transpose{Int64,Array{Int64,2}},Array{Array{Int64,2},1}}:
177175
[1 3; 2 4] [5 7; 6 8]
178176
```
179177
"""

base/reflection.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Get the name of a `Module` as a `Symbol`.
99
1010
# Examples
1111
```jldoctest
12-
julia> nameof(Base)
13-
:Base
12+
julia> nameof(Base.Broadcast)
13+
:Broadcast
1414
```
1515
"""
1616
nameof(m::Module) = ccall(:jl_module_name, Ref{Symbol}, (Any,), m)
@@ -25,7 +25,7 @@ Get a module's enclosing `Module`. `Main` is its own parent.
2525
julia> parentmodule(Main)
2626
Main
2727
28-
julia> parentmodule(Base.Sys)
28+
julia> parentmodule(Base.Broadcast)
2929
Base
3030
```
3131
"""
@@ -133,10 +133,10 @@ Get an array of the fields of a `DataType`.
133133
134134
# Examples
135135
```jldoctest
136-
julia> fieldnames(Hermitian)
136+
julia> fieldnames(Rational)
137137
2-element Array{Symbol,1}:
138-
:data
139-
:uplo
138+
:num
139+
:den
140140
```
141141
"""
142142
fieldnames(t::DataType) = Symbol[fieldname(t, n) for n in 1:fieldcount(t)]

base/subarray.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ it is not a view.
6767
6868
# Examples
6969
```jldoctest
70-
julia> a = [1 2; 3 4]
70+
julia> A = [1 2; 3 4]
7171
2×2 Array{Int64,2}:
7272
1 2
7373
3 4
7474
75-
julia> s_a = Symmetric(a)
76-
2×2 Symmetric{Int64,Array{Int64,2}}:
75+
julia> V = view(A, 1:2, :)
76+
2×2 view(::Array{Int64,2}, 1:2, :) with eltype Int64:
7777
1 2
78-
2 4
78+
3 4
7979
80-
julia> parent(s_a)
80+
julia> parent(V)
8181
2×2 Array{Int64,2}:
8282
1 2
8383
3 4

base/task.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Wrap an expression in a [`Task`](@ref) without executing it, and return the [`Ta
6161
creates a task, and does not run it.
6262
6363
```jldoctest
64-
julia> a1() = det(rand(1000, 1000));
64+
julia> a1() = sum(i for i in 1:1000);
6565
6666
julia> b = @task a1();
6767
@@ -93,7 +93,7 @@ current_task() = ccall(:jl_get_current_task, Ref{Task}, ())
9393
Determine whether a task has exited.
9494
9595
```jldoctest
96-
julia> a2() = det(rand(1000, 1000));
96+
julia> a2() = sum(i for i in 1:1000);
9797
9898
julia> b = Task(a2);
9999
@@ -116,7 +116,7 @@ istaskdone(t::Task) = ((t.state == :done) | istaskfailed(t))
116116
Determine whether a task has started executing.
117117
118118
```jldoctest
119-
julia> a3() = det(rand(1000, 1000));
119+
julia> a3() = sum(i for i in 1:1000);
120120
121121
julia> b = Task(a3);
122122

doc/src/manual/documentation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,13 +616,13 @@ the Julia documentation itself. For example:
616616

617617
```julia
618618
"""
619-
eigvals!(A,[irange,][vl,][vu]) -> values
619+
accumulate!(op, y, x)
620620
621-
Same as [`eigvals`](@ref), but saves space by overwriting the input `A`, instead of creating a copy.
621+
Cumulative operation `op` on a vector `x`, storing the result in `y`. See also [`accumulate`](@ref).
622622
"""
623623
```
624624

625-
This will create a link in the generated docs to the `eigvals` documentation
625+
This will create a link in the generated docs to the `accumulate` documentation
626626
(which has more information about what this function actually does). It's good to include
627627
cross references to mutating/non-mutating versions of a function, or to highlight a difference
628628
between two similar-seeming functions.

doc/src/manual/functions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ A few special expressions correspond to calls to functions with non-obvious name
164164
| `[A; B; C; ...]` | [`vcat`](@ref) |
165165
| `[A B; C D; ...]` | [`hvcat`](@ref) |
166166
| `A'` | [`adjoint`](@ref) |
167-
| `A.'` | [`transpose`](@ref) |
168167
| `1:n` | [`colon`](@ref) |
169168
| `A[i]` | [`getindex`](@ref) |
170169
| `A[i] = x` | [`setindex!`](@ref) |

doc/src/manual/interfaces.md

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ Now, when we ask Julia to [`collect`](@ref) all the elements into an array it ca
115115
of the right size instead of blindly [`push!`](@ref)ing each element into a `Vector{Any}`:
116116

117117
```jldoctest squaretype
118-
julia> collect(Squares(10))' # transposed to save space
119-
1×10 RowVector{Int64,Array{Int64,1}}:
120-
1 4 9 16 25 36 49 64 81 100
118+
julia> collect(Squares(4))
119+
4-element Array{Int64,1}:
120+
1
121+
4
122+
9
123+
16
121124
```
122125

123126
While we can rely upon generic implementations, we can also extend specific methods where we know
@@ -150,9 +153,12 @@ julia> Base.next(::Iterators.Reverse{Squares}, state) = (state*state, state-1)
150153
151154
julia> Base.done(::Iterators.Reverse{Squares}, state) = state < 1
152155
153-
julia> collect(Iterators.reverse(Squares(10)))' # transposed to save space
154-
1×10 RowVector{Int64,Array{Int64,1}}:
155-
100 81 64 49 36 25 16 9 4 1
156+
julia> collect(Iterators.reverse(Squares(4)))
157+
4-element Array{Int64,1}:
158+
16
159+
9
160+
4
161+
1
156162
```
157163

158164
## Indexing
@@ -275,28 +281,31 @@ methods are all it takes for `SquaresVector` to be an iterable, indexable, and c
275281
array:
276282

277283
```jldoctest squarevectype
278-
julia> s = SquaresVector(7)
279-
7-element SquaresVector:
284+
julia> s = SquaresVector(4)
285+
4-element SquaresVector:
280286
1
281287
4
282288
9
283289
16
284-
25
285-
36
286-
49
287290
288-
julia> s[s .> 20]
289-
3-element Array{Int64,1}:
290-
25
291-
36
292-
49
291+
julia> s[s .> 8]
292+
2-element Array{Int64,1}:
293+
9
294+
16
293295
294-
julia> s \ [1 2; 3 4; 5 6; 7 8; 9 10; 11 12; 13 14]
295-
1×2 RowVector{Float64,Array{Float64,1}}:
296-
0.305389 0.335329
296+
julia> s + s
297+
4-element Array{Int64,1}:
298+
2
299+
8
300+
18
301+
32
297302
298-
julia> s ⋅ s # dot(s, s)
299-
4676
303+
julia> sin.(s)
304+
4-element Array{Float64,1}:
305+
0.8414709848078965
306+
-0.7568024953079282
307+
0.4121184852417566
308+
-0.2879033166650653
300309
```
301310

302311
As a more complicated example, let's define our own toy N-dimensional sparse-like array type built
@@ -382,8 +391,8 @@ julia> A[SquaresVector(3)]
382391
4.0
383392
9.0
384393
385-
julia> dot(A[:,1],A[:,2])
386-
32.0
394+
julia> mean(A)
395+
5.0
387396
```
388397

389398
If you are defining an array type that allows non-traditional indexing (indices that start at

0 commit comments

Comments
 (0)