Skip to content

Retranslate MB03XU; fix ill-posed MB04TB/AB13FD tests - #21

Merged
jamestjsp merged 4 commits into
mainfrom
claude/nifty-greider-eaf15f
Oct 12, 2026
Merged

jamestjsp merged 4 commits into
mainfrom
claude/nifty-greider-eaf15f

Conversation

@jamestjsp

Copy link
Copy Markdown
Owner

Summary

  • MB03XU bug: in src/MB/mb03xu.c, three of the four transpose branches were placeholder stubs and the fourth was also wrong. Any MB04TB call that took the blocked path (ilo≥2, n ≳ 140) returned wrong results. That also affects mb03xd, ab13dd and ab13hd. Retranslated statement-for-statement from MB03XU.f, using 1-based access macros. Results now match Fortran exactly in all four transpose combinations.
  • MB04TB test: the old Fortran-driver test used badly ill-conditioned inputs: a 1e-16 input change moves the output by about 0.5, and gfortran's sin/cos differ from numpy's in the last bit. It also never reached the blocked path (with ilo=1, nb ≥ nh). Replaced it with a ctypes test that passes Fortran identical inputs (n=200, ilo=2, ldwork=30000, so nb=9), plus a blocked-vs-unblocked (mb04ts) test that needs no Fortran library.
  • AB13FD test: on Accelerate, Fortran also returns info=1, with beta/omega identical to C's. Reference LAPACK gives info=0. The test now accepts info of 0 or 1 and adds a strict comparison against Fortran.
  • Added a reference_cdll() helper in tests/python/fortran_reference.py.

Test plan

  • Targeted ab13fd/mb04tb/mb03xu tests pass against CTRLSYS_FORTRAN_REFERENCE_LIB; the 20 new MB03XU/MB04TB tests fail on the old code
  • Full suite: 6816 passed; 9 failures are missing SLICOT-Reference/examples/data (submodule not checked out in this worktree), unrelated
  • check_translation_smells.py clean
  • ASAN Docker: 64 passed, 17 skipped (Fortran-comparison tests; the image has no reference library), no sanitizer reports

🤖 Generated with Claude Code

- mb03xu: 3 of 4 branches were stubs, 4th wrong; blocked MB04TB
  (ilo>=2, n>~140) gave garbage. Literal retranslation, bitwise
  match vs Fortran.
- mb04tb test: old inputs ill-conditioned + never hit blocked path;
  replace with ctypes differential (n=200, ilo=2) + blocked vs mb04ts.
- ab13fd: info=1 on Accelerate matches Fortran; accept 0/1, add
  Fortran differential.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T00:32:51.212256Z 02f5b8a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jamestjsp
jamestjsp enabled auto-merge (squash) October 12, 2026 00:29
…eaf15f

# Conflicts:
#	tests/python/fortran_reference.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02f5b8a141

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/MB/mb03xu.c Outdated
jamestjsp and others added 2 commits October 11, 2026 19:35
Reference MB03XU.f passes LDQ for B(K+I+2,1)/B(1,K+I+2) DGEMVs;
wrong when LDB != LDQ (e.g. LTRB, K>0). Add padded-LDB test; pad Q
in Fortran differential so reference stays valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jamestjsp
jamestjsp merged commit 6e79533 into main Oct 12, 2026
3 checks passed
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.

1 participant