Unary Operators

UnaryOps are fairly straightforward $z = f(x)$ and their meaning should be clear from the name in most cases.

UnaryOps are used only in the map and apply functions.

julia> using SuiteSparseGraphBLAS
julia> x = GBVector([1.5, 0, pi])3x1 GraphBLAS double matrix, full by col 3 entries, memory: 280 bytes (1,1) 1.5 (2,1) 0 (3,1) 3.14159
julia> y = map(sin, x)3x1 GraphBLAS double matrix, full by col 3 entries, memory: 288 bytes (1,1) 0.997495 (2,1) 0 (3,1) 1.22465e-16
julia> map(asin, y)3x1 GraphBLAS double matrix, full by col 3 entries, memory: 288 bytes (1,1) 1.5 (2,1) 0 (3,1) 1.22465e-16

Internally functions are lowered like this:

julia> using SuiteSparseGraphBLAS
julia> op = unaryop(sin, Float64)SuiteSparseGraphBLAS.TypedUnaryOperator{typeof(sin), Float64, Float64}(true, true, "GxB_SIN_FP64", Ptr{SuiteSparseGraphBLAS.LibGraphBLAS.GB_UnaryOp_opaque} @0x00007f2fa5c21380, sin, nothing)
julia> map(op, GBVector([1.5, 0, pi]))3x1 GraphBLAS double matrix, full by col 3 entries, memory: 288 bytes (1,1) 0.997495 (2,1) 0 (3,1) 1.22465e-16

Built-Ins

The following functions are built into SuiteSparse:GraphBLAS. They are, much faster than arbitrary Julia functions and should be used when possible.

Julia FunctionGraphBLAS NameNotes
identityIDENTITY
-AINV
invMINV
oneONE
!LNOT
absABS
~BNOT
rowindexPOSITIONI
colindexPOSITIONJ
sqrtSQRT
logLOG
expEXP
log10LOG10
log2LOG2
exp2EXP2
expm1EXPM1
log1pLOG1P
sinSIN
cosCOS
tanTAN
asinASIN
acosACOS
atanATAN
sinhSINH
coshCOSH
tanhTANH
asinhASINH
acoshACOSH
atanhATANH
signSIGNUM
ceilCEIL
floorFLOOR
roundROUND
truncTRUNC
SpecialFunctions.lgammaLGAMMA
SpecialFunctions.gammaTGAMMA
erfERF
erfcERFC
frexpxFREXPX
frexpeFREXPE
isinfISINF
isnanISNAN
isfiniteISFINITE
conjCONJ
realCREAL
imagCIMAG
angleCARG

Unary functions unique to SuiteSparseGraphBLAS are: