# Inconsistent behavior between two- and three-argument methods of \`ldiv!\`

**URL:** <https://discourse.julialang.org/t/inconsistent-behavior-between-two-and-three-argument-methods-of-ldiv/76102>\
**Category:** Internals & Design\
**Tags:** linearalgebra\
**Created:** [February 9, 2022, 4:41pm UTC](https://discourse.julialang.org/t/inconsistent-behavior-between-two-and-three-argument-methods-of-ldiv/76102 "2022-02-09T16:41:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![simsurace](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simsurace/32/30216_2.png) [@simsurace](https://discourse.julialang.org/u/simsurace)\
**Post date:** [February 9, 2022, 4:41pm UTC](https://discourse.julialang.org/t/inconsistent-behavior-between-two-and-three-argument-methods-of-ldiv/76102/1 "2022-02-09T16:41:55Z")

</div>

While implementing methods for `\` and `ldiv!` for diagonal `GPUArrays` , (see [this PR](https://github.com/JuliaGPU/GPUArrays.jl/pull/391) in case you’re interested) I noticed that the two and three-argument versions of `ldiv! don’t have the same behavior for singular diagonal arguments, i.e.:

```julia
using LinearAlgebra

n = 4
d = rand(n)
d[1] = 0
D = Diagonal(d)
B = rand(n, n)
Y = zeros(n, n)

ldiv!(D, B)
# 4×4 Matrix{Float64}:
# Inf Inf Inf Inf
# 0.682851 1.40532 1.44143 0.516185
# 0.836786 0.11104 0.849226 0.896431
# 8.443 11.7222 18.7991 15.7463

ldiv!(Y, D, B) # ERROR: SingularException(1)

```

Is this intentional?
