On Fri, Jan 30, 2009 at 5:18 AM, Neal Becker wrote:
> A nit, but it would be nice if 'ones' could fill with a value other than 1.
>
> Maybe an optional val= keyword?
You can use the "tile" function for this. "tile(3,3)" creates an
array of 3 3's.
Geoffrey
___
On Fri, Jan 30, 2009 at 16:32, Neal Becker wrote:
> Robert Kern wrote:
>
>> On Fri, Jan 30, 2009 at 08:22, Neal Becker wrote:
>>> Right now there are 2 options to create an array of constant value:
>>>
>>> 1) empty (size); fill (val)
>>>
>>> 2) ones (size) * val
>>>
>>> 1 has disadvantage of not
Robert Kern wrote:
> On Fri, Jan 30, 2009 at 08:22, Neal Becker wrote:
>> Right now there are 2 options to create an array of constant value:
>>
>> 1) empty (size); fill (val)
>>
>> 2) ones (size) * val
>>
>> 1 has disadvantage of not being an expression, so can't be an arg to a
>> function call.
On Fri, Jan 30, 2009 at 08:22, Neal Becker wrote:
> Right now there are 2 options to create an array of constant value:
>
> 1) empty (size); fill (val)
>
> 2) ones (size) * val
>
> 1 has disadvantage of not being an expression, so can't be an arg to a
> function call.
So wrap it in a function.
>
On Fri, Jan 30, 2009 at 11:26, Ryan May wrote:
> Christopher Barker wrote:
>>> On 1/30/2009 3:22 PM, Neal Becker wrote:
>>>
Now what would be _really_ cool is a special array type that would
represent
a constant array without wasting memory.
>>
>> Can't you do that with scary strid
Christopher Barker wrote:
>> On 1/30/2009 3:22 PM, Neal Becker wrote:
>>
>>> Now what would be _really_ cool is a special array type that would
>>> represent
>>> a constant array without wasting memory.
>
> Can't you do that with scary stride tricks? I think I remember some
> discussion of this
> On 1/30/2009 3:22 PM, Neal Becker wrote:
>
>> Now what would be _really_ cool is a special array type that would represent
>> a constant array without wasting memory.
Can't you do that with scary stride tricks? I think I remember some
discussion of this a while back.
-Chris
--
Christopher
On 1/30/2009 3:22 PM, Neal Becker wrote:
> Now what would be _really_ cool is a special array type that would represent
> a constant array without wasting memory.
Which again is a special case of something even cooler: lazy evaluation.
This would require arrays to have immutable buffers. Then a
Sturla Molden wrote:
> On 1/30/2009 2:18 PM, Neal Becker wrote:
>> A nit, but it would be nice if 'ones' could fill with a value other than 1.
>>
>> Maybe an optional val= keyword?
>>
>
> I am -1 on this. Ones should fill with ones, zeros should fill with
> zeros. Anything else is counter-intuiti
On Fri, Jan 30, 2009 at 22:16, Sturla Molden wrote:
> On 1/30/2009 3:07 PM, Grissiom wrote:
>
> > Is fill function has any advantage over ones(size)*x ?
>
> You avoid filling with ones, all the multiplications and creating an
> temporary array. It can be done like this:
>
> a = empty(size)
> a[:]
On Fri, Jan 30, 2009 at 09:22:46AM -0500, Neal Becker wrote:
> Now what would be _really_ cool is a special array type that would represent
> a constant array without wasting memory. boost::ublas, for example, has
> this feature.
What I would actually like is some kind of sparse masked array, w
Right now there are 2 options to create an array of constant value:
1) empty (size); fill (val)
2) ones (size) * val
1 has disadvantage of not being an expression, so can't be an arg to a
function call. Also probably slower than create+fill @ same time
2 is probably slower than create+fill @
On 1/30/2009 3:07 PM, Grissiom wrote:
> Is fill function has any advantage over ones(size)*x ?
You avoid filling with ones, all the multiplications and creating an
temporary array. It can be done like this:
a = empty(size)
a[:] = x
Which would be slightly faster and more memory efficient.
S.
> Is fill function has any advantage over ones(size)*x ?
No intermediate array (inplace) ?
Matthieu
--
Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/m
On 1/30/2009 2:18 PM, Neal Becker wrote:
> A nit, but it would be nice if 'ones' could fill with a value other than 1.
>
> Maybe an optional val= keyword?
>
I am -1 on this. Ones should fill with ones, zeros should fill with
zeros. Anything else is counter-intuitive. Calling numpy.ones to fill
On Fri, Jan 30, 2009 at 21:54, Scott Sinclair
wrote:
> > 2009/1/30 David Cournapeau :
> > Neal Becker wrote:
> >> A nit, but it would be nice if 'ones' could fill with a value other than
> 1.
> >>
> >> Maybe an optional val= keyword?
> >
> > What would be the advantage compared to fill ? I would g
> 2009/1/30 David Cournapeau :
> Neal Becker wrote:
>> A nit, but it would be nice if 'ones' could fill with a value other than 1.
>>
>> Maybe an optional val= keyword?
>
> What would be the advantage compared to fill ? I would guess ones and
> zeros are special because those two values are special
Neal Becker wrote:
> A nit, but it would be nice if 'ones' could fill with a value other than 1.
>
> Maybe an optional val= keyword?
>
What would be the advantage compared to fill ? I would guess ones and
zeros are special because those two values are special (they can be
defined for many types
A nit, but it would be nice if 'ones' could fill with a value other than 1.
Maybe an optional val= keyword?
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
19 matches
Mail list logo