Re: [Numpy-discussion] Generalize hstack/vstack --> stack; Block matrices like in matlab

2016-01-09 Thread Stefan Otte
: - the implementation is not super efficient. Temporary copies are created. However, bmat also does that. Feedback is very welcome! Best, Stefan On Sun, May 10, 2015 at 12:33 PM, Stefan Otte <stefan.o...@gmail.com> wrote: > Hey, > > Just a quick update. I updated the pull request and

Re: [Numpy-discussion] Create a n-D grid; meshgrid alternative

2015-05-14 Thread Stefan Otte
Hey, I just created a pull request: https://github.com/numpy/numpy/pull/5874 Best, Stefan On Tue, May 12, 2015 at 3:29 PM Stefan Otte stefan.o...@gmail.com wrote: Hey, here is an ipython notebook with benchmarks of all implementations (scroll to the bottom for plots): https://github.com

Re: [Numpy-discussion] Create a n-D grid; meshgrid alternative

2015-05-12 Thread Stefan Otte
Hello, indeed I was looking for the cartesian product. I timed the two stackoverflow answers and the winner is not quite as clear: n_elements:10 cartesian 0.00427 cartesian2 0.00172 n_elements: 100 cartesian 0.02758 cartesian2 0.01044 n_elements: 1000 cartesian 0.97628 cartesian2

Re: [Numpy-discussion] Create a n-D grid; meshgrid alternative

2015-05-12 Thread Stefan Otte
del Río jaime.f...@gmail.com wrote: On Tue, May 12, 2015 at 1:17 AM, Stefan Otte stefan.o...@gmail.com wrote: Hello, indeed I was looking for the cartesian product. I timed the two stackoverflow answers and the winner is not quite as clear: n_elements:10 cartesian 0.00427

Re: [Numpy-discussion] Generalize hstack/vstack -- stack; Block matrices like in matlab

2015-05-10 Thread Stefan Otte
Stefan Otte stefan.o...@gmail.com wrote: To make the last point more concrete the implementation could look something like this (note that I didn't test it and that it still takes some work): def bmat(obj, ldict=None, gdict=None): return matrix(stack(obj, ldict, gdict)) def stack(obj

Re: [Numpy-discussion] Create a n-D grid; meshgrid alternative

2015-05-10 Thread Stefan Otte
I just drafted different versions of the `gridspace` function: https://tmp23.tmpnb.org/user/1waoqQ8PJBJ7/notebooks/2015-05%20gridspace.ipynb Beste Grüße, Stefan On Sun, May 10, 2015 at 1:40 PM, Stefan Otte stefan.o...@gmail.com wrote: Hey, quite often I want to evaluate a function

Re: [Numpy-discussion] numpy.stack -- which function, if any, deserves the name?

2015-03-16 Thread Stefan Otte
Hey, 1. np.stack for stacking like np.asarray(np.bmat(...)) http://thread.gmane.org/gmane.comp.python.numeric.general/58748/ https://github.com/numpy/numpy/pull/5057 I'm the author of this proposal. I'll just give some context real quickly. My stack started really simple, basically allowing

[Numpy-discussion] Subscribing to mailinglist not possible / sites down

2014-11-12 Thread Stefan Otte
Hey *, The websites to subscribe to the numpy/scipy mailinglists seem to be down: - http://mail.scipy.org/mailman/listinfo/scipy-user - http://mail.scipy.org/mailman/listinfo/scipy-user - http://projects.scipy.org/pipermail/scipy-dev/ And it's not just me:

Re: [Numpy-discussion] Generalize hstack/vstack -- stack; Block matrices like in matlab

2014-10-31 Thread Stefan Otte
: arr_rows.append(concatenate(row, axis=-1)) return concatenate(arr_rows, axis=0) if isinstance(obj, N.ndarray): return obj I basically turned the old `bmat` into `stack` and removed the matrix calls. Best, Stefan On Wed, Oct 29, 2014 at 3:59 PM, Stefan Otte

Re: [Numpy-discussion] Generalize hstack/vstack -- stack; Block matrices like in matlab

2014-10-29 Thread Stefan Otte
representation of the block matrix is nice. Best, Stefan On Tue, Oct 28, 2014 at 7:46 PM, Nathaniel Smith n...@pobox.com wrote: On 28 Oct 2014 18:34, Stefan Otte stefan.o...@gmail.com wrote: Hey, In the last weeks I tested `np.asarray(np.bmat())` as `stack` function and it works quite

Re: [Numpy-discussion] Generalize hstack/vstack -- stack; Block matrices like in matlab

2014-09-09 Thread Stefan Otte
and maintenance work. Best, Stefan On Tue, Sep 9, 2014 at 12:14 AM, cjw c...@ncf.ca wrote: On 08-Sep-14 4:40 PM, Joseph Martinot-Lagarde wrote: Le 08/09/2014 15:29, Stefan Otte a écrit : Hey, quite often I work with block matrices. Matlab offers the convenient notation [ a b; c d

[Numpy-discussion] Generalize hstack/vstack -- stack; Block matrices like in matlab

2014-09-08 Thread Stefan Otte
Hey, quite often I work with block matrices. Matlab offers the convenient notation [ a b; c d ] to stack matrices. The numpy equivalent is kinda clumsy: vstack([hstack([a,b]), hstack([c,d])]) I wrote the little function `stack` that does exactly that: stack([[a, b], [c, d]]) In my

Re: [Numpy-discussion] Proposal: Chaining np.dot with mdot helper function

2014-02-24 Thread Stefan Otte
expression. It's kinda handy but do we actually need it? Beste Grüße, Stefan On Thu, Feb 20, 2014 at 8:39 PM, Nathaniel Smith n...@pobox.com wrote: On Thu, Feb 20, 2014 at 1:35 PM, Stefan Otte stefan.o...@gmail.com wrote: Hey guys, I quickly hacked together a prototype of the optimization step

Re: [Numpy-discussion] Proposal: Chaining np.dot with mdot helper function

2014-02-20 Thread Stefan Otte
Hey, so I propose the following. I'll implement a new function `mdot`. Incorporating the changes in `dot` are unlikely. Later, one can still include the features in `dot` if desired. `mdot` will have a default parameter `optimize`. If `optimize==True` the reordering of the multiplication is

Re: [Numpy-discussion] Proposal: Chaining np.dot with mdot helper function

2014-02-20 Thread Stefan Otte
common two-argument scenario does not take more than a single if-statement overhead, I don't see why it couldn't be a replacement for the existing np.dot; but others mileage may vary. On Thu, Feb 20, 2014 at 11:34 AM, Stefan Otte stefan.o...@gmail.com wrote: Hey, so I propose the following

Re: [Numpy-discussion] Proposal: Chaining np.dot with mdot helper function

2014-02-18 Thread Stefan Otte
...@gmail.com wrote: On Mon, Feb 17, 2014 at 4:57 PM, josef.p...@gmail.com wrote: On Mon, Feb 17, 2014 at 4:39 PM, Stefan Otte stefan.o...@gmail.com wrote: Hey guys, I wrote myself a little helper function `mdot` which chains np.dot for multiple arrays. So I can write mdot(A, B, C, D, E

[Numpy-discussion] Proposal: Chaining np.dot with mdot helper function

2014-02-17 Thread Stefan Otte
Hey guys, I wrote myself a little helper function `mdot` which chains np.dot for multiple arrays. So I can write mdot(A, B, C, D, E) instead of these A.dot(B).dot(C).dot(D).dot(E) np.dot(np.dot(np.dot(np.dot(A, B), C), D), E) I know you can use `numpy.matrix` to get nicer