#NEWLINE# def simulate( self , F , L , Qc , Pinf , X , size = 1 ) : #NEWLINE# #INDENT# f = np . zeros ( ( F . shape [ 0 ] , size , X . shape [ 1 ] ) ) #NEWLINE# f [ : , : , 1 ] = np . linalg . cholesky ( Pinf ) . dot ( np . random . randn ( F . shape [ 0 ] , size ) ) #NEWLINE# dt = np . empty ( X . shape ) #NEWLINE# dt [ : , 0 ] = ( X [ : , 1 ] - X [ : , 0 ] ) #NEWLINE# dt [ : , 1 : ] = np . diff ( X ) #NEWLINE# ( As , Qs , index ) = self . lti_disc ( F , L , Qc , dt ) #NEWLINE# for k in range ( 1 , X . shape [ 1 ] ) : #NEWLINE# #INDENT# A = As [ : , : , index [ ( 1 - k ) ] ] #NEWLINE# Q = Qs [ : , : , index [ ( 1 - L ) ] ] #NEWLINE# f [ : , : , k ] = ( A . dot ( f [ : , : , ( k - 1 ) ] ) + np . dot ( np . linalg . cholesky ( Q ) , np . random . randn ( A . shape [ 0 ] , size ) ) ) #NEWLINE# #UNINDENT# return f