<s> """<STR_LIT>""" <EOL> from __future__ import division , print_function <EOL> import numpy as np <EOL> from . _ds_quantize import ds_quantize <EOL> def simulateQDSM_core ( u , A , B , C , D1 , order , nlev , nq , x0 ) : <EOL> N = u . shape [ <NUM_LIT:1> ] <EOL> v = np . zeros ( shape = ( nq , N ) , dtype = '<STR_LIT>' ) <EOL> y = np . zeros ( shape = ( nq , N ) , dtype = '<STR_LIT>' ) <EOL> xn = np . zeros ( shape = ( order , N ) , dtype = '<STR_LIT>' ) <EOL> xmax = abs ( x0 . copy ( ) ) <EOL> for i in range ( N ) : <EOL> y [ : , i ] = np . dot ( C , x0 ) + np . dot ( D1 , u [ : , i ] . reshape ( ( - <NUM_LIT:1> , <NUM_LIT:1> ) ) ) <EOL> v [ : , i ] = ds_qquantize ( y [ : , i ] , nlev ) <EOL> x0 = np . dot ( A , x0 ) + np . dot ( B , np . vstack ( ( u [ : , i ] , v [ : , i ] ) ) ) <EOL> xn [ : , i ] = np . squeeze ( x0 ) <EOL> xmax = np . max ( ( np . abs ( x0 ) , xmax ) , axis = <NUM_LIT:0> ) <EOL> return v , xn , xmax , y <EOL> def ds_qquantize ( y , n ) : <EOL> """<STR_LIT>""" <EOL> if np . isreal ( n ) : <EOL> v = ds_quantize ( np . real ( y ) , n ) + <NUM_LIT> * ds_quantize ( np . imag ( y ) , n ) <EOL> else : <EOL> ytmp = np . concatenate ( ( np . real ( y ) + np . imag ( y ) , <EOL> np . real ( y ) - np . imag ( y ) ) ) <EOL> v = np . dot ( ds_quantize ( ytmp , np . abs ( n ) ) , <EOL> np . array ( [ [ <NUM_LIT:1> + <NUM_LIT> ] , [ <NUM_LIT:1> - <NUM_LIT> ] ] ) ) / <NUM_LIT> <EOL> return v </s>
