# Nodes

## Optimization variables

When performing optimizations, you can use these operations to create the optimizable variables that can be tuned by the optimizer in order to minimize your cost function.

anchored_difference_bounded_variables | Create a sequence of optimizable variables with an anchored difference bound. |

complex_optimizable_pwc_signal | Create a complex optimizable piecewise-constant signal. |

optimizable_scalar | Create an optimizable scalar Tensor, which can be bounded, semi-bounded, or unbounded. |

optimization_variable | Create a 1D Tensor of optimization variables, which can be bounded, semi-bounded, or unbounded. |

real_fourier_pwc_signal | Create a piecewise-constant signal constructed from Fourier components. |

real_fourier_stf_signal | Create a real sampleable signal constructed from Fourier components. |

real_optimizable_pwc_signal | Create a real optimizable piecewise-constant signal. |

## Piecewise-constant tensor functions (PWCs)

You can use these operations to create piecewise-constant functions either to represent control signals or system Hamiltonians.

complex_pwc_signal | Create a complex piecewise-constant signal from moduli and phases. |

constant_pwc | Create a piecewise-constant function of time that is constant over a specified duration. |

constant_pwc_operator | Create a constant piecewise-constant operator over a specified duration. |

pwc | Create a piecewise-constant function of time. |

pwc_operator | Create a constant operator multiplied by a piecewise-constant signal. |

pwc_signal | Create a piecewise-constant signal (scalar-valued function of time). |

pwc_sum | Create the sum of multiple piecewise-constant terms. |

real_fourier_pwc_signal | Create a piecewise-constant signal constructed from Fourier components. |

sample_pwc | Sample a Pwc at the given times. |

symmetrize_pwc | Create the symmetrization of a piecewise-constant function. |

time_concatenate_pwc | Concatenate multiple piecewise-constant functions in the time dimension. |

time_reverse_pwc | Reverse in time a piecewise-constant function. |

## Sampleable tensor functions (STFs)

You can use these functions to represent time-dependent functions in Boulder Opal.

constant_stf | Create a constant sampleable tensor-valued function of time. |

constant_stf_operator | Create a constant operator. |

identity_stf | Create an Stf representing the identity function, f(t) = t. |

real_fourier_stf_signal | Create a real sampleable signal constructed from Fourier components. |

sample_stf | Sample an Stf at the given times. |

stf_operator | Create a constant operator multiplied by a sampleable signal. |

stf_sum | Create the sum of multiple sampleable functions. |

## Filtering and discretizing

You can use these functions to filter or resample the control signals.

convolve_pwc | Create the convolution of a piecewise-constant function with a kernel. |

discretize_stf | Create a piecewise-constant function by discretizing a sampleable function. |

filter_and_resample_pwc | Filter a piecewise-constant function by convolving it with a kernel and resample it again. |

gaussian_convolution_kernel | Create a convolution kernel representing a normalized Gaussian. |

sinc_convolution_kernel | Create a convolution kernel representing the sinc function. |

## Predefined signals

You can use these operations to create common analytical signals.

For creating analytical signals not bound to a graph see the Signal library module.

signals.SegmentationType | An enumeration of segmentation types for piecewise-constant signals. |

signals.cosine_pulse_pwc | Create a Pwc representing a cosine pulse. |

signals.gaussian_pulse_pwc | Create a Pwc representing a Gaussian pulse. |

signals.gaussian_pulse_stf | Create an Stf representing a Gaussian pulse. |

signals.hann_series_pwc | Create a Pwc representing a sum of Hann window functions. |

signals.hann_series_stf | Create an Stf representing a sum of Hann window functions. |

signals.linear_ramp_pwc | Create a Pwc representing a linear ramp. |

signals.linear_ramp_stf | Create an Stf representing a linear ramp. |

signals.sech_pulse_pwc | Create a Pwc representing a hyperbolic secant pulse. |

signals.sech_pulse_stf | Create an Stf representing a hyperbolic secant pulse. |

signals.sinusoid_pwc | Create a Pwc representing a sinusoidal oscillation. |

signals.sinusoid_stf | Create an Stf representing a sinusoidal oscillation. |

signals.square_pulse_pwc | Create a Pwc representing a square pulse. |

signals.tanh_ramp_pwc | Create a Pwc representing a hyperbolic tangent ramp. |

signals.tanh_ramp_stf | Create an Stf representing a hyperbolic tangent ramp. |

## Quantum information

You can use these operations to calculate common operations and metrics from quantum information theory.

annihilation_operator | Create an annihilation operator in the truncated Fock space. |

coherent_state | Create a coherent state (or a batch of them). |

creation_operator | Create a creation operator in the truncated Fock space. |

density_matrix_expectation_value | Calculate the expectation value of an operator with respect to a density matrix. |

density_matrix_infidelity | Calculate the infidelity between two states represented by density matrices. |

displacement_operator | Create a displacement operator (or a batch of them). |

embed_operators | Embed an operator or set of operators into a larger Hilbert space. |

expectation_value | Calculate the expectation value of an operator with respect to a state. |

fock_state | Create a Fock state (or a batch of them). |

inner_product | Calculate the inner product of two vectors. |

kronecker_product_list | Calculate the Kronecker product between a list of operators. |

number_operator | Create a number operator in the truncated Fock space. |

outer_product | Calculate the outer product of two vectors. |

partial_trace | Calculate the partial trace of a density matrix. |

pauli_kronecker_product | Place Pauli matrices into their two-dimensional subsystems of a system and returns the Kronecker product. |

pauli_matrix | Create a Pauli matrix from a label. |

squeeze_operator | Create a squeeze operator (or a batch of them). |

state_infidelity | Calculate the infidelity of two pure states. |

unitary_infidelity | Calculate the infidelity between a target operation and the actual implemented unitary. |

wigner_transform | Transform a density matrix into a Wigner function (or a batch of them). |

## Time evolution

You can use these operations to calculate the time evolution of your open or closed quantum system, either for simulations or optimizations.

density_matrix_evolution_pwc | Calculate the state evolution of an open system described by the GKS–Lindblad master equation. |

estimated_krylov_subspace_dimension_lanczos | Calculate an appropriate Krylov subspace dimension ($k$) to use in the Lanczos integrator while keeping the total error in the evolution below a given error tolerance. |

filter_function | Evaluate the filter function for a control Hamiltonian and a noise operator at the given frequency elements. |

frequency_domain_noise_operator | Create a control-frame noise operator in the frequency domain for a control Hamiltonian and a noise operator at the given frequencies. |

jump_trajectory_evolution_pwc | Calculate the state evolution of an open system described by the GKS–Lindblad master equation using a jump-based trajectory method. |

spectral_range | Obtain the range of the eigenvalues of a Hermitian operator. |

state_evolution_pwc | Calculate the time evolution of a state generated by a piecewise-constant Hamiltonian by using the Lanczos method. |

steady_state | Find the steady state of a time-independent open quantum system. |

time_evolution_operators_pwc | Calculate the unitary time-evolution operators for a system defined by a piecewise-constant Hamiltonian. |

time_evolution_operators_stf | Calculate the time-evolution operators for a system defined by an STF Hamiltonian by using a 4th order Runge–Kutta method. |

## Optimal and robust control

You can use these operations, together with the operations for creating optimization variables to define convenient cost functions for optimal and robust control.

infidelity_pwc | Create the total infidelity of the given piecewise-constant system. |

infidelity_stf | Create the total infidelity of a given system with a sampleable Hamiltonian. |

target | Create information about the target for system time evolution. |

## Large systems

You can use these operations to build graphs that efficiently handle large quantum systems.

constant_sparse_pwc_operator | Create a constant sparse piecewise-constant operator over a specified duration. |

density_matrix_evolution_pwc | Calculate the state evolution of an open system described by the GKS–Lindblad master equation. |

estimated_krylov_subspace_dimension_lanczos | Calculate an appropriate Krylov subspace dimension ($k$) to use in the Lanczos integrator while keeping the total error in the evolution below a given error tolerance. |

jump_trajectory_evolution_pwc | Calculate the state evolution of an open system described by the GKS–Lindblad master equation using a jump-based trajectory method. |

sparse_pwc_hermitian_part | Create the Hermitian part of a piecewise-constant operator. |

sparse_pwc_operator | Create a sparse piecewise-constant operator (sparse-matrix-valued function of time). |

sparse_pwc_sum | Create the sum of multiple sparse-matrix-valued piecewise-constant functions. |

spectral_range | Obtain the range of the eigenvalues of a Hermitian operator. |

state_evolution_pwc | Calculate the time evolution of a state generated by a piecewise-constant Hamiltonian by using the Lanczos method. |

steady_state | Find the steady state of a time-independent open quantum system. |

## Mølmer–Sørensen gates

You can use these operations to efficiently model systems described by Mølmer–Sørensen interactions.

ions.ms_dephasing_robust_cost | Calculate the cost for robust optimization of a Mølmer–Sørensen gate. |

ions.ms_displacements | Calculate the displacements for each mode and ion combination where ions are described by a Mølmer–Sørensen-type interaction. |

ions.ms_infidelity | Calculate the final operational infidelity of the Mølmer–Sørensen gate. |

ions.ms_phases | Calculate the relative phases for all pairs of ions described by a Mølmer–Sørensen-type interaction when single-tone individually-addressed laser beams are used. |

ions.ms_phases_multitone | Calculate the relative phases for all pairs of ions described by a Mølmer–Sørensen-type interaction where the ions are being addressed by a multitone global beam. |

## Random operations

You can use these operations to create random quantities, which take different values each time they are evaluated. These operations are most useful in simulations and stochastic optimizations.

random.choices | Create random samples from the data that you provide. |

random.colored_noise_stf_signal | Sample the one-sided power spectral density (PSD) of a random noise process in the time domain and returns the resultant noise trajectories as an Stf. |

random.normal | Create a sample of normally distributed random numbers. |

random.uniform | Create a sample of uniformly distributed random numbers. |

## Manipulating tensors

You can use these operations to manipulate the structures of tensors.

concatenate | Concatenate a list of tensors along a specified dimension. |

cumulative_sum | Calculate the cumulative sum of a tensor along a specified dimension. |

einsum | Perform tensor contraction via Einstein summation convention. |

max | Find the maximum value in a tensor along one or multiple of its axes. |

min | Find the minimum value in a tensor along one or multiple of its axes. |

repeat | Repeat elements of a tensor. |

reshape | Reshape a tensor into a new shape, keeping the order of its elements. |

reverse | Reverse a tensor along some specified dimensions. |

sum | Sum the elements in a tensor (or a list of tensors with the same shape) along one or multiple of its axes. |

tensor | Create a real or complex Tensor with the data provided. |

transpose | Reorder the dimensions of a tensor. |

## Linear algebra

adjoint | Calculate the element-wise adjoint of the last two dimensions of an object. |

density_matrix_expectation_value | Calculate the expectation value of an operator with respect to a density matrix. |

einsum | Perform tensor contraction via Einstein summation convention. |

embed_operators | Embed an operator or set of operators into a larger Hilbert space. |

expectation_value | Calculate the expectation value of an operator with respect to a state. |

hermitian_part | Calculate the Hermitian part of an object. |

hessian | Calculate a single Hessian matrix for all the variables. |

inner_product | Calculate the inner product of two vectors. |

kron | Calculate the Kronecker product between np.ndarrays, Tensors, Pwcs, or Stfs. |

kronecker_product_list | Calculate the Kronecker product between a list of operators. |

matmul | Calculate the matrix multiplication between np.ndarrays, Tensors, Pwcs, or Stfs. |

outer_product | Calculate the outer product of two vectors. |

partial_trace | Calculate the partial trace of a density matrix. |

trace | Calculate the trace of an object. |

transpose | Reorder the dimensions of a tensor. |

## Basic mathematical functions

abs | Calculate the element-wise absolute value of an object. |

add | Calculate the element-wise sum between numbers, np.ndarrays, Tensors, Pwcs, or Stfs. |

angle | Calculate the element-wise argument of an object. |

arccos | Calculate the element-wise arccosine of an object. |

arcsin | Calculate the element-wise arcsine of an object. |

arctan | Calculate the element-wise arctangent of an object. |

complex_value | Create element-wise complex values from real numbers, np.ndarrays, Tensors, Pwcs, or Stfs, that is, the real and imaginary parts. |

conjugate | Calculate the element-wise complex conjugate of an object. |

cos | Calculate the element-wise cosine of an object. |

cosh | Calculate the element-wise hyperbolic cosine of an object. |

cumulative_sum | Calculate the cumulative sum of a tensor along a specified dimension. |

exp | Calculate the element-wise exponential of an object. |

floordiv | Calculate the element-wise rounded-down division between real numbers, np.ndarrays, Tensors, Pwcs, or Stfs. |

imag | Calculate the element-wise imaginary part of an object. |

log | Calculate the element-wise natural logarithm of an object. |

multiply | Calculate the element-wise product between numbers, np.ndarrays, Tensors, Pwcs, or Stfs. |

negative | Calculate the element-wise numerical negative value of an object. |

pow | Calculate the element-wise power between numbers, np.ndarrays, Tensors, Pwcs, or Stfs. |

real | Calculate the element-wise real part of an object. |

sin | Calculate the element-wise sine of an object. |

sinh | Calculate the element-wise hyperbolic sine of an object. |

sqrt | Calculate the element-wise square root of an object. |

subtract | Calculate the element-wise difference between numbers, np.ndarrays, Tensors, Pwcs, or Stfs. |

sum | Sum the elements in a tensor (or a list of tensors with the same shape) along one or multiple of its axes. |

tan | Calculate the element-wise tangent of an object. |

tanh | Calculate the element-wise hyperbolic tangent of an object. |

truediv | Calculate the element-wise division between numbers, np.ndarrays, Tensors, Pwcs, or Stfs. |