Re: [Numpy-discussion] Question on LinAlg Inverse Algorithm

2011-08-31 Thread Pauli Virtanen
On Tue, 30 Aug 2011 15:48:18 -0700, Mark Janikas wrote: Last week I posted a question involving the identification of linear dependent columns of a matrix... but now I am finding an interesting result based on the linalg.inv() function... sometime I am able to invert a matrix that has linear

Re: [Numpy-discussion] A question about dtype syntax

2011-08-31 Thread Jean-Baptiste Marquette
Hi Pierre, Thanks for the guess. Unfortunately, I got the same error: [('bs3000k.cat', 280.60341, -7.09118, 9480, 0.2057, 0.14)] Traceback (most recent call last): File /Users/marquett/workspace/Distort/src/StatsSep.py, line 40, in module StatsAll = np.array(np.asarray(Stats),

Re: [Numpy-discussion] A question about dtype syntax

2011-08-31 Thread Pierre GM
On Aug 31, 2011, at 12:20 PM, Jean-Baptiste Marquette wrote: Hi Pierre, Thanks for the guess. Unfortunately, I got the same error: [('bs3000k.cat', 280.60341, -7.09118, 9480, 0.2057, 0.14)] Traceback (most recent call last): File /Users/marquett/workspace/Distort/src/StatsSep.py,

[Numpy-discussion] Numpy performance boost

2011-08-31 Thread Dieter Weber
Hi, just wanted to show an example of how python3 + numpy compares with just python3 and many other languages and language implementations: http://shootout.alioth.debian.org/u64q/performance.php?test=mandelbrot#about The python3 program using numpy is #6 and you find it with the interesting

[Numpy-discussion] Model Predictive Control package

2011-08-31 Thread Davide
Dear List, Does anybody knows if there is a python package for simulating LTI dynamic systems controlled with a model predictive controller? I am writing some code which does the job, but the math is not super-easy and i would not like to reinvent the wheel and loose to much time. I will soon

Re: [Numpy-discussion] A question about dtype syntax

2011-08-31 Thread Jean-Baptiste Marquette
Hi Pierre, Bingo ! That works. I finally coded like: Stats = [(CatBase, round(stats.mean(Data.Ra), 5), round(stats.mean(Data.Dec), 5), len(Sep), round(stats.mean(Sep),4), round(stats.stdev(Sep),4),)] StatArray = np.array(Stats, dtype=([('Catalog', 'a15'), ('RaMean',

Re: [Numpy-discussion] A question about dtype syntax

2011-08-31 Thread Pierre GM
On Aug 31, 2011, at 3:40 PM, Jean-Baptiste Marquette wrote: Traceback (most recent call last): File /Users/marquett/workspace/Distort/src/StatsSep.py, line 44, in module np.savetxt(Table, StatsAll, delimiter=' ', fmt=['%15s %.5f %.5f %5d %.4f %.4f']) File

Re: [Numpy-discussion] A question about dtype syntax

2011-08-31 Thread Jean-Baptiste Marquette
Hi Pierre, On Aug 31, 2011, at 3:40 PM, Jean-Baptiste Marquette wrote: Traceback (most recent call last): File /Users/marquett/workspace/Distort/src/StatsSep.py, line 44, in module np.savetxt(Table, StatsAll, delimiter=' ', fmt=['%15s %.5f %.5f %5d %.4f %.4f']) File

Re: [Numpy-discussion] A question about dtype syntax

2011-08-31 Thread Pierre GM
On Aug 31, 2011, at 4:24 PM, Jean-Baptiste Marquette wrote: Hi Pierre, On Aug 31, 2011, at 3:40 PM, Jean-Baptiste Marquette wrote: Traceback (most recent call last): File /Users/marquett/workspace/Distort/src/StatsSep.py, line 44, in module np.savetxt(Table, StatsAll,

Re: [Numpy-discussion] A question about dtype syntax

2011-08-31 Thread Warren Weckesser
On Wed, Aug 31, 2011 at 9:24 AM, Jean-Baptiste Marquette marqu...@iap.frwrote: Hi Pierre, On Aug 31, 2011, at 3:40 PM, Jean-Baptiste Marquette wrote: Traceback (most recent call last): File /Users/marquett/workspace/Distort/src/StatsSep.py, line 44, in module np.savetxt(Table,

Re: [Numpy-discussion] Numpy performance boost

2011-08-31 Thread Isaac Gouy
Dieter, thank you for contributing a numpy mandelbrot program - but no thanks for your disqualified for doing things differently comment here. The benchmarks game has been showing a spectral-norm program based on numpy as an interesting alternative for the last couple of years -

Re: [Numpy-discussion] Numpy performance boost

2011-08-31 Thread Chris.Barker
On 8/31/11 3:58 AM, Dieter Weber wrote: just wanted to show an example of how python3 + numpy compares with just python3 and many other languages and language implementations: http://shootout.alioth.debian.org/u64q/performance.php?test=mandelbrot#about hmmm - it would be interesting to see

Re: [Numpy-discussion] Numpy performance boost

2011-08-31 Thread Isaac Gouy
- Original Message - From: Chris.Barker chris.bar...@noaa.gov To: numpy-discussion@scipy.org Cc: Sent: Wednesday, August 31, 2011 9:08 AM Subject: Re: [Numpy-discussion] Numpy performance boost On 8/31/11 3:58 AM, Dieter Weber wrote:   just wanted to show an example of how python3

Re: [Numpy-discussion] Question on LinAlg Inverse Algorithm

2011-08-31 Thread Mark Janikas
Right indeed... I have spent a lot of time looking at this and it seems a waste of time as the results are garbage anyways when the columns are collinear. I am just going to set a threshold, check the condition number, continue is satisfied, return error/warning if not now, what is too

Re: [Numpy-discussion] Question on LinAlg Inverse Algorithm

2011-08-31 Thread Bruce Southey
On 08/31/2011 12:56 PM, Mark Janikas wrote: Right indeed... I have spent a lot of time looking at this and it seems a waste of time as the results are garbage anyways when the columns are collinear. I am just going to set a threshold, check the condition number, continue is satisfied,

Re: [Numpy-discussion] Question on LinAlg Inverse Algorithm

2011-08-31 Thread Mark Janikas
When I say garbage, I mean in the context of my hypothesis testing when in the presence of perfect multicollinearity. I advise the user of the combination that leads to the problem and move on -Original Message- From: numpy-discussion-boun...@scipy.org

[Numpy-discussion] non-uniform discrete sampling with given probabilities (w/ and w/o replacement)

2011-08-31 Thread Christopher Jordan-Squire
In numpy, is there a way of generating a random integer in a specified range where the integers in that range have given probabilities? So, for example, generating a random integer between 1 and 3 with probabilities [0.1, 0.2, 0.7] for the three integers? I'd like to know how to do this without

Re: [Numpy-discussion] non-uniform discrete sampling with given probabilities (w/ and w/o replacement)

2011-08-31 Thread Christopher Jordan-Squire
On Wed, Aug 31, 2011 at 2:07 PM, Olivier Delalleau sh...@keba.be wrote: You can use: 1 + numpy.argmax(numpy.random.multinomial(1, [0.1, 0.2, 0.7])) For your real application you'll probably want to use a value 1 for the first parameter (equal to your sample size), instead of calling it

Re: [Numpy-discussion] non-uniform discrete sampling with given probabilities (w/ and w/o replacement)

2011-08-31 Thread Olivier Delalleau
2011/8/31 Christopher Jordan-Squire cjord...@uw.edu On Wed, Aug 31, 2011 at 2:07 PM, Olivier Delalleau sh...@keba.be wrote: You can use: 1 + numpy.argmax(numpy.random.multinomial(1, [0.1, 0.2, 0.7])) For your real application you'll probably want to use a value 1 for the first

Re: [Numpy-discussion] non-uniform discrete sampling with given probabilities (w/ and w/o replacement)

2011-08-31 Thread josef . pktd
On Wed, Aug 31, 2011 at 3:22 PM, Olivier Delalleau sh...@keba.be wrote: 2011/8/31 Christopher Jordan-Squire cjord...@uw.edu On Wed, Aug 31, 2011 at 2:07 PM, Olivier Delalleau sh...@keba.be wrote: You can use: 1 + numpy.argmax(numpy.random.multinomial(1, [0.1, 0.2, 0.7])) For your real