rydiqule.stack_solvers.cyrk_solver.cyrk_solve¶
- rydiqule.stack_solvers.cyrk_solver.cyrk_solve(eoms_base: ndarray, const_base: ndarray, eom_time_r: ndarray, const_r: ndarray, eom_time_i: ndarray, const_i: ndarray, time_inputs: Sequence[Callable[[float], complex]], t_eval: ndarray, init_cond: ndarray, eqns: Literal['orig', 'flat'] = 'orig', **kwargs) ndarray [source]¶
Solve a set of Optical Bloch Equations (OBEs) with rydiqule’s time solving convention using CyRK’s
pysolve_ivp
.Uses matrix components of the equations of motion provided by the methods of a
Sensor()
. Designed to be used as a wrapped function withinsolve_time()
. Builds and solves equations of motion according rydiqule’s time solving conventions. Sets up and solves dx/dt = A(t)x + b(t)For larger solve systems,
max_ram_MB
kwarg forpysolve_ivp
will likely need to be increased from its default of 2000.- Parameters:
eoms_base (numpy.ndarray) – The matrix of shape
(*l,n,n)
representing the non time-varying portion of the matrix A in the equations of motion.const_base (numpy.ndarray) – The array of shape
(*l, n)
representing the non time-varying portion of the vector b in the equations of motion.eoms_time_r (numpy.ndarraynumpy) – The matrix of shape
(n_t, *l, n, n)
representing the real time-varying portion of the matrix A, where n_t is the length oftime_inputs
. The ith slice along the first axis should be multiplied by the real part of the ith entry intime_inputs
.const_r (numpy.nd_array) – The matrix of shape
(n_t, *l, n)
representing the real time-varying portion of the vector b, where n_t is the length oftime_inputs
. The ith slice along the first axis should be multiplied by the real part of the ith entry intime_inputs
.eoms_time_i (numpy.ndarray) – The matrix of shape
(n_t, *l, n, n)
representing the imaginary time-varying portion of the matrix A, where n_t is the length oftime_inputs
. The ith slice along the first axis should be multiplied by the imaginary part of the ith entry intime_inputs
.const_i (numpy.nd_array) – The matrix of shape
(n_t, *l, n)
representing the imaginary time-varying portion of the vector b, where n_t is the length oftime_inputs
. The ith slice along the first axis should be multiplied by the imaginary part of the ith entry intime_inputs
.time_inputs (list(callable)) – List of callable functions of length
n_t
. The functions should take a single floating point as an input representing the time in microseconds, and return a real or complex floating point value represent an electric field in V/m at that time. Return type of each function must be the same for all inputs t.t_eval (numpy.ndarray) – Array of times to sample the integration at. This array must have dtype of float64.
init_cond (numpy.ndarray) – Matrix of shape
(*l, n)
representing the initial state of the system.eqns ({"orig", "flat"}) – Method used to generate the derivative equations. Options are orig (which uses a numpy reshaping approach) and flat (which uses flat array indexing).
**kwargs (dict:) – Additional keyword arguments passed to
pysolve_ivp
.
- Returns:
The matrix solution of shape
(*l,n,n_t)
representing the density matrix of the system at each time t.- Return type:
- Raises:
RydiquleError – If system size exceeds cyrk backend limit of 65535 equations. If we see this error a lot, consider getting CyRK project to increase it by changing type of
y_size
from unisgned short.