Skip to content

Commit 99d11d8

Browse files
Update the docstring of ldiv!
The existing two examples in docstring reads well respectively, but not in conjunction: In the above example it mutates Y, whereas in the lower example it mutates X. Hope that after revising it looks more clean and intelligible.
1 parent ae208d6 commit 99d11d8

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/LinearAlgebra.jl

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,13 @@ control over the factorization of `A`.
392392
393393
# Examples
394394
```jldoctest
395-
julia> A = [1 2.2 4; 3.1 0.2 3; 4 1 2];
395+
julia> A, B = [1 2.2 4; 3.1 0.2 3; 4 1 2], [1, 2.5, 3];
396396
397-
julia> X = [1; 2.5; 3];
397+
julia> Y = copy(B);
398398
399-
julia> Y = zero(X);
399+
julia> ldiv!(Y, qr(A), B); # also try qr!(A) for the 2nd arg
400400
401-
julia> ldiv!(Y, qr(A), X);
402-
403-
julia> Y ≈ A\\X
401+
julia> Y ≈ A \ B
404402
true
405403
```
406404
"""
@@ -424,15 +422,13 @@ control over the factorization of `A`.
424422
425423
# Examples
426424
```jldoctest
427-
julia> A = [1 2.2 4; 3.1 0.2 3; 4 1 2];
428-
429-
julia> X = [1; 2.5; 3];
425+
julia> A, B = [1 2.2 4; 3.1 0.2 3; 4 1 2], [1, 2.5, 3];
430426
431-
julia> Y = copy(X);
427+
julia> B0 = copy(B);
432428
433-
julia> ldiv!(qr(A), X);
429+
julia> ldiv!(lu(A), B); # also try lu!(A) for the 1st arg
434430
435-
julia> X ≈ A\\Y
431+
julia> B ≈ A \ B0
436432
true
437433
```
438434
"""

0 commit comments

Comments
 (0)