Skip to content

Fix multiplication of constant-only LinearExpression#568

Merged
FabianHofmann merged 4 commits intomasterfrom
linexr-const-multiplication
Feb 6, 2026
Merged

Fix multiplication of constant-only LinearExpression#568
FabianHofmann merged 4 commits intomasterfrom
linexr-const-multiplication

Conversation

@FabianHofmann
Copy link
Collaborator

@FabianHofmann FabianHofmann commented Feb 6, 2026

Summary

  • Fix multiplication of constant-only LinearExpression with other expressions
  • Previously failed with IndexError when trying to access _term=0 on empty term dimension
  • Now correctly returns LinearExpression (not QuadraticExpression) since multiplying by a constant preserves linearity

When multiplying a constant-only LinearExpression with another
expression, the code would fail with IndexError when trying to
access _term=0 on an empty term dimension.

The fix correctly returns a LinearExpression (not QuadraticExpression)
since multiplying by a constant preserves linearity.
@FabianHofmann FabianHofmann merged commit 59f92ae into master Feb 6, 2026
20 checks passed
@FabianHofmann FabianHofmann deleted the linexr-const-multiplication branch February 6, 2026 12:43
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