% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pgm.R
\name{complex_index}
\alias{complex_index}
\title{Find the Complexity Index of a 0-1 String
Definded as the Number of Switches from "01" to "10" to Make It Simple.}
\usage{
complex_index(pat01, rev = 0, print = 0)
}
\arguments{
\item{pat01}{A matrix consisting of 0s or 1s \cr
or a vector whose elements are strings consisting of 0s and 1s.}

\item{rev}{= 1 to count the # of switches from "10" to "01".}

\item{print}{= 1 to print the intermediate result.}
}
\value{
A vector consisting of the # of switches for each string.
}
\description{
Find the Complexity Index of a 0-1 String
Definded as the Number of Switches from "01" to "10" to Make It Simple.
}
\details{
When rev == 0, if a string contains no 1's to the left of 0's
it is assumed to simple. \cr
This function returns the # of switches from "01" to "10"
in order to make the string simple. \cr
\cr
When rev == 0, the roles of 0 and 1 will be interchanged.
\cr\cr
When the input is a matrix or data frame, complexity index of each row will
be calculated.
}
\examples{

complex_index("0101", print=1 )
pat01=matrix(c(0,1,1,0,0,1,0,1,0,0,1,1,0,0),2)
res=complex_index( pat01 )
Print(pat01,res)

}
