#NEWLINE# @ staticmethod #NEWLINE# def histogram( v ) : #NEWLINE# #INDENT# '\n        Compute a histogram based on all unique elements in vector v \n        ' #NEWLINE# if ( uniqElements . ndim != 1 ) : #NEWLINE# #INDENT# raise ValueError ( 'Input must be a dimension 1 vector' ) #NEWLINE# #UNINDENT# uniqElements = numpy . unique ( v ) #NEWLINE# numElements = uniqElements . shape [ 0 ] #NEWLINE# hist = numpy . zeros ( numElements ) #NEWLINE# for i in range ( 0 , numElements ) : #NEWLINE# #INDENT# hist [ i ] = sum ( ( v == uniqElements [ i ] ) ) #NEWLINE# #UNINDENT# return ( hist , uniqElements )