Skip to content

Conversation

@jack-champagne
Copy link
Member

Summary

Fixes a bug where SamplingProblem construction would fail when using an EmbeddedOperator as the goal in a UnitaryTrajectory.

Problem

The operator_to_iso_vec function only had a method for AbstractMatrix but not for EmbeddedOperator. When SamplingProblem tried to convert the goal operator to an isomorphic vector representation, it failed with:

MethodError: no method matching operator_to_iso_vec(::EmbeddedOperator{ComplexF64})

Solution

Added a new method operator_to_iso_vec(op::EmbeddedOperator) that delegates to the existing method by passing op.operator.

Changes

  • src/quantum/operators/embedded_operators.jl: Add operator_to_iso_vec method for EmbeddedOperator
  • src/quantum/operators/embedded_operators.jl: Add unit test for the new method
  • src/control/templates/sampling_problem.jl: Add integration test for SamplingProblem with EmbeddedOperator

Testing

  • Unit test verifies that operator_to_iso_vec(embedded_op) produces the same result as operator_to_iso_vec(embedded_op.operator)
  • Integration test verifies that SamplingProblem can be constructed with an EmbeddedOperator goal
  • Manual testing with minimal reproduction example confirms the fix works

- Add control_api.jl, quantum_api.jl, and visualizations_api.jl literate docs
- Update docs workflow and make.jl configuration
Fixes bug where SamplingProblem construction would fail when using an
EmbeddedOperator as the goal in a UnitaryTrajectory.

The issue was that operator_to_iso_vec only had a method for AbstractMatrix
but not for EmbeddedOperator. When creating a SamplingProblem, the code
tries to convert the goal operator to an isomorphic vector representation,
which failed for EmbeddedOperator types.

Changes:
- Add operator_to_iso_vec method for EmbeddedOperator in embedded_operators.jl
- Add test for operator_to_iso_vec with EmbeddedOperator
- Add integration test for SamplingProblem with EmbeddedOperator goal
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