Error in `namespaceExport(ns, exports)`: undefined exports: h5AbsLinkName, h5Attr, h5AttrNames, h5Attributes, h5Backup, h5Class, h5Copy, h5CreateDataset, h5CreateFile, h5CreateGroup, h5Delete, h5DeleteAttr, h5Dims, h5Exists, h5GuessDtype, h5List, h5MaxDims, h5Move, h5Open, h5Overwrite, h5Prep, h5Read, h5ReadDataset, h5TryOpen, h5Write, h5WriteAttr, h5WriteDataset, h5WriteScalar, is.H5D, is.H5Group

ctrl.h5ds <- H5Mat(filename = system.file("extdata", "ctrl_dense.h5",
package = "RcppPlanc", mustWork = TRUE),
stim.h5ds <- H5Mat(filename = system.file("extdata", "stim_dense.h5",
ctrl.h5sp <- H5SpMat(filename = system.file("extdata", "ctrl_sparse.h5",
stim.h5sp <- H5SpMat(filename = system.file("extdata", "stim_sparse.h5",
res1 <- inmf(list(ctrl.dense, stim.dense), k = k, nCores = 2)
"All datasets should be of the same class")
expect_error(inmf(list(ctrl.dense, ctrl.dense), k = 300),
res2 <- inmf(list(ctrl.sparse, stim.sparse), k = k, nCores = 2)
res3 <- inmf(list(ctrl.h5ds, stim.h5ds), k = k)
res4 <- inmf(objectList = list(ctrl.h5sp, stim.h5sp), k = k, nCores = 2)
expect_true(all.equal(res1, res4, tolerance = 1e-6))
res0 <- inmf(list(ctrl.sparse, stim.sparse), k = k, nCores = 2)
res1 <- inmf(list(ctrl.sparse, stim.sparse), k = k, Hinit = res0$H, Vinit = res0$V, Winit = res0$W, nCores = 2)
res2 <- inmf(list(ctrl.dense, stim.dense), k = k, Hinit = res0$H, Vinit = res0$V, Winit = res0$W,, nCores = 2)
expect_error(inmf(list(ctrl.sparse, stim.sparse), k = k,
Hinit = lapply(res0$H, t), Vinit = res0$V, Winit = res0$W),
Hinit = res0$H, Vinit = lapply(res0$V, t), Winit = res0$W),
Hinit = res0$H, Vinit = res0$V, Winit = t(res0$W)),
res1 <- onlineINMF(list(ctrl.sparse, stim.sparse), k = k, minibatchSize = 50, nCores = 2)
expect_error(onlineINMF(list(ctrl.sparse, stim.sparse), k = k),
expect_error(onlineINMF(list(ctrl.sparse, stim.dense), k = k),
res2 <- onlineINMF(list(ctrl.dense, stim.dense), k = k, minibatchSize = 50, nCores = 2)
res3 <- onlineINMF(list(ctrl.h5ds, stim.h5ds), k = k, minibatchSize = 50, nCores = 2)
res4 <- onlineINMF(list(ctrl.h5sp, stim.h5sp), k = k, minibatchSize = 50, nCores = 2)
new.data@x <- new.data@x + runif(length(new.data@x))
new.h5sp <- as.H5SpMat(new.data, "temp_new_sparse.h5", overwrite = TRUE)
new.h5m <- as.H5Mat(new.data.dense, "temp_new_dense.h5", overwrite = TRUE)
res0 <- onlineINMF(list(ctrl.sparse, stim.sparse), k = k, minibatchSize = 50)
res1 <- onlineINMF(list(ctrl.sparse, stim.sparse), newDatasets = list(new.data),
k = k, minibatchSize = 50, permuteChunkSize = 32,
Hinit = res0$H, Vinit = res0$V, Winit = res0$W,
Ainit = res0$A, Binit = res0$B, nCores = 2)
res2 <- onlineINMF(list(ctrl.dense, stim.dense), newDatasets = list(new.data.dense),
expect_error(onlineINMF(list(ctrl.dense, stim.dense), newDatasets = list(new.data),
k = k, minibatchSize = 50, Hinit = res0$H,
"newDatasets should be of the same class as original datasets")
expect_error(onlineINMF(list(ctrl.sparse, stim.sparse), newDatasets = list(new.data),
Vinit = lapply(res0$V, t), Winit = res0$W,
"All given Vs must be of size 173 x 20")
"Given W must be of size 173 x 20 but is 20 x 173")
Ainit = res0$A, Binit = lapply(res0$B, t)),
"Given Bs must all be of size 173 x 20")
# A's are square, and nearly symmetric (but not exactly), don't have a smart check here yet
res3 <- onlineINMF(list(ctrl.h5sp, stim.h5sp), newDatasets = list(new.h5sp),
res4 <- onlineINMF(list(ctrl.h5ds, stim.h5ds), newDatasets = list(new.h5m),
k = k, minibatchSize = 50,  Hinit = res0$H,
newDatasets = list(new.data), project = TRUE,
k = k, minibatchSize = 50, Winit = res0$W, nCores = 2))
res1 <- uinmf(list(ctrl.sparse, stim.sparse), list(p1, p2), nCores = 2)
res2 <- uinmf(list(ctrl.dense, stim.dense), list(p1.dense, p2.dense), nCores = 2)
expect_error(uinmf(list(ctrl.sparse, stim.sparse), list(p1, p2), lambda = 1:3),
"Must specify 1 lambda for all or each.")
"Number of matrix in unshared feature list does not match")
"Data of unshared feature should be of the same class as")
"Number of columns in each matrix from")
res3 <- uinmf(list(a = ctrl.sparse, b = stim.sparse), list(a = p1), nCores = 2)
res4 <- uinmf(list(a = ctrl.dense, b = stim.dense), list(a = p1.dense), nCores = 2)
expect_error(as.H5Mat(ctrl.dense, "temp_new_dense.h5", overwrite = FALSE),
"File already exists at the given path")
# Test if `as.H5Mat.dgCMatrix` S3 method convert sparse to h5 dense correctly
ctrl.h5ds_2 <- as.H5Mat(ctrl.sparse, "temp_ctrl_dense.h5", overwrite = TRUE, chunk_size = c(173, 300))
res1 <- onlineINMF(list(ctrl.sparse, stim.sparse), k = k, minibatchSize = 50, permuteChunkSize = 300)
res2 <- onlineINMF(list(ctrl.h5ds_2, stim.h5ds), k = k, minibatchSize = 50)
expect_error(H5SpMat("thisFilenameShouldNotExist", "something", "a", "b", 1, 2),
expect_error(as.H5SpMat(ctrl.dense, "temp_new_sparse.h5", overwrite = FALSE),
# Test if `as.H5SpMat.matrix` S3 method convert dense to h5 sparse correctly
ctrl.h5sp_2 <- as.H5SpMat(ctrl.dense, filename = "temp_ctrl_sparse.h5")
res1 <- onlineINMF(list(ctrl.sparse, stim.sparse), k = k, minibatchSize = 50)
res2 <- onlineINMF(list(ctrl.h5sp_2, stim.h5sp), k = k, minibatchSize = 50)
expect_true(all.equal(res1, res2, tolerance = 1e-6))