% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RcppExports.R
\name{.oblique_procrustes_batch}
\alias{.oblique_procrustes_batch}
\title{Batched oblique Procrustes target rotation over a cube of loading matrices}
\usage{
.oblique_procrustes_batch(
  A,
  B,
  eps = 1e-05,
  maxit = 1000L,
  max_line_search = 10L,
  step0 = 1,
  normalize = FALSE,
  random_starts = 0L,
  screen_keep = 2L,
  triage_maxit = 25L,
  triage_improve_tol = 0
)
}
\arguments{
\item{A}{Numeric array of dimension \verb{n x m x b}: the \code{b} loading matrices to
align.}

\item{B}{Numeric \verb{n x m} target loading matrix shared across all slices.}

\item{eps}{Numeric scalar. Convergence tolerance for the projected-gradient
norm.}

\item{maxit}{Integer scalar. Maximum number of full projected-gradient updates.}

\item{max_line_search}{Integer scalar. Maximum number of step-halving attempts
after the initial trial step in each line-search phase.}

\item{step0}{Numeric scalar. Initial step size used in the projected-gradient
update.}

\item{normalize}{Logical scalar. If \code{TRUE}, apply Kaiser normalization to the
loadings (only) before rotation and reverse it afterwards, leaving the target
unnormalized (ignored for single-factor slices).}

\item{random_starts}{Integer scalar. Number of additional random starts per
slice.}

\item{screen_keep}{Integer scalar. Number of screened random starts retained
for triage optimization.}

\item{triage_maxit}{Integer scalar. Number of short optimization iterations
used in the triage stage.}

\item{triage_improve_tol}{Numeric scalar. Relative improvement required for a
triaged start to be promoted to full optimization.}
}
\value{
A named list with the aligned-loadings array \code{loadings} (\verb{n x m x b}),
the factor-correlation array \code{Phi} (\verb{m x m x b}), and the per-slice
diagnostics \code{valid}, \code{convergence}, \code{value}, \code{iterations}, and
\code{line_search_failed}.
}
\description{
Align each slice of a loading-matrix cube to a single shared target using the
same oblique target rotation as \code{.oblique_procrustes()}, in one call. This
removes the per-replicate marshalling overhead of looping \code{efa_procrustes()} in R
over bootstrap or multiple-imputation arrays.
}
\details{
Each slice \code{A[, , i]} is aligned to \code{B}. For a single-factor cube the alignment
reduces to the closed-form sign match \code{T = sign(crossprod(A_i, B))} with factor
correlation \code{1}, matching the one-factor short-circuit in \code{efa_procrustes()}. For
two or more factors the slice is warm-started from the closed-form orthogonal
Procrustes solution (mirroring \code{efa_procrustes()}) and optimized with the same
multi-start oblique solver as \code{.oblique_procrustes()}. Random starts are drawn
serially with \code{R::rnorm} in the calling process.

Slices are aligned independently. A slice that cannot be aligned (a non-finite
loading matrix, a failed warm-start decomposition, an invalid fit, or any
linear-algebra exception) is reported with \code{valid = FALSE} and \code{NA} for the
loadings, factor correlations, and all other per-slice diagnostics, rather than
aborting the whole call, so one degenerate replicate does not discard the rest.
}
\keyword{internal}
