Skip to content

BUG: restore the multi-state BilinearIntegrator constructor dropped in c9fdeb7 (unblocks Piccolo #300) #138

Description

@aarontrowbridge

Problem

The integrator-struct refactor (c9fdeb7) dropped the historical BilinearIntegrator(G, traj, xs::AbstractVector{Symbol}, u) constructor. Today's only constructor takes a single x::Symbol, so any caller stacking multiple named components — concretely Piccolo's exported VariationalKetIntegrator / VariationalUnitaryIntegrator, which pass vcat(ψ̃, ψ̃_variations...) — throws MethodError on every call. Tracked as Piccolo #300; the variational integrators have had zero working callers since the Rollouts-era import, which is why nothing fired until the Piccolo coverage campaign found it.

Approach

Additive restore, matching the multi-name convention the codebase already carries (solve.jl's get_nonlinear_constraints already dispatches on x_names; Piccolissimo's exponential family uses it):

  • Struct gains x_names::Vector{Symbol}; x_name::Symbol stays as the primary (first) name for display and back-compat field access.
  • New constructor BilinearIntegrator(G, xs::AbstractVector{Symbol}, u, traj); the single-name constructor delegates via [x].
  • evaluate! / eval_jacobian / eval_hessian_of_lagrangian gather the stacked state from all names.
  • get_nonlinear_constraints: check x_names before x_name so a both-fields integrator sums the full stack (single-name behavior unchanged — x_names = [x]).

Scope

In: the above, plus a multi-name testitem (stacked two-component trajectory vs. a single concatenated-component equivalent). Out: Piccolo-side variational integrator tests (ride Piccolo's 2.0.3, ref Piccolo #300).

Acceptance criteria

  1. BilinearIntegrator(G, [:a, :b], :u, traj) constructs and integrates a stacked state correctly (test: matches a single-component trajectory whose data is the vcat of the two).
  2. get_nonlinear_constraints returns the stacked dimension for multi-name integrators.
  3. Existing single-name behavior unchanged (full suite green).
  4. Piccolo's VariationalKetIntegrator/VariationalUnitaryIntegrator construct without MethodError (verified from Piccolo's test PR).

Versioning

DTO 0.10.1 (additive; the field is new, .x_name access still works). Piccolo 2.0.3 follows with the variational tests.

Refs: Piccolo #300 · coverage campaign cluster D (Piccolo #294)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions