DoubleCenter {invertiforms} | R Documentation |
A convenience function to create DoubleCenter S4 objects, which are useful for simultaneously row and column centering a matrix.
DoubleCenter(A)
## S4 method for signature 'DoubleCenter,sparseMatrix'
transform(iform, A)
## S4 method for signature 'DoubleCenter,sparseLRMatrix'
inverse_transform(iform, A)
## S4 method for signature 'DoubleCenter,vsp_fa'
inverse_transform(iform, A)
A |
A matrix to transform. |
iform |
An Invertiform object describing the transformation. |
DoubleCenter()
creates a DoubleCenter object.
transform()
returns the transformed matrix,
typically as a sparseLRMatrix::sparseLRMatrix.
inverse_transform()
returns the inverse transformed matrix,
typically as a sparseLRMatrix::sparseLRMatrix in most cases.
When possible reduces the sparseLRMatrix::sparseLRMatrix to a
Matrix::sparseMatrix()
.
library(igraph)
library(igraphdata)
data("karate", package = "igraphdata")
A <- get.adjacency(karate)
iform <- DoubleCenter(A)
A_tilde <- transform(iform, A)
A_recovered <- inverse_transform(iform, A_tilde)
all.equal(A, A_recovered)