A convenience function to create DoubleCenter S4 objects, which are useful for simultaneously row and column centering a matrix.
Usage
DoubleCenter(A)
# S4 method for DoubleCenter,sparseMatrix
transform(iform, A)
# S4 method for DoubleCenter,sparseLRMatrix
inverse_transform(iform, A)
# S4 method for DoubleCenter,vsp_fa
inverse_transform(iform, A)
Arguments
- A
A matrix to transform.
- iform
An Invertiform object describing the transformation.
Value
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 aMatrix::sparseMatrix()
.
Examples
library(igraph)
#>
#> Attaching package: ‘igraph’
#> The following objects are masked from ‘package:stats’:
#>
#> decompose, spectrum
#> The following object is masked from ‘package:base’:
#>
#> union
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)
#> [1] TRUE