Quandary
Loading...
Searching...
No Matches
Classes | Functions
mastereq.hpp File Reference
#include "defs.hpp"
#include "oscillator.hpp"
#include "util.hpp"
#include <optional>
#include <petscts.h>
#include <vector>
#include <assert.h>
#include <iostream>
#include "gate.hpp"
#include "hamiltonianfilereader.hpp"
Include dependency graph for mastereq.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MatShellCtx
 Matrix shell context containing data needed for applying the right-hand-side (RHS) system matrix to a vector. More...
 
class  MasterEq
 Implementation of the real-valued right-hand-side (RHS) system matrix of the quantum dynamical equations. More...
 

Functions

int applyRHS_matfree_1Osc (Mat RHS, Vec x, Vec y)
 Matrix-vector products to apply the RHS system matrix to a state vector.
 
int applyRHS_matfree_transpose_1Osc (Mat RHS, Vec x, Vec y)
 Transpose matrix-free MatMult for 1 oscillator.
 
int applyRHS_matfree_2Osc (Mat RHS, Vec x, Vec y)
 Matrix-free MatMult for 2 oscillators.
 
int applyRHS_matfree_transpose_2Osc (Mat RHS, Vec x, Vec y)
 Transpose matrix-free MatMult for 2 oscillators.
 
int applyRHS_matfree_3Osc (Mat RHS, Vec x, Vec y)
 Matrix-free MatMult for 3 oscillators.
 
int applyRHS_matfree_transpose_3Osc (Mat RHS, Vec x, Vec y)
 Transpose matrix-free MatMult for 3 oscillators.
 
int applyRHS_matfree_4Osc (Mat RHS, Vec x, Vec y)
 Matrix-free MatMult for 4 oscillators.
 
int applyRHS_matfree_transpose_4Osc (Mat RHS, Vec x, Vec y)
 Transpose matrix-free MatMult for 4 oscillators.
 
int applyRHS_matfree_5Osc (Mat RHS, Vec x, Vec y)
 Matrix-free MatMult for 5 oscillators.
 
int applyRHS_matfree_transpose_5Osc (Mat RHS, Vec x, Vec y)
 Transpose matrix-free MatMult for 5 oscillators.
 
int applyRHS_sparsemat (Mat RHS, Vec x, Vec y)
 Sparse matrix MatMult.
 
int applyRHS_sparsemat_transpose (Mat RHS, Vec x, Vec y)
 Transpose sparse matrix MatMult.
 
void compute_dRHS_dParams_sparsemat (const double t, const Vec x, const Vec x_bar, const double alpha, Vec grad, std::vector< size_t > &nlevels, IS isu, IS isv, std::vector< Mat > &Ac_vec, std::vector< Mat > &Bc_vec, Vec aux, Oscillator **oscil_vec)
 : Sparse-matrix version to compute gradient of RHS with respect to parameters
 
void compute_dRHS_dParams_matfree (const PetscInt dim, const double t, const Vec x, const Vec x_bar, const double alpha, Vec grad, std::vector< size_t > &nlevels, DecoherenceType decoherence_type, Oscillator **oscil_vec)
 : Matrix free version to compute gradient of RHS with respect to parameters
 
double H_detune (const double detuning0, const int a)
 Inline for Matrix-free RHS to Compute detuning for 1 oscillator.
 
double H_selfkerr (const double xi0, const int a)
 Inline for Matrix-free RHS to Compute self-Kerr coefficient for 1 oscillator.
 
double L2 (const double dephase0, const int i0, const int i0p)
 Inline for Matrix-free RHS to compute L2 dephasing coefficient for 1 oscillator.
 
double L1diag (const double decay0, const int i0, const int i0p)
 Inline for Matrix-free RHS to compute L1 decay coefficient for 1 oscillator.
 
int TensorGetIndex (const int nlevels0, const int i0, const int i0p)
 Inline for Matrix-free RHS to compute tensor product index for 1 oscillator system.
 
double H_detune (const double detuning0, const double detuning1, const int a, const int b)
 Inline for Matrix-free RHS, Computes detuning Hamiltonian term for 2 oscillators.
 
double H_selfkerr (const double xi0, const double xi1, const int a, const int b)
 Inline for Matrix-free RHS, Computes self-Kerr nonlinearity terms for 2 oscillators.
 
double H_crosskerr (const double xi01, const int a, const int b)
 Inline for Matrix-free RHS, Computes cross-Kerr coupling between 2 oscillators.
 
double L2 (const double dephase0, const double dephase1, const int i0, const int i1, const int i0p, const int i1p)
 Inline for Matrix-free RHS, Computes L2 dephasing Lindblad operator for 2 oscillators.
 
double L1diag (const double decay0, const double decay1, const int i0, const int i1, const int i0p, const int i1p)
 Inline for Matrix-free RHS, Computes L1 decay Lindblad operator diagonal term for 2 oscillators.
 
int TensorGetIndex (const int nlevels0, const int nlevels1, const int i0, const int i1, const int i0p, const int i1p)
 Inline for Matrix-free RHS, Computes tensor product index for 2 oscillator system.
 
double H_detune (const double detuning0, const double detuning1, const double detuning2, const int i0, const int i1, const int i2)
 
double H_selfkerr (const double xi0, const double xi1, const double xi2, const int i0, const int i1, const int i2)
 
double H_crosskerr (const double xi01, const double xi02, const double xi12, const int i0, const int i1, const int i2)
 
double L2 (const double dephase0, const double dephase1, const double dephase2, const int i0, const int i1, const int i2, const int i0p, const int i1p, const int i2p)
 
double L1diag (const double decay0, const double decay1, const double decay2, const int i0, const int i1, const int i2, const int i0p, const int i1p, const int i2p)
 
int TensorGetIndex (const int nlevels0, const int nlevels1, const int nlevels2, const int i0, const int i1, const int i2, const int i0p, const int i1p, const int i2p)
 
double H_detune (const double detuning0, const double detuning1, const double detuning2, const double detuning3, const int i0, const int i1, const int i2, const int i3)
 
double H_selfkerr (const double xi0, const double xi1, const double xi2, const double xi3, const int i0, const int i1, const int i2, const int i3)
 
double H_crosskerr (const double xi01, const double xi02, const double xi03, const double xi12, const double xi13, const double xi23, const int i0, const int i1, const int i2, const int i3)
 
double L2 (const double dephase0, const double dephase1, const double dephase2, const double dephase3, const int i0, const int i1, const int i2, const int i3, const int i0p, const int i1p, const int i2p, const int i3p)
 
double L1diag (const double decay0, const double decay1, const double decay2, const double decay3, const int i0, const int i1, const int i2, const int i3, const int i0p, const int i1p, const int i2p, const int i3p)
 
int TensorGetIndex (const int nlevels0, const int nlevels1, const int nlevels2, const int nlevels3, const int i0, const int i1, const int i2, const int i3, const int i0p, const int i1p, const int i2p, const int i3p)
 
double H_detune (const double detuning0, const double detuning1, const double detuning2, const double detuning3, const double detuning4, const int i0, const int i1, const int i2, const int i3, const int i4)
 
double H_selfkerr (const double xi0, const double xi1, const double xi2, const double xi3, const double xi4, const int i0, const int i1, const int i2, const int i3, const int i4)
 
double H_crosskerr (const double xi01, const double xi02, const double xi03, const double xi04, const double xi12, const double xi13, const double xi14, const double xi23, const double xi24, const double xi34, const int i0, const int i1, const int i2, const int i3, const int i4)
 
double L2 (const double dephase0, const double dephase1, const double dephase2, const double dephase3, const double dephase4, const int i0, const int i1, const int i2, const int i3, const int i4, const int i0p, const int i1p, const int i2p, const int i3p, const int i4p)
 
double L1diag (const double decay0, const double decay1, const double decay2, const double decay3, const double decay4, const int i0, const int i1, const int i2, const int i3, const int i4, const int i0p, const int i1p, const int i2p, const int i3p, const int i4p)
 
int TensorGetIndex (const int nlevels0, const int nlevels1, const int nlevels2, const int nlevels3, const int nlevels4, const int i0, const int i1, const int i2, const int i3, const int i4, const int i0p, const int i1p, const int i2p, const int i3p, const int i4p)
 
void dRHSdp_getcoeffs (const PetscInt dim, const int it, const int n, const int np, const int i, const int ip, const int stridei, const int strideip, const double *xptr, double *res_p_re, double *res_p_im, double *res_q_re, double *res_q_im)
 Inline for Matrix-free RHS for gradient updates.
 
void Jkl_coupling (const PetscInt dim, const int it, const int ni, const int nj, const int nip, const int njp, const int i, const int ip, const int j, const int jp, const int stridei, const int strideip, const int stridej, const int stridejp, const double *xptr, const double Jij, const double cosij, const double sinij, double *yre, double *yim)
 Matrix-free solver inline for dipole-dipole coupling between oscillators.
 
void Jkl_coupling_T (const PetscInt dim, const int it, const int ni, const int nj, const int nip, const int njp, const int i, const int ip, const int j, const int jp, const int stridei, const int strideip, const int stridej, const int stridejp, const double *xptr, const double Jij, const double cosij, const double sinij, double *yre, double *yim)
 Transpose of dipole-dipole coupling for adjoint computations.
 
void L1decay (const PetscInt dim, const int it, const int n, const int i, const int ip, const int stridei, const int strideip, const double *xptr, const double decayi, double *yre, double *yim)
 Matrix-free solver inline for off-diagonal L1 decay term.
 
void L1decay_T (const PetscInt dim, const int it, const int i, const int ip, const int stridei, const int strideip, const double *xptr, const double decayi, double *yre, double *yim)
 Matrix-free inline Transpose of off-diagonal L1 decay for adjoint computations.
 
void control (const PetscInt dim, const int it, const int n, const int i, const int np, const int ip, const int stridei, const int strideip, const double *xptr, const double pt, const double qt, double *yre, double *yim)
 Matrix-free solver inline for control terms.
 
void control_T (const PetscInt dim, const int it, const int n, const int i, const int np, const int ip, const int stridei, const int strideip, const double *xptr, const double pt, const double qt, double *yre, double *yim)
 Matrix-free Transpose of control terms for adjoint computations.
 

Function Documentation

◆ applyRHS_matfree_1Osc()

int applyRHS_matfree_1Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Matrix-vector products to apply the RHS system matrix to a state vector.

Each function returns y = RHS*x. Matrix-free versions as well as sparse-matrix versions are implemented. Those functions will be passed to PETSc's MatMult operations to realize a Matrix-Vector Multiplication of the RHS with a state vector, such that one can call PETSc's MatMult(RHS, x, y) for the RHS. Note: The RHS matrix must be assembled before usage, see MasterEq::assemble_RHS. Matrix-free MatMult for 1 oscillator

◆ applyRHS_matfree_2Osc()

int applyRHS_matfree_2Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Matrix-free MatMult for 2 oscillators.

◆ applyRHS_matfree_3Osc()

int applyRHS_matfree_3Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Matrix-free MatMult for 3 oscillators.

◆ applyRHS_matfree_4Osc()

int applyRHS_matfree_4Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Matrix-free MatMult for 4 oscillators.

◆ applyRHS_matfree_5Osc()

int applyRHS_matfree_5Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Matrix-free MatMult for 5 oscillators.

◆ applyRHS_matfree_transpose_1Osc()

int applyRHS_matfree_transpose_1Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Transpose matrix-free MatMult for 1 oscillator.

◆ applyRHS_matfree_transpose_2Osc()

int applyRHS_matfree_transpose_2Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Transpose matrix-free MatMult for 2 oscillators.

◆ applyRHS_matfree_transpose_3Osc()

int applyRHS_matfree_transpose_3Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Transpose matrix-free MatMult for 3 oscillators.

◆ applyRHS_matfree_transpose_4Osc()

int applyRHS_matfree_transpose_4Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Transpose matrix-free MatMult for 4 oscillators.

◆ applyRHS_matfree_transpose_5Osc()

int applyRHS_matfree_transpose_5Osc ( Mat  RHS,
Vec  x,
Vec  y 
)

Transpose matrix-free MatMult for 5 oscillators.

◆ applyRHS_sparsemat()

int applyRHS_sparsemat ( Mat  RHS,
Vec  x,
Vec  y 
)

Sparse matrix MatMult.

◆ applyRHS_sparsemat_transpose()

int applyRHS_sparsemat_transpose ( Mat  RHS,
Vec  x,
Vec  y 
)

Transpose sparse matrix MatMult.

◆ compute_dRHS_dParams_matfree()

void compute_dRHS_dParams_matfree ( const PetscInt  dim,
const double  t,
const Vec  x,
const Vec  x_bar,
const double  alpha,
Vec  grad,
std::vector< size_t > &  nlevels,
DecoherenceType  decoherence_type,
Oscillator **  oscil_vec 
)

: Matrix free version to compute gradient of RHS with respect to parameters

Updates grad += alpha * x^T * (d RHS / d params)^T * x_bar in a matrix-free manner. See compute_dRHS_dParams_sparsemat for the sparse-matrix version of this routine.

Parameters
[in]dimDimension of full vectorized system: N^2 if Lindblad, N if Schroedinger
[in]tCurrent time
[in]xState vector
[in]x_barAdjoint state vector
[in]alphaScaling factor
[out]gradGradient vector to update
[in]nlevelsNumber of energy levels per subsystem
[in]decoherence_typeType of Lindblad decoherence operators, or NONE
[in]oscil_vecVector of quantum oscillators

◆ compute_dRHS_dParams_sparsemat()

void compute_dRHS_dParams_sparsemat ( const double  t,
const Vec  x,
const Vec  x_bar,
const double  alpha,
Vec  grad,
std::vector< size_t > &  nlevels,
IS  isu,
IS  isv,
std::vector< Mat > &  Ac_vec,
std::vector< Mat > &  Bc_vec,
Vec  aux,
Oscillator **  oscil_vec 
)

: Sparse-matrix version to compute gradient of RHS with respect to parameters

Updates grad += alpha * x^T * (d RHS / d params)^T * x_bar with sparse-matrix version of RHS. Compare compute_dRHS_dParams_matfree for the matrix-free version of this routine.

Parameters
[in]tCurrent time
[in]xState vector
[in]x_barAdjoint state vector
[in]alphaScaling factor
[out]gradGradient vector to update
[in]nlevelsNumber of energy levels per subsystem
[in]isuIndex stride to access real parts of a state vector
[in]isvIndex stride to access imaginar parts of a state vector
[in]Ac_vecVector of real parts of control matrices per oscillator
[in]Bc_vecVector of imaginary parts of control matrices per oscillator
[in]auxAuxiliary vector for computations
[in]oscil_vecVector of quantum oscilators

◆ control()

void control ( const PetscInt  dim,
const int  it,
const int  n,
const int  i,
const int  np,
const int  ip,
const int  stridei,
const int  strideip,
const double *  xptr,
const double  pt,
const double  qt,
double *  yre,
double *  yim 
)
inline

Matrix-free solver inline for control terms.

Applies control Hamiltonian terms (ladder operators) to the state.

Parameters
dimDimension of full vectorized system: N^2 if Lindblad, N if Schroedinger
itCurrent tensor index
nNumber of levels
iOccupation number (bra)
npNumber of levels (conjugate)
ipOccupation number (ket)
strideiStride for bra index
strideipStride for ket index
xptrPointer to state vector data
ptReal part of control amplitude
qtImaginary part of control amplitude
yrePointer to store real part of result
yimPointer to store imaginary part of result

◆ control_T()

void control_T ( const PetscInt  dim,
const int  it,
const int  n,
const int  i,
const int  np,
const int  ip,
const int  stridei,
const int  strideip,
const double *  xptr,
const double  pt,
const double  qt,
double *  yre,
double *  yim 
)
inline

Matrix-free Transpose of control terms for adjoint computations.

Parameters
dimDimension of full vectorized system: N^2 if Lindblad, N if Schroedinger
itCurrent tensor index
nNumber of levels
iOccupation number (bra)
npNumber of levels (conjugate)
ipOccupation number (ket)
strideiStride for bra index
strideipStride for ket index
xptrPointer to state vector data
ptReal part of control amplitude
qtImaginary part of control amplitude
yrePointer to store real part of result
yimPointer to store imaginary part of result

◆ dRHSdp_getcoeffs()

void dRHSdp_getcoeffs ( const PetscInt  dim,
const int  it,
const int  n,
const int  np,
const int  i,
const int  ip,
const int  stridei,
const int  strideip,
const double *  xptr,
double *  res_p_re,
double *  res_p_im,
double *  res_q_re,
double *  res_q_im 
)
inline

Inline for Matrix-free RHS for gradient updates.

Computes coefficients for gradient computation with respect to control parameters.

Parameters
dimDimension of full vectorized system: N^2 if Lindblad, N if Schroedinger
itCurrent tensor index
nNumber of levels for current oscillator
npNumber of levels for conjugate oscillator
iCurrent occupation number
ipConjugate occupation number
strideiStride for current oscillator
strideipStride for conjugate oscillator
xptrPointer to state vector data
res_p_rePointer to store real part of p result
res_p_imPointer to store imaginary part of p result
res_q_rePointer to store real part of q result
res_q_imPointer to store imaginary part of q result

◆ H_crosskerr() [1/4]

double H_crosskerr ( const double  xi01,
const double  xi02,
const double  xi03,
const double  xi04,
const double  xi12,
const double  xi13,
const double  xi14,
const double  xi23,
const double  xi24,
const double  xi34,
const int  i0,
const int  i1,
const int  i2,
const int  i3,
const int  i4 
)
inline

◆ H_crosskerr() [2/4]

double H_crosskerr ( const double  xi01,
const double  xi02,
const double  xi03,
const double  xi12,
const double  xi13,
const double  xi23,
const int  i0,
const int  i1,
const int  i2,
const int  i3 
)
inline

◆ H_crosskerr() [3/4]

double H_crosskerr ( const double  xi01,
const double  xi02,
const double  xi12,
const int  i0,
const int  i1,
const int  i2 
)
inline

◆ H_crosskerr() [4/4]

double H_crosskerr ( const double  xi01,
const int  a,
const int  b 
)
inline

Inline for Matrix-free RHS, Computes cross-Kerr coupling between 2 oscillators.

Parameters
xi01Cross-Kerr coefficient between oscillators 0 and 1
aOccupation number for oscillator 0
bOccupation number for oscillator 1
Returns
double Cross-Kerr energy contribution

◆ H_detune() [1/5]

double H_detune ( const double  detuning0,
const double  detuning1,
const double  detuning2,
const double  detuning3,
const double  detuning4,
const int  i0,
const int  i1,
const int  i2,
const int  i3,
const int  i4 
)
inline

◆ H_detune() [2/5]

double H_detune ( const double  detuning0,
const double  detuning1,
const double  detuning2,
const double  detuning3,
const int  i0,
const int  i1,
const int  i2,
const int  i3 
)
inline

◆ H_detune() [3/5]

double H_detune ( const double  detuning0,
const double  detuning1,
const double  detuning2,
const int  i0,
const int  i1,
const int  i2 
)
inline

◆ H_detune() [4/5]

double H_detune ( const double  detuning0,
const double  detuning1,
const int  a,
const int  b 
)
inline

Inline for Matrix-free RHS, Computes detuning Hamiltonian term for 2 oscillators.

Parameters
detuning0Detuning frequency for oscillator 0
detuning1Detuning frequency for oscillator 1
aOccupation number for oscillator 0
bOccupation number for oscillator 1
Returns
double Total detuning energy contribution

◆ H_detune() [5/5]

double H_detune ( const double  detuning0,
const int  a 
)
inline

Inline for Matrix-free RHS to Compute detuning for 1 oscillator.

Parameters
detuning0Detuning frequency
aOccupation number
Returns
double Detuning energy contribution

◆ H_selfkerr() [1/5]

double H_selfkerr ( const double  xi0,
const double  xi1,
const double  xi2,
const double  xi3,
const double  xi4,
const int  i0,
const int  i1,
const int  i2,
const int  i3,
const int  i4 
)
inline

◆ H_selfkerr() [2/5]

double H_selfkerr ( const double  xi0,
const double  xi1,
const double  xi2,
const double  xi3,
const int  i0,
const int  i1,
const int  i2,
const int  i3 
)
inline

◆ H_selfkerr() [3/5]

double H_selfkerr ( const double  xi0,
const double  xi1,
const double  xi2,
const int  i0,
const int  i1,
const int  i2 
)
inline

◆ H_selfkerr() [4/5]

double H_selfkerr ( const double  xi0,
const double  xi1,
const int  a,
const int  b 
)
inline

Inline for Matrix-free RHS, Computes self-Kerr nonlinearity terms for 2 oscillators.

Parameters
xi0Self-Kerr coefficient for oscillator 0
xi1Self-Kerr coefficient for oscillator 1
aOccupation number for oscillator 0
bOccupation number for oscillator 1
Returns
double Total self-Kerr energy contribution

◆ H_selfkerr() [5/5]

double H_selfkerr ( const double  xi0,
const int  a 
)
inline

Inline for Matrix-free RHS to Compute self-Kerr coefficient for 1 oscillator.

Parameters
xi0Self-Kerr coefficient for oscillator 0
aOccupation number
Returns
double Self-Kerr energy contribution

◆ Jkl_coupling()

void Jkl_coupling ( const PetscInt  dim,
const int  it,
const int  ni,
const int  nj,
const int  nip,
const int  njp,
const int  i,
const int  ip,
const int  j,
const int  jp,
const int  stridei,
const int  strideip,
const int  stridej,
const int  stridejp,
const double *  xptr,
const double  Jij,
const double  cosij,
const double  sinij,
double *  yre,
double *  yim 
)
inline

Matrix-free solver inline for dipole-dipole coupling between oscillators.

Implements J_kl coupling terms in the rotating frame between oscillator i and j.

Parameters
dimDimension of full vectorized system: N^2 if Lindblad, N if Schroedinger
itCurrent tensor index
niNumber of levels for oscillator i
njNumber of levels for oscillator j
nipNumber of levels for oscillator i (conjugate)
njpNumber of levels for oscillator j (conjugate)
iOccupation number for oscillator i
ipOccupation number for oscillator i (conjugate)
jOccupation number for oscillator j
jpOccupation number for oscillator j (conjugate)
strideiStride for oscillator i
strideipStride for oscillator i (conjugate)
stridejStride for oscillator j
stridejpStride for oscillator j (conjugate)
xptrPointer to state vector data
JijCoupling coefficient
cosijCosine of frequency difference
sinijSine of frequency difference
yrePointer to store real part of result
yimPointer to store imaginary part of result

◆ Jkl_coupling_T()

void Jkl_coupling_T ( const PetscInt  dim,
const int  it,
const int  ni,
const int  nj,
const int  nip,
const int  njp,
const int  i,
const int  ip,
const int  j,
const int  jp,
const int  stridei,
const int  strideip,
const int  stridej,
const int  stridejp,
const double *  xptr,
const double  Jij,
const double  cosij,
const double  sinij,
double *  yre,
double *  yim 
)
inline

Transpose of dipole-dipole coupling for adjoint computations.

Parameters
dimDimension of full vectorized system: N^2 if Lindblad, N if Schroedinger
itCurrent tensor index
niNumber of levels for oscillator i
njNumber of levels for oscillator j
nipNumber of levels for oscillator i (conjugate)
njpNumber of levels for oscillator j (conjugate)
iOccupation number for oscillator i
ipOccupation number for oscillator i (conjugate)
jOccupation number for oscillator j
jpOccupation number for oscillator j (conjugate)
strideiStride for oscillator i
strideipStride for oscillator i (conjugate)
stridejStride for oscillator j
stridejpStride for oscillator j (conjugate)
xptrPointer to state vector data
JijCoupling coefficient
cosijCosine of frequency difference
sinijSine of frequency difference
yrePointer to store real part of result
yimPointer to store imaginary part of result

◆ L1decay()

void L1decay ( const PetscInt  dim,
const int  it,
const int  n,
const int  i,
const int  ip,
const int  stridei,
const int  strideip,
const double *  xptr,
const double  decayi,
double *  yre,
double *  yim 
)
inline

Matrix-free solver inline for off-diagonal L1 decay term.

Parameters
dimDimension of full vectorized system: N^2 if Lindblad, N if Schroedinger
itCurrent tensor index
nNumber of levels
iOccupation number (bra)
ipOccupation number (ket)
strideiStride for bra index
strideipStride for ket index
xptrPointer to state vector data
decayiDecay rate
yrePointer to store real part of result
yimPointer to store imaginary part of result

◆ L1decay_T()

void L1decay_T ( const PetscInt  dim,
const int  it,
const int  i,
const int  ip,
const int  stridei,
const int  strideip,
const double *  xptr,
const double  decayi,
double *  yre,
double *  yim 
)
inline

Matrix-free inline Transpose of off-diagonal L1 decay for adjoint computations.

Parameters
dimDimension of full vectorized system: N^2 if Lindblad, N if Schroedinger
itCurrent tensor index
iOccupation number (bra)
ipOccupation number (ket)
strideiStride for bra index
strideipStride for ket index
xptrPointer to state vector data
decayiDecay rate
yrePointer to store real part of result
yimPointer to store imaginary part of result

◆ L1diag() [1/5]

double L1diag ( const double  decay0,
const double  decay1,
const double  decay2,
const double  decay3,
const double  decay4,
const int  i0,
const int  i1,
const int  i2,
const int  i3,
const int  i4,
const int  i0p,
const int  i1p,
const int  i2p,
const int  i3p,
const int  i4p 
)
inline

◆ L1diag() [2/5]

double L1diag ( const double  decay0,
const double  decay1,
const double  decay2,
const double  decay3,
const int  i0,
const int  i1,
const int  i2,
const int  i3,
const int  i0p,
const int  i1p,
const int  i2p,
const int  i3p 
)
inline

◆ L1diag() [3/5]

double L1diag ( const double  decay0,
const double  decay1,
const double  decay2,
const int  i0,
const int  i1,
const int  i2,
const int  i0p,
const int  i1p,
const int  i2p 
)
inline

◆ L1diag() [4/5]

double L1diag ( const double  decay0,
const double  decay1,
const int  i0,
const int  i1,
const int  i0p,
const int  i1p 
)
inline

Inline for Matrix-free RHS, Computes L1 decay Lindblad operator diagonal term for 2 oscillators.

Parameters
decay0Decay rate for oscillator 0
decay1Decay rate for oscillator 1
i0Occupation number for oscillator 0 (bra)
i1Occupation number for oscillator 1 (bra)
i0pOccupation number for oscillator 0 (ket)
i1pOccupation number for oscillator 1 (ket)
Returns
double Total L1 diagonal contribution

◆ L1diag() [5/5]

double L1diag ( const double  decay0,
const int  i0,
const int  i0p 
)
inline

Inline for Matrix-free RHS to compute L1 decay coefficient for 1 oscillator.

Parameters
decay0Decay rate for oscillator 0
i0Occupation number (bra)
i0pOccupation number (ket)
Returns
double L1 diagonal contribution

◆ L2() [1/5]

double L2 ( const double  dephase0,
const double  dephase1,
const double  dephase2,
const double  dephase3,
const double  dephase4,
const int  i0,
const int  i1,
const int  i2,
const int  i3,
const int  i4,
const int  i0p,
const int  i1p,
const int  i2p,
const int  i3p,
const int  i4p 
)
inline

◆ L2() [2/5]

double L2 ( const double  dephase0,
const double  dephase1,
const double  dephase2,
const double  dephase3,
const int  i0,
const int  i1,
const int  i2,
const int  i3,
const int  i0p,
const int  i1p,
const int  i2p,
const int  i3p 
)
inline

◆ L2() [3/5]

double L2 ( const double  dephase0,
const double  dephase1,
const double  dephase2,
const int  i0,
const int  i1,
const int  i2,
const int  i0p,
const int  i1p,
const int  i2p 
)
inline

◆ L2() [4/5]

double L2 ( const double  dephase0,
const double  dephase1,
const int  i0,
const int  i1,
const int  i0p,
const int  i1p 
)
inline

Inline for Matrix-free RHS, Computes L2 dephasing Lindblad operator for 2 oscillators.

Parameters
dephase0Dephasing rate for oscillator 0
dephase1Dephasing rate for oscillator 1
i0Occupation number for oscillator 0 (bra)
i1Occupation number for oscillator 1 (bra)
i0pOccupation number for oscillator 0 (ket)
i1pOccupation number for oscillator 1 (ket)
Returns
double Total L2 operator contribution

◆ L2() [5/5]

double L2 ( const double  dephase0,
const int  i0,
const int  i0p 
)
inline

Inline for Matrix-free RHS to compute L2 dephasing coefficient for 1 oscillator.

Parameters
dephase0Dephasing rate for oscillator 0
i0Occupation number (bra)
i0pOccupation number (ket)
Returns
double L2 operator contribution

◆ TensorGetIndex() [1/5]

int TensorGetIndex ( const int  nlevels0,
const int  i0,
const int  i0p 
)
inline

Inline for Matrix-free RHS to compute tensor product index for 1 oscillator system.

Parameters
nlevels0Number of levels for oscillator 0
i0Occupation number (bra)
i0pOccupation number (ket)
Returns
int Linear index in tensor product space

◆ TensorGetIndex() [2/5]

int TensorGetIndex ( const int  nlevels0,
const int  nlevels1,
const int  i0,
const int  i1,
const int  i0p,
const int  i1p 
)
inline

Inline for Matrix-free RHS, Computes tensor product index for 2 oscillator system.

Parameters
nlevels0Number of levels for oscillator 0
nlevels1Number of levels for oscillator 1
i0Occupation number for oscillator 0 (bra)
i1Occupation number for oscillator 1 (bra)
i0pOccupation number for oscillator 0 (ket)
i1pOccupation number for oscillator 1 (ket)
Returns
int Linear index in tensor product space

◆ TensorGetIndex() [3/5]

int TensorGetIndex ( const int  nlevels0,
const int  nlevels1,
const int  nlevels2,
const int  i0,
const int  i1,
const int  i2,
const int  i0p,
const int  i1p,
const int  i2p 
)
inline

◆ TensorGetIndex() [4/5]

int TensorGetIndex ( const int  nlevels0,
const int  nlevels1,
const int  nlevels2,
const int  nlevels3,
const int  i0,
const int  i1,
const int  i2,
const int  i3,
const int  i0p,
const int  i1p,
const int  i2p,
const int  i3p 
)
inline

◆ TensorGetIndex() [5/5]

int TensorGetIndex ( const int  nlevels0,
const int  nlevels1,
const int  nlevels2,
const int  nlevels3,
const int  nlevels4,
const int  i0,
const int  i1,
const int  i2,
const int  i3,
const int  i4,
const int  i0p,
const int  i1p,
const int  i2p,
const int  i3p,
const int  i4p 
)
inline