libcdict: fast dictionaries in C
Abstract
A common requirement in science is to store and share large sets of simulation data in an efficient, nested, flexible and human-readable way. Such datasets contain number counts and distributions, i.e. histograms and maps, of arbitrary dimension and variable type, e.g. floating-point number, integer or character string. Modern high-level programming languages like Perl and Python have associated arrays, knowns as dictionaries or hashes, respectively, to fulfil this storage need. Low-level languages used more commonly for fast computational simulations, such as C and Fortran, lack this functionality. We present libcdict, a C dictionary library, to solve this problem. Libcdict provides C and Fortran application programming interfaces (APIs) to native dictionaries, called cdicts, and functions for cdicts to load and save these as JSON and hence for easy interpretation in other software and languages like Perl, Python and R.
- Publication:
-
The Journal of Open Source Software
- Pub Date:
- December 2023
- DOI:
- arXiv:
- arXiv:2401.14272
- Bibcode:
- 2023JOSS....8.4756I
- Keywords:
-
- Astronomy;
- Associated arrays;
- Dictionaries;
- Meson;
- Perl;
- C;
- Computer Science - Data Structures and Algorithms;
- Astrophysics - Astrophysics of Galaxies;
- Astrophysics - High Energy Astrophysical Phenomena;
- Astrophysics - Instrumentation and Methods for Astrophysics;
- Astrophysics - Solar and Stellar Astrophysics
- E-Print:
- Accepted for publication in JOSS (The Journal of Open-Source Software)