Learn R Programming

invertiforms (version 0.1.2)

DoubleCenter: Construct and use DoubleCenter transformations

Description

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)

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 a Matrix::sparseMatrix().

Arguments

A

A matrix to transform.

iform

An Invertiform object describing the transformation.

Examples

Run this code

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)

Run the code above in your browser using DataLab