Skip to content

Commit

Permalink
test(matrices): refactor test_linear_algebra_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mfasi committed Sep 22, 2024
1 parent c57ade4 commit d0f0aac
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ function test_linear_algebra_functions(A::AbstractMatrix)
results = Dict{Function,Bool}()

# linear algebra functions
@try_catch results[isdiag] = isdiag(A) == isdiag(matrix)
@try_catch results[ishermitian] = ishermitian(A) == ishermitian(matrix)
@try_catch results[issymmetric] = issymmetric(A) == issymmetric(matrix)
@try_catch results[adjoint] = adjoint(A) adjoint(matrix)
@try_catch results[transpose] = transpose(A) transpose(matrix)
@try_catch results[det] = det(A) determinant
@try_catch results[eigvals] = eigvals(A) eigvals(matrix)

property_functions = [isdiag, ishermitian, issymmetric]
# https://github.com/JuliaLang/julia/issues/55404
if VERSION >= v"1.10"
@try_catch results[isposdef] = isposdef(A) == isposdef(matrix)
append!(property_functions, [isposdef])
end
for func in property_functions
@try_catch results[func] = func(A) == func(matrix)
end

if determinant != 0
@try_catch results[inv] = inv(A) inv(matrix)
end
computation_functions = [adjoint, transpose, det, eigvals]
if determinant != 0
append!(computation_functions, [inv])
end
for func in property_functions
@try_catch results[func] = func(A) func(matrix)
end

if all(values(results))
Expand Down

0 comments on commit d0f0aac

Please sign in to comment.