You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test Diagonal functions against non-dense matrices (#1316)
In the `Diagonal` tests, we often compare results of function
evaluations with that for the corresponding dense matrix. E.g., with `D
= Diagonal(::Vector)` and `DM = Matrix(D)`,
```julia
@test log(Diagonal(abs.(D.diag))) ≈ log(abs.(DM)) atol=n^3*eps(relty)
```
The problem with this is that, in the dense method `log(::Matrix)`, we
check if the matrix is diagonal, and dispatch to the `Diagonal` methods
for performance. This makes this test useless, as we are comparing
identical methods.
In this PR, I've changed the type of `DM` to be `Hermitian` for real
matrices, and `UpperTriangular` for complex ones. Both of these types
have special methods for `log`, at least. The `Hermitian` matrices have
special methods for all the trigonometric functions, and for the complex
matrices, we wrap these in a custom wrapper `NotDiagonal` that avoids
the `isdiag` paths. This wrapper lies about the structure, but it should
be ok for the testing purposes as we ensure that we are comparing
different paths.
0 commit comments