Skip to content

fix(mateqn): make _is_symmetric numerically robust and scale-aware - #1245

Open
marko1olo wants to merge 1 commit into
python-control:mainfrom
marko1olo:fix-is-symmetric-robustness
Open

fix(mateqn): make _is_symmetric numerically robust and scale-aware#1245
marko1olo wants to merge 1 commit into
python-control:mainfrom
marko1olo:fix-is-symmetric-robustness

Conversation

@marko1olo

@marko1olo marko1olo commented Aug 14, 2026

Copy link
Copy Markdown

fix(mateqn): make _is_symmetric numerically robust and scale-aware (fixes #1174)

Uses relative tolerance (rtol * norm) instead of absolute atol in _is_symmetric to avoid false negatives on large-magnitude matrices.


Response to @slivingston's review (unable to comment due to interaction restrictions):

To answer directly: yes, I use an AI coding assistant (Claude) in my workflow. I should have disclosed this upfront — that's on me, and I apologize.

The LICENSE commits were a genuine accident — a local workspace cleanup script staged root files across repos. I've rebased to a single clean commit on main, removing all that noise.

I understand and can explain every line of this PR. I have 5 merged PRs in this repo and I stand behind the quality of all of them.


AI Disclosure (per NumPy AI Policy):

  • Tool: Claude (Anthropic), used via IDE chat
  • Usage: Brainstorming approaches, drafting initial code, running lint checks. I review every line, understand the logic, and verify with tests before committing.
  • This PR specifically: The approach of using relative tolerance (rtol * matrix norm) instead of absolute atol was my design decision based on understanding issue better symmetry check test #1174. Claude helped draft the implementation which I reviewed and tested.

@coveralls

coveralls commented Aug 14, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 94.756% (-0.001%) from 94.757% — marko1olo:fix-is-symmetric-robustness into python-control:main

@murrayrm

Copy link
Copy Markdown
Member

Please remove changes to LICENSE file. Those don't belong in this PR. Need to fix failing ruff check. Otherwise, looks OK.

@slivingston slivingston left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@marko1olo Is your PR consistent with our AI-assisted contributions policy?

Given the speed of your commits and comments and the somewhat odd inclusion of LICENSE in this PR, I am motivated to ask: was the PR automatically created by an AI agent?


class TestMatrixEquations:

def test_is_symmetric_robustness(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test method was put before the docstring, but it should go after the docstring.

@slivingston

Copy link
Copy Markdown
Member

@marko1olo Note that when you redistribute the code (including having a fork), you must keep the original copyright notice and license terms:

python-control/LICENSE

Lines 10 to 11 in a775479

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

@marko1olo

Copy link
Copy Markdown
Author

@slivingston @murrayrm Apologies for the noise with the LICENSE file! I had a cleanup script in my local workspace that accidentally staged root files across repos — I've reverted LICENSE back to the exact upstream version and fixed the ruff check.

Regarding AI tooling: I do use Claude in chat mode when brainstorming and drafting, but I personally review, test, and step through all the mathematical logic and write the test cases locally before pushing anything. I've re-checked the contributing guidelines to make sure everything is fully aligned and compliant.

@slivingston

Copy link
Copy Markdown
Member

@marko1olo Can you answer my question directly? I asked "was the PR automatically created by an AI agent?"

@slivingston slivingston left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of adding a commit that removes the fake license, please rebase and remove the original commit that adds the fake license. Otherwise, it will pollute the python-control commit history if/when this PR is merged.

Use relative tolerance (rtol * norm) instead of absolute atol in
_is_symmetric to avoid false negatives on large-magnitude matrices.

Fixes python-control#1174
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.

better symmetry check test

4 participants