- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.7k
          Reroute algebraic functions for Symmetric/Hermitian through triangular
          #52942
        
          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
Conversation
Symmetric/Hermitian through triangular
      | This PR exceeds my most optimistic expectations. Note that it doesn't work for mismatched uplo, though, because that will be wrapped by  function matrix_sum(T)
   d = 2
   a = Hermitian(Matrix{T}(undef,d,d),:U)
   b = Hermitian(Matrix{T}(undef,d,d),:L)
   for i=1:d
       for j=i:d
           a.data[i,j] = T(1)
           b.data[j,i] = T(1)
       end
   end
   a+b
end     | 
| Yes, fixing the mismatched  | 
| The addition/subtraction with mismatched  julia> matrix_sum(BigFloat)
2×2 Hermitian{BigFloat, Matrix{BigFloat}}:
 2.0  2.0
 2.0  2.0 | 
195cea2    to
    2c5bd94      
    Compare
  
    | This should be good to go | 
| Gentle bump | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to me (although i do kind of hate that we are doing all of this with the uplo flag. Using characters is ugly. None of that is the fault of this PR though.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
This ensures that only the triangular indices are accessed for strided parent matrices. Fix #52895
This also provides a speed-up in several common cases (allocations mentioned only when they differ):
-Hreal(H)H + HH + H2isdiag(H)I'm not entirely certain why
isdiag(H)allocates on master, as union splitting should handle this automatically, but manually splitting the union appears to help.