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

Re: How to improve the performance of my matrix additi

Subject: Re: How to improve the performance of my matrix addition function?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 12 Jul 2020 21:19:13 -0000
Re:  How to improve the performance of my matrix additi
On 12.07.2020 22:47, Dr. Roger L Costello costello@xxxxxxxxx wrote:

My application uses lots of matrix operations. I used the SAXON Tool Profile
(-TP) option to generate a web page that shows the performance of each of my
matrix operations. I found that my matrix addition function is taking an
appallingly large amount of time. Below is my matrix addition function. Do you
have suggestions on ways to improve its performance?  /Roger

<!-- A matrix can only be added to another matrix if the two matrices have the same dimensions. To add two matrices, just add the corresponding entries, and place this sum in the corresponding position in the matrix which results. --> <xsl:function name="matrix:addition" as="element(Matrix)"> <xsl:param name="M" as="element(Matrix)" /> <xsl:param name="N" as="element(Matrix)" /> <xsl:param name="name-of-result-matrix" as="xs:string" />

     <Matrix id="{$name-of-result-matrix}">
         <xsl:for-each select="1 to count($M/row)">
             <xsl:variable name="i" select="." as="xs:integer"/>
             <row>
                 <xsl:for-each select="1 to count($M/row[$i]/col)">
                     <xsl:variable name="j" select="." as="xs:integer"/>
                     <col>
                         <xsl:value-of select="$M/row[$i]/col[$j] +
$N/row[$i]/col[$j]"/>
                     </col>
                 </xsl:for-each>
             </row>
         </xsl:for-each>
     </Matrix>
</xsl:function>

Does it improve performance if you use


    <Matrix id="{$name-of-result-matrix}">
        <xsl:for-each select="$M/row">
            <xsl:variable name="i" select="position()"/>
            <xsl:variable name="row2" select="$N/row[$i]"/>
            <row>
                <xsl:for-each select="col">
                    <xsl:variable name="j" select="position()"/>
                    <col>
                        <xsl:value-of select=". + $row2/col[$j]"/>
                    </col>
                </xsl:for-each>
            </row>
        </xsl:for-each>
    </Matrix>

?

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.