Insert data in a part of GPU matrix.
gpuInsert(A, data, row, col)
gpuInsert(A, data, positions)
A(row, col) = data
A(positions) = data
Can be :
Pointer on the matrix stored in device memory (GPU).
Pointer on the matrix stored in host memory (CPU).
A is the variable where data will be inserted.
Can be :
Pointer on the matrix stored in device memory (GPU).
Pointer on the matrix stored in host memory (CPU).
data is the variable which will be inserted in A.
A scalar or row vector stored in device or host memory.
In the case of insertion overloaded row can be a matrix.
A scalar or colomn vector stored in device or host memory.
In the case of insertion overloaded col can be a matrix.
A matrix stored in device or host memory.
Positions where data will be inserted.
gpuInsert
allow the user to insert a items into a matrix stored in device.
Only the overload allow the use of :
The insertion is only allowed into a variable, it can't be use as a concatenation.
a = matrix(1:100, 10, 10) da = gpuSetData(a); // insert a scalar gpuInsert(da, 3000, 3, 3); gpuGetData(da) da(4,4) = 4000; gpuGetData(da) // insert a matrix into a matrix gpuInsert(da,-10, [1 6 23 64]); gpuGetData(da) da([1 6 23 64]) = -11; gpuGetData(da) gpuInsert(da, (1:11:100) * -1, 1:11:100); gpuGetData(da) da([1:11:100]) = (1:11:100) * -2; gpuGetData(da) db = gpuSetData([1:11:100]); dc = gpuSetData((1:11:100) * -3) da(db) = dc; gpuGetData(da) gpuFree(db); gpuFree(dc); // insertion only allowed with overload da(:) = 0; gpuGetData(da) da(2,:) = 2; gpuGetData(da) da(:,4) = %i; gpuGetData(da) da([1 2; 4 5], [1 2 3]) = 36 + 6*%i; gpuGetData(da) gpuFree(da); | ![]() | ![]() |