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])
Probably I am a little bit biased :-), but comparing
sum(f:zipWith(f:mult(), $vect1, $vect2))
to
sum(for $i in 1 to count($x) return $x[$i] * $y[$i])
the former seems slightly more readable/elegant.
--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
On Nov 7, 2007 6:45 AM, 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])
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--