Skip to content

Preserve Gaussian subclasses in multiply and convolve - #5385

Merged
FlorianPfaff merged 4 commits into
mainfrom
chatgpt/fix-gaussian-subclass-operations
Aug 22, 2026
Merged

Preserve Gaussian subclasses in multiply and convolve#5385
FlorianPfaff merged 4 commits into
mainfrom
chatgpt/fix-gaussian-subclass-operations

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

GaussianDistribution.shift() and the conversion factories preserve derived Gaussian types, but multiply() and convolve() hard-coded GaussianDistribution(...). Calling either operation on a subclass therefore silently discarded the concrete type, unlike the subclass-preserving operation contract used by other distribution representations.

Fix

Construct same-dimensional operation results through type(self) in:

  • GaussianDistribution.multiply()
  • GaussianDistribution.convolve()

The Gaussian formulas and numerical behavior are unchanged. marginalize_out() is intentionally left unchanged because it changes dimensionality and subclasses may have dimension-specific semantics.

Regression coverage

Adds a minimal derived Gaussian and verifies that both operations preserve the left-hand concrete subclass.

Scope

  • production diff: 2 additions / 2 deletions
  • one focused 30-line regression test
  • refreshed against the current main tip before PR creation
  • no overlap found with the existing open Gaussian/subclass PR queue

@github-actions

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 4.82s
✅ JSON prettier 7 0 0 0 0.46s
✅ JSON v8r 7 0 0 5.48s
✅ MARKDOWN markdownlint 68 0 0 0 1.44s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.29s
✅ PYTHON black 2006 22 0 0 45.88s
✅ PYTHON isort 2006 38 0 0 2.02s
✅ REPOSITORY betterleaks yes no no 1.04s
✅ REPOSITORY checkov yes no no 25.26s
✅ REPOSITORY git_diff yes no no 0.12s
✅ REPOSITORY secretlint yes no no 72.7s
✅ REPOSITORY syft yes no no 2.02s
✅ REPOSITORY trivy-sbom yes no no 1.88s
✅ YAML prettier 11 0 0 0 0.39s
✅ YAML v8r 11 0 0 7.82s
✅ YAML yamllint 11 0 0 0.59s

Notices

⚠️ Your configuration references items that have been removed from MegaLinter and are ignored: MAKEFILE_CHECKMAKE. 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.0.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

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

@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 21, 2026 21:49
@FlorianPfaff
FlorianPfaff merged commit 0ed553e into main Aug 22, 2026
15 of 26 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