MATLAB PARALLEL COMPUTING TOOLBOX - S Guide de l'utilisateur Page 269

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 656
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 268
Run Built-In Functions on a GPU
9-11
(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
Considerations for Complex Numbers
If the output of a function running on the GPU could potentially be complex, you must
explicitly specify its input arguments as complex. This applies to gpuArray or to
functions called in code run by arrayfun.
For example, if creating a gpuArray which might have negative elements, use G =
gpuArray(complex(p)), then you can successfully execute sqrt(G).
Or, within a function passed to arrayfun, if x is a vector of real numbers, and some
elements have negative values, sqrt(x) will generate an error; instead you should call
sqrt(complex(x)).
The following table lists the functions that might return complex data, along with the
input range over which the output remains real.
Function Input Range for Real Output
acos(x) abs(x) <= 1
acosh(x) x >= 1
acoth(x) abs(x) >= 1
acsc(x) abs(x) >= 1
asec(x) abs(x) >= 1
asech(x) 0 <= x <= 1
asin(x) abs(x) <= 1
atanh abs(x) <= 1
Vue de la page 268
1 2 ... 264 265 266 267 268 269 270 271 272 273 274 ... 655 656

Commentaires sur ces manuels

Pas de commentaire