logfactSum {clrng}R Documentation

logfactSum

Description

Computes the log-factorial of a table on a GPU.

Usage

logfactSum(x, Nglobal = getOption("clrng.Nglobal"))

Arguments

x

a matrix of integers.

Nglobal

a (non-empty) integer vector specifying size of the index space for use.

Value

sum of log-factorials of elements of the input matrix ‘x’.

Examples


library(clrng)
if (detectGPUs() >= 1) {
setContext(grep("gpu", listContexts()$device_type)[1])

x <- matrix(c(1:36), 6,6)
logfactSum(x, c(2,2))
# note if matrix is not of integers, a warning will be displayed, eg.
x2 <- matrix(c(1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1), 3,3)
is.integer(x2)
logfactSum(x2, c(16,16))} else {
  message("No GPU context available")
}


[Package clrng version 0.0.5 Index]