swap_mult: Swap elements of multiple binary chains

Description Usage Arguments Details

Description

swap_mult is used to swap elements of multiple binary chains if doing so maintains the same number of transitions between the two states of those chains.

Usage

1
swap_mult(bin_chains, m)

Arguments

bin_chains

A two dimensional integer vector with binary values.

m

A positive nonzero integer value for the attempted number of swaps to attempt on bin_chains.

Details

swap_mult works by taking a two dimensional integer vector bin_chains and m, a number of times to attempt swaps. It generates random integers which are valid indices of the two dimensional vector bin_chains and tries to swap the elements of the vector at the indices that it generates, only doing so if this preserves the total number of transitions between states. After attempting m swaps, swap_mult returns the new, freshly swapped two dimensional vector of binary chains.


cwcartmell/maRkov documentation built on May 14, 2019, 1:37 p.m.