Unary Operations
Prefer `@.` for multi-op elementwise expressions so every operator is dotted (especially unary negation). This ensures broadcast operations are fused. See [Kernel Fusion](perf/kernel_fusion.md).
The following unary operations are supported and can be broadcast over NDArray:
-,!,abs,acos,acosh,asin,asinh,atan,atanh,cbrt,conj,cos,cosh,deg2rad,exp,exp2,expm1,floor,imag,isfinite,log,log10,log1p,log2,rad2deg,real,sign,signbit,sin,sinh,sqrt,tan,tanh,^2,^-1orinv
Differences from Base Julia
- The
acoshfunction in Julia will error on inputs outside of the domain (x >= 1), but cuNumeric.jl will returnNaN.
cuNumeric.unary_reduction_map Constant
Supported Unary Reduction Operations
The following unary reduction operations are supported and can be applied directly to NDArray values:
• all • any • maximum • minimum • prod • sum
These operations follow standard Julia semantics.
Reduction over specific dimensions is supported via the dims keyword argument, following the same semantics as Julia's base reduction functions.
Examples
julia
sourceA = cuNumeric.ones(5)
maximum(A)
sum(A)
# Reduce over a specific dimension
B = cuNumeric.ones(3, 4)
sum(B, dims=1) # 1×4 result
sum(B, dims=2) # 3×1 result
# Reduce over multiple dimensions
sum(B, dims=(1,2)) # 1×1 result