Skip to content

feat(analysis): accept the bin phasor in GoertzelAlgorithm - #360

Merged
gabrielfrasantos merged 1 commit into
mainfrom
claude/goertzel-bin-phasor
Oct 23, 2026
Merged

gabrielfrasantos merged 1 commit into
mainfrom
claude/goertzel-bin-phasor

Conversation

@gabrielfrasantos

Copy link
Copy Markdown
Contributor

Summary

GoertzelAlgorithm gets a constructor that takes the unit bin phasor e^{jω}, ω = 2πk/N, instead of the bin index:

GoertzelAlgorithm(math::Complex<T> binPhasor, std::size_t blockLength);

The resonator only needs cos ω and sin ω, evaluated once per configuration. On a Cortex-M4, math::Sin/math::Cos resolve to newlib's software sinf/cosf, which pull in their general argument reduction (__ieee754_rem_pio2f, __kernel_rem_pio2f and the two_over_pi table) — about 4 KB of flash. In e-foc that constructor is the last reason those functions are linked. A caller with its own trigonometry can now keep them out of the image.

  • GoertzelAlgorithm(k, N) delegates to the new constructor and evaluates the cosine once instead of twice. Behaviour is unchanged.
  • New test supplied_bin_phasor_matches_direct_dft_bin.
  • doc/analysis/GoertzelAlgorithm.md: why a caller would supply the phasor, and how an error in it detunes the resonator.

Testing

  • Host numerical.analysis_test: 168/168 pass. All 18 Goertzel tests, including the new one, pass.
  • clang-format clean.

Needed by embedded-pro/e-foc, which supplies the phasor from its sine table.


Generated by Claude Code

A caller can supply e^{jω} of the bin instead of the bin index. The resonator
needs only cos ω and sin ω, evaluated once; on a Cortex-M4 the software
sinf/cosf behind math::Sin/math::Cos pull in several kilobytes of argument
reduction, which a caller with its own trigonometry can now keep out of the
image. The bin-index constructor delegates to the new one and evaluates the
cosine once instead of twice.

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

Copy link
Copy Markdown
Contributor

✅⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ ACTION actionlint 7 0 0 0.55s
✅ CPP clang-format 468 11 0 0 4.68s
✅ CPP cppcheck 468 0 0 9.57s
✅ DOCKERFILE hadolint 1 0 0 0.74s
✅ JSON jsonlint 8 0 0 0.12s
✅ JSON prettier 8 8 0 0 0.48s
⚠️ MARKDOWN markdownlint 148 2 158 0 4.08s
✅ MARKDOWN markdown-table-formatter 148 12 0 0 0.39s
⚠️ SPELL lychee 259 23 0 20.97s
✅ YAML prettier 12 3 0 0 0.66s
✅ YAML yamllint 12 0 0 0.72s

Detailed Issues

⚠️ SPELL / lychee - 23 errors
📝 Summary
---------------------
🔍 Total..........603
🔗 Unique.........452
✅ Successful.....568
⏳ Timeouts.........0
🔀 Redirected.....151
👻 Excluded........11
❓ Unknown..........0
🚫 Errors..........23
⛔ Unsupported.....23

Errors in .github/workflows/static-analysis.yml
[403] https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$ (at 37:21) | Rejected status code: 403 Forbidden

Errors in CHANGELOG.md
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/1 (at 206:31) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/13 (at 220:7) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/15 (at 215:18) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/18 (at 205:62) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/2 (at 213:34) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/24 (at 210:19) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/26 (at 211:30) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/27 (at 208:23) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/3 (at 204:35) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/4 (at 214:34) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/6 (at 212:53) | Rejected status code: 404 Not Found
[404] https://github.com/embedded-pro/embedded-numerical-toolbox/issues/7 (at 209:32) | Rejected status code: 404 Not Found

Errors in doc/filters/active/AhrsMadgwickMahony.md
[ERROR] file://doc/filters/ComplementaryFilter.md (at 131:3) | File not found. Check if file exists and path is correct

Errors in doc/filters/active/ExtendedKalmanFilter.md
[ERROR] file://doc/dynamics/EulerLagrange.md (at 130:3) | File not found. Check if file exists and path is correct

Errors in doc/filters/active/KalmanFilter.md
[ERROR] file://doc/filters/controllers/Lqr.md (at 114:77) | File not found. Check if file exists and path is correct
[ERROR] file://doc/filters/controllers/Lqr.md (at 133:3) | File not found. Check if file exists and path is correct
[ERROR] file://doc/filters/controllers/Pid.md (at 135:3) | File not found. Check if file exists and path is correct
[ERROR] file://doc/filters/solvers/DiscreteAlgebraicRiccatiEquation.md (at 134:3) | File not found. Check if file exists and path is correct

Errors in doc/performance-optimization/README.md
[403] https://developer.arm.com/documentation/100166/latest/ (at 472:3) | Rejected status code: 403 Forbidden
[403] https://developer.arm.com/documentation/dui0473/latest (at 474:3) | Rejected status code: 403 Forbidden

Errors in README.md
[ERROR] file:///releases/latest (at 39:14) | File not found. Check if file exists and path is correct
[404] https://embedded-pro.github.io/embedded-dsp-control/ (at 38:1) | Rejected status code: 404 Not Found

Hint: Followed 151 redirects. You might want to consider replacing redirecting URLs with the resolved URLs. Use verbose mode (`-v`/`-vv`) to see redirection details.
Hint: You can configure accepted/rejected response codes with `-a` or `--accept`
⚠️ MARKDOWN / markdownlint - 158 errors
laude/agents/reviewer.md:8 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Canonical rules: `AGENTS.md`. ..."]
.claude/agents/unit-tester.md:8 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Read `AGENTS.md`, `.github/ins..."]
.github/agents/algo-implementer.agent.md:11 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You deploy ONE algorithm at a ..."]
.github/agents/executor.agent.md:11 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Canonical rules: `AGENTS.md`. ..."]
.github/agents/orchestrator.agent.md:21 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Triage requests and route to t..."]
.github/agents/planner.agent.md:11 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Canonical rules: `AGENTS.md`. ..."]
.github/agents/reviewer.agent.md:14 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Canonical rules: `AGENTS.md`. ..."]
.github/agents/unit-tester.agent.md:11 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You add or extend the unit tes..."]
.github/instructions/numerical-cpp.instructions.md:76:401 error MD013/line-length Line length [Expected: 400; Actual: 423]
.github/prompts/orchestrate.prompt.md:8:401 error MD013/line-length Line length [Expected: 400; Actual: 496]
.github/prompts/orchestrate.prompt.md:8 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Analyze the following task for..."]
.github/prompts/unit-test.prompt.md:8 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Author (or extend) the unit te..."]
CHANGELOG.md:26 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Bug Fixes"]
CHANGELOG.md:38 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Bug Fixes"]
CHANGELOG.md:52 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Build System"]
CHANGELOG.md:64 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Features"]
CHANGELOG.md:133 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Miscellaneous"]
CHANGELOG.md:151 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Build System"]
CHANGELOG.md:179 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "⚠ BREAKING CHANGES"]
CHANGELOG.md:183 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Features"]
CHANGELOG.md:195 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Bug Fixes"]
CHANGELOG.md:202 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Features"]
CHANGELOG.md:218 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Bug Fixes"]
doc/analysis/Decibels.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 637]
doc/analysis/GoertzelAlgorithm.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 492]
doc/analysis/GoertzelAlgorithm.md:93:401 error MD013/line-length Line length [Expected: 400; Actual: 757]
doc/analysis/GoertzelAlgorithm.md:109:401 error MD013/line-length Line length [Expected: 400; Actual: 451]
doc/analysis/HilbertTransform.md:31:34 error MD056/table-column-count Table column count [Expected: 2; Actual: 4; Too many cells, extra data will be missing]
doc/analysis/PowerDensitySpectrum.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 509]
doc/analysis/PowerDensitySpectrum.md:104:20 error MD056/table-column-count Table column count [Expected: 2; Actual: 6; Too many cells, extra data will be missing]
doc/analysis/PowerDensitySpectrum.md:104:17 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:20 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:32 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:38 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:45 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/PowerDensitySpectrum.md:104:135 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/analysis/SignalDetectors.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 481]
doc/control_analysis/FrequencyResponse.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 469]
doc/control_analysis/README.md:11:68 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/control_analysis/README.md:11:147 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/control_analysis/README.md:12:53 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/control_analysis/README.md:12:172 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/control_analysis/README.md:13:68 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/control_analysis/README.md:13:151 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/control_analysis/RootLocus.md:69 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
doc/control_analysis/TransferFunctionStateSpace.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 589]
doc/controllers/Feedforward2Dof.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 627]
doc/controllers/FrictionCompensation.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 420]
doc/controllers/FrictionCompensation.md:29:401 error MD013/line-length Line length [Expected: 400; Actual: 406]
doc/controllers/FrictionCompensation.md:44:401 error MD013/line-length Line length [Expected: 400; Actual: 436]
doc/controllers/GainScheduledController.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 454]
doc/controllers/LeadLagCompensator.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 639]
doc/controllers/Lqg.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 428]
doc/controllers/SaturationRateLimiter.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 451]
doc/controllers/SaturationRateLimiter.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 477]
doc/estimators/ExpectationMaximization.md:104:103 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/estimators/LmsAdaptiveFilter.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 547]
doc/estimators/README.md:11:128 error MD056/table-column-count Table column count [Expected: 2; Actual: 3; Too many cells, extra data will be missing]
doc/estimators/README.md:11:128 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/AhrsMadgwickMahony.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 538]
doc/filters/active/AhrsMadgwickMahony.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 554]
doc/filters/active/AlphaBetaFilter.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 419]
doc/filters/active/AlphaBetaFilter.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 451]
doc/filters/active/KalmanSmoother.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 421]
doc/filters/active/KalmanSmoother.md:111:28 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:111:61 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:111:110 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:122:19 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:122:27 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:122:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:123:19 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:123:27 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:123:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:124:19 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:124:27 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:124:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:125:19 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:125:27 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/KalmanSmoother.md:125:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/UnscentedKalmanFilter.md:11:401 error MD013/line-length Line length [Expected: 400; Actual: 468]
doc/filters/active/UnscentedKalmanFilter.md:149:65 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/active/UnscentedKalmanFilter.md:149:153 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/passive/MedianFilter.md:69:25 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/passive/MedianFilter.md:69:43 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/passive/MedianFilter.md:70:51 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/passive/MedianFilter.md:70:96 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:13:74 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:13:179 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:14:74 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:14:179 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:15:74 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:15:179 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:16:74 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:16:179 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:17:74 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/filters/README.md:17:179 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/math/AngleUtilities.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 603]
doc/math/AngleUtilities.md:58:401 error MD013/line-length Line length [Expected: 400; Actual: 438]
doc/math/CubicSpline.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 453]
doc/math/CubicSpline.md:38:401 error MD013/line-length Line length [Expected: 400; Actual: 476]
doc/math/GivensRotation.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 429]
doc/math/HouseholderTransform.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 455]
doc/math/MatrixExponential.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 555]
doc/math/MatrixNorms.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 452]
doc/math/MatrixNorms.md:42:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/math/MatrixNorms.md:43:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/math/MatrixNorms.md:44:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/math/MatrixNorms.md:45:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/math/MatrixNorms.md:46:67 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/math/SE3Transform.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 538]
doc/math/SE3Transform.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 546]
doc/math/SE3Transform.md:23:401 error MD013/line-length Line length [Expected: 400; Actual: 494]
doc/math/SE3Transform.md:43:401 error MD013/line-length Line length [Expected: 400; Actual: 464]
doc/math/SE3Transform.md:126:401 error MD013/line-length Line length [Expected: 400; Actual: 414]
doc/math/StepResponseMetrics.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 514]
doc/math/StepResponseMetrics.md:61 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
doc/motion_profiles/SCurveProfile.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 438]
doc/motion_profiles/SCurveProfile.md:53:401 error MD013/line-length Line length [Expected: 400; Actual: 480]
doc/motion_profiles/TrapezoidalProfile.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 474]
doc/nonlinear_control/BacksteppingControl.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 594]
doc/nonlinear_control/FeedbackLinearization.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 533]
doc/nonlinear_control/FeedbackLinearization.md:15:401 error MD013/line-length Line length [Expected: 400; Actual: 491]
doc/nonlinear_control/ModelReferenceAdaptiveControl.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 587]
doc/nonlinear_control/README.md:9:80 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/nonlinear_control/README.md:9:258 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/nonlinear_control/README.md:10:80 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/nonlinear_control/README.md:10:258 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/nonlinear_control/README.md:11:80 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/nonlinear_control/README.md:11:270 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/regularization/Regularization.md:100:32 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/regularization/Regularization.md:100:135 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/robust_control/ActiveDisturbanceRejection.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 699]
doc/robust_control/ActiveDisturbanceRejection.md:85:401 error MD013/line-length Line length [Expected: 400; Actual: 575]
doc/robust_control/ActiveDisturbanceRejection.md:93:401 error MD013/line-length Line length [Expected: 400; Actual: 622]
doc/robust_control/DisturbanceObserver.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 476]
doc/robust_control/README.md:12:259 error MD060/table-column-style Table column style [Table pipe does not align with header for style "aligned"]
doc/robust_control/SlidingModeControl.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 644]
doc/solvers/ConditionNumber.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 461]
doc/solvers/ConditionNumber.md:51:401 error MD013/line-length Line length [Expected: 400; Actual: 425]
doc/solvers/DampedPseudoInverse.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 531]
doc/solvers/DampedPseudoInverse.md:89:401 error MD013/line-length Line length [Expected: 400; Actual: 581]
doc/solvers/JacobiEigenSolver.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 443]
doc/solvers/JacobiEigenSolver.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 609]
doc/solvers/JacobiEigenSolver.md:45:401 error MD013/line-length Line length [Expected: 400; Actual: 427]
doc/solvers/RungeKuttaIntegrators.md:9:401 error MD013/line-length Line length [Expected: 400; Actual: 509]
doc/solvers/SpectralRadius.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 665]
doc/solvers/SymplecticIntegrators.md:7:401 error MD013/line-length Line length [Expected: 400; Actual: 486]
doc/solvers/SymplecticIntegrators.md:35:401 error MD013/line-length Line length [Expected: 400; Actual: 476]
doc/solvers/SymplecticIntegrators.md:63:401 error MD013/line-length Line length [Expected: 400; Actual: 431]
doc/windowing/window.md:5:401 error MD013/line-length Line length [Expected: 400; Actual: 415]
README.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "[![Quality Gate Status](https:..."]
README.md:9:401 error MD013/line-length Line length [Expected: 400; Actual: 442]
README.md:17:401 error MD013/line-length Line length [Expected: 400; Actual: 472]
roadmap/README.md:11 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]

(Truncated to last 20000 characters out of 20701)

Notices

⚠️ Your configuration references items that have been removed from MegaLinter and are ignored: REPOSITORY_GITLEAKS, REPOSITORY_KICS. See Removed linters to find their replacements.

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.1.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,CPP_CPPCHECK,CPP_CLANG_FORMAT,DOCKERFILE_HADOLINT,JSON_JSONLINT,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,SPELL_LYCHEE,YAML_PRETTIER,YAML_YAMLLINT

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

@sonarqubecloud

Copy link
Copy Markdown

@gabrielfrasantos
gabrielfrasantos merged commit f2e74a4 into main Oct 23, 2026
14 checks passed
@gabrielfrasantos
gabrielfrasantos deleted the claude/goertzel-bin-phasor branch October 23, 2026 17:59
gabrielfrasantos pushed a commit to embedded-pro/e-foc that referenced this pull request Oct 23, 2026
Alignment, pole-pair detection and the inductance estimator were the only
callers of sinf/cosf, which on the Cortex-M4 link newlib's general argument
reduction (__ieee754_rem_pio2f, __kernel_rem_pio2f, two_over_pi): about 4 KB.

- Voltage vectors (alignment, pole pairs, the injected sine) use
  FastTrigonometry::Sine/Cosine; 1.9e-5 is irrelevant there.
- The Goertzel bin phasor and the delay rotation need more: an error e in
  cos w rotates the Goertzel result by about N e / (2 sin w), 2.6e-2 rad at the
  default 700 Hz with the interpolated table. FastTrigonometry gains
  AccurateSineAndCosine, which rotates the table entry below the angle by the
  remainder through a short series (within 1.3e-6, the table's own precision),
  and the estimator passes the phasor to the Goertzel constructor that
  numerical-toolbox now offers (embedded-pro/numerical-toolbox-cpp#360).

numerical-toolbox is pinned to that pull request's branch until it merges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SeegZiU2Up4ZYQBwnfrLeP
gabrielfrasantos added a commit to embedded-pro/e-foc that referenced this pull request Oct 23, 2026
* refactor(core): give interfaces protected non-virtual destructors

Nothing destroys an object through an interface: there is no heap, and every
owner (std::optional, std::variant, statics) holds the concrete type. A virtual
destructor still emits a deleting destructor per class and, under multiple
inheritance, one thunk per base with the whole destructor body inlined.
FocController<PositionCascade> alone carried about eleven of them.

Interfaces now declare `protected: ~I() = default;` (the EMIL convention),
concrete classes drop their virtual/override destructors, and the rule in
AGENTS.md, CLAUDE.md and the Copilot/agent instructions changes with it.
Host code that owns through a base pointer (integration test interactor,
tools) keeps its virtual destructor.

EK-TM4C123GXL sync_foc_sensored flash: 231936 -> 213496 B.

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

* refactor(targets): never destroy the application's static objects

main() held Logic and PlatformFactoryImpl as function statics, so their
destructors were registered with atexit and linked, together with everything
they destroy, although the event loop never returns. infra::StaticStorage
constructs them in place and has a trivial destructor.

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

* perf(ti): size console, dispatcher and fault buffers to what the application needs

The EK-TM4C123GXL has 32 KiB of RAM and sync_foc_sensored left 528 B free
after the 1 KiB stack. Each buffer now has a measured or structural bound,
documented in documentation/architecture/system.md:

- event dispatcher 50 -> 24: the full @sil suite peaks at 3 pending actions;
  the TI drivers add at most one per CAN error class, CAN rx/tx, UART rx/tx
  and the timer service. The SIL target uses the same depth.
- terminal: history 4 -> 1, line 256 -> 64 chars (longest command is 34),
  input queue 256 -> 128, UART DMA receive buffer 256 -> 64.
- CAN receive buffer 32 -> 16 frames (a client queues at most 8; overflow is
  counted as messageLost).
- backtrace 243 -> 16 entries, fault string 1024 -> 448 B. The string is now
  checked against PersistentFaultData::kMaxFormattedSize, so the boot dump is
  complete (REQ-EH-002); 243 entries never fitted the old 1 KiB string.
- CLI command table 32 -> 24, the number sync_foc_sensored registers.
- TI linker script: .bss first and sorted by alignment, so the 1 KiB-aligned
  uDMA control table no longer forces up to 1 KiB of padding after .data.

The trace and RTT buffers stay at 2048 B: construction output is ~1.1 KB, ~1.7
KB with a previous fault dump, and the UART only drains once the event loop
runs.

EK-TM4C123GXL sync_foc_sensored RAM: 31216 -> 25532 B.

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

* perf(ident): keep the software sinf/cosf out of the firmware

Alignment, pole-pair detection and the inductance estimator were the only
callers of sinf/cosf, which on the Cortex-M4 link newlib's general argument
reduction (__ieee754_rem_pio2f, __kernel_rem_pio2f, two_over_pi): about 4 KB.

- Voltage vectors (alignment, pole pairs, the injected sine) use
  FastTrigonometry::Sine/Cosine; 1.9e-5 is irrelevant there.
- The Goertzel bin phasor and the delay rotation need more: an error e in
  cos w rotates the Goertzel result by about N e / (2 sin w), 2.6e-2 rad at the
  default 700 Hz with the interpolated table. FastTrigonometry gains
  AccurateSineAndCosine, which rotates the table entry below the angle by the
  remainder through a short series (within 1.3e-6, the table's own precision),
  and the estimator passes the phasor to the Goertzel constructor that
  numerical-toolbox now offers (embedded-pro/numerical-toolbox-cpp#360).

numerical-toolbox is pinned to that pull request's branch until it merges.

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

* perf(ti): define each board's pin objects once

The pins and PWM channel table were `inline` variables in
PinsAndPeripherals.hpp. GpioPin's constructor touches the hardware, so each of
the two translation units that include the header emitted its own guarded
dynamic initialiser for all of them (about 1.1 KB each). They are now declared
`extern` and defined in the board's PinsAndPeripherals.cpp, compiled into the
TI platform library.

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

* build(deps): take hal-ti's integer dead-time computation

CalculateDeadTimeCycles divided a float by a double literal, the only use of
the soft-float double routines in the firmware (about 2 KB). hal-ti now
computes the count in integer arithmetic (embedded-pro/hal-ti#136); hal-ti is
pinned to that pull request's branch until it merges. The branch sits on
hal-ti main, so this also takes embedded-pro/hal-ti#135 (PWM writes only the
comparators while a generator runs).

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

* build(deps): pin hal-ti to main after embedded-pro/hal-ti#136 merged

Same tree as the pull request's branch head; only the commit changes.

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

* build(deps): pin numerical-toolbox to main after #360 merged

Moves to d611820, which also brings #358 (Levenberg–Marquardt, active-set QP),
#361 (protected non-virtual interface destructors) and #362 (CI only).

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

* docs(transforms): realign the interfaces table after the new row

MegaLinter's markdown-table-formatter flagged the table once the
AccurateSineAndCosine row widened its first column.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
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