def structure_function(f, index=0):
 def structured_function(*args):
  pattern = args[index]
  evaluated = f(*args)
  evaluated[(pattern == 0)] = 0
  return evaluated
 return structured_function

def structure_function ( f , index = 0 ) : def structured_function ( * args ) : pattern = args [ index ] evaluated = f ( * args ) evaluated [ ( pattern == 0 ) ] = 0 return evaluated return structured_function
decorator to structure a function wich apply on dense matrix .