Cargando…
Employing C++ Templates in the Design of a Computer Algebra Library
We discuss design aspects of the open-source Basic Polynomial Algebra Subprograms (BPAS) library. We build on standard C++11 template mechanisms to improve ease of use and accessibility. The BPAS computer algebra library looks to enable end-users to do work more easily and efficiently through optimi...
Autores principales: | , , |
---|---|
Formato: | Online Artículo Texto |
Lenguaje: | English |
Publicado: |
2020
|
Materias: | |
Acceso en línea: | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7340909/ http://dx.doi.org/10.1007/978-3-030-52200-1_34 |
_version_ | 1783555119567077376 |
---|---|
author | Brandt, Alexander Moir, Robert H. C. Moreno Maza, Marc |
author_facet | Brandt, Alexander Moir, Robert H. C. Moreno Maza, Marc |
author_sort | Brandt, Alexander |
collection | PubMed |
description | We discuss design aspects of the open-source Basic Polynomial Algebra Subprograms (BPAS) library. We build on standard C++11 template mechanisms to improve ease of use and accessibility. The BPAS computer algebra library looks to enable end-users to do work more easily and efficiently through optimized C code wrapped in an object-oriented and user-friendly C++ interface. Two key aspects of this interface to be discussed are the encoding of the algebraic hierarchy as a class hierarchy and a mechanism to support the combination of algebraic types as a new type. Existing libraries, if encoding the algebraic hierarchy at all, use runtime value checks to determine if two elements belong to the same ring for an incorrect false sense of type safety in an otherwise statically-typed language. On the contrary, our template metaprogramming mechanism provides true compile-time type safety and compile-time code generation. The details of this mechanism are transparent to end-users, providing a very natural interface for an end-user mathematician. |
format | Online Article Text |
id | pubmed-7340909 |
institution | National Center for Biotechnology Information |
language | English |
publishDate | 2020 |
record_format | MEDLINE/PubMed |
spelling | pubmed-73409092020-07-08 Employing C++ Templates in the Design of a Computer Algebra Library Brandt, Alexander Moir, Robert H. C. Moreno Maza, Marc Mathematical Software – ICMS 2020 Article We discuss design aspects of the open-source Basic Polynomial Algebra Subprograms (BPAS) library. We build on standard C++11 template mechanisms to improve ease of use and accessibility. The BPAS computer algebra library looks to enable end-users to do work more easily and efficiently through optimized C code wrapped in an object-oriented and user-friendly C++ interface. Two key aspects of this interface to be discussed are the encoding of the algebraic hierarchy as a class hierarchy and a mechanism to support the combination of algebraic types as a new type. Existing libraries, if encoding the algebraic hierarchy at all, use runtime value checks to determine if two elements belong to the same ring for an incorrect false sense of type safety in an otherwise statically-typed language. On the contrary, our template metaprogramming mechanism provides true compile-time type safety and compile-time code generation. The details of this mechanism are transparent to end-users, providing a very natural interface for an end-user mathematician. 2020-06-06 /pmc/articles/PMC7340909/ http://dx.doi.org/10.1007/978-3-030-52200-1_34 Text en © Springer Nature Switzerland AG 2020 This article is made available via the PMC Open Access Subset for unrestricted research re-use and secondary analysis in any form or by any means with acknowledgement of the original source. These permissions are granted for the duration of the World Health Organization (WHO) declaration of COVID-19 as a global pandemic. |
spellingShingle | Article Brandt, Alexander Moir, Robert H. C. Moreno Maza, Marc Employing C++ Templates in the Design of a Computer Algebra Library |
title | Employing C++ Templates in the Design of a Computer Algebra Library |
title_full | Employing C++ Templates in the Design of a Computer Algebra Library |
title_fullStr | Employing C++ Templates in the Design of a Computer Algebra Library |
title_full_unstemmed | Employing C++ Templates in the Design of a Computer Algebra Library |
title_short | Employing C++ Templates in the Design of a Computer Algebra Library |
title_sort | employing c++ templates in the design of a computer algebra library |
topic | Article |
url | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7340909/ http://dx.doi.org/10.1007/978-3-030-52200-1_34 |
work_keys_str_mv | AT brandtalexander employingctemplatesinthedesignofacomputeralgebralibrary AT moirroberthc employingctemplatesinthedesignofacomputeralgebralibrary AT morenomazamarc employingctemplatesinthedesignofacomputeralgebralibrary |