code: def compare(self, v1, v2):
          
          try:
              if len(v1) != len(v2): return 0
              for x, y in zip(v1, v2):
                  if abs( x - y ) > self.tolerance:
                      return 0
              return 1
          except:
              # some patterns may not be vectors
              try:
                  if abs( v1 - v2 ) > self.tolerance:
                      return 0
                  else:
                      return 1
              except:
                  return 0
docs: Compares two values. Returns 1 if all values are withing
          self.tolerance of each other.