Skip to content

Commit

Permalink
Set the input to EVD to be weighted by correlation (#428)
Browse files Browse the repository at this point in the history
* Set the input to EVD to be weighted by correlation

* consolidate EVD call
  • Loading branch information
scottstanie authored Oct 10, 2024
1 parent 6802001 commit da4a875
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/dolphin/phase_link/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ def process_coherence_matrices(
"""
rows, cols, n, _ = C_arrays.shape

evd_eig_vals, evd_eig_vecs = eigh_largest_stack(C_arrays * jnp.abs(C_arrays))
if use_evd:
# EVD
evd_eig_vals, evd_eig_vecs = eigh_largest_stack(C_arrays)
eig_vals, eig_vecs = evd_eig_vals, evd_eig_vecs
estimator = jnp.zeros(eig_vals.shape, dtype=bool)
else:
Expand Down Expand Up @@ -449,7 +449,6 @@ def process_coherence_matrices(
inv_has_nans_3d = jnp.tile(inv_has_nans[:, :, None], (1, 1, n))

# For EVD, or places where inverting |Gamma| failed: fall back to computing EVD
evd_eig_vals, evd_eig_vecs = eigh_largest_stack(C_arrays)
eig_vecs = lax.select(
inv_has_nans_3d,
# Run this on True: EVD, since we failed to invert:
Expand Down

0 comments on commit da4a875

Please sign in to comment.