Chapter 13: Best practices Up Main page Chapter 15: Functional image processing in Quasar

# 14 Built-in function quick reference

Some built-in functions are listed in Table 14.1↓. More runtime library functions are given in Table 14.2↓. For a detailed explanation of the functions, we refer to the Documentation Browser (F1 in Redshift).
Table 14.1 Common built-in functions (most functions are self-explanatory). Functions with asterisk (*) are accessible from __kernel__ and __device__ functions.
 abs (*) absolute value/modulus sum (*) sum of the elements acos (*) cumsum cumulative sum atan (*) prod product of the elements atan2 (*) cumprod cumulative product ceil (*) mean round (*) linspace cos (*) lerp (*) linear interpolation sin (*) dotprod (*) vector dot product exp (*) zeros (*) exp2 (*) power of two ones (*) floor (*) rand uniformly distributed mod (*) modulo randn normal distributed frac (*) fractional part cell cell matrix log (*) eye identity matrix log2 (*) logarithm base 2 size (*) dimensions of object log10 (*) logarithm base 10 numel (*) number of elements =prod(size(x)) max (*) complex (*) complex value min (*) real (*) real part saturate (*) clamps to [0,1] imag (*) imaginary part sign (*) sign of the number float (*) conversion to float (kernel function) sqrt (*) int (*) take integer part tan (*) isnan (*) value is NaN (not a number) angle (*) angle of a complex number isinf (*) value is infinite transpose matrix transpose isfinite (*) value is finite herm_transpose Hermitian transpose maxvalue (*) maximum value for the specified type conj (*) conjugate minvalue (*) minimum value for the specified type copy performs a shallow copy repmat repeat matrix deepcopy performs a deep copy reshape reshape matrix squeeze removes singleton dimensions shuffledims swaps dimensions fft1 / ifft1 1-dimensional (I)FFT type returns data type of object fft2 / ifft2 2-dimensional (I)FFT object creates an empty structure fft3 / ifft3 3-dimensional (I)FFT sprintf build a C-style format string shared (*) allocation of shared mem. printf print a C-style format string shared_zeros (*) shared mem with zero init. strcat string concatenation and (*) bitwise AND sscanf parses using a C-style format string or (*) bitwise OR factorial the factorial function xor (*) bitwise XOR inv matrix inverse shl (*) bitwise left shift svd singular value decomposition shr (*) bitwise right shift serial_do serial execution not (*) bitwise inversion parallel_do parallel execution mirror_ext (*) mirroring extension max_block_size see Subsection 2.4.4↑ periodize (*) periodic extension assert runtime assertion tounicode converts vec to a UNICODE string schedule manual run-time scheduling function toascii converts vec to an ASCII string mat2cell converts from matrix to cell matrix fromunicode converts UNICODE string to vec cell2mat converts from cell matrix to matrix fromascii converts ASCII string to vec ind2pos converts linear index to n-D coords