# Solving linear system BC = X where B is a symmetric positive semi-definite matrix

**URL:** https://discourse.julialang.org/t/solving-linear-system-bc-x-where-b-is-a-symmetric-positive-semi-definite-matrix/115280
**Category:** Performance
**Tags:** linearalgebra, matrices, linearsolve
**Created:** [June 6, 2024, 12:52pm UTC](https://discourse.julialang.org/t/solving-linear-system-bc-x-where-b-is-a-symmetric-positive-semi-definite-matrix/115280 "2024-06-06T12:52:10Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Uranium238](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uranium238/32/209706_2.png) [@Uranium238](https://discourse.julialang.org/u/Uranium238)
#### Post date: [June 6, 2024, 2:23pm UTC](https://discourse.julialang.org/t/solving-linear-system-bc-x-where-b-is-a-symmetric-positive-semi-definite-matrix/115280/5 "2024-06-06T14:23:13Z")

</div>

> [@ChrisRackauckas](#):
>
> Which is better depends on size

The matrices I would be working with are in the order of `6x6`. Using the `LinearSolve.KrylovJL_CG()` seems to be causing numerical instability at the later stages of the DIIS solver [for Coupled Cluster Equations](https://discourse.julialang.org/t/how-to-employ-nlsolve-to-a-function-which-has-parameters-which-are-difficult-to-calculate/115126) I am trying to implement. The matrices I am trying to work with have small values of entries like

```julia
6×6 Symmetric{Float64, Matrix{Float64}}:
 1.72458e-16 1.06023e-16 1.01555e-16 9.45545e-17 8.19558e-17 7.61703e-17
 1.06023e-16 8.87195e-17 8.45981e-17 7.75149e-17 6.32949e-17 5.68955e-17
 1.01555e-16 8.45981e-17 8.3458e-17 7.63146e-17 6.20451e-17 5.55372e-17
 9.45545e-17 7.75149e-17 7.63146e-17 7.54038e-17 5.98022e-17 5.33082e-17
 8.19558e-17 6.32949e-17 6.20451e-17 5.98022e-17 5.52861e-17 4.88773e-17
 7.61703e-17 5.68955e-17 5.55372e-17 5.33082e-17 4.88773e-17 4.73348e-17

```

As of now I have not provided the exact code where the `LinearSolve` is used, but would be happy to provide if necessary.

---

_[View the full topic](https://discourse.julialang.org/t/solving-linear-system-bc-x-where-b-is-a-symmetric-positive-semi-definite-matrix/115280)._
