package_complex

qugradlab.pulses.invertible_functions.packaging.package_complex(x: ndarray[float]) Any[source]

Takes the last axis of a real tensor and takes the first entry as the real part and the second as the imaginary.

Parameters:

x (NDArray[Shape[s := Any_Shape, 2], float]) – The tensor to reshape.

Returns:

The reshaped tensor.

Return type:

NDArray[Shape[s], complex]

package_complex.inverse()

Takes a complex tensor and splits it into the real and imaginary parts as the final axis.

PARAMETERS:
  • z (NDArray[Shape[s := Any_Shape], complex]) — The tensor to reshape.

RETURNS:

The reshaped tensor.

RETURN TYPE:

NDArray[Shape[s, 2], float]

package_complex.compose()

Composes package_complex() with another InvertibleFunction to create a new InvertibleFunction along with the composed inverse. That is the following assertions should hold:

assert package_complex.compose(g)(x, *g_args, **g_kwargs)                 == package_complex(g(x, *g_args, **g_kwargs))

for all inputs x.

PARAMETERS:
RETURNS:

A new InvertibleFunction that is the composition of the two functions.

RETURN TYPE:

InvertibleFunction