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 offsett = 0corresponds to theta_1 andt = 1to theta_2. The y-direction is orthogonal to the interpolation vector and may be supplied or generated randomly. This is the orqvizperform_2D_interpolationpattern.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 oftheta_2 - theta_1.span_y (
tuple[float,float]) – Offset range alongdirection_yin units of the y-direction norm.rng (
Generator|int|None) – Optional seed ornumpy.random.Generatorfor the random y-direction.reporter (
ProgressReporter|None) – OptionalProgressReporter.
- Returns:
centeris theta_1;direction_xistheta_2 - theta_1;x_offsetsare the t values.- Return type:
- Raises:
TypeError – If
programis not a supported variational program.NotImplementedError – If
programis anIterativeQAOAinstance.ValueError – If shapes do not match, directions are zero/parallel, or
grid_shapeis invalid.