def sde(self):
import scipy.linalg as la<EOL>F     = None<EOL>L     = None<EOL>Qc    = None<EOL>H     = None<EOL>Pinf  = None<EOL>P0    = None<EOL>dF    = None<EOL>dQc   = None<EOL>dPinf = None<EOL>dP0   = None<EOL>n = <NUM_LIT:0><EOL>nq = <NUM_LIT:0><EOL>nd = <NUM_LIT:0><EOL>for p in self.parts:<EOL><INDENT>(Ft,Lt,Qct,Ht,Pinft,P0t,dFt,dQct,dPinft,dP0t) = p.sde()<EOL>F = la.block_diag(F,Ft) if (F is not None) else Ft<EOL>L = la.block_diag(L,Lt) if (L is not None) else Lt<EOL>Qc = la.block_diag(Qc,Qct) if (Qc is not None) else Qct<EOL>H = np.hstack((H,Ht)) if (H is not None) else Ht<EOL>Pinf = la.block_diag(Pinf,Pinft) if (Pinf is not None) else Pinft<EOL>P0 = la.block_diag(P0,P0t) if (P0 is not None) else P0t<EOL>if dF is not None:<EOL><INDENT>dF = np.pad(dF,((<NUM_LIT:0>,dFt.shape[<NUM_LIT:0>]),(<NUM_LIT:0>,dFt.shape[<NUM_LIT:1>]),(<NUM_LIT:0>,dFt.shape[<NUM_LIT:2>])),<EOL>'<STR_LIT>', constant_values=<NUM_LIT:0>)<EOL>dF[-dFt.shape[<NUM_LIT:0>]:,-dFt.shape[<NUM_LIT:1>]:,-dFt.shape[<NUM_LIT:2>]:] = dFt<EOL><DEDENT>else:<EOL><INDENT>dF = dFt<EOL><DEDENT>if dQc is not None:<EOL><INDENT>dQc = np.pad(dQc,((<NUM_LIT:0>,dQct.shape[<NUM_LIT:0>]),(<NUM_LIT:0>,dQct.shape[<NUM_LIT:1>]),(<NUM_LIT:0>,dQct.shape[<NUM_LIT:2>])),<EOL>'<STR_LIT>', constant_values=<NUM_LIT:0>)<EOL>dQc[-dQct.shape[<NUM_LIT:0>]:,-dQct.shape[<NUM_LIT:1>]:,-dQct.shape[<NUM_LIT:2>]:] = dQct<EOL><DEDENT>else:<EOL><INDENT>dQc = dQct<EOL><DEDENT>if dPinf is not None:<EOL><INDENT>dPinf = np.pad(dPinf,((<NUM_LIT:0>,dPinft.shape[<NUM_LIT:0>]),(<NUM_LIT:0>,dPinft.shape[<NUM_LIT:1>]),(<NUM_LIT:0>,dPinft.shape[<NUM_LIT:2>])),<EOL>'<STR_LIT>', constant_values=<NUM_LIT:0>)<EOL>dPinf[-dPinft.shape[<NUM_LIT:0>]:,-dPinft.shape[<NUM_LIT:1>]:,-dPinft.shape[<NUM_LIT:2>]:] = dPinft<EOL><DEDENT>else:<EOL><INDENT>dPinf = dPinft<EOL><DEDENT>if dP0 is not None:<EOL><INDENT>dP0 = np.pad(dP0,((<NUM_LIT:0>,dP0t.shape[<NUM_LIT:0>]),(<NUM_LIT:0>,dP0t.shape[<NUM_LIT:1>]),(<NUM_LIT:0>,dP0t.shape[<NUM_LIT:2>])),<EOL>'<STR_LIT>', constant_values=<NUM_LIT:0>)<EOL>dP0[-dP0t.shape[<NUM_LIT:0>]:,-dP0t.shape[<NUM_LIT:1>]:,-dP0t.shape[<NUM_LIT:2>]:] = dP0t<EOL><DEDENT>else:<EOL><INDENT>dP0 = dP0t<EOL><DEDENT>n += Ft.shape[<NUM_LIT:0>]<EOL>nq += Qct.shape[<NUM_LIT:0>]<EOL>nd += dFt.shape[<NUM_LIT:2>]<EOL><DEDENT>assert (F.shape[<NUM_LIT:0>] == n and F.shape[<NUM_LIT:1>]==n), "<STR_LIT>"<EOL>assert (L.shape[<NUM_LIT:0>] == n and L.shape[<NUM_LIT:1>]==nq), "<STR_LIT>"<EOL>assert (Qc.shape[<NUM_LIT:0>] == nq and Qc.shape[<NUM_LIT:1>]==nq), "<STR_LIT>"<EOL>assert (H.shape[<NUM_LIT:0>] == <NUM_LIT:1> and H.shape[<NUM_LIT:1>]==n), "<STR_LIT>"<EOL>assert (Pinf.shape[<NUM_LIT:0>] == n and Pinf.shape[<NUM_LIT:1>]==n), "<STR_LIT>"<EOL>assert (P0.shape[<NUM_LIT:0>] == n and P0.shape[<NUM_LIT:1>]==n), "<STR_LIT>"<EOL>assert (dF.shape[<NUM_LIT:0>] == n and dF.shape[<NUM_LIT:1>]==n and dF.shape[<NUM_LIT:2>]==nd), "<STR_LIT>"<EOL>assert (dQc.shape[<NUM_LIT:0>] == nq and dQc.shape[<NUM_LIT:1>]==nq and dQc.shape[<NUM_LIT:2>]==nd), "<STR_LIT>"<EOL>assert (dPinf.shape[<NUM_LIT:0>] == n and dPinf.shape[<NUM_LIT:1>]==n and dPinf.shape[<NUM_LIT:2>]==nd), "<STR_LIT>"<EOL>assert (dP0.shape[<NUM_LIT:0>] == n and dP0.shape[<NUM_LIT:1>]==n and dP0.shape[<NUM_LIT:2>]==nd), "<STR_LIT>"<EOL>return (F,L,Qc,H,Pinf,P0,dF,dQc,dPinf,dP0)<EOL>
Support adding kernels for sde representation