
# Utility functions
import numpy as N

import itertools

arraySize = (3000,1000)
numArrays = 50
#arrayList = pool.map(myutil.my_random,itertools.repeat(arraySize,numArrays))
arrayList = [N.random.random(s) for s in itertools.repeat(arraySize,numArrays)]

def numpy_inner_product(arr):
    """ A default inner product for n-dimensional numpy arrays """
    return N.sum(arr*arr.conj())


    
def my_inner_product(arr):
    ip = 0
    for r in range(arr.shape[0]):
        for c in range(arr.shape[1]):
            ip += arr[r,c]**2
    return ip
    
def my_random(args):
    return N.random.random(args)

"""
def numexpr_inner_product(arr):
    import numexpr as NE
    conj = arr.conj()
    return N.sum(NE.evaluate('arr*conj'))
"""