make_doubly_stochastic: Compute the doubly stochastic matrix from a given matrix

View source: R/spatial_weights.R

make_doubly_stochasticR Documentation

Compute the doubly stochastic matrix from a given matrix

Description

This function iteratively computes the doubly stochastic matrix from a given input matrix. A doubly stochastic matrix is a matrix in which both row and column elements sum to 1.

Usage

make_doubly_stochastic(A, iter = 30)

Arguments

A

A numeric matrix for which to compute the doubly stochastic matrix

iter

Integer, the number of iterations to perform (default is 30)

Value

A numeric matrix representing the computed doubly stochastic matrix

Examples

# Create an example matrix
A <- matrix(c(2, 4, 6, 8, 10, 12), nrow = 3, ncol = 2)

# Compute the doubly stochastic matrix
result <- make_doubly_stochastic(A, iter = 30)

bbuchsbaum/neighborweights documentation built on April 1, 2024, 8:41 p.m.