
# Utility functions
import numpy as N

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 inner_product_fake(arr):
    """ A fake inner product for n-dimensional numpy arrays
        this should take almost time itself, but can serve 
        to test the overhead
    """
    return arr[0,0]

    
def my_random(args):
    return N.random.random(args)
