<< gpuLoadFunction sciGPGPU gpuMax >>

sciGPGPU >> sciGPGPU > gpuMatrix

gpuMatrix

Reshape a vector or a matrix to a different size.

Call sequence

resMat = gpuMatrix(A, newRows, newCols)
resMat = gpuMatrix(A, [newRows newCols])

Parameters

A

Can be :

Pointer on the matrix stored in device memory (GPU).

Pointer on the matrix stored in host memory (CPU).

newRows

The new row size.

newCols

The new col size.

resMat

The input argument A reshaped.

Description

resMat = gpuMatrix(A, rows, cols)

gpuMatrix reshape the input argument A. The total size of A must be equal to the multiplication of newRows and newCols.

Exemples

a  = 1:9
da = gpuSetData(a);

db = gpuMatrix(a,3,3);
dc = gpuMatrix(da,3,3);

gpuGetData(db)
gpuGetData(dc)

gpuFree(da);
gpuFree(db);
gpuFree(dc);


a  = matrix(1:8,2,4)
da = gpuSetData(a);

db = gpuMatrix(a,[4 2]);
dc = gpuMatrix(da,[4 2]);

gpuGetData(db)
gpuGetData(dc)

gpuFree(da);
gpuFree(db);
gpuFree(dc);

See Also


Report an issue
<< gpuLoadFunction sciGPGPU gpuMax >>