[PD-dev] list object operators
Mathieu Bouchard
matju at artengine.ca
Sat Feb 18 19:05:25 CET 2006
On Tue, 10 Jan 2006, Frank Barknecht wrote:
> Regarding your suggestion of speeding up list-math: What about extending
> [expr] to handle lists as well? Maybe a new variable could deal with
> this like $l1, $l2, ..., so that things like this would be possible:
> [expr $f1 * $l1]. I didn't think too much about the best syntax for
> list-expr yet, like when should the result be a list,
[expr~]'s $v1,$v2,... could be a source of inspiration (and of
compatibility-by-analogy)
Else, GridFlow and VASP and iemmatrix are other possible sources.
> when should it be a scalar, how to handle the two kinds of
> multiplication possible with [expr $l1 * $l2] (inner product with a
> scalar result vs. element-wise product to a list),
There are more kinds of products than just that. with lists of 3 elements
you may have the wedge-product (partial determinant). there are a bunch of
other "inner" products according to Hilbert's inner product axioms.
Basically a product could be any operator $ for which
(a*b)$c = a*(b$c) = b$(a*c)
where * is the product-by-scalar. That's damn wide. In math books, which
operator is used depends on context. Me, I prefer saying * for pointwise,
and saying #inner for the dot product. Matlab4 prefers saying .* for
pointwise and * for the dot product.
Miller, with a phd in math, prolly has a few ideas about it himself, if he
bothers to speak them...
> what to do with "mixed" lists that also include symbols and gpointers
> etc., but the basic concept looks very useful to me.
That's a damn good question. The most forward-compatible thing you can
do is abort on everything you don't know how to handle. If stuff was
accepted loosely, people would start depending on that behaviour, and
later introducing a proper behaviour would be impossible.
_ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada
More information about the Pd-dev
mailing list