I’m trying to implement “cublasDgelsBatched()”, and i’m a bit confused about how the function works. In the manual, it says that the i’th Least Squares Solution over-writes the i’th input matrix Carray[i]. What I’m wondering is, since the solution is, in general, not the same dimensions as the Carray[i], how should I access the solution? And what happens to the parts of Carray[i] for which there are not enough elements from the solution to over-write?

Specifically, how would I index into the i’th solution if I want to copy it from the device back onto a host-side solution array?