Reshape a vector or a matrix to a different size.
resMat = gpuMatrix(A, newRows, newCols)
resMat = gpuMatrix(A, [newRows newCols])
Can be :
Pointer on the matrix stored in device memory (GPU).
Pointer on the matrix stored in host memory (CPU).
The new row size.
The new col size.
The input argument A reshaped.
gpuMatrix
reshape the input argument A.
The total size of A must be equal to the multiplication of newRows and newCols.
a = 1:9 da = gpuSetData(a); db = gpuMatrix(a,3,3) dc = gpuMatrix(da,3,3) clear da; clear db; clear dc; a = matrix(1:8,2,4) da = gpuSetData(a); db = gpuMatrix(a,[4 2]) dc = gpuMatrix(da,[4 2]) clear da; clear db; clear dc; | ![]() | ![]() |