Skip to content

Commit

Permalink
as.matrix sometimes gives warning on HPC
Browse files Browse the repository at this point in the history
  • Loading branch information
iflint1 committed Oct 29, 2023
1 parent 783409e commit 32c7e65
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/compute_A1.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ compute_A1 <- function(..., list, nthreads = NULL, debug = FALSE, time_limit = I
}, error = function(e) e, warning = function(w) w)

# If we don't have enough RAM to call Matrix::as.matrix.Matrix, use custom function instead.
if(is(tt, "error")) {
if(is(tt, "error") | is(tt, "warning")) {
# Ref: https://programmerah.com/the-sparse-matrix-of-r-language-is-too-large-to-be-used-as-matrix-8856/
as_matrix <- function(mat) {
tmp <- matrix(data = 0L, nrow = mat@Dim[1], ncol = mat@Dim[2])
Expand Down
2 changes: 1 addition & 1 deletion R/compute_A2_plus_A3.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ compute_A2_plus_A3 <- function(..., list, nthreads = NULL, debug = FALSE, npoint
}, error = function(e) e, warning = function(w) w)

# If we don't have enough RAM to call Matrix::as.matrix.Matrix, use custom function instead.
if(is(tt, "error")) {
if(is(tt, "error") | is(tt, "warning")) {
# Ref: https://programmerah.com/the-sparse-matrix-of-r-language-is-too-large-to-be-used-as-matrix-8856/
as_matrix <- function(mat) {
tmp <- matrix(data = 0L, nrow = mat@Dim[1], ncol = mat@Dim[2])
Expand Down
2 changes: 1 addition & 1 deletion R/compute_G2.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ compute_G2 <- function(..., list, nthreads = NULL, debug = FALSE, time_limit = I
}, error = function(e) e, warning = function(w) w)

# If we don't have enough RAM to call Matrix::as.matrix.Matrix, use custom function instead.
if(is(tt, "error")) {
if(is(tt, "error") | is(tt, "warning")) {
# Ref: https://programmerah.com/the-sparse-matrix-of-r-language-is-too-large-to-be-used-as-matrix-8856/
as_matrix <- function(mat) {
tmp <- matrix(data = 0L, nrow = mat@Dim[1], ncol = mat@Dim[2])
Expand Down
2 changes: 1 addition & 1 deletion R/compute_S.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ compute_S <- function(..., list, nthreads = NULL, debug = FALSE, time_limit = In
}, error = function(e) e, warning = function(w) w)

# If we don't have enough RAM to call Matrix::as.matrix.Matrix, use custom function instead.
if(is(tt, "error")) {
if(is(tt, "error") | is(tt, "warning")) {
# Ref: https://programmerah.com/the-sparse-matrix-of-r-language-is-too-large-to-be-used-as-matrix-8856/
as_matrix <- function(mat) {
tmp <- matrix(data = 0L, nrow = mat@Dim[1], ncol = mat@Dim[2])
Expand Down

0 comments on commit 32c7e65

Please sign in to comment.