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/