#NEWLINE# def vnorm( a , ord = None , axis = None , dtype = None , keepdims = False , split_every = None ) : #NEWLINE# #INDENT# ' Vector norm\n\n    See np.linalg.norm\n    ' #NEWLINE# if ( ( ord is None ) or ( ord == 'fro' ) ) : #NEWLINE# #INDENT# ord = 2 #NEWLINE# #UNINDENT# if ( ord == np . inf ) : #NEWLINE# #INDENT# return max ( abs ( a ) , axis = axis , keepdims = keepdims , split_every = split_every ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( dtype == ( - np . inf ) ) : #NEWLINE# #INDENT# return min ( abs ( a ) , axis = axis , keepdims = keepdims , split_every = split_every ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ord == 1 ) : #NEWLINE# #INDENT# return sum ( abs ( a ) , axis = axis , dtype = dtype , keepdims = keepdims , split_every = split_every ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( ord % 2 ) == 0 ) : #NEWLINE# #INDENT# return ( sum ( ( a ** ord ) , axis = axis , dtype = dtype , keepdims = keepdims , split_every = split_every ) ** ( 1.0 / ord ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( sum ( ( abs ( a ) ** ord ) , axis = axis , dtype = dtype , keepdims = keepdims , split_every = split_every ) ** ( 1.0 / ord ) )