>However, this doesn’t necessarily mean that XQuery is the wrong
>language for a linear algebra. Even a raytracer has already been
>implemented in XQuery (from the developers of XMLPrime; it seems to be
>offline). Some other examples on what can be done with XQuery is found
>in [1].

Indeed, I think that XQUERY might be very well suited to linear algebra (except for dynamic memory allocation). Most of the linear algebra algorithmic is of "functional" (in the sense recursive then evaluate expression) nature. I bet that a linear algebra module written in xquery could end up with 10% amount lines of code than its C++ or JAVA equivalent.

Direct overloading may be supported in a future version of XQuery.
> Many things are happening; for example, arrays will be introduced with
> XQuery 3.1. You are welcome to post feature requests in the W3 Bug
> Tracker [2].

That's interesting. Specially if further version of xquery support constant-sized arrays, meaning that xquery can allocate contiguous block of memory (I will not have to bind JAVA anymore !).
I was trying to look to a site listing the new features of xquery 3.1 but did not succeed. Could you be kind enough to provide a link if you have one in mind ?

Thanks for yours answers,

cheers,

Jean-Marc


2013/11/18 Christian Grün <christian.gruen@gmail.com>
Hi again,

> - I don't know how to allocate and address directly contiguous memory blocks
> in XQUERY.

Operations on this level cannot be realized in XQuery. Instead, the
query processor is responsible for all memory management. If
operations turn out to really be too cpu/memory consuming, Java
bindings (and annotations like @Deterministic) may be the better
choice.

However, this doesn’t necessarily mean that XQuery is the wrong
language for a linear algebra. Even a raytracer has already been
implemented in XQuery (from the developers of XMLPrime; it seems to be
offline). Some other examples on what can be done with XQuery is found
in [1].

> - Immutability might result in a big overload in memory? This might not be
> true, see a recent thread over this topic (XQUERY for noobs).

That’s difficult to say, as memory consumption largely depends on the
specific problem, and the concrete implementation.

> - I don't know how to overload the basic operators (*,+,-) with XQUERY. This
> may result in quite heavy notations like
> alg:prod($mat1,alg:minus($mat2,$mat3)) instead of $mat1*($mat2-$mat3).

Function implementations can be assigned to variables, which makes the
notation more compact:

    $prod($mat1, $minus($mat2, $mat3))

Direct overloading may be supported in a future version of XQuery.
Many things are happening; for example, arrays will be introduced with
XQuery 3.1. You are welcome to post feature requests in the W3 Bug
Tracker [2].

Christian

[1] http://cs.uef.fi/~kilpelai/RDK11/exercises/Ex8Files/xqueryProblems.pdf
[2] https://www.w3.org/Bugs/Public/