Castor: A C++ library to code “à la Matlab”
Matthieu Aussal, Marc Bakry, Laurent Séries · The Journal of Open Source Software · 2022
The objective of the Castor framework is to propose high-level semantics, inspired by the Matlab language, allowing fast software prototyping in a low-level compiled language.It is nothing more than a matrix management layer using the tools of the standard C++ library (C++14 and later), in different storage formats (full, sparse and hierarchical).Linear algebra operations are built over the BLAS API and graphic rendering is performed in the VTK framework.The Castor framework is provided as an open source software under the LGPL 3.0, compiled and validated with clang and gcc. Statement of needMatlab is a software used worldwide in numerical prototyping, due to its particularly userfriendly semantics and its certified toolboxes.However, many use cases do not allow codes in Matlab format, for example multi-platform portability issues, proprieraty licensing and more generally code interfacing.To start meeting these needs, a header-only template library for matrix management has been developed, based on the standard C++14 and later library, by encapsulating the std::vector class.Many tools and algorithms are provided to simplify the development of prototypes:• dense, sparse and hierarchical matrices manipulations, • linear algebra computations (Anderson et al., 1999), • graphical representations (Schroeder et al., 2000).This high-level semantic/low-level language coupling makes it possible to gain efficiency in the developpement, while ensuring performance for applications.In addition, direct access to data structures allows users to optimize the most critical parts of their code.Finally, a complete documentation is available, as well as continuous integration unit tests.All of this makes it possible to meet the needs of teaching (notebooks using a C++ interpreter such as Cling), academic research and industrial applications at the same time.