7 Data processing

This chapter describe classes mglData and mglDataC for working with data arrays of real and complex numbers. Both classes are derived from abstract class mglDataA, and can be used as arguments of any plotting functions (see MathGL core). These classes are defined in #include <mgl2/data.h> and #include <mgl2/datac.h> correspondingly. The classes have mostly the same set of functions for easy and safe allocation, resizing, loading, saving, modifying of data arrays. Also it can numerically differentiate and integrate data, interpolate, fill data by formula and so on. Classes support data with dimensions up to 3 (like function of 3 variables – x,y,z). The internal representation of numbers is mreal (or dual=std::complex<mreal> for mglDataC), which can be configured as float or double by selecting option --enable-double at the MathGL configuring (see Installation). Float type have smaller size in memory and usually it has enough precision in plotting purposes. However, double type provide high accuracy what can be important for time-axis, for example. Data arrays are denoted by Small Caps (like DAT) if it can be (re-)created by MGL commands.