I am using the C library in my Swift application, and I cannot figure out how to get a multidimensional array that the C method should return.
I get this from the C API:
struct resultArray
{
double *data;
int size[2];
};
Where:
size = matrix size, an array of two elements with the number of rows and the number of columns
data = matrix data
In swift, I can do the following to get the size:
let numRows = Int(results.size.0)
let numColoumns = Int(results.size.1)
But I don’t understand how to get the matrix so that I can iterate over it? I tried the following:
let matrixResult = results.data.memory
This seems to only return a double value, because matrixResult becomes Double.
Then I tried this:
let matrixResult = results.data
What matrixResult an does:
UnsafeMutablePointer<Double>
, C. Swift... - , ?