Quantum Utilities¶
As more and more lowlevel functions migrate to the quantum space, such as dot products and distance estimation between vectors, they comprise a category we (so far) simply refer to as “utility” functions

qcware.qutils.
qdot
(*args, **kwargs)¶  Outputs the dot product of two arrays; quantum analogue of::
numpy.dot
 Cases (following numpy.dot):
x is 1d, y is 1d; performs vector  vector multiplication. Returns float. x is 2d, y is 1d; performs matrix  vector multiplication. Returns 1d array. x is 1d, y is 2d; performs vector  matrix multiplication. Returns 1d array. x is 2d, y is 2d; performs matrix  matrix multiplication. Returns 2d array.
Arguments:
 Parameters
x (Union[float, numpy.ndarray]) – 1d or 2d array
y (Union[float, numpy.ndarray]) – 1d or 2d array
circuit (quasar.Circuit) – Circuit to use for evaluation (None to implicitly create circuit), defaults to None
loader_mode (str) – , defaults to parallel
circuit_mode (str) – , defaults to sequential
backend (str) – , defaults to qcware/cpu_simulator
num_measurements (int) – , defaults to None
 Returns
float, 1d array, or 2d array: dot product
 Return type
Union[float, numpy.ndarray]

qcware.qutils.
distance_estimation
(*args, **kwargs)¶  Outputs the distance between input vectors; quantum analogue of::
numpy.linalg.norm(X  Y)**2
 Cases (following numpy.dot):
x is 1d, y is 1d; performs vector  vector multiplication. Returns float. x is 2d, y is 1d; performs matrix  vector multiplication. Returns 1d array. x is 1d, y is 2d; performs vector  matrix multiplication. Returns 1d array. x is 2d, y is 2d; performs matrix  matrix multiplication. Returns 2d array.
Arguments:
 Parameters
x (Union[float, numpy.ndarray]) – 1d or 2d array
y (Union[float, numpy.ndarray]) – 1d or 2d array
circuit (quasar.Circuit) – Circuit to use for evaluation (None to implicitly create circuit), defaults to None
loader_mode (str) – , defaults to parallel
circuit_mode (str) – , defaults to sequential
backend (str) – , defaults to qcware/cpu_simulator
num_measurements (int) – , defaults to None
 Returns
float, 1d array, or 2d array: distance estimation
 Return type
Union[float, numpy.ndarray]