[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Increasing sequence ?

Subject: Re: Increasing sequence ?
From: "Wolfgang Laun wolfgang.laun@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Mar 2015 09:56:27 -0000
Re:  Increasing sequence ?
Dimitre,

I haven't the sleight-of-hand with writing this lingo, but wouldn't it be
worthwhile to try and check the ascending
property by *halving *the sequence and looking at each part separately?
When splitting, the last item of the first half must be less than the first
of the second, and then call recursively for each of the halves. I don't
know whether it would be faster, but it should reduce the risk of stack
overflow.

Cheers
Wolfgang

On 27 March 2015 at 10:37, Leo Studer leo.studer@xxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Dimitre
>
> thanks, this is amazing. With Saxon EE in Oxygen 16.1 I get stack overflow
> with 10000 ;-).
> Can you compare the time with this solution?
> *declare namespace **my* = "my:my";
> *declare function **my:increasing2*(*$seq* *as **xs:double**)*as *
> *xs:boolean*
> {*every **$v* *in *1 *to *(*count*(*$seq*)-1) *satisfies *(*$seq*[*$v*]
> lt *$seq*[*$v*+1])};
> *let **$v*:=(1 *to *1000000) *return *(*my:increasing2*(*$v*))
>
> Cheers
> Leo
>
> On 27.03.2015, at 05:24, Dimitre Novatchev dnovatchev@xxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Leo,
>
> I ran this with BaseX 7.8.2:
>
> declare namespace my = "my:my";
> declare function my:increasing($seq as xs:double*) as xs:boolean
> {empty($seq[2])
> or
>  $seq[1] lt $seq[2]  and  my:increasing(subsequence($seq, 2))
> };
> let $v:=(1 to 10000)
>  return my:increasing($v)
>
>
> And here is the result (do note this below: - marking as ***tail
> call***: my:increasing(fn:subsequence($seq_0, 2))  )
>
> Total Time: 3.74ms (for 100 000 - long sequence the time was 17.77ms,
> for 1 000 000 - long sequence the time was 207.56ms)
>
>
>   XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <-list/528976> (by
> email <>)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.