Thanks, Gerritt, so much useful information here!

I haven't run into performance issues for the specific task I'm working on, likely because the data sets are small. (The are all also very messy, which is why I need a robust solution, which R currently does not have.)

Excellent point about maps and xs:double. I haven't really used XSL3 except when I really needed the iterate function. I think one of the reasons I haven't used maps much so far is that most of the keys I use need to be multi-valued (i.e., the same index gets mapped to several nodes), and I wasn't under the impression that maps allowed for this, though I could be wrong.

M. Kay's book on XSLT2 is so helpful that I think I've been spoiled... have a hard time sorting out the specs to understand exactly what XSLT3 is capable of.


On Thu, Jan 24, 2013 at 2:24 PM, Imsieke, Gerrit, le-tex <gerrit.imsieke@le-tex.de> wrote:


On 2013-01-24 13:49, David Rudel wrote:
> Hi All,
> I have benefited greatly from the members in the XSL/Saxon communities,
> and I would like to contribute myself.
>
> I have recently worked up a primitive collection of functions designed
> to allow XSL to do vector analysis and linear algebra. It handles things
> like finding projections onto linear subspaces, cofactors, adjoints,
> determinants, and minors. It can also invert matrices and solve systems.
>
> I have in conjunction written up an implementation of a solver for doing
> robust non-linear regression for a data set. Notably, some dedicated
> statistical analysis software (e.g., R) does not have this capability.
>
> All of the above is written in XSL (i.e., not java). So "extension" is
> probably the wrong word to use for this, but I do think it is something
> that other people using XSL might find useful.

David,

That sounds interesting!

When I tried to do some statistical analysis in XSLT (for hundreds of
stylesheets, calculating correlation coefficients for element names and
text() in matching patterns vs. the occurrence of certain namespace URIs
in these stylesheets), I ran into serious performance issues and
therefore never published the functions and templates that I wrote.

If I was serious about it, Id rather use R or Julia than XSLT.

OTOH, if I had the time now, Id switch over to XSLT 3 maps
(http://www.w3.org/TR/xslt-30/#map) instead of XML structures to
represent matrices. That might speed up things enormously, because,
among other things, numerical values dont have to be cast to double
from text nodes / attribute values in intermediate XML structures.

>
> I'm writing to ask two questions:
>
> A. Is there a way within XSL to communicate an error to someone running
> a script? For example, if someone tries to find the determinant of a
> non-square matrix, it would be nice to be able to communicate what type
> of error occurred.

Apart from the aforementioned maps, XSLT 3 has try/catch:
http://www.w3.org/TR/xslt-30/#try-catch

And Im almost sure that function objects, fold-left() et al.
(http://www.w3.org/TR/2013/CR-xpath-functions-30-20130108/#func-fold-left)
might be nice for your library.

So Id go for XSLT/Xpath 3 full throttle. Or maintain two versions, in
order to demonstrate how beautiful a language XSLT/XPath 3 has become,
even in comparison to the already-mostly-ok XSLT/XPath 2.

>
> B. Once I have these written up for public consumption, what would be
> the best way to share them? Would it be possible to have them added to
> the EXSL project?

Id go for github or Google code, so that others can submit bug reports,
pull requests, and feedback.

Gerrit


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help



--

"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.