Using the Shogun library, we can use a particular constructor of the SGMatrix type to initialize it with the C++ array. It takes a pointer to the data and matrix dimensions, as illustrated in the following code snippet:
std::vector<double> values;
...
SGMatrix<float64_t> matrix(values.data(), num_rows, numcols);
Notice that all of these functions only make a wrapper for the original C++ array where the data is stored, and don't copy the values into a new location. If we want to copy values from a C++ array to a matrix object, we usually need to call a clone() method or an analog of it for the wrapper object.
After we have a matrix object for a machine learning framework we use, we can initialize other specialized objects for training machine learning algorithms. Examples of such objects are the CDenseFeatures noun for the Shogun library or the CClassificationDataset noun for the Shark-ML library.