Skip to contents

Sinkhorn and Knopp proved that any entrywise positive square matrix has a unique doubly stochastic scaling D1 K D2 with positive diagonal factors, and that alternately normalising rows and columns finds it. The diagonal factors are returned as well because they are what the transport modules actually consume.

Usage

Otdwd(K, max_iter = 200)

Arguments

K

Entrywise positive square matrix.

max_iter

Number of row/column sweeps.

Value

List with M, iters, d1, d2, row_err, col_err, n.

Details

Formula: K <- diag(1/(K 1)) K, \(K <- K diag(1/(K' 1))\), repeated – Sinkhorn and Knopp (1967), Theorem 1.

References

Sinkhorn, R. and Knopp, P. (1967). Pacific Journal of Mathematics 21(2):343-348. doi:10.2140/pjm.1967.21.343 .

Examples

Otdwd(K = 5L)
#> $M
#>      [,1]
#> [1,]    1
#> 
#> $iters
#> [1] 200
#> 
#> $d1
#> [1] 0.2
#> 
#> $d2
#> [1] 1
#> 
#> $row_err
#> [1] 0
#> 
#> $col_err
#> [1] 0
#> 
#> $n
#> [1] 1
#> 
#> $method
#> [1] "Sinkhorn-Knopp doubly stochastic scaling"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"