I know there must be a simple method to do this.

I have implemented this function for calculating a checksum based on a
ones complement addition:

def complement_ones_checksum(ints):
    """
    Returns a complements one checksum based
    on a specified numpy.array of dtype=uint16
    """
    result = 0x0
    for i in ints:
        result += i
        result = (result  + (result >> 16)) & 0xFFFF
    return result

It works, but is of course inefficient. My prfiler syas this is the
99.9% botteleneck in my applicaiton.

What is the efficient numpy way to do this?

No need to dwelve into fast inlining of c-code or Fortran and stuff
like that although that may give further performance imporevements.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to