Statically typed matrix: in C++ library

  • Authors:
  • Predrag S. Rakić;Lazar Stričević;Zorica Suvajdžin Rakić

  • Affiliations:
  • University of Novi Sad, Novi Sad, Serbia;University of Novi Sad, Novi Sad, Serbia;University of Novi Sad, Novi Sad, Serbia

  • Venue:
  • Proceedings of the Fifth Balkan Conference in Informatics
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

Contemporary C++ matrix libraries model matrices as if the only relevant characteristic of matrix type is its element type and number of dimensions. Actual size of each dimension is usually completely disregarded in the model. Dimension size is treated as dynamic characteristics of matrix object, making a matrix type neither static nor dynamic, but something in between. Logical consequence of data model inconsistency is more or less noticeable discrepancy in the interface design. Matrix model in which element type, number of dimensions and size of each dimension are all treated as equally important characteristic of matrix type is presented in this paper. Proposed matrix model is implemented in the C++ proof-of-concept template library called Typed Matrix Library (TML). Matrices in TML are statically typed objects. Modeling matrices this way enables compile-time correctness verification in matrix operations. At the same time, this approach incurs no run-time overhead compared to the classical one. Arguably, linear algebra programs based on the presented model require no additional information/dependencies to be supplied to the program code than developers are already aware of, thus no extra developers' effort is required in order to use matrices based on this model.