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

2014-09-08 Thread cjw
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 ] This would appear to be a desirable way to go. Numpy has something similar for str

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

2014-09-08 Thread Joseph Martinot-Lagarde
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 ] > > to stack matrices. The numpy equivalent is kinda clumsy: > > vstack([hstack([a,b]), hstack([c,d])]) > > I wrote the little function `stack` t

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

2014-09-08 Thread Joseph Martinot-Lagarde
Le 08/09/2014 16:41, Sturla Molden a écrit : > Stefan Otte wrote: > >> stack([[a, b], [c, d]]) >> >> In my case `stack` replaced `hstack` and `vstack` almost completely. >> >> If you're interested in including it in numpy I created a pull request >> [1]. I'm looking forward to getting some fe

Re: [Numpy-discussion] SFMT (faster mersenne twister)

2014-09-08 Thread Robert Kern
On Mon, Sep 8, 2014 at 6:05 PM, Pierre-Andre Noel wrote: > > I think we could add new generators to NumPy though, > > perhaps with a keyword to control the algorithm (defaulting to the > current > > Mersenne Twister). > > Why not do something like the C++11 ? In , a "generator" > is the engine

Re: [Numpy-discussion] SFMT (faster mersenne twister)

2014-09-08 Thread Julian Taylor
On 08.09.2014 19:05, Pierre-Andre Noel wrote: > > I think we could add new generators to NumPy though, > > perhaps with a keyword to control the algorithm (defaulting to the > current > > Mersenne Twister). > ... > > Here is how I propose to adapt this scheme to numpy. First, there would > b

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

2014-09-08 Thread Eelco Hoogendoorn
Blaze aims to do something like that; to make the notion of an array and how it stores it's data far more flexible. But if it isn't a single strided ND array, it isn't numpy. This concept lies at its very heart; and for good reasons I would add. -Original Message- From: "Benjamin Root"

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

2014-09-08 Thread Stephan Hoyer
On Mon, Sep 8, 2014 at 10:00 AM, Benjamin Root wrote: > Btw, on a somewhat related note, whoever can implement ndarray to be able > to use views from other ndarrays stitched together would get a fruit basket > from me come the holidays and possibly naming rights for the next kid... > Ben, you sh

Re: [Numpy-discussion] SFMT (faster mersenne twister)

2014-09-08 Thread Pierre-Andre Noel
> I think we could add new generators to NumPy though, > perhaps with a keyword to control the algorithm (defaulting to the current > Mersenne Twister). Why not do something like the C++11 ? In , a "generator" is the engine producing randomness, and a "distribution" decides what is the type

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

2014-09-08 Thread Benjamin Root
Btw, on a somewhat related note, whoever can implement ndarray to be able to use views from other ndarrays stitched together would get a fruit basket from me come the holidays and possibly naming rights for the next kid... Cheers! Ben Root On Mon, Sep 8, 2014 at 12:55 PM, Benjamin Root wrote: >

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

2014-09-08 Thread Benjamin Root
A use case would be "image stitching" or even data tiling. I have had to implement something like this at work (so, I can't share it, unfortunately) and it even goes so far as to allow the caller to specify how much the tiles can overlap and such. The specification is ungodly hideous and I doubt I

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

2014-09-08 Thread Eelco Hoogendoorn
Sturla: im not sure if the intention is always unambiguous, for such more flexible arrangements. Also, I doubt such situations arise often in practice; if the arrays arnt a grid, they are probably a nested grid, and the code would most naturally concatenate them with nested calls to a stacking fun

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

2014-09-08 Thread josef.pktd
On Mon, Sep 8, 2014 at 12:10 PM, Jaime Fernández del Río < jaime.f...@gmail.com> wrote: > On Mon, Sep 8, 2014 at 7:41 AM, Sturla Molden > wrote: > >> Stefan Otte wrote: >> >> > stack([[a, b], [c, d]]) >> > >> > In my case `stack` replaced `hstack` and `vstack` almost completely. >> > >> > If

Re: [Numpy-discussion] Weighted Covariance/correlation

2014-09-08 Thread tpoole
Hi all, Any input to this? Last time it generated a fair bit of discussion, which I’ll summarise here. It’s currently possible to calculate a weighted average using np.average, but the corresponding functionality does not exist for (co)variance or corrcoeff calculations. In this case it’s less

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

2014-09-08 Thread Nathaniel Smith
On 8 Sep 2014 10:42, "Sturla Molden" wrote: > > Stefan Otte wrote: > > > stack([[a, b], [c, d]]) > > > > In my case `stack` replaced `hstack` and `vstack` almost completely. > > > > If you're interested in including it in numpy I created a pull request > > [1]. I'm looking forward to getting

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

2014-09-08 Thread Jaime Fernández del Río
On Mon, Sep 8, 2014 at 7:41 AM, Sturla Molden wrote: > Stefan Otte wrote: > > > stack([[a, b], [c, d]]) > > > > In my case `stack` replaced `hstack` and `vstack` almost completely. > > > > If you're interested in including it in numpy I created a pull request > > [1]. I'm looking forward to

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

2014-09-08 Thread josef.pktd
On Mon, Sep 8, 2014 at 10:41 AM, Sturla Molden wrote: > Stefan Otte wrote: > > > stack([[a, b], [c, d]]) > > > > In my case `stack` replaced `hstack` and `vstack` almost completely. > > > > If you're interested in including it in numpy I created a pull request > > [1]. I'm looking forward to

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

2014-09-08 Thread Sturla Molden
Stefan Otte wrote: > stack([[a, b], [c, d]]) > > In my case `stack` replaced `hstack` and `vstack` almost completely. > > If you're interested in including it in numpy I created a pull request > [1]. I'm looking forward to getting some feedback! As far as I can see, it uses hstack and vsta

Re: [Numpy-discussion] SFMT (faster mersenne twister)

2014-09-08 Thread josef.pktd
On Sun, Sep 7, 2014 at 4:23 PM, Sturla Molden wrote: > Benjamin Root wrote: > > In addition to issues with reproducibility, think of all of the unit > tests > > that would break! > > That is a reproducibility problem :) > > ___ > NumPy-Discussion maili

[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 ca