# \#linearsolve

**URL:** https://discourse.julialang.org/tag/linearsolve/1153.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Automatic differentiation of function using \`LinearProblem\`](https://discourse.julialang.org/t/automatic-differentiation-of-function-using-linearproblem/136063)

<div class="topic-metadata">

**Author:** [@NoFishLikeIan](https://discourse.julialang.org/u/NoFishLikeIan)\
**Replies:** 8\
**Last updated:** [March 22, 2026, 2:08pm UTC](https://discourse.julialang.org/t/automatic-differentiation-of-function-using-linearproblem/136063 "2026-03-22T14:08:42Z")

</div>

I am trying to optimise a function f: \\mathbb{R}^n \\to \\mathbb{R} which internally solves a linear problem, informally something like f(w) = g(x) where x solves A(w) x= b(x). To do this I am using LinearSolve and automa…

---

## [Solving Optimization of Least Squares Term with Quadratic Term with Memory Infeasible Matrix](https://discourse.julialang.org/t/solving-optimization-of-least-squares-term-with-quadratic-term-with-memory-infeasible-matrix/132599)

<div class="topic-metadata">

**Author:** [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Replies:** 2\
**Last updated:** [September 24, 2025, 2:41pm UTC](https://discourse.julialang.org/t/solving-optimization-of-least-squares-term-with-quadratic-term-with-memory-infeasible-matrix/132599 "2025-09-24T14:41:15Z")

</div>

I want to solve: \\arg \\min\_{\\boldsymbol{x}} \\frac{\\lambda}{2} \\boldsymbol{x}^{T} \\boldsymbol{E}^{T} \\boldsymbol{K} \\boldsymbol{E} \\boldsymbol{x} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{A} \\boldsymbol{x} - \\boldsymbol{y} …

---

## [Solving a Shifted Linear System of 2 Symmetric Positive Semi Definite (SPSD) Matrices](https://discourse.julialang.org/t/solving-a-shifted-linear-system-of-2-symmetric-positive-semi-definite-spsd-matrices/131636)

<div class="topic-metadata">

**Author:** [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Replies:** 31\
**Last updated:** [August 18, 2025, 6:20pm UTC](https://discourse.julialang.org/t/solving-a-shifted-linear-system-of-2-symmetric-positive-semi-definite-spsd-matrices/131636 "2025-08-18T18:20:18Z")

</div>

I have the following linear system: \\left( \\boldsymbol{A} + \\lambda \\boldsymbol{C} \\right) \\boldsymbol{x} = \\boldsymbol{A}^{T} \\boldsymbol{b} Where \\boldsymbol{A}, \\boldsymbol{C} \\in \\mathcal{S}\_{+}^{n} are Symmetric …

---

## [Block matrix linear solve performance](https://discourse.julialang.org/t/block-matrix-linear-solve-performance/129353)

<div class="topic-metadata">

**Author:** [@Karajan](https://discourse.julialang.org/u/Karajan)\
**Replies:** 6\
**Last updated:** [June 15, 2025, 5:41pm UTC](https://discourse.julialang.org/t/block-matrix-linear-solve-performance/129353 "2025-06-15T17:41:51Z")

</div>

Hi there! I have located a bottleneck in my simulations I could use some help with. I think this is mainly a linear algebra problem rather than pure Julia performance, but I know very little about that field so I’m not …

---

## ["I don't like NumPy" - Julia equivalents to the numpy code?](https://discourse.julialang.org/t/i-dont-like-numpy-julia-equivalents-to-the-numpy-code/129052)

<div class="topic-metadata">

**Author:** [@MDSW](https://discourse.julialang.org/u/MDSW)\
**Replies:** 19\
**Last updated:** [May 21, 2025, 7:46pm UTC](https://discourse.julialang.org/t/i-dont-like-numpy-julia-equivalents-to-the-numpy-code/129052 "2025-05-21T19:46:36Z")

</div>

I came across this post and, not being an expert in either NumPy or the how it would be done in Julia, was curious if anyone here could weigh in with idiomatic Julia versions of some of these examples for comparison. No…

---

## [What is a recommended way to solve a linear equation?](https://discourse.julialang.org/t/what-is-a-recommended-way-to-solve-a-linear-equation/128420)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 31\
**Last updated:** [May 8, 2025, 6:48am UTC](https://discourse.julialang.org/t/what-is-a-recommended-way-to-solve-a-linear-equation/128420 "2025-05-08T06:48:34Z")

</div>

I wonder what is a fair way to solve (maybe approximately) a linear equation system Ax = b, at this time. The A may be very large scale and sparse. I might want to use an iterative solution approach (e.g. CG, MINRES etc.…

---

## [Linear system solution not working in CUDA](https://discourse.julialang.org/t/linear-system-solution-not-working-in-cuda/126398)

<div class="topic-metadata">

**Author:** [@eveningsilverfox](https://discourse.julialang.org/u/eveningsilverfox)\
**Replies:** 4\
**Last updated:** [March 1, 2025, 11:51am UTC](https://discourse.julialang.org/t/linear-system-solution-not-working-in-cuda/126398 "2025-03-01T11:51:39Z")

</div>

I am trying to do a linear solve using LU decomposition and ldiv! on my GPU. However, the results from the GPU do not match those from the CPU. Any ideas where I am going wrong? EDIT: I tried using the simple backslash …

---

## [Circular dependency](https://discourse.julialang.org/t/circular-dependency/125794)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [February 11, 2025, 5:42pm UTC](https://discourse.julialang.org/t/circular-dependency/125794 "2025-02-11T17:42:53Z")

</div>

After updating my package KiteModels.jl I get the following warning: ┌ Warning: Circular dependency detected. │ Precompilation will be skipped for dependencies in this cycle: │ ┌ LinearSolve → LinearSolveSparseArraysEx…

---

## [LinearSolve.jl for many values of b?](https://discourse.julialang.org/t/linearsolve-jl-for-many-values-of-b/94980)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 2\
**Last updated:** [December 16, 2024, 2:20pm UTC](https://discourse.julialang.org/t/linearsolve-jl-for-many-values-of-b/94980 "2024-12-16T14:20:47Z")

</div>

I’m writing a package and I really like the idea of LinearSolve.jl, because I want my code to perform well and be flexible: work on CPU or GPU, be differentiable, not allocate, etc. But one of my most important use case…

---

## [Make \`LinearSolve\` factorizations available in a standalone manner](https://discourse.julialang.org/t/make-linearsolve-factorizations-available-in-a-standalone-manner/123260)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 1\
**Last updated:** [November 29, 2024, 7:49pm UTC](https://discourse.julialang.org/t/make-linearsolve-factorizations-available-in-a-standalone-manner/123260 "2024-11-29T19:49:49Z")

</div>

This question was initially posted a few weeks back as an issue in LinearSolve.jl but got no attention there. By reposting it here I’m hoping to generate a bit of discussion about this. As far as I understand the purpos…

---

## [Sparse non-square linear problem](https://discourse.julialang.org/t/sparse-non-square-linear-problem/122650)

<div class="topic-metadata">

**Author:** [@Nichola](https://discourse.julialang.org/u/Nichola)\
**Replies:** 3\
**Last updated:** [November 15, 2024, 1:00am UTC](https://discourse.julialang.org/t/sparse-non-square-linear-problem/122650 "2024-11-15T01:00:17Z")

</div>

I would like to solve Ax = b where A is a sparse non-square array. For example : using SparseArrays using LinearSolve n = 3 m = 4 A = sparse(rand(ComplexF64, m, n)) b = rand(ComplexF64, m) prob = LinearProblem(A, b) …

---

## [How to optimise a linear solve in a hot loop?](https://discourse.julialang.org/t/how-to-optimise-a-linear-solve-in-a-hot-loop/120835)

<div class="topic-metadata">

**Author:** [@marcsgil](https://discourse.julialang.org/u/marcsgil)\
**Replies:** 7\
**Last updated:** [October 3, 2024, 12:55pm UTC](https://discourse.julialang.org/t/how-to-optimise-a-linear-solve-in-a-hot-loop/120835 "2024-10-03T12:55:51Z")

</div>

I have a hot loop that takes the following simplified form: for n in eachindex(result) compute\_A!(A) compute\_b!(b) x = A \\ b result\[n\] = f(x) end Here, A is a tall dense matrix, b is a dense vector, bot…

---

## [Solve Large Scale Underdetermined Linear Equation with per Element Equality Constraint](https://discourse.julialang.org/t/solve-large-scale-underdetermined-linear-equation-with-per-element-equality-constraint/119655)

<div class="topic-metadata">

**Author:** [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Replies:** 16\
**Last updated:** [September 25, 2024, 5:10pm UTC](https://discourse.julialang.org/t/solve-large-scale-underdetermined-linear-equation-with-per-element-equality-constraint/119655 "2024-09-25T17:10:56Z")

</div>

I have the following linear system to solve: \\boldsymbol{A} \\boldsymbol{x} = \\boldsymbol{0}, \\quad \\text{subject to} \\; {x}\_{i} = {v}\_{i} \\; \\forall i \\in \\mathcal{V} Where \\boldsymbol{A} \\in \\mathbb{R}^{m \\times n} w…

---

## [Some iterative solvers in LinearSolve ignore the initial conditions](https://discourse.julialang.org/t/some-iterative-solvers-in-linearsolve-ignore-the-initial-conditions/118903)

<div class="topic-metadata">

**Author:** [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Replies:** 2\
**Last updated:** [September 1, 2024, 2:57pm UTC](https://discourse.julialang.org/t/some-iterative-solvers-in-linearsolve-ignore-the-initial-conditions/118903 "2024-09-01T14:57:32Z")

</div>

Hello, I think I might be doing something wrong, but it seems that none of the Krylov methods in LinearSolve are using the initial guess I provide. (In the small example below, the initial guess is the true solution.) i…

---

## [Convergence of gmres from IterativeSolvers in minimal examples](https://discourse.julialang.org/t/convergence-of-gmres-from-iterativesolvers-in-minimal-examples/115852)

<div class="topic-metadata">

**Author:** [@Pablo\_Marchant](https://discourse.julialang.org/u/Pablo_Marchant)\
**Replies:** 7\
**Last updated:** [June 23, 2024, 2:55pm UTC](https://discourse.julialang.org/t/convergence-of-gmres-from-iterativesolvers-in-minimal-examples/115852 "2024-06-23T14:55:07Z")

</div>

Hi all, I’m trying to see if I can apply gmres in a domain specific problem I have, where I need to solve a system Ax=b where A is a non-symmetric square block tridiagonal matrix. I have not managed to get this to work,…

---

## [Solving linear system BC = X where B is a symmetric positive semi-definite matrix](https://discourse.julialang.org/t/solving-linear-system-bc-x-where-b-is-a-symmetric-positive-semi-definite-matrix/115280)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 7\
**Last updated:** [June 6, 2024, 4:19pm UTC](https://discourse.julialang.org/t/solving-linear-system-bc-x-where-b-is-a-symmetric-positive-semi-definite-matrix/115280 "2024-06-06T16:19:18Z")

</div>

I am trying to solve for X in BC=X where B is a symmetric positive semi-definite matrix and X is simply a vector with 1 in all of it’s entries. As far as I understand, this can be solved using C=B\\X , but I was wondering…

---

## [Is there any easy-to-use parallel linear solver in Julia?](https://discourse.julialang.org/t/is-there-any-easy-to-use-parallel-linear-solver-in-julia/95867)

<div class="topic-metadata">

**Author:** [@maphdze](https://discourse.julialang.org/u/maphdze)\
**Replies:** 5\
**Last updated:** [June 3, 2024, 10:02pm UTC](https://discourse.julialang.org/t/is-there-any-easy-to-use-parallel-linear-solver-in-julia/95867 "2024-06-03T22:02:13Z")

</div>

I am wondering that if there are some easy-to-use parallel linear solvers in Julia? I have tried MUMPS.jl, but if you want to parallelize it, you have to use MPI.jl, then other parts of the code will be executed ‘number…

---

## [Problem with LinearSolve.jl and PardisoJL()](https://discourse.julialang.org/t/problem-with-linearsolve-jl-and-pardisojl/113595)

<div class="topic-metadata">

**Author:** [@MichelJuillard](https://discourse.julialang.org/u/MichelJuillard)\
**Replies:** 2\
**Last updated:** [April 28, 2024, 8:27pm UTC](https://discourse.julialang.org/t/problem-with-linearsolve-jl-and-pardisojl/113595 "2024-04-28T20:27:15Z")

</div>

I encounter a problem using LinearSolve to solve a sparse linear system with PardisoJL(): The test case, test\_PardisoJL.jl: using Pkg Pkg.activate(; temp=true) Pkg.add("LinearSolve") Pkg.add("Pardiso") using LinearAlg…

---

## [Trying to solve KU=F, FEA problem, with roughly 5-10million DOFs](https://discourse.julialang.org/t/trying-to-solve-ku-f-fea-problem-with-roughly-5-10million-dofs/112480)

<div class="topic-metadata">

**Author:** [@balaji\_sriram](https://discourse.julialang.org/u/balaji_sriram)\
**Replies:** 7\
**Last updated:** [April 5, 2024, 2:20pm UTC](https://discourse.julialang.org/t/trying-to-solve-ku-f-fea-problem-with-roughly-5-10million-dofs/112480 "2024-04-05T14:20:48Z")

</div>

Hi, Im new to Julia, but i have experience with MATLAB, im trying to solve a KU=F, FEA type problem , with over 1 million DOFs. Note: the K matrix is sparse, symmetric, positive definite and banded. In matlab, the comman…

---

## [Seeking Feedback on Robust Solution for Consistent but ill-conditioned Linear System with Real Symmetric Positive Semidefinite Matrices](https://discourse.julialang.org/t/seeking-feedback-on-robust-solution-for-consistent-but-ill-conditioned-linear-system-with-real-symmetric-positive-semidefinite-matrices/111957)

<div class="topic-metadata">

**Author:** [@swanchristmas](https://discourse.julialang.org/u/swanchristmas)\
**Replies:** 1\
**Last updated:** [March 27, 2024, 2:45am UTC](https://discourse.julialang.org/t/seeking-feedback-on-robust-solution-for-consistent-but-ill-conditioned-linear-system-with-real-symmetric-positive-semidefinite-matrices/111957 "2024-03-27T02:45:18Z")

</div>

Hello everyone, I’m currently grappling with a challenging problem involving a linear system that’s consistent but ill-conditioned due to the nature of the matrices involved. I’ve devised a potential solution, but I’m s…

---

## [How do you speed up the linear sparse solver in Zygote?](https://discourse.julialang.org/t/how-do-you-speed-up-the-linear-sparse-solver-in-zygote/111801)

<div class="topic-metadata">

**Author:** [@ToPo](https://discourse.julialang.org/u/ToPo)\
**Replies:** 44\
**Last updated:** [March 24, 2024, 7:18am UTC](https://discourse.julialang.org/t/how-do-you-speed-up-the-linear-sparse-solver-in-zygote/111801 "2024-03-24T07:18:47Z")

</div>

I have confirmed that the standard Julia solver (backslash) can be used in the automatic differentiation of Zygote. Below is a sample program. (This program calculates the gradient.) However, while the forward computat…

---

## [How to add other arguments to function turned to LinearOperator?](https://discourse.julialang.org/t/how-to-add-other-arguments-to-function-turned-to-linearoperator/110475)

<div class="topic-metadata">

**Author:** [@erny123](https://discourse.julialang.org/u/erny123)\
**Replies:** 3\
**Last updated:** [February 21, 2024, 9:16pm UTC](https://discourse.julialang.org/t/how-to-add-other-arguments-to-function-turned-to-linearoperator/110475 "2024-02-21T21:16:47Z")

</div>

Trying to write a matrix-free solver using LinearOperators.jl and Krylov.jl However, from this: Introduction to Linear Operators I’m seeing that you can only use functions that follow the 5-argument (and 3) mul! operat…

---

## [Neumann series expander for solving linear problem?](https://discourse.julialang.org/t/neumann-series-expander-for-solving-linear-problem/99736)

<div class="topic-metadata">

**Author:** [@ehgus](https://discourse.julialang.org/u/ehgus)\
**Replies:** 3\
**Last updated:** [June 2, 2023, 1:48am UTC](https://discourse.julialang.org/t/neumann-series-expander-for-solving-linear-problem/99736 "2023-06-02T01:48:49Z")

</div>

Is there a package providing Neumann series expansion for solving linear problem? I usually solve Ax = b by calculating x = b + Sb + SSb + SSSb ... where S = 1- A, and I’d like to convert my matlab code into Julia. So …

---

## [Avoiding computing inverse of matrix, don't think it's possible in my case](https://discourse.julialang.org/t/avoiding-computing-inverse-of-matrix-dont-think-its-possible-in-my-case/98478)

<div class="topic-metadata">

**Author:** [@p\_f](https://discourse.julialang.org/u/p_f)\
**Replies:** 4\
**Last updated:** [May 8, 2023, 4:03pm UTC](https://discourse.julialang.org/t/avoiding-computing-inverse-of-matrix-dont-think-its-possible-in-my-case/98478 "2023-05-08T16:03:53Z")

</div>

I have a system of (6+3N) equations given by: A\*inv(B)\*C\*dX = K which I then solve using dX = (A\*inv(B)\*C) \\ K A\*inv(B)\*C form a square (6+3N) matrix but the submatrices have sizes: A: (6+3N) x (6N) B: (6N) x (6N) …

---

## [Matrix-Free/Function-Only Linear Solves](https://discourse.julialang.org/t/matrix-free-function-only-linear-solves/95411)

<div class="topic-metadata">

**Author:** [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Replies:** 5\
**Last updated:** [March 14, 2023, 7:26pm UTC](https://discourse.julialang.org/t/matrix-free-function-only-linear-solves/95411 "2023-03-14T19:26:08Z")

</div>

Suppose I want to solve a system of equations A\*x = b, and I have a function A\_func such that A\_func(x) = A\*x. How could I go about solving the system of equations without constructing the matrix A? I could construct th…

---

## [LinearSolve is changing their solutions](https://discourse.julialang.org/t/linearsolve-is-changing-their-solutions/95028)

<div class="topic-metadata">

**Author:** [@Noel\_Araujo](https://discourse.julialang.org/u/Noel_Araujo)\
**Replies:** 3\
**Last updated:** [February 22, 2023, 7:06pm UTC](https://discourse.julialang.org/t/linearsolve-is-changing-their-solutions/95028 "2023-02-22T19:06:52Z")

</div>

I am solving some Linear Systems using LinearSolve.jl and its caching system. I was fine doing fine with this example using LinearSolve n = 4 A = rand(n, n) b = \[rand(n) for i ∈ 1:3\] ## everything is 'true' let lin…

---

## [Is there a reliable package for solving simple equation system?](https://discourse.julialang.org/t/is-there-a-reliable-package-for-solving-simple-equation-system/94877)

<div class="topic-metadata">

**Author:** [@Kim](https://discourse.julialang.org/u/Kim)\
**Replies:** 4\
**Last updated:** [February 19, 2023, 8:14pm UTC](https://discourse.julialang.org/t/is-there-a-reliable-package-for-solving-simple-equation-system/94877 "2023-02-19T20:14:20Z")

</div>

Today I am working on finding the insections of a line and a infinite long cylinder. It is a simple math problem that can be solved by hand and very easy for Matlab. However, it looks like tough for Julia which is inspir…

---

## [LinearSolve for a matrix-free problem](https://discourse.julialang.org/t/linearsolve-for-a-matrix-free-problem/91308)

<div class="topic-metadata">

**Author:** [@Lucas\_S\_Campos](https://discourse.julialang.org/u/Lucas_S_Campos)\
**Replies:** 1\
**Last updated:** [December 6, 2022, 3:55pm UTC](https://discourse.julialang.org/t/linearsolve-for-a-matrix-free-problem/91308 "2022-12-06T15:55:48Z")

</div>

I am trying to use LinearSolve for a matrix-free problem. I tried using the functionoperator from SciMLOperators and it does seem to work when doing matrix multiplication. However when trying to solve a linear system it…

---

## [The objective function sparse is not supported by JuMP in julia](https://discourse.julialang.org/t/the-objective-function-sparse-is-not-supported-by-jump-in-julia/89726)

<div class="topic-metadata">

**Author:** [@thiagoselias](https://discourse.julialang.org/u/thiagoselias)\
**Replies:** 9\
**Last updated:** [November 3, 2022, 8:28pm UTC](https://discourse.julialang.org/t/the-objective-function-sparse-is-not-supported-by-jump-in-julia/89726 "2022-11-03T20:28:22Z")

</div>

model = Model(Gurobi.Optimizer) @objective(model, Min, DRect + 0.6DBlad + 0.6DBO) The objective function sparse(\[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …

---

## [Can you solve wide matrices with LinearSolve.jl?](https://discourse.julialang.org/t/can-you-solve-wide-matrices-with-linearsolve-jl/89595)

<div class="topic-metadata">

**Author:** [@Ethan\_Leonard](https://discourse.julialang.org/u/Ethan_Leonard)\
**Replies:** 4\
**Last updated:** [November 2, 2022, 3:36am UTC](https://discourse.julialang.org/t/can-you-solve-wide-matrices-with-linearsolve-jl/89595 "2022-11-02T03:36:27Z")

</div>

New user here, trying to find an efficient way to iteratively solve lots of wide matrices in a loop. I came across LinearSolve.jl , but haven’t seen anything in the documentation about whether it can solve non-square ma…

[Next page](https://discourse.julialang.org/tag/linearsolve/1153.md?match_all_tags=true&page=1&tags%5B%5D=linearsolve)
