FastMat: A C++ library for multi-index array computations

Rodrigo R. Paz*, Mario A. Storti, Lisandro D. Dalcin, Hugo G. Castro, Pablo A. Kler

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

1 Scopus citations


In this paper we introduce and describe an efficient thread-safe matrix library for computing element/cell residuals and Jacobians in Finite Elements and Finite Volume-like codes. The library provides a wide range of multi-index tensor operations that are normally used in scientific numerical computations. The library implements an algorithm for choosing the optimal computation order when a product of several tensors is performed (i.e., the so-called 'multi-product' operation). Another key-point of the FastMat approach is that some computations (for instance the optimal order in the multi-product operation mentioned before) are computed in the first iteration of the loop body and stored in a cache object, so that in the second and subsequent executions these computations are retrieved from the cache, and then not recomputed. The library is open source and freely available within the multi-physics parallel FEM code PETSc-FEM and it can be exploited on distributed and shared memory architectures as well as in hybrid approaches. We studied the performance of the library in the context of typical FEM tensor contractions.

Original languageEnglish (US)
Pages (from-to)38-48
Number of pages11
JournalAdvances in Engineering Software
StatePublished - Dec 2012
Externally publishedYes

Bibliographical note

Funding Information:
This work has received financial support from European Research Council (ERC) (Spain, Advanced Grant, Real Time Computational Mechanics Techniques for Multi-Fluid Problems, Reference: ERC-2009-AdG, Dir: Dr. Sergio Idelsohn), Consejo Nacional de Investigaciones Cientı´ficas y Técnicas ( CONICET, Argentina , Grant PIP 5271/05 ), Universidad Nacional del Litoral (UNL, Argentina, Grants CAI+D 2009 65/334), Agencia Nacional de Promoción Cientı´fica y Tecnológica ( ANPCyT, Argentina , Grants PICT 01141/2007, PICT 2008–0270 “Jóvenes Investigadores”, PICT-1506/2006), Secretarı´a de Ciencia y Tecnologı´a de la Universidad Tecnológica Nacional, Facultad Regional Resistencia, Chaco ( UTN FRRe, Argentina , Grant PID 2012 25/L057 ) and Universidad Tecnológica Nacional, Facultad Regional San Nicolás (Buenos Aires).


  • Finite element method
  • Finite volume method
  • Multi-index array library
  • Numerical analysis
  • Parallel computing
  • Thread-safe matrix library

ASJC Scopus subject areas

  • Software
  • Engineering(all)


Dive into the research topics of 'FastMat: A C++ library for multi-index array computations'. Together they form a unique fingerprint.

Cite this