# In-place backslash operator for sparse matrices

**URL:** <https://discourse.julialang.org/t/in-place-backslash-operator-for-sparse-matrices/6091>\
**Category:** Numerics\
**Tags:** linearalgebra\
**Created:** [September 26, 2017, 6:09pm UTC](https://discourse.julialang.org/t/in-place-backslash-operator-for-sparse-matrices/6091 "2017-09-26T18:09:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tryingtosolve](https://avatars.discourse-cdn.com/v4/letter/t/bbe5ce/32.png) [@tryingtosolve](https://discourse.julialang.org/u/tryingtosolve)\
**Post date:** [September 26, 2017, 6:09pm UTC](https://discourse.julialang.org/t/in-place-backslash-operator-for-sparse-matrices/6091/1 "2017-09-26T18:09:36Z")

</div>

I have been doing `A\b` where `A` is a sparse matrix. However, is there an in place version of `\`? I have stumbled upon `A_ldiv_B!` but it seems to me (1) this function has been deprecated and (2) it didn’t work on sparse matrices anyway.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 26, 2017, 7:17pm UTC](https://discourse.julialang.org/t/in-place-backslash-operator-for-sparse-matrices/6091/2 "2017-09-26T19:17:56Z")

</div>

I don’t think `A_ldiv_B!` has been deprecated — you can still find this function in the latest master. (Maybe a specific method of it was deprecated?)

`A_ldiv_B!` is supported for sparse matrices, but you have to give a factorization object, not the matrix itself. That is, if `A` is a sparse matrix, then `F = factorize(A)` to create the (sparse) LU (etc.) factorization, and then do `A_ldiv_B!(F, b)` to solve Ax=b in-place in `b` with the precomputed factorization.

Note that this is explained in the `A_ldiv_B!` documentation: [https://docs.julialang.org/en/latest/stdlib/linalg/#Base.LinAlg.A\_ldiv\_B](https://docs.julialang.org/en/latest/stdlib/linalg/#Base.LinAlg.A_ldiv_B)!

**Update in 2019:** The corresponding function in Julia 1.0 or later is [`ldiv!`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.ldiv!) in the `LinearAlgebra` standard library.
