On Wed, 08 Nov 2006, koara apparently wrote:
> 'mat' is a numpy.array with shape=(22973, 1009),
> 'vec' is a numpy.array with shape=(22973,), both of type int:
> for i in xrange(1009):
> ...
> fr = vec[10001]
> mat[:, i] = vec # assign whole column
> if mat[10001, i] != fr:
> print "how come?"
> ...
> for elements beyond index 10000, nothing is assigned (ie,
> numpy.sum(mat[row, :]) is zero for any row > 10000).
Using numpy 1.0 and trying the code below,
I do not see the problem.
import numpy
from numpy import random
m = random.randint(0,1000,(22973,1009))
v = random.randint(0,1000,(22973,))
fr = v[10001]
for i in xrange(1009):
m[:,i] = v
if m[10001, i] != fr:
print m[10001,i], fr
Upgrading to numpy 1.0 should be easy enough and may fix
your problem.
Cheers,
Alan Isaac
|