Skip to content

Conversation

@lkdvos
Copy link
Member

@lkdvos lkdvos commented Oct 14, 2025

This PR addresses #76:

  • I've removed the hard ishermitian checks from the YALAPACK implementations. Since these already take an argument uplo, and are pretty low-level, I feel like these should not check for hermitian properties, as you may want to provide an upper or lower triangular array instead.
  • I've added an optional hermitian_tol argument to the algorithm structs to control the precision with which the input is verified.
  • I've added some default tolerance to allow for slightly non-hermitian inputs by default.

The main issue is that the previous implementation of the approximate hermitian check actually has to allocate a new array, so I adapted this to no longer require the temporary array. However, I don't think I can do this for arbitrary norm function handles. Currently, I just removed this feature. I think in general we could have different p-norms, but I'd say we just add that option if we ever need it?

@Jutho
Copy link
Member

Jutho commented Oct 15, 2025

This is currently failing for GPU arrays. How should we proceed for not. @kshyatt , what is the best way to proceed? Simply comment out the hermiticity check from the GPU eigh implementations for now? Or overload ishermitian for GPU arrays to use the general fallback?

@Jutho
Copy link
Member

Jutho commented Oct 15, 2025

Can you add a simple test to see if the error calculation is now correct. Something like:

A = randn(T, (m, m))
A = A + A' + sqrt(eps(real(T))) * randn(T, (m, m))
ϵ = norm(A - A')
@test !ishermitian(A; atol = (999//1000) * ϵ)
@test ishermitian(A; atol = (1001//1000) * ϵ)

@lkdvos lkdvos force-pushed the ld-hermitian branch 2 times, most recently from 61dab5a to 872c7b9 Compare October 15, 2025 20:40
return strided_ishermitian_exact(A, Val(true); kwargs...)
end
function isantihermitian_approx(A; atol, rtol, kwargs...)
return norm(project_hermitian(A; kwargs...)) max(atol, rtol * norm(A))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use the norm provided in kwargs here? Or do we not want to support this option (would be fine with me, I am very happy with the standard Frobenius norm).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also above for ishermitian_approx.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I want to support that option for now, because I don't think I really want to deal with the strided_ishermitian_approx implementation that would be required for that.

@lkdvos
Copy link
Member Author

lkdvos commented Oct 16, 2025

Thanks @kshyatt for the GPU additions, I think this PR is now passing everything. I'll let the tests finish, and then I think this is good to go, there shouldn't be any interference with the tests that got added to main in the meantime.

@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 86.66667% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ixAlgebraKitAMDGPUExt/MatrixAlgebraKitAMDGPUExt.jl 42.85% 4 Missing ⚠️
...MatrixAlgebraKitCUDAExt/MatrixAlgebraKitCUDAExt.jl 50.00% 4 Missing ⚠️
src/common/matrixproperties.jl 93.61% 3 Missing ⚠️
src/implementations/eigh.jl 95.23% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/common/defaults.jl 100.00% <100.00%> (ø)
src/implementations/projections.jl 96.10% <100.00%> (+0.10%) ⬆️
src/yalapack.jl 69.46% <ø> (-0.31%) ⬇️
src/implementations/eigh.jl 94.02% <95.23%> (-0.46%) ⬇️
src/common/matrixproperties.jl 89.69% <93.61%> (+1.75%) ⬆️
...ixAlgebraKitAMDGPUExt/MatrixAlgebraKitAMDGPUExt.jl 64.44% <42.85%> (-1.41%) ⬇️
...MatrixAlgebraKitCUDAExt/MatrixAlgebraKitCUDAExt.jl 66.66% <50.00%> (-1.52%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lkdvos lkdvos enabled auto-merge (squash) October 16, 2025 12:39
@lkdvos lkdvos requested a review from Jutho October 16, 2025 12:39
@lkdvos lkdvos merged commit 50eb537 into main Oct 16, 2025
10 checks passed
@lkdvos lkdvos deleted the ld-hermitian branch October 16, 2025 22:37
@lkdvos lkdvos mentioned this pull request Nov 14, 2025
lkdvos referenced this pull request Nov 14, 2025
* Bump v0.6

* rename `gaugefix` -> `fixgauge`

* reduce unnecessary warnings

* fix `copy_input` signatures in Mooncake tests

* Add changelog to docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Necessity of the hard symmetry/hermiticity checks in eigh(!) decompositions

3 participants