% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/trace_elimination.R
\name{record_elimination_trace}
\alias{record_elimination_trace}
\title{Record elimination trace for a parameterized graph}
\usage{
record_elimination_trace(graph, param_length)
}
\arguments{
\item{graph}{Graph object (must be parameterized)}

\item{param_length}{Integer number of parameters}
}
\value{
Trace object (Python object, use with evaluate_trace)
}
\description{
Records the graph elimination operations as a linear trace for efficient
repeated evaluation with different parameter values.
}
\details{
This is a Phase 1-2 feature that records elimination operations once
(O(n³) complexity) to enable fast repeated evaluation (O(n) complexity).
Essential for SVGD and other inference methods that evaluate the model
many times with different parameters.
}
\examples{
\dontrun{
# Build parameterized graph
coalescent_callback <- function(state) {
  n <- state[1]
  if (n <= 1) return(list())
  rate <- n * (n - 1) / 2
  list(list(c(n - 1), 0.0, c(rate)))
}
graph <- create_graph(callback = coalescent_callback, parameterized = TRUE, nr_samples = 5)

# Record trace once
trace <- record_elimination_trace(graph, param_length = 1)

# Evaluate with different parameters (fast)
theta1 <- c(1.0)
result1 <- evaluate_trace(trace, theta1)
theta2 <- c(2.0)
result2 <- evaluate_trace(trace, theta2)
}

}
