Nothing
library(gpuR)
context("CPU gpuMatrix Correlations")
current_context <- set_device_context("cpu")
# set seed
set.seed(123)
ORDER_X <- 4
ORDER_Y <- 5
# Base R objects
A <- matrix(rnorm(ORDER_X*ORDER_Y), nrow=ORDER_X, ncol=ORDER_Y)
C <- cov(A)
test_that("CPU gpuMatrix Single Precision Pearson Covariance",
{
has_cpu_skip()
fgpuX <- gpuMatrix(A, type="float")
gpuC <- cov(fgpuX)
expect_is(gpuC, "fgpuMatrix")
expect_equal(gpuC[], C, tolerance=1e-06,
info="float covariance values not equivalent")
})
test_that("CPU gpuMatrix Double Precision Pearson Covariance",
{
has_cpu_skip()
dgpuX <- gpuMatrix(A, type="double")
gpuC <- cov(dgpuX)
expect_is(gpuC, "dgpuMatrix")
expect_equal(gpuC[], C, tolerance=.Machine$double.eps ^ 0.5,
info="double colSums not equivalent")
})
setContext(current_context)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.