Peter Otten wrote: > Peter Otten wrote: > >> # use at your own risk >> import numpy >> >> N = 10**4 # I get a MemoryError for a bigger exponent >> b = numpy.array(range(N)) >> a = numpy.zeros((N, N)) + b >> a *= a.transpose() >> a[0,0] = (b*b).sum() >> print a > > Sorry, this is nonsense.
Maybe not as bad as I feared. I seems you can't transpose and inplace-multiply, so # use at your own risk import numpy N = 5 b = numpy.array(range(N)) a = numpy.zeros((N, N)) + b a = a * a.transpose() a[0,0] = (b*b).sum() print a might work if there is sufficient memory available... Peter -- http://mail.python.org/mailman/listinfo/python-list