\name{lav_constraints}
\alias{lav_con_parse}
\alias{lav_pt_con_ceq}
\alias{lav_pt_con_ciq}
\alias{lav_pt_con_def}
\title{Utility Functions: Constraints}
\description{Utility functions for equality and inequality constraints.}
\usage{
lav_con_parse(partable = NULL, constraints = NULL, theta = NULL,
                     debug = FALSE)
lav_pt_con_ceq(partable, con = NULL, debug = FALSE,
                             txt_only = FALSE)
lav_pt_con_ciq(partable, con = NULL, debug = FALSE,
                             txt_only = FALSE)
lav_pt_con_def(partable, con = NULL, debug = FALSE,
                             txt_only = FALSE, warn = TRUE)
}
\arguments{
\item{partable}{A lavaan parameter table.}
\item{constraints}{A character string containing the constraints.}
\item{theta}{A numeric vector. Optional vector with values for the
model parameters in the parameter table.}
\item{debug}{Logical. If TRUE, show debugging information.}
\item{con}{An optional partable where the operator is one of `==',
`>', `<' or `:='}
\item{txt_only}{Logical. If TRUE, only the body of the function is returned as a character string. If FALSE, a function is returned.}
\item{warn}{Logical. If FALSE, warnings are suppressed.}
}
\details{
This is a collection of lower-level constraint-related functions
that are used in the lavaan code. They are made public at the
request of package developers. Below is a brief description of what
they do:

The \code{lav_con_parse} function parses the constraints
specification (provided as a string, see example), and generates
a list with useful information about the constraints.

The \code{lav_pt_con_ceq} function creates a function
which takes the (unconstrained) parameter vector as input, and
returns the slack values for each equality constraint. If the equality
constraints hold perfectly, this function returns zeroes.

The \code{lav_pt_con_ciq} function creates a function
which takes the (unconstrained) parameter vector as input, and
returns the slack values for each inequality constraint.

The \code{lav_pt_con_def} function creates a function
which takes the (unconstrained) parameter vector as input, and
returns the computed values of the defined parameters.
}
\examples{
myModel <- 'x1 ~ a*x2 + b*x3 + c*x4'
myParTable <- lavParTable(myModel, as_data_frame = FALSE)
con <- ' a == 2*b
         b - c == 5 '
conInfo <- lav_con_parse(myParTable, constraints = con)

myModel2 <- 'x1 ~ a*x2 + b*x3 + c*x4
             a == 2*b
             b - c == 5 '
ceq <- lav_pt_con_ceq(partable = lavParTable(myModel2))
ceq( c(2,3,4) )
}

