You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#v2 = SparseVector(div(n * (n + 1), 2), v2_I, v2_V) # When it works in the future
# until then
v2 =zeros(Num, div(n * (n +1), 2))
v2[v2_I] .= v2_V
tuple(sparse(I1,J1,V1, m, n),
sparse(I2,J2,V2, m, div(n * (n +1), 2)),
v2,
wrap.(nls))
end
Description
Currently, semiquadratic_form returns a tuple of four objects: A, B, v2, and c arranged such that A * vars + B * v2 + c is equivalent to the input expression.
This issue proposes a breaking change to update the function's behavior to a more intuitive and user-friendly form: A * vars + vars' * B * vars + c
Motivation
The current form, while functional, requires constructing a vector v2 containing monomials of vars up to degree 2. This approach is less intuitive and can be cumbersome to work with. The proposed change aligns with standard mathematical notation for quadratic forms and simplifies subsequent calculations.
Proposed Changes
Modify the internal logic to directly compute matrices B in the new form.
Update the function's docstring.
Adjust existing tests to accommodate the new output format.
Provide additional examples demonstrating the usage of the updated function in documentation.
Impact
This change is considered breaking as it modifies the output structure of semiquadratic_form. However, considering the function's limited usage, the impact on existing code is expected to be minimal.
Symbolics.jl/src/semipoly.jl
Lines 329 to 402 in b8f7cf6
Description
Currently,
semiquadratic_form
returns a tuple of four objects:A
,B
,v2
, andc
arranged such thatA * vars + B * v2 + c
is equivalent to the input expression.This issue proposes a breaking change to update the function's behavior to a more intuitive and user-friendly form:
A * vars + vars' * B * vars + c
Motivation
The current form, while functional, requires constructing a vector
v2
containing monomials ofvars
up to degree 2. This approach is less intuitive and can be cumbersome to work with. The proposed change aligns with standard mathematical notation for quadratic forms and simplifies subsequent calculations.Proposed Changes
B
in the new form.Impact
This change is considered breaking as it modifies the output structure of
semiquadratic_form
. However, considering the function's limited usage, the impact on existing code is expected to be minimal.cc @shashi
The text was updated successfully, but these errors were encountered: