2.1.9. filter_functions.util

This module provides various helper functions.

2.1.9.1. Functions

abs2()

Absolute value squared

get_indices_from_identifiers()

The indices of a subset of identifiers within a list of identifiers.

tensor()

Fast, flexible tensor product of an arbitrary number of inputs using einsum()

tensor_insert()

For an array that is known to be a tensor product, insert arrays at a given position in the product chain

tensor_merge()

For two arrays that are tensor products of known dimensions, merge them at arbitary positions in the product chain

tensor_transpose()

For a tensor product, transpose the order of the constituents in the product chain

mdot()

Multiple matrix product

adot()

Accumulated matrix product

remove_float_errors()

Set entries whose absolute value is below a certain threshold to zero

oper_equiv()

Determine if two vectors or operators are equal up to a global phase

dot_HS()

Hilbert-Schmidt inner product

get_sample_frequencies()

Get frequencies with typical infrared and ultraviolet cutoffs for a PulseSequence

progressbar()

A progress bar for loops. Uses tqdm if available and a simple custom one if not.

hash_array_along_axis()

Return a list of hashes along a given axis

all_array_equal()

Check if all arrays in an iterable are equal

2.1.9.2. Exceptions

CalculationError

Exception raised if trying to fetch the pulse correlation function when it was not computed during concatenation

Functions

abs2(x)

Fast function to calculate the absolute value squared,

adot(arr[, axis])

Accumulate matrix products along axis.

all_array_equal(it)

Return True if all array elements of it are equal by hashing the bytes representation of each array.

cexp(x[, out, where])

Fast complex exponential.

cexpm1(x[, out, where])

Fast complex exponential minus one.

dot_HS(U, V[, eps])

Return the Hilbert-Schmidt inner product of U and V,

get_indices_from_identifiers(...)

Get the indices of operators for given identifiers.

get_sample_frequencies(pulse[, n_samples, ...])

Get n_samples sample frequencies spaced 'linear' or 'log'.

hash_array_along_axis(arr[, axis])

Return the hashes of arr along the first axis

integrate(f[, x, dx])

Fast trapezoidal integration with small memory footprint.

is_sequence_like(obj)

Test if obj is a sequence-like type.

mdot(arr[, axis])

Multiple matrix products along axis.

oper_equiv(psi, phi[, eps, normalized])

Checks whether psi and phi are equal up to a global phase, i.e.

parse_operators(opers, err_loc)

Parse a sequence of operators and convert to ndarray.

parse_optional_parameters(**allowed_kwargs)

Decorator factory to parse optional parameter with certain legal values.

parse_spectrum(spectrum, omega, idx)

progressbar(iterable, *args, **kwargs)

Progress bar for loops.

progressbar_range(*args[, show_progressbar])

Wrapper for range() that shows a progressbar dependent on a kwarg.

remove_float_errors(arr[, eps_scale])

Clean up arr by removing floating point numbers smaller than the dtype's precision multiplied by eps_scale.

tensor(*args[, rank, optimize])

Fast, flexible tensor product using einsum.

tensor_insert(arr, *args, pos, arr_dims[, ...])

For a tensor product arr, insert args into the product chain at pos.

tensor_merge(arr, ins, pos, arr_dims, ins_dims)

For two tensor products arr and ins, merge ins into the product chain at indices pos.

tensor_transpose(arr, order, arr_dims[, rank])

Transpose the order of a tensor product chain.

Exceptions

CalculationError(message)

Indicates a quantity could not be computed.