scan_interp_2d

scan_interp_2d(program, theta_1, theta_2, *, direction_y=None, grid_shape=(41, 41), span_x=(-0.5, 1.5), span_y=(-0.5, 0.5), rng=None, reporter=None)[source]

Two-dimensional interpolation scan between two parameter vectors.

The x-direction is the unnormalized vector theta_2 - theta_1, so offset t = 0 corresponds to theta_1 and t = 1 to theta_2. The y-direction is orthogonal to the interpolation vector and may be supplied or generated randomly. This is the orqviz perform_2D_interpolation pattern.

Default x-span (-0.5, 1.5) extends the interpolation line by half its length in each direction; default y-span (-0.5, 0.5) shows a symmetric strip around the interpolation axis.

Parameters:
  • program (_SupportsVizScan) – Variational program to scan.

  • theta_1 (TypeAliasType) – Starting parameter vector.

  • theta_2 (TypeAliasType) – Ending parameter vector.

  • direction_y (TypeAliasType | None) – Optional y-direction. If omitted, a random vector orthogonal to the interpolation direction is used (same norm, matching orqviz).

  • grid_shape (tuple[int, int]) – (n_x, n_y) grid resolution. Both entries must be >= 2.

  • span_x (tuple[float, float]) – Offset range along the interpolation direction in units of theta_2 - theta_1.

  • span_y (tuple[float, float]) – Offset range along direction_y in units of the y-direction norm.

  • rng (Generator | int | None) – Optional seed or numpy.random.Generator for the random y-direction.

  • reporter (ProgressReporter | None) – Optional ProgressReporter.

Returns:

center is theta_1; direction_x is theta_2 - theta_1; x_offsets are the t values.

Return type:

Scan2DResult

Raises:
  • TypeError – If program is not a supported variational program.

  • NotImplementedError – If program is an IterativeQAOA instance.

  • ValueError – If shapes do not match, directions are zero/parallel, or grid_shape is invalid.