On 8/27/06, Carlos Pita <[EMAIL PROTECTED]> wrote:
Maybe something like this:
I n [12]: a = empty((3,3), dtype=int)
In [13]: a.fill(11)
In [14]: a
Out[14]:
array([[11, 11, 11],
[11, 11, 11],
[11, 11, 11]])
I haven't timed it, so don't know how fast it is. Looking at this makes me think fill should return the array so that one could do something like: a = empty((3,3), dtype=int).fill(10)
Chuck
Hi all!
Is there a more efficient way of creating a constant K-valued array of size N than:
zeros(N) + K
?
Maybe something like this:
I n [12]: a = empty((3,3), dtype=int)
In [13]: a.fill(11)
In [14]: a
Out[14]:
array([[11, 11, 11],
[11, 11, 11],
[11, 11, 11]])
I haven't timed it, so don't know how fast it is. Looking at this makes me think fill should return the array so that one could do something like: a = empty((3,3), dtype=int).fill(10)
Chuck
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion