<s> from . . ndtypes import Int32 , Int64 , Float32 , Float64 <EOL> from loop_transform import LoopTransform <EOL> class Vectorize ( LoopTransform ) : <EOL> def pre_apply ( self , _ ) : <EOL> pass <EOL> vector_elt_types = ( Int32 , Int64 , Float32 , Float64 ) <EOL> def vectorize_loop ( self , stmt ) : <EOL> candidate_names = set ( [ ] ) <EOL> before_values = { } <EOL> after_values = { } <EOL> for ( k , ( before , after ) ) in stmt . merge . iteritems ( ) : <EOL> t = before . type <EOL> if t in self . vector_elt_types : <EOL> candidate_names . add ( k ) <EOL> before_values [ k ] = before <EOL> after_values [ k ] = after <EOL> def transform_ForLoop ( self , stmt ) : <EOL> if self . is_simple_block ( stmt . body ) and len ( stmt . merge ) > <NUM_LIT:1> : <EOL> return self . vectorize_loop ( stmt ) <EOL> else : <EOL> return stmt </s>
