Discussion: new operators for numerical computation
Gregory Lielens
gregory.lielens at fft.be
Thu Jul 20 11:37:12 EDT 2000
Robin Becker wrote:
>
> In article <8l6vul$5ig$1 at slb3.atl.mindspring.net>, Aahz Maruch
> <aahz at netcom.com> writes
> >In article <Pine.LNX.4.10.10007191505070.1129-100000 at rocket.knowledgetrack.com>,
> >Huaiyu Zhu <huaiyu_zhu at yahoo.com> wrote:
> >>
> >> matrix element names (with prefix m or e)
> >> + .+ add
> >> - .- sub
> >
> >I am strongly opposed to operators of the form ".+". What happens if
> >take an expression of the form "5.+matrix"? No, that goes against the
> >Python rule of having zero ambiguity.
> >--
> > --- Aahz (Copyright 2000 by aahz at netcom.com)
> >
> ...
> people keep talking about matrix operations as though there is only one
> way to do one kind of matrix multiply; I use at least two (inner, outer)
> commonly, but others eg Kronecker or Lie are certainly in use. I don't
> think any proposal which doesn't address this is likely to get my vote.
> --
> Robin Becker
Are you talking of matrices, or Nd arrays? I am only aware of one kind
of matrix multiply, defined as
a=b @ c <=> a(i,j) = b(i,k) * c(k,j) (using summation over repeated
indices, @ stand for the yet-to-be-defined matrix mul operator)
For Nd arrays, there is indeed more possibilities, and I fear adressing
all of them could be too much to ask to "simple" infix operators....
I propose to extend the meaning of the matrix multiply to Nd arrays as
a=b at c <=> a(i1,...,in,j1,...,jm) = b(i1,...,in,k) * c(k,j1,...,jm)
For general inner/outer product, something in the line of Yorick
notation is imho unavoidable
a=b[,,Contract,Contract]@c[,Contract,,Contract] would stand for
a(i,j,k,l)=b(i,j,c1,c2)*c(k,c1,l,c2)
Replace Contract keyword with + sign, and you almost have Yorick
notation...
Kronecker/lie, I am not really aware of what they are...but I guess they
would be writable in a general inner/outer framework, with the help of
special arrays/tensors (correct me if am completely off on this!)
imho Division (right and left) belongs to pure matrices, and can not
really be generalized
I feel that way because I am not aware of a well defined inverse for a
Nd array ...(should someone be interrested in this I could post a
discussion I had with Travis Oliphant, from NumPy group)
Greg.
More information about the Python-list
mailing list