Help with the (Unsafe) pointer management

Hello, i need an help in programming. I am facing to a library that has to be used with mex in matlab, and i did in a good way the matrix product in the GPU ( C = A dot B)  Now i need the data stored in the MPSMatrix C, not in a plain way but in a way i can use in c (const float**).

So i used in Swift:

let outBuffer = C.data.contents()

And now i need an object that should be <UnsafeMutablePointer<UnsafeMutablePointer> structured this way:

[c11 c12 ... c1n] ....         ..... [cn1 ....    cnn]

Can you help me to implement this? Thank you so much.

Done. matrixC is the object that comes from the output of MPSMatrixMultiplication.

let doublePointer = UnsafeMutablePointer<UnsafeMutablePointer<Float>>.allocate(capacity: count)

        for i in 0..<matrixC.rows {
            doublePointer[i] = rawPointer.advanced(by: i*matrixC.columns).bindMemory(to: Float.self, capacity: matrixC.columns)
        }

        // print by iterating over 1st row
        for i in 0..<10 {
            print(doublePointer.pointee[i])
        }

        

        // print by iterating over 1st column
        for j in 0..<10 {
            print(doublePointer[j].pointee)
        }
Help with the (Unsafe) pointer management
 
 
Q