def semilinearPrime(x):
 try:
  shape = x.shape
  x.flatten()
  x = x.tolist()
 except AttributeError:
  shape = (1, len(x))
 def f(val):
  if (val < 0):
   return safeExp(val)
  else:
   return 1.0
 return array(list(map(f, x))).reshape(shape)

def semilinearPrime ( x ) : try : shape = x . shape x . flatten ( ) x = x . tolist ( ) except AttributeError : shape = ( 1 , len ( x ) ) def f ( val ) : if ( val < 0 ) : return safeExp ( val ) else : return 1.0 return array ( list ( map ( f , x ) ) ) . reshape ( shape )
this function is the first derivative of the semilinear function .