Skip to content

Conversation

@jpbrodrick89
Copy link
Contributor

Currently, is_symmetric returns True for PSD/NSD matrices. This led to failing test in test_well_posed.py when we changed our transpose rules, this should be a minimal fix.

Note we could go all out and add is_hermitian tests and .H helper function for less verbosity, but as I think we're not really prioritising complex support right now (e..g see comment in CG solver) that can be delayed for now.

…dentityLinearOperator to avoid test failures
@jpbrodrick89
Copy link
Contributor Author

Can confirm only one failing test now

Copy link
Owner

@patrick-kidger patrick-kidger left a comment

Choose a reason for hiding this comment

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

One comment only, LGTM!

Comment on lines +1517 to +1520
def _has_real_dtype(operator) -> bool:
"""Check if all dtypes in an operator's structure are real (not complex)."""
leaves = jtu.tree_leaves(operator.in_structure())
return all(jnp.issubdtype(leaf.dtype, jnp.floating) for leaf in leaves)
Copy link
Owner

Choose a reason for hiding this comment

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

We should probably check the out_structure as well? (Even if the only codepath at the moment is for a posdef/negdef operator, for which the new check ensure this is already true.)

Copy link
Owner

Choose a reason for hiding this comment

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

Also this seems like it might produce a silent flake if e.g. an integer dtype somehow slips through our floating-point-casting elsewhere. Perhaps we should explicitly check for floating, complex, and if neither then raise an error?

@patrick-kidger patrick-kidger merged commit 09a31b3 into patrick-kidger:main Feb 9, 2026
1 check failed
@patrick-kidger
Copy link
Owner

Okay, deciding to go ahead and merge as this is blocking other stuff I'm working on :D (I'll incorporate my comment into #203.)

@jpbrodrick89
Copy link
Contributor Author

jpbrodrick89 commented Feb 9, 2026

Ah, sorry, i actually addressed your comment and committed but I must have tried to push to your repo rather than my fork and didn't notice the error message. 🤦‍♂️ Will rebase my other PRs on yours when that's merged. Thanks!

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