Sasha wrote: > On 7/6/06, Robert Kern <[EMAIL PROTECTED]> wrote: > >> ... >> I don't think that just because arrays are often used for linear algebra that >> linear algebra assumptions should be built in to the core array type. >> >> > > In addition, transpose is a (rank-2) array or matrix operation and not > a linear algebra operation. Transpose corresponds to the "adjoint" > linear algebra operation if you represent vectors as single column > matrices and co-vectors as single-row matrices. This is a convenient > representation followed by much of the relevant literature, but it > does not alow generalization beyond rank-2. Another useful feature is > that inner product can be calculated as the matrix product as long as > you accept a 1x1 matrix for a scalar. This feature does not work > beyond rank-2 either because in order to do tensor inner product you > have to be explicit about the axes being collapsed (for example using > Einstein notation). > At various times, I've thought about how one might do Einstein notation within Python. About the best I could come up with was:
A.ijk * B.klm or A("ijk") * B("klm") Neither is spectacular, the first is a cleaner notation, but conceptually messy since it abuses getattr. Both require some intermediate pseudo object that wraps the array as well as info about the indexing. > Since ndarray does not distinguish between upper an lower indices, it > is not possible distinguish between vectors and co-vectors in any way > other than using matrix convention. This makes ndarrays a poor model > for linear algebra tensors. > My tensor math is rusty, but isn't it possible to represent all ones tensors as either covariant and contravariant and just embed the information about the metric into the product operator? It would seem that the inability to specify lower and upper indices is not truly limiting, but the inability to specify what axis to contract over is a fundamental limitation of sorts. I'm sure I'm partly influenced by my feeling that in practice upper and lower indices (aka contra- and covariant- and mixed-tensors) would be a pain in the neck, but a more capable inner product operator might well be useful if we could come up with correct syntax. -tim Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion