{"title":"Expression Defined Accuracy","authors":"A. Pokorny, J. W. von Gudenberg","doi":"10.1109/SCAN.2006.17","DOIUrl":null,"url":null,"abstract":"In numerical computations the accuracy of the result quite often depends on a few expressions. In numerical linear algebra, e.g., summations or dot products should very often be computed with additional precision or accuracy. Corresponding algorithms have been developed for a long time and only recently revisited. The usage of these algorithms would be facilitated, if we had a means in a programming language to specify the accuracy requirements of an expression evaluation. In this paper we present a precision aware C+ + template library (PTL)for matrix / vector operations that provides several algorithms with different accuracy or precision characteristics for matrix multiplication and related operations. A matrix is a template parameterized with the number of rows and columns, the element type, a type representing the shape, and an evaluation strategy. Currently only two shapes are implemented, fixed or dynamically adaptable dense arrays. We distinguish between row and column vectors. The access to submatrices and -vectors is accomplished by an overloaded function template. It is possible to adapt the expression system to types declared in other libraries or declared by the user. The concept of expression templates is extended in a way that allows the user to specify rules for the evaluation strategy. The expression tree is constructed by overloading the operators for the expression type. In a second but still compile-time step the evaluation strategy is chosen and the trees are transformed and prepared for run-time execution. The strategy is determined by the tag type of the result, but it can be explicitly set using the index operator. The evaluation strategies can be combined with loop unrolling or loop fusion. Note that the latter not only increases the precision but also the accuracy of the result, since this strategy directly implements the dotprecision expression evaluation in the XSC languages. The library provides evaluation strategies for matrix and vector expressions with k-fold precision and with least bit accuracy. Efficiency and accuracy of the algorithms are tested vs. the Gnu multiple precision library GMP.","PeriodicalId":388600,"journal":{"name":"12th GAMM - IMACS International Symposium on Scientific Computing, Computer Arithmetic and Validated Numerics (SCAN 2006)","volume":"121 3 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2006-09-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"12th GAMM - IMACS International Symposium on Scientific Computing, Computer Arithmetic and Validated Numerics (SCAN 2006)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/SCAN.2006.17","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
In numerical computations the accuracy of the result quite often depends on a few expressions. In numerical linear algebra, e.g., summations or dot products should very often be computed with additional precision or accuracy. Corresponding algorithms have been developed for a long time and only recently revisited. The usage of these algorithms would be facilitated, if we had a means in a programming language to specify the accuracy requirements of an expression evaluation. In this paper we present a precision aware C+ + template library (PTL)for matrix / vector operations that provides several algorithms with different accuracy or precision characteristics for matrix multiplication and related operations. A matrix is a template parameterized with the number of rows and columns, the element type, a type representing the shape, and an evaluation strategy. Currently only two shapes are implemented, fixed or dynamically adaptable dense arrays. We distinguish between row and column vectors. The access to submatrices and -vectors is accomplished by an overloaded function template. It is possible to adapt the expression system to types declared in other libraries or declared by the user. The concept of expression templates is extended in a way that allows the user to specify rules for the evaluation strategy. The expression tree is constructed by overloading the operators for the expression type. In a second but still compile-time step the evaluation strategy is chosen and the trees are transformed and prepared for run-time execution. The strategy is determined by the tag type of the result, but it can be explicitly set using the index operator. The evaluation strategies can be combined with loop unrolling or loop fusion. Note that the latter not only increases the precision but also the accuracy of the result, since this strategy directly implements the dotprecision expression evaluation in the XSC languages. The library provides evaluation strategies for matrix and vector expressions with k-fold precision and with least bit accuracy. Efficiency and accuracy of the algorithms are tested vs. the Gnu multiple precision library GMP.