GPU 上でのスパース配列の処理
スパースな GPU 配列の作成
gpuArray
入力を指定して sparse
を呼び出すか、スパース入力を指定して 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
を使用して、配列の非ゼロ要素、およびその行インデックスと列インデックスを特定します。次に、必要な値を置き換えて、スパースな 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 |