Home | History | Annotate | Download | only in spbench
      1 // This file is part of Eigen, a lightweight C++ template library
      2 // for linear algebra.
      3 //
      4 // Copyright (C) 2012 Dsir Nuentsa-Wakam <desire.nuentsa_wakam (at) inria.fr>
      5 //
      6 // This Source Code Form is subject to the terms of the Mozilla
      7 // Public License v. 2.0. If a copy of the MPL was not distributed
      8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
      9 
     10 #ifndef SPBENCHSTYLE_H
     11 #define SPBENCHSTYLE_H
     12 
     13 void printBenchStyle(std::ofstream& out)
     14 {
     15   out << "<xsl:stylesheet id='stylesheet' version='1.0' \
     16       xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >\n \
     17       <xsl:template match='xsl:stylesheet' />\n \
     18       <xsl:template match='/'> <!-- Root of the document -->\n \
     19       <html>\n \
     20         <head> \n \
     21           <style type='text/css'> \n \
     22             td { white-space: nowrap;}\n \
     23           </style>\n \
     24         </head>\n \
     25         <body>";
     26   out<<"<table border='1' width='100%' height='100%'>\n \
     27         <TR> <!-- Write the table header -->\n \
     28         <TH>Matrix</TH> <TH>N</TH> <TH> NNZ</TH>  <TH> Sym</TH>  <TH> SPD</TH> <TH> </TH>\n \
     29           <xsl:for-each select='BENCH/AVAILSOLVER/SOLVER'>\n \
     30             <xsl:sort select='@ID' data-type='number'/>\n \
     31             <TH>\n \
     32               <xsl:value-of select='TYPE' />\n \
     33               <xsl:text></xsl:text>\n \
     34               <xsl:value-of select='PACKAGE' />\n \
     35               <xsl:text></xsl:text>\n \
     36             </TH>\n \
     37           </xsl:for-each>\n \
     38         </TR>";
     39 
     40   out<<"  <xsl:for-each select='BENCH/LINEARSYSTEM'>\n \
     41           <TR> <!-- print statistics for one linear system-->\n \
     42             <TH rowspan='4'> <xsl:value-of select='MATRIX/NAME' /> </TH>\n \
     43             <TD rowspan='4'> <xsl:value-of select='MATRIX/SIZE' /> </TD>\n \
     44             <TD rowspan='4'> <xsl:value-of select='MATRIX/ENTRIES' /> </TD>\n \
     45             <TD rowspan='4'> <xsl:value-of select='MATRIX/SYMMETRY' /> </TD>\n \
     46             <TD rowspan='4'> <xsl:value-of select='MATRIX/POSDEF' /> </TD>\n \
     47             <TH> Compute Time </TH>\n \
     48             <xsl:for-each select='SOLVER_STAT'>\n \
     49               <xsl:sort select='@ID' data-type='number'/>\n \
     50               <TD> <xsl:value-of select='TIME/COMPUTE' /> </TD>\n \
     51             </xsl:for-each>\n \
     52           </TR>";
     53   out<<"  <TR>\n \
     54             <TH> Solve Time </TH>\n \
     55             <xsl:for-each select='SOLVER_STAT'>\n \
     56               <xsl:sort select='@ID' data-type='number'/>\n \
     57               <TD> <xsl:value-of select='TIME/SOLVE' /> </TD>\n \
     58             </xsl:for-each>\n \
     59           </TR>\n \
     60           <TR>\n \
     61             <TH> Total Time </TH>\n \
     62             <xsl:for-each select='SOLVER_STAT'>\n \
     63               <xsl:sort select='@ID' data-type='number'/>\n \
     64               <xsl:choose>\n \
     65                 <xsl:when test='@ID=../BEST_SOLVER/@ID'>\n \
     66                   <TD style='background-color:red'> <xsl:value-of select='TIME/TOTAL' />  </TD>\n \
     67                 </xsl:when>\n \
     68                 <xsl:otherwise>\n \
     69                   <TD>  <xsl:value-of select='TIME/TOTAL' /></TD>\n \
     70                 </xsl:otherwise>\n \
     71               </xsl:choose>\n \
     72             </xsl:for-each>\n \
     73           </TR>";
     74   out<<"  <TR>\n \
     75               <TH> Error </TH>\n \
     76               <xsl:for-each select='SOLVER_STAT'>\n \
     77                 <xsl:sort select='@ID' data-type='number'/>\n \
     78                 <TD> <xsl:value-of select='ERROR' />\n \
     79                 <xsl:if test='ITER'>\n \
     80                   <xsl:text>(</xsl:text>\n \
     81                   <xsl:value-of select='ITER' />\n \
     82                   <xsl:text>)</xsl:text>\n \
     83                 </xsl:if> </TD>\n \
     84               </xsl:for-each>\n \
     85             </TR>\n \
     86           </xsl:for-each>\n \
     87       </table>\n \
     88     </body>\n \
     89     </html>\n \
     90   </xsl:template>\n \
     91   </xsl:stylesheet>\n\n";
     92 
     93 }
     94 
     95 #endif
     96