Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't check approximate equality elementwise #110

Merged
merged 1 commit into from
Sep 13, 2022
Merged

Conversation

stevengj
Copy link
Member

In #109, you added an isapproxskewhermitian that checks A[i,j] ≈ -A[j,i]' elementwise. This is generally a bad way to compare arrays. Instead, you generally want to compare whole-array norms, e.g. compare ‖A+A'‖ to ‖A‖. For example, this result makes little sense:

julia> A = [0 1 1e-16; -1 0 1; 0 -1 0]
3×3 Matrix{Float64}:
  0.0   1.0  1.0e-16
 -1.0   0.0  1.0
  0.0  -1.0  0.0

julia> isapproxskewhermitian(A)
false

julia> norm(A+A') / norm(A)
7.071067811865474e-17

Since this function is only used for testing, it makes more sense to just define isapproxskewhermitian(A) = A ≈ -A' (where on arrays compares whole-array norms) in runtests.jl, rather than trying to export something.

I also removed the export for to_symtridiagonal, which is mostly an internal implementation detail and is not documented. If there is some need for this we could always document it and export it. (It would make sense to add documentation for it and other internal functions anyway, of course.)

@stevengj stevengj requested a review from smataigne September 10, 2022 17:07
@codecov
Copy link

codecov bot commented Sep 10, 2022

Codecov Report

Base: 88.81% // Head: 88.74% // Decreases project coverage by -0.06% ⚠️

Coverage data is based on head (7739f0b) compared to base (9f7fa85).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
- Coverage   88.81%   88.74%   -0.07%     
==========================================
  Files           9        9              
  Lines        1430     1422       -8     
==========================================
- Hits         1270     1262       -8     
  Misses        160      160              
Impacted Files Coverage Δ
src/skewhermitian.jl 83.72% <ø> (-0.96%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@smataigne smataigne merged commit 2c05595 into main Sep 13, 2022
@stevengj stevengj mentioned this pull request Sep 17, 2022
Closed
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.

2 participants