xsl-list
[Top] [All Lists]

## Re: [xsl] How to multiply 2 sequences ?

2007-11-07 07:58:23
```On 07/11/2007, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
```
```
It seems that you are trying to obtain the scalar product of
two vectors:

X = {x1, x2, ... , xn}

Y = {y1, y2, ... , yn}

X.Y = x1.y1 + x2.y2 + ... + xn.yn

```
```
If that is indeed the requirement (and I wasn't able to work it out from the
posting) then it can be done in XPath 2.0 (without any help from FXSL) as

sum(for \$i in 1 to count(\$x) return \$x[\$i] * \$y[\$i])
```
```
My guess was for the sum of the cross product:

sum(for \$a in \$x, \$b in \$y return \$a * \$b)

...i guess we'll find out at some point

--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

```
 Current Thread [xsl] How to multiply 2 sequences ?, TEICHERT, Peter Re: [xsl] How to multiply 2 sequences ?, Andrew Welch Re: [xsl] How to multiply 2 sequences ?, Dimitre Novatchev RE: [xsl] How to multiply 2 sequences ?, Michael Kay Re: [xsl] How to multiply 2 sequences ?, Andrew Welch <= Re: [xsl] How to multiply 2 sequences ?, Dimitre Novatchev