Skip to content

Commit 0cbf85f

Browse files
authored
Check approx equality in bunchkaufman docstring (#1251)
Instead of subtracting two matrices to check that the result is zero, we may directly compare these. I've used `isapprox` here, as the floating-point results are generally expected to hold only approximately, although the exact equality seems to hold in this example.
1 parent 5e53d12 commit 0cbf85f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/bunchkaufman.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,8 @@ julia> d, u, p = S; # destructuring via iteration
182182
julia> d == S.D && u == S.U && p == S.p
183183
true
184184
185-
julia> S.U*S.D*S.U' - S.P*A*S.P'
186-
2×2 Matrix{Float64}:
187-
0.0 0.0
188-
0.0 0.0
185+
julia> S.U * S.D * S.U' ≈ S.P * A * S.P'
186+
true
189187
190188
julia> S = bunchkaufman(Symmetric(A, :L))
191189
BunchKaufman{Float64, Matrix{Float64}, Vector{Int64}}
@@ -202,10 +200,8 @@ permutation:
202200
2
203201
1
204202
205-
julia> S.L*S.D*S.L' - A[S.p, S.p]
206-
2×2 Matrix{Float64}:
207-
0.0 0.0
208-
0.0 0.0
203+
julia> S.L * S.D * S.L' ≈ A[S.p, S.p]
204+
true
209205
```
210206
"""
211207
bunchkaufman(A::AbstractMatrix{T}, rook::Bool=false; check::Bool = true) where {T} =

0 commit comments

Comments
 (0)