Ah! So much ado about nothing. What I was looking for was in fact:
B[A_idx][:,A_idx] ... it's even explained in the the NumPy for Matlab Users
doc on scipy.org
/Thank you
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.sci
On 3/20/07, David Koch <[EMAIL PROTECTED]> wrote:
> And by the way - whenever I do a .__doc__ all newline characters
> are printed as "\n" in the python console ... how do I change that?
The easiest way to access the doc strings is to type help()
in the python interpreter, or ? in ipython
().
The
I will consider it Sven, I thought it was a good idea to collect everything
which had to do with Matlab -> Python in one thread.
Anyway,
Specifically, I was looking for an equivalent to Matlab's "sprand" which
allows one to create sparse normally distributed matrices. The function also
accepts
David Koch schrieb:
> Hi,
>
> naive question - how do I get an overview over everything to do with
> "sparse functionality" in SciPy 0.5.2 ... I can't find any documentation
> anywhere.
>
First of all I would recommend to start a new and properly named thread
for that
good luck,
sven
__
Hi,
naive question - how do I get an overview over everything to do with "sparse
functionality" in SciPy 0.5.2 ... I can't find any documentation anywhere.
/David
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/ma
On Thu, Mar 15, 2007 at 12:26:10PM +0100, David Koch wrote:
> Next thing, I have
>
> A_Idx = array([1, 0])
>
> and B is a matrix. How would I select the four elements in B indicated by
> "meshgrid(A_Idx)", that ist: B[1,1], B[1,0], B[0,1], B[0,0]
> In Matlab you would simply use B(A_idx, A_idx) w
On 3/15/07, David Koch <[EMAIL PROTECTED]> wrote:
... NumPy equiv for Matlab B(A_idx, A_Idx)
Ok, I did like this:
A_Idx = array([1, 0])
B = random.randn(3,3)
rowInd = kron(ones((1, len(A_Idx)), int), A_Idx[:, newaxis])
colInd = kron(ones((len(A_Idx), 1), int), A_Idx)
B[rowInd, colInd] - re
On 3/14/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
I definitely second this comment. Using arrays when you are trying to
append a lot of data is using the wrong data format. And the code is so
much more readable with lists.
Thank you,
I will consider it,
Next thing, I have
A_Idx = arr
On Wed, Mar 14, 2007 at 04:11:43PM +0100, Sturla Molden wrote:
> On 3/14/2007 2:46 PM, Robert Cimrman wrote:
> > a = []
> > while ...
> > a.append( scalar )
> > a = array( a )
> While it may help, growing Python lists is also an O(N) process.
> One can reduce the amount of allocations by preal
On 3/14/07, Sturla Molden <[EMAIL PROTECTED]> wrote:
On 3/14/2007 2:46 PM, Robert Cimrman wrote:
> a = []
> while ...
> a.append( scalar )
> a = array( a )
While it may help, growing Python lists is also an O(N) process.
This may just be a terminology problem, but just to be clear, append
On 3/14/2007 2:46 PM, Robert Cimrman wrote:
> a = []
> while ...
> a.append( scalar )
> a = array( a )
While it may help, growing Python lists is also an O(N) process.
One can reduce the amount of allocations by preallocating an ndarray of
a certain size (e.g. 1024 scalars), filling it up, an
On 3/14/07, David Koch <[EMAIL PROTECTED]> wrote:
On 3/14/07, Sven Schreiber <[EMAIL PROTECTED]> wrote:
>
>
>
> If you want a 1d-array in the end you could try empty(0) to start with,
> and then do hstack((A, your_scalar)) or something like that.
Depending on what your generating routine loo
On 3/14/07, Sven Schreiber <[EMAIL PROTECTED]> wrote:
If you want a 1d-array in the end you could try empty(0) to start with,
and then do hstack((A, your_scalar)) or something like that.
Yeah, that works - odd, I thought concatenate((a,b),0) == hstack((a,b))
Thanks
/David
___
David Koch schrieb:
>
> In Python, I tried:
>
> A = empty((0,0))
> while
> A = concatenate((A, array([someScalarValue])), 1)
> end
>
> which returns an error since the shape of the empty A does not match the
> vector I want to concatenate with. Any way to get around this without
> havi
David Koch wrote:
> Hi,
>
> so one thing I came across now is the following, very simple:
>
> Matlab:
> A = []
> while
>A = [A some_scalar_value]
> end
>
>
> In Python, I tried:
>
> A = empty((0,0))
> while
>A = concatenate((A, array([someScalarValue])), 1)
> end
>
> which r
Hi,
so one thing I came across now is the following, very simple:
Matlab:
A = []
while
A = [A some_scalar_value]
end
In Python, I tried:
A = empty((0,0))
while
A = concatenate((A, array([someScalarValue])), 1)
end
which returns an error since the shape of the empty A does not
David Koch wrote:
> Hello,
>
> I am trying to translate some Matlab code to NumPy. I started reading
> the NumPy book and, yeah it's a very long read :-/ One thing I am
> completely confused about are the concpets of "basic" vs. "advanced"
> indexing. Are there some good examples out there where
Thank you everybody for your replies.
Completely off-topic:
I just read your sig Christoper:
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R
Do you work with tsunami early-warning systems? I once had to give a
presentation at Uni about the type of buoy
David Koch wrote:
> - Is it "pythonic" to initialize vectors to 2 dimensions so that
> vec.shape == (len(vec), 1) instead of vec.shape == (len(vec),)?
It depends what it means -- and this is not a question of Pythonic --
maybe Numpythonic?
Numpy is an n-d array package -- NOT a matrix package (
On 3/5/07, David Koch <[EMAIL PROTECTED]> wrote:
Hello,
I am trying to translate some Matlab code to NumPy. I started reading the
NumPy book and, yeah it's a very long read :-/ One thing I am completely
confused about are the concpets of "basic" vs. "advanced" indexing. Are
there some good exam
On 3/5/2007 2:13 PM, David Koch wrote:
> - Given a matrix R, is there an equvialent to the Matlab
> operation R(:,j) = [] (which removes column j and
> "shrinks" the matrix?
>>> help(numpy.delete)
Help on function delete in module numpy.lib.function_base:
delete(arr, obj, axis=None)
Retu
On 3/5/2007 2:13 PM, David Koch wrote:
> - Am I correct in assuming that all arrays have to be initialized to
> their final number of elements in NumPy (using empty/zero for instance)?
You can also create an array from a Python list, data in a file, another
array or a memory mapping. In these c
Hello,
I am trying to translate some Matlab code to NumPy. I started reading the
NumPy book and, yeah it's a very long read :-/ One thing I am completely
confused about are the concpets of "basic" vs. "advanced" indexing. Are
there some good examples out there where for the same piece of code - M
23 matches
Mail list logo