# Which pivoting strategy is used in \`LinearAlgebra.bunchkaufman()\` function for Bunch-Kaufman factorization when we still not using rook pivoting?

**URL:** https://discourse.julialang.org/t/which-pivoting-strategy-is-used-in-linearalgebra-bunchkaufman-function-for-bunch-kaufman-factorization-when-we-still-not-using-rook-pivoting/116399
**Category:** General Usage
**Tags:** linearalgebra
**Created:** [June 29, 2024, 8:21pm UTC](https://discourse.julialang.org/t/which-pivoting-strategy-is-used-in-linearalgebra-bunchkaufman-function-for-bunch-kaufman-factorization-when-we-still-not-using-rook-pivoting/116399 "2024-06-29T20:21:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![shubh\_b](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shubh_b/32/20697_2.png) [@shubh\_b](https://discourse.julialang.org/u/shubh_b)
#### Post date: [June 29, 2024, 8:21pm UTC](https://discourse.julialang.org/t/which-pivoting-strategy-is-used-in-linearalgebra-bunchkaufman-function-for-bunch-kaufman-factorization-when-we-still-not-using-rook-pivoting/116399/1 "2024-06-29T20:21:02Z")

</div>

When trying to do Bunch-Kaufman factorization of the symmetric matrix `A` like below:

```julia
julia> using LinearAlgebra

julia> M = [4 12 -16; 9.5 37 -43; 11 -6.5 9];

julia> A = Symmetric(M, :L)
3×3 Symmetric{Float64, Matrix{Float64}}:
  4.0 9.5 11.0
  9.5 37.0 -6.5
 11.0 -6.5 9.0

julia> S = bunchkaufman(A) # By default rook::Bool=false
BunchKaufman{Float64, Matrix{Float64}, Vector{Int64}}
D factor:
3×3 Tridiagonal{Float64, Vector{Float64}}:
 9.0 0.0 ⋅
 0.0 32.3056 0.0
  ⋅ 0.0 -18.8641
L factor:
3×3 UnitLowerTriangular{Float64, Matrix{Float64}}:
  1.0 ⋅ ⋅
 -0.722222 1.0 ⋅
  1.22222 0.539983 1.0
permutation:
3-element Vector{Int64}:
 3
 2
 1

julia> S.P * S.L * S.D * S.L' * S.P' ≈ A
true

```

We can see to get the matrix `A` back by multiplying the components of the BunchKaufman factorization object `S`. Here we can notice `S.P`, the permutation matrix is not an identity matrix!

```julia
julia> S.P
3×3 Matrix{Float64}:
 0.0 0.0 1.0
 0.0 1.0 0.0
 1.0 0.0 0.0

```

Although in this case, if by default rook pivoting is not used in the function, which particular pivoting strategy is used here then?
