Skip to content

Commit 157e5d2

Browse files
as.SparseBlockMatrixR now calls constructor explicitly (same as w/ other classes in sparsebnUtils)
1 parent 19c5abe commit 157e5d2

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

R/s3-SparseBlockMatrixR.R

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ is.SparseBlockMatrixR <- function(x){
5656
inherits(x, "SparseBlockMatrixR")
5757
} # END IS.SPARSEBLOCKMATRIXR
5858

59+
as.SparseBlockMatrixR <- function(x){
60+
SparseBlockMatrixR(x) # NOTE: S3 delegation is implicitly handled by the constructor here
61+
}
62+
5963
#------------------------------------------------------------------------------#
6064
# reIndexC.SparseBlockMatrixR
6165
# Re-indexing TO C for SparseBlockMatrixR objects
@@ -201,30 +205,6 @@ SparseBlockMatrixR.matrix <- function(x, sigmas, ...){
201205
SparseBlockMatrixR(sparsebnUtils::as.sparse(x), sigmas, ...)
202206
} # END SPARSEBLOCKMATRIXR.MATRIX
203207

204-
#------------------------------------------------------------------------------#
205-
# as.SparseBlockMatrixR.list
206-
# Convert FROM list TO SparseBlockMatrixR
207-
#
208-
as.SparseBlockMatrixR.list <- function(x){
209-
SparseBlockMatrixR(x)
210-
} # END AS.SPARSEBLOCKMATRIXR.LIST
211-
212-
#------------------------------------------------------------------------------#
213-
# as.SparseBlockMatrixR.sparse
214-
# Convert FROM sparse TO SparseBlockMatrixR
215-
#
216-
as.SparseBlockMatrixR.sparse <- function(x){
217-
SparseBlockMatrixR(x)
218-
} # END AS.SPARSEBLOCKMATRIXR.SPARSE
219-
220-
#------------------------------------------------------------------------------#
221-
# as.SparseBlockMatrixR.matrix
222-
# Convert FROM matrix TO SparseBlockMatrixR
223-
#
224-
as.SparseBlockMatrixR.matrix <- function(x){
225-
SparseBlockMatrixR(x)
226-
} # END AS.SPARSEBLOCKMATRIXR.MATRIX
227-
228208
#------------------------------------------------------------------------------#
229209
# as.list.SparseBlockMatrixR
230210
# Convert FROM SparseBlockMatrixR TO list

R/s3-generics.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@
1414

1515
# Generics for SparseBlockMatrixR ------------------------------------------------------------
1616
SparseBlockMatrixR <- function(x, ...) UseMethod("SparseBlockMatrixR", x)
17-
as.SparseBlockMatrixR <- function(x) UseMethod("as.SparseBlockMatrixR", x)
1817
to_B <- function(x) UseMethod("to_B", x)

0 commit comments

Comments
 (0)