Skip to content

Conversation

@jack-champagne
Copy link
Member

@jack-champagne jack-champagne commented Dec 3, 2025

This pull request adds several new example scripts and updates existing ones to improve clarity, consistency, and usability for quantum optimal control problems using the QuantumCollocation.jl library. The most significant changes are the addition of new, well-documented examples for minimum time optimization, robust control, and single qubit gates, as well as refactoring and modernizing existing examples for multilevel transmon and two-qubit gates. These updates make the documentation more user-friendly and demonstrate advanced features and best practices.

New Example Additions:

  • Added minimum_time_problem.jl example, demonstrating how to optimize for the fastest possible gate duration while maintaining high fidelity, including visualization and analysis of the tradeoff between fidelity and duration.
  • Added robust_control.jl example, showcasing robust pulse optimization using UnitarySamplingProblem to handle system uncertainties and parameter variations, with detailed comparisons and visualization of results.
  • Added single_qubit_gate.jl example, providing a canonical step-by-step workflow for optimizing a Hadamard gate, including setup, solution, analysis, and suggestions for further exploration.

Refactoring and Modernization of Existing Examples:

  • Updated multilevel_transmon.jl to use consistent parameter naming (drive_bounds), removed unnecessary manual time step calculations, and switched to the modern API for problem setup and solution. Also improved code clarity and commented out legacy solution loading in favor of direct optimization calls. [1] [2] [3] [4]
  • Updated two_qubit_gates.jl to use new operator naming conventions, clarified Hamiltonian and control definitions, refactored system and problem setup to use EmbeddedOperator and drive_bounds, and commented out legacy solution loading. Also improved math notation for clarity. [1] [2] [3] [4] [5] [6]

These changes greatly improve the accessibility and instructional value of the example scripts, making it easier for users to learn and apply advanced quantum control techniques.

aarontrowbridge and others added 30 commits October 28, 2025 19:50
…instead of timesteps; refactor integrator functions for consistency
…ps; update system initialization parameters for consistency across tests.
… use N instead of T for consistency; update integrator functions accordingly.
…l problems

- Changed control variable name from `a` to `u` across multiple problem templates:
  - `unitary_sampling_problem.jl`
  - `unitary_smooth_pulse_problem.jl`
  - `unitary_variational_problem.jl`

- Updated associated bounds and regularization weights to reflect the new naming convention.

- Enhanced trajectory initialization functions to support new control variable naming and added documentation for new methods.

- Introduced new functions for generating initial unitary and control trajectories with detailed docstrings.
* update readme for docs building instructions
* use new docs CI separate from rest
* use PiccoloDocsTemplate
* minor docs fixes

---------

Co-authored-by: Gennadi Ryan <gennadiryan@gmail.com>
Co-authored-by: Gennadi Ryan <41800392+gennadiryan@users.noreply.github.com>
* feat: add julia 1.12 to test matrix and update compat

* chore: use 'pre' Julia version in nightly.yml
- Updated all manual pages and examples to use u, du, ddu naming
- Changed .trajectory.a → .trajectory.u
- Updated function parameters: a_bound → u_bound, da_bound → du_bound, etc.
- Updated regularizers: R_a → R_u, R_da → R_du, R_dda → R_ddu
- Updated math notation in index.md: a_t → u_t
- Consistent with source code refactoring
- Created comprehensive comparison table of all 8 problem templates
- Added selection guide for choosing the right template
- Documented key differences: Unitary vs Ket, Smooth vs MinTime, etc.
- Listed common parameters with examples
- Updated make.jl to include overview as first manual page
- Created "Working with Solutions" guide covering:
  * Solving problems with solve!() options
  * Extracting controls, states, and time data
  * Fidelity evaluation (direct vs rollout)
  * Saving/loading trajectories
  * Post-processing and exporting for experiments
  * Best practices and debugging tips

- Created "PiccoloOptions Reference" documenting:
  * All available options with examples
  * Common configuration patterns
  * Leakage suppression setup
  * When to use bound_state, geodesic, etc.
  * Tips and tricks for each option

- Updated docs structure to include new manual pages
- Updated QuantumSystem constructors to include required T_max and drive_bounds
- Updated VariationalQuantumSystem constructor with required parameters
- Simplified solve!() calls (removed verbose and print_level to avoid issues)
- Fixed all driftless_system instantiations in examples
- Ensures all code blocks execute without UndefVarError or MethodError
- Added required T_max (10.0) and drive_bounds ([1.0, 1.0]) parameters
- Updated all QuantumSystem calls with drift Hamiltonian
- Fixed in: ket_problem_templates, unitary_problem_templates,
  working_with_solutions, and piccolo_options
- Matches updated PiccoloQuantumObjects API signature
- Use EmbeddedOperator for matrix goals with QuantumSystem
- Changed (system, matrix, T, Δt) → (system, EmbeddedOperator(matrix, system), T)
- Removed Δt parameter (not used in current API, calculated from T and T_max)
- Fixed in ket_problem_templates, unitary_problem_templates,
  working_with_solutions, and piccolo_options
- Matches actual function signatures in problem templates
- Add unitary_trajectory(sys, U_goal, N) for unitary gate synthesis
  - Takes goal unitary as positional arg, initial defaults to identity
  - Supports geodesic interpolation and custom timestep bounds

- Add ket_trajectory(sys, ψ_init(s), ψ_goal(s), N) for quantum state transfer
  - Supports single state or multiple states with shared controls
  - Auto-generates state names (:ψ̃1, :ψ̃2) or accepts custom names
  - Convenience constructor for single state: ket_trajectory(sys, ψ_init, ψ_goal, N)

- Add density_trajectory(sys, ρ_init, ρ_goal, N) for open system evolution
  - Direct positional arguments for initial and goal density matrices

All functions:
- Accept Δt_min and Δt_max kwargs for timestep bounds
- Support free_time flag to toggle between variable/fixed timesteps
- Build NamedTrajectory directly without calling existing initialize_trajectory
- Properly convert sys.drive_bounds from Vector{Tuple} to (lower, upper) format

Added comprehensive tests for all functions including:
- Default parameters
- Fixed vs free time
- Custom timestep bounds
- Multiple states (for ket_trajectory)
- Custom state names
aarontrowbridge and others added 11 commits October 31, 2025 17:02
- Introduced the `QuantumTrajectories` module with three main trajectory types: `UnitaryTrajectory`, `KetTrajectory`, and `DensityTrajectory`.
- Each trajectory type encapsulates quantum-specific metadata and provides high-level constructors for easy initialization.
- Implemented accessor functions for trajectory properties and integrated with existing quantum systems.
- Added tests for each trajectory type to ensure correct functionality and integration with quantum systems.
- Created a new test suite for default integrators and smooth pulse problems, demonstrating the use of the new trajectory types.
- Implemented UnitaryMinimumTimeProblem for minimum-time unitary control optimization.
- Developed UnitarySamplingProblem for robust control pulse generation across multiple quantum systems.
- Created UnitarySmoothPulseProblem for free-time unitary gate problems with smooth control pulses.
- Introduced UnitaryVariationalProblem for optimizing quantum control trajectories with variational parameters.
- Added QuantumControlProblem wrapper to combine quantum trajectory information with optimization problems.
- Included comprehensive documentation for each problem type and their respective arguments.
- Implemented tests for various problem scenarios to ensure functionality and correctness.
- Updated test_load.jl to verify the availability of new problem types in the QuantumCollocation module.
…jective type check in SmoothPulseProblem tests; add empty sampling_problem.jl file
…and Clarity

- Updated SmoothPulseProblem to streamline control derivative handling and integrate new PiccoloQuantumObjects functions.
- Improved integrator initialization logic to support both single and multiple integrators more intuitively.
- Added support for SamplingTrajectory and EnsembleTrajectory in BilinearIntegrator, allowing for dynamic handling of multiple systems and state variables.
- Introduced new KetInfidelityObjective variants to accommodate shared goals across multiple state variables in ensemble contexts.
- Enhanced tests for various trajectory types, ensuring robust validation of integrator functionality and objective definitions.
Copy link
Member Author

@jack-champagne jack-champagne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs are also fairly broken, will be fixing

Copy link
Member Author

@jack-champagne jack-champagne Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the variational stuff being deleted?


# Run all testitem tests in package
@run_package_tests
@run_package_tests filter=ti->( !(:experimental in ti.tags) )
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marking the bilinear density integrator test as flaky and filtering it out here. opening an issue

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.

3 participants