Skip to content

Commit aba980c

Browse files
WalterMadelimjishnub
authored andcommitted
Update the docstring of ldiv! (#1344)
![image](https://github.com/user-attachments/assets/724d0ca3-fc05-46a7-b22a-cc0ab929bfe0) A comment about the existing docstring is: The lower example reads counter-intuitive, _given_ the experience from reading the upper example. And `X` and `Y` are not like `A` and `B`. Hope the revised version reads clearer and intelligible. (cherry picked from commit 2d35f07)
1 parent 5dc7640 commit aba980c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/LinearAlgebra.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,13 @@ control over the factorization of `A`.
393393
```jldoctest
394394
julia> A = [1 2.2 4; 3.1 0.2 3; 4 1 2];
395395
396-
julia> X = [1; 2.5; 3];
396+
julia> B = [1, 2.5, 3];
397397
398-
julia> Y = zero(X);
398+
julia> Y = similar(B); # use similar since there is no need to read from it
399399
400-
julia> ldiv!(Y, qr(A), X);
400+
julia> ldiv!(Y, qr(A), B); # you may also try qr!(A) to further reduce allocation
401401
402-
julia> Y ≈ A\\X
402+
julia> Y ≈ A \\ B
403403
true
404404
```
405405
"""
@@ -425,13 +425,13 @@ control over the factorization of `A`.
425425
```jldoctest
426426
julia> A = [1 2.2 4; 3.1 0.2 3; 4 1 2];
427427
428-
julia> X = [1; 2.5; 3];
428+
julia> B = [1, 2.5, 3];
429429
430-
julia> Y = copy(X);
430+
julia> B0 = copy(B); # a backup copy to facilitate testing
431431
432-
julia> ldiv!(qr(A), X);
432+
julia> ldiv!(lu(A), B); # you may also try lu!(A) to further reduce allocation
433433
434-
julia> X ≈ A\\Y
434+
julia> B ≈ A \\ B0
435435
true
436436
```
437437
"""

0 commit comments

Comments
 (0)