Two related questions:
1. Suppose B = ravel(A) and
B[i] corresponds to A[i0,i1,...].
Are there named functions that map the indices
(i0,i0,...) -> i
and back? This is assuming A.shape = (m0,m1,...) is known.
2. Suppose the above function is called ravel_index and its
Given a list of matrices [A0, A1, ...] is there a function that
calculates a matrix B such that
B[i,j] = A0[i0,j] * A1[i1,j] * ...
where i = ravel_index(i0, i1, ...).
What about the inverse function that turns B into C such that
C[i0,i1,...,j] = A0[i0,j] * A1[i1,j] * ...
I've considered reshape, ravel, take, put, outerproct but couldn't come
up with a combination to do it without a for-loop on j and a for-loop on
The above two questions I need answers right now. But I can imagine a
need for a more general operations in the future. Given a sequence of
arrays [A0,A1,...], produce a tensor product by picking certain indices
from each array (like i0,i1 above), while keeping some other indices
fixed (like j above). For example, the above could be written as
B = tensor_like([A0,A1...], [(0,None,None,...), ...,
As another example, if len(A.shape)==3 then
transpose(A) == tensor_like([A], [(2,), (1,), (0,)])
I was really surprised today to find that Perry Greenfield and I were
the only two developers listed on the Numeric Feature Requests tracker
on Source Forge. Since we work on numarray, I removed us. That leaves
If you are a NumPy developer who wants to handle Feature Requests for
Numeric, you might want to add yourself back onto the list of assignees.
Todd Miller jmiller(a)stsci.edu
STSCI / SSG
If ar1 and ar2 are arrays, are the following two expressions supposed to give
the same result?
(ar1 and ar2)
The first form seems to return the value of the second array, which isn't very
useful. It would be nice to map the first expression to do what the first does.
Dear Numpy list,
Has anyone looked at the comparitive speed of Numpy/Numarray vs. Ox? For
those that don't know, Ox is an implicitly typed, object oriented matrix
programming language that is one of the fastest around, and also allows
linking to C libraries (http://www.nuff.ox.ac.uk/Users/Doornik/index.html). I
use Python a lot, but I was wondering what the computational cost would be to
switch my matrix-y stuff to Numpy. Ox isn't open source...