<< gpuSplin2d sciGPGPU gpuSum >>

sciGPGPU >> sciGPGPU > gpuSubtract

gpuSubtract

Perform the subtraction between two matrix.

Call sequence

dResult = gpuSubtract(A,B)

Parameters

A

Can be :

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

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

B

Can be :

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

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

dResult

dResult is the result of computation stored in device memory (GPU).

Description

dResult = gpusubtract(A,B)

gpuSubtract perform an subtraction between two matrix or between a scalar and a matrix. The result is on the device memory, use the gpuGetData function to get the result in host memory. This function use cuBLAS to perform operations.

Exemples

A = rand(200,300) + %i * rand(200,300);
B = rand(200,300) + %i * rand(200,300);

dB = gpuSetData(B);
dA = gpuSetData(A);

d1 = gpuSubtract(A,B);
d2 = gpuSubtract(d1,dB);
d3 = gpuSubtract(d2,dA);

result = gpuGetData(d3);

norm(result - (A-B-B-A))

clear dA, dB, d1, d2, d3;

See Also


Report an issue
<< gpuSplin2d sciGPGPU gpuSum >>