% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/blockfit_solve.R
\name{.bf_constrained_flat_update}
\alias{.bf_constrained_flat_update}
\title{Constrained Flat Update Given Current Spline Solution}
\usage{
.bf_constrained_flat_update(
  XfWXf_pen,
  Xfr,
  A_full,
  constraint_values,
  beta_spline,
  flat_rows_all,
  spline_rows_all,
  spline_cols,
  flat_cols,
  p_expansions,
  K,
  nc_flat
)
}
\arguments{
\item{XfWXf_pen}{Penalized flat Gram matrix
(\eqn{nc_f \times nc_f}).}

\item{Xfr}{Right-hand side cross-product for flat update
(\eqn{nc_f \times 1}).}

\item{A_full}{Full constraint matrix (\eqn{P \times R}).}

\item{constraint_values}{List of constraint RHS vectors.}

\item{beta_spline}{List of \eqn{K+1} current spline coefficient vectors.}

\item{flat_rows_all}{Integer vector of flat row indices in the full P-space.}

\item{spline_rows_all}{Integer vector of spline row indices in the full P-space.}

\item{spline_cols}{Integer vector of spline column indices within each partition.}

\item{flat_cols}{Integer vector of flat column indices within each partition.}

\item{p_expansions}{Integer; columns per partition.}

\item{K}{Integer; number of interior knots.}

\item{nc_flat}{Integer; number of flat columns.}
}
\value{
Numeric vector of flat coefficients (\eqn{nc_f \times 1}).
}
\description{
Solves for flat coefficients subject to the residual equality
constraint imposed by the full constraint system, conditional on
the current spline block solution.
}
\details{
When the full constraint system is \eqn{\mathbf{A}^\top \boldsymbol{\beta} = \mathbf{c}},
and we partition \eqn{\boldsymbol{\beta}} into spline and flat blocks, the flat
update must satisfy:
\deqn{
\mathbf{A}_{\mathrm{flat}}^\top \boldsymbol{\beta}_{\mathrm{flat}}
= \mathbf{c} - \mathbf{A}_{\mathrm{spline}}^\top \boldsymbol{\beta}_{\mathrm{spline}}
}

This function solves the penalized least-squares problem for flat coefficients
subject to this residual equality constraint using a Lagrangian approach.
}
\keyword{internal}
