pygsti.baseobjs.opcalc.slowopcalc

Python implementations of common polynomial operations

Module Contents

Functions

_typed_bulk_eval_compact_polynomials(vtape, ctape, paramvec, dest_shape, dtype='auto')

Evaluate many compact polynomial forms at a given set of variable values.

_typed_bulk_eval_compact_polynomials_derivs(vtape, ctape, wrt_params, paramvec, dest_shape, dtype='auto')

abs_sum_bulk_eval_compact_polynomials_complex(vtape, ctape, paramvec, dest_size, **kwargs)

Equivalent to np.sum(np.abs(bulk_eval_compact_polynomials_complex(.)))

compact_deriv(vtape, ctape, wrt_params)

Take the derivative of one or more compact Polynomials with respect

float_product(ar)

Attributes

bulk_eval_compact_polynomials_real

bulk_eval_compact_polynomials_complex

bulk_eval_compact_polynomials_derivs_real

bulk_eval_compact_polynomials_derivs_complex

pygsti.baseobjs.opcalc.slowopcalc._typed_bulk_eval_compact_polynomials(vtape, ctape, paramvec, dest_shape, dtype='auto')

Evaluate many compact polynomial forms at a given set of variable values.

Parameters
  • vtape (numpy.ndarray) – Specifies “variable” and “coefficient” 1D numpy arrays to evaluate. These “tapes” can be generated by concatenating the tapes of individual complact-polynomial tuples returned by :method:`Polynomial.compact`.

  • ctape (numpy.ndarray) – Specifies “variable” and “coefficient” 1D numpy arrays to evaluate. These “tapes” can be generated by concatenating the tapes of individual complact-polynomial tuples returned by :method:`Polynomial.compact`.

  • paramvec (array-like) – An object that can be indexed so that paramvec[i] gives the numerical value to substitute for i-th polynomial variable (x_i).

  • dest_shape (tuple) – The shape of the final array of evaluated polynomials. The resulting 1D array of evaluated polynomials is reshaped accordingly.

  • dtype ({"auto", "real", "complex}) – The type of the coefficient array that is returned.

Returns

numpy.ndarray – An array of the same type as the coefficient tape or with the type given by dtype, and with shape given by dest_shape.

pygsti.baseobjs.opcalc.slowopcalc.bulk_eval_compact_polynomials_real
pygsti.baseobjs.opcalc.slowopcalc.bulk_eval_compact_polynomials_complex
pygsti.baseobjs.opcalc.slowopcalc._typed_bulk_eval_compact_polynomials_derivs(vtape, ctape, wrt_params, paramvec, dest_shape, dtype='auto')
pygsti.baseobjs.opcalc.slowopcalc.bulk_eval_compact_polynomials_derivs_real
pygsti.baseobjs.opcalc.slowopcalc.bulk_eval_compact_polynomials_derivs_complex
pygsti.baseobjs.opcalc.slowopcalc.abs_sum_bulk_eval_compact_polynomials_complex(vtape, ctape, paramvec, dest_size, **kwargs)

Equivalent to np.sum(np.abs(bulk_eval_compact_polynomials_complex(.)))

pygsti.baseobjs.opcalc.slowopcalc.compact_deriv(vtape, ctape, wrt_params)

Take the derivative of one or more compact Polynomials with respect to one or more variables/parameters.

Parameters
  • vtape (numpy.ndarray) – Specifies “variable” and “coefficient” 1D numpy arrays to differentiate. These “tapes” can be generated by concatenating the tapes of individual complact-polynomial tuples returned by :method:`Polynomial.compact`.

  • ctape (numpy.ndarray) – Specifies “variable” and “coefficient” 1D numpy arrays to differentiate. These “tapes” can be generated by concatenating the tapes of individual complact-polynomial tuples returned by :method:`Polynomial.compact`.

  • wrt_params (list) – The variable indices to differentiate with respect to. They must be sorted in ascending order. E.g. “[0,3]” means separatey differentiate w.r.t x_0 and x_3 (concatenated first by wrt_param then by poly).

Returns

vtape, ctape (numpy.ndarray)

pygsti.baseobjs.opcalc.slowopcalc.float_product(ar)