Iterator-Based Design of Generic C++ Algorithms for Basic Tensor Operations
Numerical tensor calculus has recently gained increasing attention in many scientific fields including quantum computing and machine learning which contain basic tensor operations such as the pointwise tensor addition and multiplication of tensors. We present a C++ design of multi-dimensional iterat...
Main Author: | |
---|---|
Format: | Article |
Language: | English |
Published: |
Frontiers Media S.A.
2022-04-01
|
Series: | Frontiers in Applied Mathematics and Statistics |
Subjects: | |
Online Access: | https://www.frontiersin.org/articles/10.3389/fams.2022.806537/full |
_version_ | 1811314213405065216 |
---|---|
author | Cem Savas Bassoy |
author_facet | Cem Savas Bassoy |
author_sort | Cem Savas Bassoy |
collection | DOAJ |
description | Numerical tensor calculus has recently gained increasing attention in many scientific fields including quantum computing and machine learning which contain basic tensor operations such as the pointwise tensor addition and multiplication of tensors. We present a C++ design of multi-dimensional iterators and iterator-based C++ functions for basic tensor operations using mode-specific iterators only, simplifying the implementation of algorithms with recursion and multiple loops. The proposed C++ functions are designed for dense tensor and subtensor types with any linear storage format, mode and dimensions. We demonstrate our findings with Boost's latest uBlas tensor extension and discuss how other C++ frameworks can utilize our proposal without modifying their code base. Our runtime measurements show that C++ functions with iterators can compute tensor operations at least as fast as their pointer-based counterpart. |
first_indexed | 2024-04-13T11:07:56Z |
format | Article |
id | doaj.art-a7fadf54314f420692cca88546923e74 |
institution | Directory Open Access Journal |
issn | 2297-4687 |
language | English |
last_indexed | 2024-04-13T11:07:56Z |
publishDate | 2022-04-01 |
publisher | Frontiers Media S.A. |
record_format | Article |
series | Frontiers in Applied Mathematics and Statistics |
spelling | doaj.art-a7fadf54314f420692cca88546923e742022-12-22T02:49:13ZengFrontiers Media S.A.Frontiers in Applied Mathematics and Statistics2297-46872022-04-01810.3389/fams.2022.806537806537Iterator-Based Design of Generic C++ Algorithms for Basic Tensor OperationsCem Savas BassoyNumerical tensor calculus has recently gained increasing attention in many scientific fields including quantum computing and machine learning which contain basic tensor operations such as the pointwise tensor addition and multiplication of tensors. We present a C++ design of multi-dimensional iterators and iterator-based C++ functions for basic tensor operations using mode-specific iterators only, simplifying the implementation of algorithms with recursion and multiple loops. The proposed C++ functions are designed for dense tensor and subtensor types with any linear storage format, mode and dimensions. We demonstrate our findings with Boost's latest uBlas tensor extension and discuss how other C++ frameworks can utilize our proposal without modifying their code base. Our runtime measurements show that C++ functions with iterators can compute tensor operations at least as fast as their pointer-based counterpart.https://www.frontiersin.org/articles/10.3389/fams.2022.806537/fulltensor n-rankN-way arraymulti-dimensional arraytensor computationsmulti-dimensional iteratorsoftware design and development |
spellingShingle | Cem Savas Bassoy Iterator-Based Design of Generic C++ Algorithms for Basic Tensor Operations Frontiers in Applied Mathematics and Statistics tensor n-rank N-way array multi-dimensional array tensor computations multi-dimensional iterator software design and development |
title | Iterator-Based Design of Generic C++ Algorithms for Basic Tensor Operations |
title_full | Iterator-Based Design of Generic C++ Algorithms for Basic Tensor Operations |
title_fullStr | Iterator-Based Design of Generic C++ Algorithms for Basic Tensor Operations |
title_full_unstemmed | Iterator-Based Design of Generic C++ Algorithms for Basic Tensor Operations |
title_short | Iterator-Based Design of Generic C++ Algorithms for Basic Tensor Operations |
title_sort | iterator based design of generic c algorithms for basic tensor operations |
topic | tensor n-rank N-way array multi-dimensional array tensor computations multi-dimensional iterator software design and development |
url | https://www.frontiersin.org/articles/10.3389/fams.2022.806537/full |
work_keys_str_mv | AT cemsavasbassoy iteratorbaseddesignofgenericcalgorithmsforbasictensoroperations |