sinkhorn_knopp {nett}R Documentation

Sinkhorn–Knopp matrix scaling

Description

Implements the Sinkhorn–Knopp algorithm for transforming a square matrix with positive entries to a stochastic matrix with given common row and column sums (e.g., a doubly stochastic matrix).

Usage

sinkhorn_knopp(
  A,
  sums = rep(1, nrow(A)),
  niter = 100,
  tol = 1e-08,
  sym = FALSE,
  verb = FALSE
)

Arguments

A

input matrix

sums

desired row/column sums

niter

number of iterations

tol

convergence tolerance

sym

whether to compute symmetric scaling D A D

verb

whether to print the current change

Details

Computes diagonal matrices D1 and D2 to make D1AD2 into a matrix with given row/column sums. For a symmetric matrix A, one can set sym = TRUE to compute a symmetric scaling DAD.

Value

Diagonal matrices D1 and D2 to make D1AD2 into a matrix with given row/column sums.


[Package nett version 1.0.0 Index]