Skip to content

rational: the guard band filter's named settings per half-band kind (IIR-c follow-up, question 20) - #115

Merged
tap merged 2 commits into
mainfrom
claude/sample-rate-solutions-comparison-mqc190
Nov 22, 2026
Merged

tap merged 2 commits into
mainfrom
claude/sample-rate-solutions-comparison-mqc190

Conversation

@tap

@tap tap commented Nov 22, 2026

Copy link
Copy Markdown
Owner

What this changes

This is IIR-c's follow-up for your answer to question 20, given after #114 merged: "The settings can be different for the fir and near linear chains than the nonlinear chains."

  • half_band_kind { fir, nonlinear, near_linear }, new in guard_band.h beside guard_phase. Each named setting takes it, with no default, so every call site names the half-band its filter serves:

    • super_economy(kind): order 5 behind the nonlinear half-band, 7 behind the FIR and near-linear ones;
    • economy(kind) and balanced(kind): order 7 behind every kind;
    • transparent(kind): order 7 behind the nonlinear half-band, 11 behind the FIR and near-linear ones.

    These are the orders I7's rule picks behind each kind. guard_band_settings{} is still economy's numbers at order 7, valid behind every kind, and remains the constructor's and validate()'s default.

  • Six tabulated designs per form instead of four. The two new ones, (70 dB, 1/3, order 7) and (120 dB, 5/12, order 11), are rows DspTap already commits, so the DspTap pin doesn't move.

  • Tests. Every battery over the named settings now covers the six designs: golden leg (vectors regenerated), bit pins, spec, fixed point, limit cycle, quantized linear stopbands. Beyond that:

    • the order-rule test pins every kind's pick against its named setting;
    • the alias, composition and offering tests use the setting for the kind each chain holds.
  • Docs. Updated: the header's settings table (gaining a half-band column), rational/README.md, the root README, the book chapter, rational/CLAUDE.md, rational/PLAN.md (R26, R28, a new follow-up record) and docs/ROADMAP.md. docs/IIR_PLAN.md gets a new v12 recording questions 20 and 21 as decided; v11's record of IIR-c is left as it landed.

Question 21 (the linear form in Q15) is decided as DspTap Q15 rows: tap/DspTap#69, 0.4.0. This PR leaves the Q15 limit as #114 pinned it. Moving the pin to v0.4.0 lifts it, in a PR of its own after the tag.

Why

Question 14's orders, 5 / 7 / 7 / 7, meet −A/2 in the guard band only behind the nonlinear half-band. Behind the near-linear and FIR half-bands they leave −31.4 / −31.6 dB at super_economy (target −35) and −48.8 / −45.6 dB at transparent (target −60). Named settings per kind give every kind the order its rule picks.

Verification

What Measured Test
Order rule at the named orders nonlinear −40.1 / −43.5 / −40.2 / −61.6 dB; near-linear −39.6 / −39.2 / −37.8 / −64.6; FIR −40.9 / −37.0 / −37.0 / −62.1: every kind at or below −A/2 guard_band.OrderIsTheLowestOddOrderWhoseGuardBandAliasIsAtHalfA
The two new designs super_economy order 7: stop edge 0.4350, Chebyshev II 20 multiplies, FIR 38 taps at −70.9 dB. transparent order 11: stop edge 0.4669, 30 multiplies, FIR 102 taps at −120.1 dB guard_band.EachFormMeetsItsSpec
Limit cycle at the new floating orders (20 starts per design, bound 16× the smallest normal, unchanged) order 7 at super_economy: 4.4× float, 3.0× double; order 11 at transparent: 8.4× / 7.7×; on the M55, 4.4× / 3.0× and 4.2× / 6.4×. The worst stays order 7's 8.7× / 10.4× guard_band_float_test.TheChebyshevLimitCycleIsBounded
Golden leg (Chebyshev II / FIR) double 8.2e-15 / 5.6e-16, float 1.1e-6 / 6.8e-8, Q15 1.5e-5 / 2.5e-4, Q31 5.1e-9 / 4.0e-9 guard_band_test.MatchesTheGoldenLeg
Bit pins re-recorded, since the hashed cases grew from 8 to 12; identical on x86-64, M33, M55 and Hexagon guard_band_fixed_test.OutputsAreBitPinned
Fixed point largest state 1.71 of full scale; windows Q15 420–1,750 and Q31 828–3,480 frames, every state zero within 365 and 802 FullScaleDriveNeverWrapsInside, FixedPointSilenceIsExactlyZeroAfterTheWindow
Without flush-to-zero residue at most 11× the smallest subnormal (bound 32, unchanged) iir_subnormals.WithoutFlushToZeroTheGuardBandResidueIsBounded
Linear form in Q15 at the new designs −68.9 / −69.2 dB, inside the honest limit #114 pinned (question 21) guard_band_fixed_test.QuantizedLinearTablesAttainTheirStatedStopbands

Where it ran:

  • Hosted: GCC 13 with -Werror on all three engines, 488 of 488 (my rebuild of the pushed head). The agent that built it also ran:
    • Clang 18 with -Werror and GCC without exceptions or RTTI, 488 of 488 each;
    • GCC 15.3 (the gcc:15 image) with -Werror, 507 of 507;
    • a Debug run of the guard band and precondition tests, 87 of 87.
  • QEMU, both builds:
    • M33: 169, 74 of 75 (double's limit-cycle test skipped, as before) and 6 of 6;
    • M55: 169, 75 and 6 of 6. The guard band image is now 965,964 bytes;
    • Hexagon: 271 of 271.
  • Ratchet: every rational workload, probe and stack binary is byte-identical (stripped) to rational: the guard band filter in both forms and the composition tests (IIR-c) #114's on M33, M55, Hexagon and host. No baseline or ceiling file changes.
  • Style and docs: clang-format 18, clang-tidy 18 on the changed tests, the vocabulary gate and the book, all clean.

Notes for the reviewer

  • API change since rational: the guard band filter in both forms and the composition tests (IIR-c) #114: a call to guard_band_settings::economy() without the kind no longer compiles. Nothing outside this tree consumes the filter yet: the C ABI is IIR-d's.
  • The golden-leg generator's internal check (sosfilt against the direct form) is loosened from 1e-11 to 1e-8, because order 11's polynomial form agrees to only 1.7e-9. Scipy's design still matches DspTap's within 1.4e-14.
  • The offering table's near-linear rows with a filter moved. Going down by 2 they are 25 and 43 multiplies at super_economy, and 49 and 121 at transparent.

Generated by Claude Code

… follow-up)

Question 20 of docs/IIR_PLAN.md, which IIR-c (#114) put to the maintainer,
decided after it landed: "The settings can be different for the fir and near
linear chains than the nonlinear chains."

guard_band.h gains half_band_kind (fir, nonlinear, near_linear) beside
guard_phase, and every named setting takes it with no default. I7's rule
(question 14) is applied behind the half-band the filter serves: 5 / 7 / 7 / 7
behind the nonlinear half-band, 7 / 7 / 7 / 11 behind the FIR and near-linear
ones. economy and balanced are one design behind every kind and take the kind
all the same; guard_band_settings{} stays economy's and the constructor's and
validate()'s default. Six designs per form, the two new ones (70 dB 1/3 at
order 7, 120 dB 5/12 at order 11) already DspTap's committed Chebyshev II and
type II FIR rows, so DspTap does not change; any other setting designs at run
time as before.

Every test over the named settings runs the six designs: the golden vectors
regenerated (12 cases; the generator's sosfilt against direct-form check
loosened to 1e-8, the order-11 polynomials agreeing within 1.7e-9), the four
bit pins re-recorded as the cases they hash grew, the spec, fixed point, limit
cycle and quantized linear stopbands; the order rule pins every kind's pick
against its named setting; the aliases, composition and offering tests build
each chain's filter at its own kind, and the offering table's near-linear rows
with a filter move (down 2 at super_economy 25 and 43 multiplies, at
transparent 49 and 121).

The floating limit cycle at the new orders, over 20 starts per design: 4.4
(float) and 3.0 (double) times the smallest normal at super_economy's order 7,
8.4 and 7.7 at transparent's order 11, inside the bound of 16, which stays.
Without flush-to-zero the residue reaches 11 times the smallest subnormal
(bound 32). The Q15 linear limit is unchanged in kind and stays pinned
(question 21: DspTap's Q15 rows, a later pin bump): -68.9 and -69.2 dB for the
new rows.

The header's settings table gains a half-band column, and README.md,
rational/README.md, rational/CLAUDE.md and the book's guard band chapter state
the settings per kind with the new windows, latencies and multiplies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016GKzq1VSdcMYCRMhddiMaf
docs/IIR_PLAN.md v12 records the maintainer's answers to the two questions
IIR-c (#114) put to him, given after it landed, and the follow-up that
implements them:
- question 20, the guard band settings behind the near-linear and the FIR
  half-band, decided per kind: "The settings can be different for the fir and
  near linear chains than the nonlinear chains." 5 / 7 / 7 / 7 behind the
  nonlinear half-band, 7 / 7 / 7 / 11 behind the FIR and near-linear ones,
  through half_band_kind (I6, I7, section 5 item 4, section 8);
- question 21, the linear form in Q15, decided as "DspTap Q15 rows": DspTap
  commits Q15 linear rows designed with margin in a PR of its own; rational
  keeps the Q15 limit pinned as it is until the pin bump that brings them.
v11's record of IIR-c stays as it was; IIR-c is marked landed.

rational/PLAN.md: R26 and R28 state the settings per kind and the limit cycle
at the new orders; v0.23 and section 6's record of IIR-c's follow-up carry its
measurements and verification (488 of 488 hosted with GCC 13, Clang 18 and
without exceptions, 507 of 507 with GCC 15; the M33, M55 and Hexagon legs in
both builds; every rational ratchet binary byte-identical to IIR-c's, no
baseline or ceiling re-recorded). docs/ROADMAP.md marks IIR-c landed and adds
its follow-up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016GKzq1VSdcMYCRMhddiMaf

tap commented Nov 22, 2026

Copy link
Copy Markdown
Owner Author

Hexagon cross rational (QEMU) was cancelled at its 20-minute limit (ci.yml's timeout: 20 for that leg), with 270 of 271 tests passed. The one still running was rational.Stage.WideRatiosOfTheCharterRunTheSchedule, an existing test this PR doesn't touch, which takes about 290 s on this leg.

This PR doesn't cause it. That runner was about 1.5× slower at every step, including the build and tests this PR doesn't change:

run build Design.TheCoarseGridWouldUnderPinTwoRows guard_band.AliasesLandOnlyAboveThePassbandEdge total test time
#114, same leg 7.0 min 131 s 57 s 419.1 s
this PR, no-exceptions Hexagon leg (passed) 6.2 min 129 s 63 s 419.9 s
this PR, cancelled run 10.1 min 195 s 104 s —

The underlying issue is the margin: the leg normally needs about 14½ of its 20 minutes. Proposed patch, not made here to keep this PR to its change: raise timeout: from 20 to 30 for the two Hexagon rational entries in the qemu matrix (.github/workflows/ci.yml, lines 242 and 347 at this head).

I'm re-running the leg once.


Generated by Claude Code

@tap
tap merged commit 3c60711 into main Nov 22, 2026
78 of 79 checks passed
@tap
tap deleted the claude/sample-rate-solutions-comparison-mqc190 branch November 22, 2026 20:59
tap pushed a commit that referenced this pull request Nov 22, 2026
…an v13)

docs/IIR_PLAN.md v13 records question 21's answer as it lands: DspTap 0.4.0
(tap/DspTap#69) commits the guard band filter's Q15 rows and the symmetric
quantizer, and the pin move runs them, so the linear form in Q15 holds the 70
dB tier at the four 70 dB named settings (-89.2 / -70.4 / -72.3 / -70.7 dB at
32 / 40 / 50 / 60 taps); transparent's Q15 limit stays pinned (-70.9 / -69.2
dB), as the FIR stages state Q15 at transparent (section 5 item 4, section 8).

rational/PLAN.md: R26 names the Q15 rows and the per-format length; v0.24 and
section 6's record of the pin move carry the Q15 numbers per setting, what
moved (the Q15 FIR pin and the Q15 rows' latency, window and multiplies) and
what did not (every float, double and Q31 output, the Q15 Chebyshev II), the
A/B (every async, bridge and rational ratchet binary byte-identical across the
move on the M33, M55, Hexagon and host in both builds) and the verification.
docs/ROADMAP.md adds the pin move after IIR-c's follow-up (#115) and moves
TapTools' first step to DspTap v0.4.0, the family's floor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016GKzq1VSdcMYCRMhddiMaf
tap pushed a commit that referenced this pull request Nov 22, 2026
…an v13)

docs/IIR_PLAN.md v13 records question 21's answer as it lands: DspTap 0.4.0
(tap/DspTap#69) commits the guard band filter's Q15 rows and the symmetric
quantizer, and the pin move runs them, so the linear form in Q15 holds the 70
dB tier at the four 70 dB named settings (-89.2 / -70.4 / -72.3 / -70.7 dB at
32 / 40 / 50 / 60 taps); transparent's Q15 limit stays pinned (-70.9 / -69.2
dB), as the FIR stages state Q15 at transparent (section 5 item 4, section 8).

rational/PLAN.md: R26 names the Q15 rows and the per-format length; v0.24 and
section 6's record of the pin move carry the Q15 numbers per setting, what
moved (the Q15 FIR pin and the Q15 rows' latency, window and multiplies) and
what did not (every float, double and Q31 output, the Q15 Chebyshev II), the
A/B (every async, bridge and rational ratchet binary byte-identical across the
move on the M33, M55, Hexagon and host in both builds) and the verification.
docs/ROADMAP.md adds the pin move after IIR-c's follow-up (#115) and moves
TapTools' first step to DspTap v0.4.0, the family's floor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016GKzq1VSdcMYCRMhddiMaf
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