and slicing).
On Fri, Sep 6, 2013 at 12:48 PM, James Bergstra
wrote:
> Thanks for the tips! FWIW my guess is that since '.data' is dynamically
> generated property rather than an attribute, it is being freed and
> re-allocated in the loop, and once for each of my id() express
i, Sep 6, 2013 at 5:58 PM, James Bergstra
> wrote:
> >
> > I'm stumped. I can't figure out how to extract from e.g.
> >
> > view = A[:, 3]
> >
> > that the view starts at element 3 of A. I was planning to make a
> may_share_memory implementation
Hi, could someone help me understand why this assertion fails?
def test_is(self):
a = np.empty(1)
b = np.empty(1)
if a.data is not b.data:
assert id(a.data) != id(b.data) # <-- fail
I'm trying to write an alternate may_share_memory function.
Thanks,
- James
_
On Fri, Sep 6, 2013 at 10:19 AM, James Bergstra > wrote:
>
>> Hi, could someone help me understand why this assertion fails?
>>
>> def test_is(self):
>> a = np.empty(1)
>> b = np.empty(1)
>> if a.data is not b.data:
>> assert id(a
On Thu, Jun 14, 2012 at 5:53 PM, Nathaniel Smith wrote:
> On Thu, Jun 14, 2012 at 9:22 PM, srean wrote:
> No, I'm saying I totally see the advantages. Here's the code I'm talking
> about:
>
> def _loglik(self, params):
> alpha, beta = self.used_alpha_beta(params)
> if np.any(alp
On Thu, Jun 14, 2012 at 4:22 PM, srean wrote:
>>
>> For example, I wrote a library routine for doing log-linear
>> regression. Doing this required computing the derivative of the
>> likelihood function, which was a huge nitpicky hassle; took me a few
>> hours to work out and debug. But it's still
On Thu, Jun 14, 2012 at 3:38 PM, Nathaniel Smith wrote:
> On Thu, Jun 14, 2012 at 7:53 PM, James Bergstra
> wrote:
>> On Thu, Jun 14, 2012 at 11:01 AM, Nathaniel Smith wrote:
>>
>>>> Indeed that would be great as sympy already has already excellent math
>>&
On Thu, Jun 14, 2012 at 11:01 AM, Nathaniel Smith wrote:
>> Indeed that would be great as sympy already has already excellent math
>> expression rendering.
>>
>> An alternative would be to output mathml or something similar that
>> could be understood by the mathjax rendering module of the IPytho
On Thu, Jun 14, 2012 at 4:00 AM, Olivier Grisel
wrote:
> 2012/6/13 James Bergstra :
>> Further to the recent discussion on lazy evaluation & numba, I moved
>> what I was doing into a new project:
>>
>> PyAutoDiff:
>> https://github.com/jaberg/pyautodiff
Further to the recent discussion on lazy evaluation & numba, I moved
what I was doing into a new project:
PyAutoDiff:
https://github.com/jaberg/pyautodiff
It currently works by executing CPython bytecode with a numpy-aware
engine that builds a symbolic expression graph with Theano... so you
can d
On Mon, Jun 11, 2012 at 12:03 AM, James Bergstra
wrote:
> If anyone is interested in my ongoing API & bytecode adventure in why
> / how lazy computing could be useful, I've put together a few tiny
> hypothetically-runnable examples here:
>
> https://github.com/jaberg/nu
Hi all, (sorry for missing the debate, I don't often check my
numpy-list folder.)
I agree that an "official" numpy solution to this problem is
premature, but at the same time I think the failure to approach
anything remotely resembling a consensus on how to deal with lazy
evaluation is really gumm
On Sat, Feb 25, 2012 at 5:13 PM, Alan G Isaac wrote:
> On 2/25/2012 4:44 PM, James Bergstra wrote:
>> bincount([]) makes no sense,
>
> I disagree:
> http://permalink.gmane.org/gmane.comp.python.numeric.general/42041
>
gmane is down to me at the moment, but if this argues that
bincount([]) makes no sense, but if a minlength argument is provided,
then the routine should succeed.
It fails in 1.6.1, has it been fixed in master?
- James
--
http://www-etud.iro.umontreal.ca/~bergstrj
___
NumPy-Discussion mailing list
NumPy-Discussi
On Mon, Feb 20, 2012 at 2:57 PM, Lluís wrote:
> James Bergstra writes:
> [...]
> > I should add that the biggest benefit of expressing things as compound
> > expressions in this way is not in saving temporaries (though that is
> nice) it's
> > being able to expr
Looks like Dag forked the discussion of lazy evaluation to a new thread
([Numpy-discussion] ndarray and lazy evaluation).
There are actually several projects inspired by this sort of design: off
the top of my head I can think of Theano, copperhead, numexpr, arguably
sympy, and some non-public cod
On Mon, Feb 20, 2012 at 1:01 PM, James Bergstra wrote:
> On Mon, Feb 20, 2012 at 12:28 PM, Francesc Alted wrote:
>
>> On Feb 20, 2012, at 6:18 PM, Dag Sverre Seljebotn wrote:
>> > You need at least a slightly different Python API to get anywhere, so
>> > numexpr/The
brr))
# compute arr and brr as quickly as possible
a, b = expr.run()
# modify one of the arrays that the expression was compiled to use
A[:] += 1
# re-run the compiled expression on the new value
a, b = expr.run()
- JB
--
James Bergstra, Ph.D.
Research Scientist
Rowland Institute, Harvard
On Thu, Jul 7, 2011 at 4:59 PM, James Bergstra
wrote:
> On Thu, Jul 7, 2011 at 1:10 PM, Charles R Harris
> wrote:
>>
>>
>> On Thu, Jul 7, 2011 at 11:03 AM, James Bergstra
>> wrote:
>>>
>>> In numpy 1.5.1, the functions PyArray_MoveInto and Py
On Thu, Jul 7, 2011 at 1:10 PM, Charles R Harris
wrote:
>
>
> On Thu, Jul 7, 2011 at 11:03 AM, James Bergstra
> wrote:
>>
>> In numpy 1.5.1, the functions PyArray_MoveInto and PyArray_CopyInto
>> don't appear to treat strides correctly.
>>
>>
In numpy 1.5.1, the functions PyArray_MoveInto and PyArray_CopyInto
don't appear to treat strides correctly.
Evidence:
PyNumber_InPlaceAdd(dst, src), and modifies the correct subarray to
which dst points.
In the same context, PyArray_MoveInto(dst, src) modifies the first two
rows of the
underlyi
I find that "numpy.max(0, 1e-6) == 0" is confusing, because it makes bugs
hard to spot. The doc says that the second argument to max is an optional
integer. My bad.
But could the function raise an error if it is passed an invalid 'axis'
argument? That would have helped.
James
--
http://www-etu
Hi all, I'm wondering if this is a bug...
Something strange happens with my ufunc as soon as I use 1 elements. As
the test shows, the ufunc computes the correct result for either the first
or last elements, but both at the same time is no good.
Turns out I'm only running numpy 1.3.0 with
On Tue, Apr 6, 2010 at 10:08 AM, David Cournapeau wrote:
> could be put out of multiarray proper. Also, exposing an API for
> things like fancy indexing would be very useful, but I don't know if
> it even makes sense - I think a pure python implementation of fancy
> indexing as a reference would be
all that, plus automatic differentiation, detection and
>> correction of numerical instabilities, etc.
>>
>> Probably the most amazing thing about it is that with recent versions,
>> you basically flip a switch and it will instead use an available CUDA-
>> capable Nvidi
Thanks all for your help, I think I'm on my way again.
The catch in the first place was not being confident that a
PyArray_Scalar was the thing I needed. I grep'd the code for uint8,
int8 and so on and could not find their definitions.
On first reading I overlooked the PyArray_Scalar link in thi
On Tue, Mar 2, 2010 at 7:32 PM, David Warde-Farley wrote:
>
> On 2-Mar-10, at 7:23 PM, James Bergstra wrote:
>
>> Sorry... again... how do I make such a scalar... *in C* ? What would
>> be the recommended C equivalent of this python code? Are there C
>> type-checking
On Tue, Mar 2, 2010 at 7:18 PM, Warren Weckesser
wrote:
> James Bergstra wrote:
>> On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker
>> wrote:
>>
>>> James Bergstra wrote:
>>>
>>>> Maybe I'm missing something... but I don't th
On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker
wrote:
> James Bergstra wrote:
>> Maybe I'm missing something... but I don't think I want to create an array.
>>
>> In [3]: import numpy
>>
>> In [4]: type(numpy.int8())
>> Out[4]:
>>
>
On Mon, Mar 1, 2010 at 1:44 AM, David Cournapeau wrote:
> On Mon, Mar 1, 2010 at 1:35 PM, James Bergstra
> wrote:
>> Could someone point me to documentation (or even numpy src) that shows
>> how to allocate a numpy.int8 in C, or check to see if a PyObject is a
>> numpy
Could someone point me to documentation (or even numpy src) that shows
how to allocate a numpy.int8 in C, or check to see if a PyObject is a
numpy.int8?
Thanks,
James
--
http://www-etud.iro.umontreal.ca/~bergstrj
___
NumPy-Discussion mailing list
NumPy
In case this hasn't been solved in more recent numpy...
I've tried the following lines on two installations of numpy 1.3 with python 2.6
numpy.random.binomial(n=numpy.asarray([2,3,4], dtype='int64'),
p=numpy.asarray([.1, .2, .3], dtype='float64'))
A 64bit computer gives an output of array lengt
Your question involves a few concepts:
- an integer vector describing the position of an element
- the logical shape (another int vector)
- the physical strides (another int vector)
Ignoring the case of negative offsets, a physical offset is the inner
product of the physical strides with the po
On Tue, Nov 17, 2009 at 9:53 PM, Robert Kern wrote:
> On Tue, Nov 17, 2009 at 20:48, James Bergstra
> wrote:
>> Is it by design that "numpy.sqrt(None)" raises an "AttributeError: sqrt"?
>
> Yes. numpy.sqrt() is a ufunc. Ufuncs take their arguments and try
Is it by design that "numpy.sqrt(None)" raises an "AttributeError: sqrt"?
This was confusing because there was an attribute lookup of 'sqrt' in
numpy right there in the expression I typed, but that was not the
attribute that python was complaining about. I presume that numpy.sqrt
didn't know wha
On Tue, Nov 10, 2009 at 8:17 PM, Christopher Barker
wrote:
> James Bergstra wrote:
>> In some cases a brute-force approach is also good.
>
> true.
>
>> If r is a matrix of shape Nx2:
>>
>> (r*r).sum(axis=1) -2 * numpy.dot(r, r.T) +
>> (r*r).sum(ax
On Tue, Nov 10, 2009 at 7:07 PM, Christopher Barker
wrote:
> Hi all,
>
> I have a bunch of points in 2-d space, and I need to find out which
> pairs of points are within a certain distance of one-another (regular
> old Euclidean norm).
>
> scipy.spatial.KDTree.query_ball_tree() seems like it's bui
On Fri, Oct 30, 2009 at 7:23 AM, Gael Varoquaux
wrote:
> On Fri, Oct 30, 2009 at 08:21:16PM +0900, David Cournapeau wrote:
>> On Fri, Oct 30, 2009 at 8:04 PM, Sebastian Haase wrote:
>
>> > I understand where this error comes from, however what I was trying to
>> > do seems to "intuitive" that I w
On Wed, Sep 9, 2009 at 10:41 AM, Francesc Alted wrote:
>> Numexpr mainly supports functions that are meant to be used element-wise,
>> so the operation/element ratio is normally 1 (or close to 1). In these
>> scenarios is where improved memory access is much more important than CPU
>> (or, for th
On Fri, Aug 21, 2009 at 2:51 PM, Matthew Brett wrote:
> I can imagine Numpy being useful for scripting in this
> C-and-assembler-centric world, making it easier to write automated
> testers, or even generate C code.
>
> Is anyone out there working on this kind of stuff? I ask only because
> there
On Thu, Aug 6, 2009 at 4:57 PM, Sturla Molden wrote:
>
>> Now linear algebra or FFTs on a GPU would probably be a huge boon,
>> I'll admit - especially if it's in the form of a drop-in replacement
>> for the numpy or scipy versions.
>
>
> NumPy generate temporary arrays for expressions involving nd
On Thu, Aug 6, 2009 at 1:19 PM, Charles R
Harris wrote:
> I almost looks like you are reimplementing numpy, in c++ no less. Is there
> any reason why you aren't working with a numpy branch and just adding
> ufuncs?
I don't know how that would work. The Ufuncs need a datatype to work
with, and AFA
>David Warde-Farley cs.toronto.edu> writes:
>> It did inspire some of our colleagues in Montreal to create this,
>> though:
>>
>> http://code.google.com/p/cuda-ndarray/
>>
>> I gather it is VERY early in development, but I'm sure they'd love
>> contributions!
>>
>
>Hi David,
>That does look q
43 matches
Mail list logo