[PYTHON MATRIX-SIG] Final conventions for alpha2
Carlos Fonseca
fonseca@gaivota.demon.co.uk
Sat, 17 Aug 1996 21:04:47 +0100 (BST)
On Fri, 16 Aug 1996, Konrad HINSEN wrote:
> > I don't have a particular bias towards fft, but I do have one towards
> > the huge collection of non-strctural numeric operations that have the
> > same properties. Things like histogram, spline, sort, argmax, etc.
>
> That may be a long list, but how often are they applied to arrays
> of rank higher than 1? In other words, how frequently would one
> have to override a default of zero?
Everytime one wanted to evaluate the fft (or whatever) of multiple
one-dimensional signals at once. In genetic algorithms (GAs, what I would
like to write code for), individuals can all be evaluated independently
from each other, which is ideal for vectorized operations. If assessing
each individual involves computing the fft of a different 1d signal, then
axis=-1.
If one can say that individuals (in GAs, that is) will mostly be described
by 1d (vector of decision variables, vector of objective values, etc) or
2d structures (a covariance matrix, a 2d pattern), and that outer
dimensions will be used to structure the population, since most
computations will be local to the individual itself, -1 and -2 will
definetely be the most common choices for axes.
I am still new to Python (but experieced with MATLAB), and I've only
written a couple of functions so far. But the answer to your question is
"very often", in my case...
> most typical application of a function. Basically, the default
> should be zero for structural operations, -1 for non-structural
> operations acting on vectors, and -2 for non-structural operations
> acting on matrices (e.g. inversion). I don't think this is difficult
> to remember, and I can't think of a function for which the answer
> according to this rule is not obvious.
>
> Konrad.
I am afraid I do not understand what you mean by structural and
non-structural operations. In particular, why is take() structural and
argsort() non-structural? For take(a,argsort(a)) to make sense, both
should have the same defaults, whatever the dimensions of a.
Carlos
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================