이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
GPU에서 희소 형식 배열 사용하기
희소 GPU 배열 만들기
sparse
를 gpuArray
입력값과 함께 호출하거나 gpuArray
를 희소 형식 입력값과 함께 호출하여 희소 형식 gpuArray
를 만들 수 있습니다. 예를 들면 다음과 같습니다.
x = [0 1 0 0 0; 0 0 0 0 1]
0 1 0 0 0 0 0 0 0 1
s = sparse(x)
(1,2) 1 (2,5) 1
g = gpuArray(s); % g is a sparse gpuArray gt = transpose(g); % gt is a sparse gpuArray f = full(gt) % f is a full gpuArray
0 0 1 0 0 0 0 0 0 1
희소 GPU 배열을 지원하는 함수
희소 형식의 gpuArray
객체는 인덱싱을 지원하지 않습니다. 대신 find
를 사용하여 배열에서 0이 아닌 배열 요소, 그리고 이러한 요소의 행 인덱스와 열 인덱스를 찾습니다. 그런 다음 원하는 값을 대체하고 희소 형식 gpuArray
를 새로 생성합니다.
다음 표에는 희소 형식 gpuArray
객체를 지원하는 함수가 나와 있습니다.
abs acos acosd acosh acot acotd acoth acsc acscd acsch angle asec asecd asech asin asind asinh atan atand atanh bicg bicgstab ceil cgs classUnderlying conj cos cosd cosh cospi cot cotd coth csc cscd csch ctranspose deg2rad diag end | eps exp expint expm1 find fix floor full gmres gpuArray.speye imag isaUnderlying isdiag isempty isequal isequaln isfinite isfloat isinteger islogical isnumeric isreal issparse istril istriu isUnderlyingType length log log2 log10 log1p lsqr minus mtimes mpower mustBeUnderlyingType ndims nextpow2 nnz nonzeros | norm numel nzmax pcg plus power qmr rad2deg real reallog realsqrt round sec secd sech sign sin sind sinh sinpi size sparse spfun spones sprandsym sqrt sum tan tand tanh tfqmr times (.*) trace transpose tril triu uminus underlyingType uplus |