\newcommand{\NWtarget}[2]{\hypertarget{#1}{#2}}
\newcommand{\NWlink}[2]{\hyperlink{#1}{#2}}
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
\newcommand{\NWtxtDefBy}{Defined by}
\newcommand{\NWtxtRefIn}{Referenced in}
\newcommand{\NWtxtNoRef}{Not referenced}
\newcommand{\NWtxtFileDefBy}{File defined by}
\newcommand{\NWtxtIdentsUsed}{Uses:}
\newcommand{\NWtxtIdentsNotUsed}{Never used}
\newcommand{\NWtxtIdentsDefed}{Defines:}
\newcommand{\NWsep}{${\diamond}$}
\newcommand{\NWnotglobal}{(not defined globally)}
\newcommand{\NWuseHyperlinks}{}
\documentclass[a4paper]{report}

%\VignetteIndexEntry{Implementing Permutation Tests}
%\VignetteDepends{libcoin}
%\VignetteKeywords{conditional inference, conditional Monte Carlo}}
%\VignettePackage{libcoin}

%% packages
\usepackage{amsfonts,amstext,amsmath,amssymb,amsthm}

\usepackage[utf8]{inputenc}

\newif\ifshowcode
\showcodetrue

\usepackage{latexsym}
%\usepackage{html}

\usepackage{listings}

\usepackage{color}
\definecolor{linkcolor}{rgb}{0, 0, 0.7}

\usepackage[%
backref,%
raiselinks,%
pdfhighlight=/O,%
pagebackref,%
hyperfigures,%
breaklinks,%
colorlinks,%
pdfpagemode=UseNone,%
pdfstartview=FitBH,%
linkcolor={linkcolor},%
anchorcolor={linkcolor},%
citecolor={linkcolor},%
filecolor={linkcolor},%
menucolor={linkcolor},%
urlcolor={linkcolor}%
]{hyperref}

\usepackage[round]{natbib}

\usepackage{underscore}

\usepackage[top=25mm,bottom=25mm,left=25mm,right=25mm]{geometry}

\usepackage{lmodern}

\newcommand{\pkg}[1]{\textbf{#1}}
\newcommand{\proglang}[1]{\textsf{#1}}
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\file}[1]{\texttt{#1}}

\newcommand{\R}{\mathbb{R} }
\newcommand{\Prob}{\mathbb{P} }
\newcommand{\N}{\mathbb{N} }
%\newcommand{\C}{\mathbb{C} }
\newcommand{\V}{\mathbb{V}} %% cal{\mbox{\textnormal{Var}}} }
\newcommand{\E}{\mathbb{E}} %%mathcal{\mbox{\textnormal{E}}} }
\newcommand{\Var}{\mathbb{V}} %%mathcal{\mbox{\textnormal{Var}}} }
\newcommand{\argmin}{\operatorname{argmin}\displaylimits}
\newcommand{\argmax}{\operatorname{argmax}\displaylimits}
\newcommand{\LS}{\mathcal{L}_n}
\newcommand{\TS}{\mathcal{T}_n}
\newcommand{\LSc}{\mathcal{L}_{\text{comb},n}}
\newcommand{\LSbc}{\mathcal{L}^*_{\text{comb},n}}
\newcommand{\F}{\mathcal{F}}
\newcommand{\A}{\mathcal{A}}
\newcommand{\yn}{y_{\text{new}}}
\newcommand{\z}{\mathbf{z}}
\newcommand{\X}{\mathbf{X}}
\newcommand{\Y}{\mathbf{Y}}
\newcommand{\sX}{\mathcal{X}}
\newcommand{\sY}{\mathcal{Y}}
\newcommand{\T}{\mathbf{T}}
\newcommand{\x}{\mathbf{x}}
\renewcommand{\a}{\mathbf{a}}
\newcommand{\xn}{\mathbf{x}_{\text{new}}}
\newcommand{\y}{\mathbf{y}}
\newcommand{\w}{\mathbf{w}}
\newcommand{\sbullet}{\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}}
\newcommand{\wdot}{\mathbf{w}_{\sbullet}}
\renewcommand{\t}{\mathbf{t}}
\newcommand{\M}{\mathbf{M}}
\renewcommand{\vec}{\text{vec}}
\newcommand{\B}{\mathbf{B}}
\newcommand{\K}{\mathbf{K}}
\newcommand{\W}{\mathbf{W}}
\newcommand{\D}{\mathbf{D}}
\newcommand{\I}{\mathbf{I}}
\newcommand{\bS}{\mathbf{S}}
\newcommand{\cellx}{\pi_n[\x]}
\newcommand{\partn}{\pi_n(\mathcal{L}_n)}
\newcommand{\err}{\text{Err}}
\newcommand{\ea}{\widehat{\text{Err}}^{(a)}}
\newcommand{\ecv}{\widehat{\text{Err}}^{(cv1)}}
\newcommand{\ecvten}{\widehat{\text{Err}}^{(cv10)}}
\newcommand{\eone}{\widehat{\text{Err}}^{(1)}}
\newcommand{\eplus}{\widehat{\text{Err}}^{(.632+)}}
\newcommand{\eoob}{\widehat{\text{Err}}^{(oob)}}
\newcommand{\mub}{\boldsymbol{\mu}}
\newcommand{\Sigmab}{\boldsymbol{\Sigma}}


\author{Torsten Hothorn \\ Universit\"at Z\"urich}

\title{The \pkg{libcoin} Package}

\begin{document}

\pagenumbering{roman}
\maketitle
\tableofcontents

\chapter*{Licence}

{\setlength{\parindent}{0cm}
Copyright (C) 2016-2026 Torsten Hothorn \\

This file is part of the \pkg{libcoin} \proglang{R} add-on package. \\

\pkg{libcoin} is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 2. \\

\pkg{libcoin} is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details. \\

You should have received a copy of the GNU General Public License
along with \pkg{libcoin}.  If not, see <http://www.gnu.org/licenses/>.
}

\chapter{Introduction}
\pagenumbering{arabic}

The \pkg{libcoin} package implements a generic framework for permutation
tests. We assume that we are provided with $n$ observations
\begin{eqnarray*}
(\Y_i, \X_i, w_i, \text{block}_i), \quad i = 1, \dots, N.
\end{eqnarray*}
The variables $\Y$ and $\X$ from sample spaces $\mathcal{Y}$ and
$\mathcal{X}$ may
be measured at arbitrary scales and may be multivariate as well. In addition
to those measurements, case weights $w_i \in \N$ and a factor $\text{block}_i \in \{1, \dots, B\}$
coding for $B$ independent blocks may
be available.
We are interested in testing the null hypothesis of independence of $\Y$ and
$\X$
\begin{eqnarray*}
H_0: D(\Y \mid \X) = D(\Y)
\end{eqnarray*}
against arbitrary alternatives. \cite{Strasser+Weber:1999} suggest to derive
scalar test statistics for testing $H_0$ from multivariate linear statistics
of a specific linear form. Let $\A \subseteq \{1, \dots, N\}$ denote some subset of the
observation numbers and consider the linear statistic
\begin{eqnarray} \label{linstat}
\T(\A) = \vec\left(\sum_{i \in \A} w_i g(\X_i) h(\Y_i, \{\Y_i \mid i \in \A\})^\top\right)
\in \R^{PQ}.
\end{eqnarray}
Here, $g: \mathcal{X} \rightarrow \R^P$ is a transformation of
$\X$ known as the \emph{regression function} and $h: \mathcal{Y} \times
\mathcal{Y}^n \rightarrow \R^Q$ is a transformation of $\Y$ known as the
\emph{influence function}, where the latter may depend on $\Y_i$ for $i \in \A$
in a permutation symmetric way.  We will give specific examples on how to choose
$g$ and $h$ later on.

With $\x_i = g(\X_i) \in \R^P$ and $\y_i = h(\Y_i, \{\Y_i, i \in \A\}) \in \R^Q$ we write
\begin{eqnarray} \label{linstatsimple}
\T(\A) = \vec\left(\sum_{i \in \A} w_i \x_i \y_i^\top\right)
\in \R^{PQ}.
\end{eqnarray}
The \pkg{libcoin} package doesn't handle neither $g$ nor $h$, this is the job
of \pkg{coin} and we therefore continue with $\x_i$ and $\y_i$.

The distribution of $\T$  depends on the joint
distribution of $\Y$ and $\X$, which is unknown under almost all practical
circumstances. At least under the null hypothesis one can dispose of this
dependency by fixing $\X_i, i \in \A$ and conditioning on all possible
permutations $S(\A)$ of the responses $\Y_i, i \in \A$.
This principle leads to test procedures known
as \textit{permutation tests}.
The conditional expectation $\mub(\A) \in \R^{PQ}$ and covariance
$\Sigmab(\A) \in \R^{PQ \times PQ}$
of $\T$ under $H_0$ given
all permutations $\sigma \in S(\A)$ of the responses are derived by
\cite{Strasser+Weber:1999}:
\begin{eqnarray}
\mub(\A) & = & \E(\T(\A) \mid S(\A)) = \vec \left( \left( \sum_{i \in \A} w_i \x_i \right) \E(h \mid S(\A))^\top
\right), \nonumber \\
\Sigmab(\A) & = & \V(\T(\A) \mid S(\A)) \nonumber \\
& = &
    \frac{\wdot}{\wdot(\A) - 1}  \V(h \mid S(\A)) \otimes
        \left(\sum_{i \in \A} w_i  \x_i \otimes w_i \x_i^\top \right)
\label{expectcovar}
\\
& - & \frac{1}{\wdot(\A) - 1}  \V(h \mid S(\A))  \otimes \left(
        \sum_{i \in \A} w_i \x_i \right)
\otimes \left( \sum_{i \in \A} w_i \x_i\right)^\top
\nonumber
\end{eqnarray}
where $\wdot(\A) = \sum_{i \in \A} w_i$ denotes the sum of the case weights,
and $\otimes$ is the Kronecker product. The conditional expectation of the
influence function is
\begin{eqnarray*}
\E(h \mid S(\A)) = \wdot(\A)^{-1} \sum_{i \in \A} w_i \y_i \in
\R^Q
\end{eqnarray*}
with corresponding $Q \times Q$ covariance matrix
\begin{eqnarray*}
\V(h \mid S(\A)) = \wdot(\A)^{-1} \sum_{i \in \A} w_i \left(\y_i - \E(h \mid S(\A)) \right) \left(\y_i  - \E(h \mid S(\A))\right)^\top.
\end{eqnarray*}

With $A_b = \{i \mid \text{block}_i = b\}$ we get $\T = \sum_{b = 1}^B T(\A_b)$,
$\mub = \sum_{b = 1}^B \mub(\A_b)$ and $\Sigmab = \sum_{b = 1}^B \Sigmab(\A_b)$.

Having the conditional expectation and covariance at hand we are able to
standardize a linear statistic $\T \in \R^{PQ}$ of the form
(\ref{linstatsimple}). Univariate test statistics~$c$ mapping an observed linear
statistic $\t \in
\R^{PQ}$ into the real line can be of arbitrary form.  An obvious choice is
the maximum of the absolute values of the standardized linear statistic
\begin{eqnarray*}
c_\text{max}(\t, \mub, \Sigmab)  = \max \left| \frac{\t -
\mub}{\text{diag}(\Sigmab)^{1/2}} \right|
\end{eqnarray*}
utilizing the conditional expectation $\mub$ and covariance matrix
$\Sigmab$. The application of a quadratic form $c_\text{quad}(\t, \mub,
\Sigmab)  =
(\t - \mub) \Sigmab^+ (\t - \mub)^\top$ is one alternative, although
computationally more expensive because the Moore-Penrose
inverse $\Sigmab^+$ of $\Sigmab$ is involved.

The definition of one- and two-sided $p$-values used for the computations in
the \pkg{libcoin} package is
\begin{eqnarray*}
P(c(\T, \mub, \Sigmab) &\le& c(\t, \mub, \Sigmab)) \quad \text{(less)} \\
P(c(\T, \mub, \Sigmab) &\ge& c(\t, \mub, \Sigmab)) \quad \text{(greater)}\\
P(|c(\T, \mub, \Sigmab)| &\le& |c(\t, \mub, \Sigmab)|) \quad \text{(two-sided).}
\end{eqnarray*}
Note that for quadratic forms only two-sided $p$-values are available
and that in the one-sided case maximum type test statistics are replaced by
\begin{eqnarray*}
\min \left( \frac{\t - \mub}{\text{diag}(\Sigmab)^{1/2}} \right)
    \quad \text{(less) and }
\max \left( \frac{\t - \mub}{\text{diag}(\Sigmab)^{1/2}} \right)
    \quad \text{(greater).}
\end{eqnarray*}

This single source file implements and documents the \pkg{libcoin} package
following the literate programming paradigm. The keynote lecture on literate
programming by Donald E.~Knuth given at useR! 2016 in Stanford very much
motivated this little experiment.

\chapter{\proglang{R} Code}

\section{\proglang{R} User Interface}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
\NWtarget{nuweb3a}{} \verb@"R/libcoin.R"@\nobreak\ {\footnotesize {3a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape LinStatExpCov}\nobreak\ {\footnotesize \NWlink{nuweb4}{4}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape LinStatExpCov1d}\nobreak\ {\footnotesize \NWlink{nuweb6}{6}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape LinStatExpCov2d}\nobreak\ {\footnotesize \NWlink{nuweb8}{8}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape vcov LinStatExpCov}\nobreak\ {\footnotesize \NWlink{nuweb10}{10}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape doTest}\nobreak\ {\footnotesize \NWlink{nuweb12}{12}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Contrasts}\nobreak\ {\footnotesize \NWlink{nuweb14}{14}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The \pkg{libcoin} package implements two \proglang{R} functions, \code{LinStatExpCov()} and
\code{doTest()} for the computation of linear statistics, their expectation
and covariance as well as for the computation of test statistics and
$p$-values. There are two interfaces: One (labelled ``1d'') when the data is
available as matrices \code{X} and \code{Y}, both with the same number of
rows $N$. The second interface (labelled ``2d'') handles the case when the
data is available in aggregated form; details will be explained later.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
\NWtarget{nuweb3b}{} $\langle\,${\itshape LinStatExpCov Prototype}\nobreak\ {\footnotesize {3b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@(X, Y, ix = NULL, iy = NULL, weights = integer(0),@\\
\mbox{}\verb@ subset = integer(0), block = integer(0), checkNAs = TRUE,@\\
\mbox{}\verb@ varonly = FALSE, nresample = 0, standardise = FALSE,@\\
\mbox{}\verb@ tol = sqrt(.Machine$double.eps))@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb4}{4}\NWlink{nuweb17}{, 17}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap3}\raggedright\small
\NWtarget{nuweb4}{} $\langle\,${\itshape LinStatExpCov}\nobreak\ {\footnotesize {4}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@LinStatExpCov <-@\\
\mbox{}\verb@function@\hbox{$\langle\,${\itshape LinStatExpCov Prototype}\nobreak\ {\footnotesize \NWlink{nuweb3b}{3b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (missing(X) && !is.null(ix) && is.null(iy)) {@\\
\mbox{}\verb@        X <- ix@\\
\mbox{}\verb@        ix <- NULL@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (missing(X)) X <- integer(0)@\\
\mbox{}\verb@@\\
\mbox{}\verb@    ## <FIXME> for the time being only!!! </FIXME>@\\
\mbox{}\verb@##    if (length(subset) > 0) subset <- sort(subset)@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (is.null(ix) && is.null(iy))@\\
\mbox{}\verb@        .LinStatExpCov1d(X = X, Y = Y,@\\
\mbox{}\verb@                         weights = weights, subset = subset,@\\
\mbox{}\verb@                         block = block, checkNAs = checkNAs,@\\
\mbox{}\verb@                         varonly = varonly, nresample = nresample,@\\
\mbox{}\verb@                         standardise = standardise, tol = tol)@\\
\mbox{}\verb@    else if (!is.null(ix) && !is.null(iy))@\\
\mbox{}\verb@        .LinStatExpCov2d(X = X, Y = Y, ix = ix, iy = iy,@\\
\mbox{}\verb@                         weights = weights, subset = subset,@\\
\mbox{}\verb@                         block = block, checkNAs = checkNAs,@\\
\mbox{}\verb@                         varonly = varonly, nresample = nresample,@\\
\mbox{}\verb@                         standardise = standardise, tol = tol)@\\
\mbox{}\verb@    else@\\
\mbox{}\verb@        stop("incorrect call to ", sQuote("LinStatExpCov()"))@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb3a}{3a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{One-Dimensional Case (``1d'')}

We assume that $\x_i$ and $\y_i$ for $i = 1, \dots, N$ are available as
numeric matrices \code{X} and \code{Y} with $N$ rows as well as $P$ and $Q$
columns, respectively. The special case of a dummy matrix
\code{X} with $P$ columns can also be represented by a factor at $P$ levels.
The vector of case weights \code{weights} can be stored as \code{integer}
or \code{double} (possibly resulting from an aggregation of $N > $
\code{INT_MAX} observations). The subset vector \code{subset} may contain
the elements $1, \dots, N$ as \code{integer} or \code{double} (for $N > $
\code{INT_MAX}) and can be longer than $N$. The \code{subset} vector MUST be
sorted. \code{block} is a factor at $B$ levels of length $N$.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap4}\raggedright\small
\NWtarget{nuweb5a}{} $\langle\,${\itshape Check weights, subset, block}\nobreak\ {\footnotesize {5a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (is.null(weights)) weights <- integer(0)@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (length(weights) > 0) {@\\
\mbox{}\verb@    if (!((N == length(weights)) && all(weights >= 0)))@\\
\mbox{}\verb@        stop("incorrect weights")@\\
\mbox{}\verb@    if (checkNAs) stopifnot(!anyNA(weights))@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (is.null(subset)) subset <- integer(0)@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (length(subset) > 0 && checkNAs) {@\\
\mbox{}\verb@    rs <- range(subset)@\\
\mbox{}\verb@    if (anyNA(rs)) stop("no missing values allowed in subset")@\\
\mbox{}\verb@    if (!((rs[2] <= N) && (rs[1] >= 1L)))@\\
\mbox{}\verb@        stop("incorrect subset")@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (is.null(block)) block <- integer(0)@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (length(block) > 0) {@\\
\mbox{}\verb@    if (!((N == length(block)) && is.factor(block)))@\\
\mbox{}\verb@        stop("incorrect block")@\\
\mbox{}\verb@    if (checkNAs) stopifnot(!anyNA(block))@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb6}{6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15b}{, 15b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Missing values are only allowed in \code{X} and
\code{Y}, all other vectors must not contain \code{NA}s. Missing values are
dealt with by excluding the corresponding observations from the subset
vector.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap5}\raggedright\small
\NWtarget{nuweb5b}{} $\langle\,${\itshape Handle Missing Values}\nobreak\ {\footnotesize {5b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@ms <- !complete.cases(X, Y)@\\
\mbox{}\verb@if (all(ms))@\\
\mbox{}\verb@    stop("all observations are missing")@\\
\mbox{}\verb@if (any(ms)) {@\\
\mbox{}\verb@    if (length(subset) > 0) {@\\
\mbox{}\verb@        if (all(subset %in% which(ms)))@\\
\mbox{}\verb@            stop("all observations are missing")@\\
\mbox{}\verb@        subset <- subset[!(subset %in% which(ms))]@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        subset <- seq_len(N)[-which(ms)]@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb6}{6}.
\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The logical argument \code{varonly} triggers the computation of the diagonal
elements of the covariance matrix $\Sigmab$ only. \code{nresample} permuted linear statistics
under the null hypothesis $H_0$ are returned on the original and
standardised scale (the latter only when \code{standardise} is \code{TRUE}).
Variances smaller than \code{tol} are treated as being zero.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap6}\raggedright\small
\NWtarget{nuweb6}{} $\langle\,${\itshape LinStatExpCov1d}\nobreak\ {\footnotesize {6}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@.LinStatExpCov1d <-@\\
\mbox{}\verb@function(X, Y, weights = integer(0), subset = integer(0), block = integer(0),@\\
\mbox{}\verb@         checkNAs = TRUE, varonly = FALSE, nresample = 0, standardise = FALSE,@\\
\mbox{}\verb@         tol = sqrt(.Machine$double.eps))@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (NROW(X) != NROW(Y))@\\
\mbox{}\verb@        stop("dimensions of X and Y don't match")@\\
\mbox{}\verb@    N <- NROW(X)@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (is.integer(X)) {@\\
\mbox{}\verb@        if (is.null(attr(X, "levels")) || checkNAs) {@\\
\mbox{}\verb@            rg <- range(X)@\\
\mbox{}\verb@            if (anyNA(rg))@\\
\mbox{}\verb@                stop("no missing values allowed in X")@\\
\mbox{}\verb@            stopifnot(rg[1] > 0) # no missing values allowed here!@\\
\mbox{}\verb@            if (is.null(attr(X, "levels")))@\\
\mbox{}\verb@                attr(X, "levels") <- seq_len(rg[2])@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (is.factor(X) && checkNAs)@\\
\mbox{}\verb@        stopifnot(!anyNA(X))@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Check weights, subset, block}\nobreak\ {\footnotesize \NWlink{nuweb5a}{5a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (checkNAs) {@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Handle Missing Values}\nobreak\ {\footnotesize \NWlink{nuweb5b}{5b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    ret <- .Call(R_ExpectationCovarianceStatistic, X, Y, weights, subset,@\\
\mbox{}\verb@                 block, as.integer(varonly), as.double(tol))@\\
\mbox{}\verb@    ret$varonly <- as.logical(ret$varonly)@\\
\mbox{}\verb@    ret$Xfactor <- as.logical(ret$Xfactor)@\\
\mbox{}\verb@    if (nresample > 0) {@\\
\mbox{}\verb@        ret$PermutedLinearStatistic <-@\\
\mbox{}\verb@            .Call(R_PermutedLinearStatistic, X, Y, weights, subset,@\\
\mbox{}\verb@                  block, as.double(nresample))@\\
\mbox{}\verb@        if (standardise)@\\
\mbox{}\verb@            ret$StandardisedPermutedLinearStatistic <-@\\
\mbox{}\verb@                .Call(R_StandardisePermutedLinearStatistic, ret)@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    class(ret) <- c("LinStatExpCov1d", "LinStatExpCov")@\\
\mbox{}\verb@    ret@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb3a}{3a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}, \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb36}{36}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Here is a simple example. We have five groups and a uniform outcome (rounded
to one digit) and want
to test independence of group membership and outcome. The simplest way is
to set-up the dummy matrix explicitly:
<<1dex-1>>=
isequal <-
function(a, b) {
    attributes(a) <- NULL
    attributes(b) <- NULL
    if (!isTRUE(all.equal(a, b))) {
        print(a, digits = 10)
        print(b, digits = 10)
        FALSE
    } else
        TRUE
}
library("libcoin")
set.seed(290875)
x <- gl(5, 20)
y <- round(runif(length(x)), 1)
ls1 <- LinStatExpCov(X = model.matrix(~ x - 1), Y = matrix(y, ncol = 1))
ls1$LinearStatistic
tapply(y, x, sum)
@
The linear statistic is simply the sum of the response in each group.
Alternatively, we can compute the same object without setting-up the dummy
matrix:
<<1dex-2>>=
ls2 <- LinStatExpCov(X = x, Y = matrix(y, ncol = 1))
all.equal(ls1[-grep("Xfactor", names(ls1))],
          ls2[-grep("Xfactor", names(ls2))])
@
The results are identical, except for a logical indicating that a factor was
used to represent the dummy matrix \code{X}.

\subsection{Two-Dimensional Case (``2d'')}

Sometimes the data takes only a few unique values and considerable
computational speedups can be achieved taking this information into account.
Let \code{ix} denote an integer vector with elements $0, \dots, L_x$ of
length $N$ and
\code{iy} an integer vector with elements $0, \dots, L_y$, also of length
$N$. The matrix
\code{X} is now of dimension $(L_x + 1) \times P$ and the matrix \code{Y}
of dimension $(L_y + 1) \times Q$. The combination of \code{X} and \code{ix}
means that the $i$th observation corresponds to the row \code{X[ix[i] + 1,]}.
This looks cumbersome in \proglang{R} notation but is a very efficient way
of dealing with missing values at \proglang{C} level. By convention,
elements of \code{ix} being zero denote a missing value (\code{NA}s are not
allowed in \code{ix} and \code{iy}). Thus, the first row of \code{X}
corresponds to a missing value. If the first row is simply zero, missing
values do not contribute to any of the sums computed later. Even more
important is the fact that all entities, such as linear statistics etc., can
be computed from the two-way tabulation (therefore the abbreviation ``2d'')
over the $N$ elements of \code{ix} and \code{iy}. Once such a
table was computed, the remaining computations can be performed in
dimension $L_x \times L_y$, typically much smaller than $N$.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap7}\raggedright\small
\NWtarget{nuweb8}{} $\langle\,${\itshape LinStatExpCov2d}\nobreak\ {\footnotesize {8}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@.LinStatExpCov2d <-@\\
\mbox{}\verb@function(X = numeric(0), Y, ix, iy, weights = integer(0), subset = integer(0),@\\
\mbox{}\verb@         block = integer(0), checkNAs = TRUE, varonly = FALSE, nresample = 0,@\\
\mbox{}\verb@         standardise = FALSE, tol = sqrt(.Machine$double.eps))@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    IF <- function(x) is.integer(x) || is.factor(x)@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (!((length(ix) == length(iy)) && IF(ix) && IF(iy)))@\\
\mbox{}\verb@        stop("incorrect ix and/or iy")@\\
\mbox{}\verb@    N <- length(ix)@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Check ix}\nobreak\ {\footnotesize \NWlink{nuweb9a}{9a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Check iy}\nobreak\ {\footnotesize \NWlink{nuweb9b}{9b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (length(X) > 0) {@\\
\mbox{}\verb@        if (!(NROW(X) == (length(attr(ix, "levels")) + 1) &&@\\
\mbox{}\verb@              all(complete.cases(X))))@\\
\mbox{}\verb@            stop("incorrect X")@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (!(NROW(Y) == (length(attr(iy, "levels")) + 1) &&@\\
\mbox{}\verb@          all(complete.cases(Y))))@\\
\mbox{}\verb@        stop("incorrect Y")@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Check weights, subset, block}\nobreak\ {\footnotesize \NWlink{nuweb5a}{5a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    ret <- .Call(R_ExpectationCovarianceStatistic_2d, X, ix, Y, iy,@\\
\mbox{}\verb@                 weights, subset, block, as.integer(varonly), as.double(tol))@\\
\mbox{}\verb@    ret$varonly <- as.logical(ret$varonly)@\\
\mbox{}\verb@    ret$Xfactor <- as.logical(ret$Xfactor)@\\
\mbox{}\verb@    if (nresample > 0) {@\\
\mbox{}\verb@        ret$PermutedLinearStatistic <-@\\
\mbox{}\verb@            .Call(R_PermutedLinearStatistic_2d, X, ix, Y, iy, block, nresample, ret$Table)@\\
\mbox{}\verb@        if (standardise)@\\
\mbox{}\verb@            ret$StandardisedPermutedLinearStatistic <-@\\
\mbox{}\verb@                .Call(R_StandardisePermutedLinearStatistic, ret)@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    class(ret) <- c("LinStatExpCov2d", "LinStatExpCov")@\\
\mbox{}\verb@    ret@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb3a}{3a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}, \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb40a}{40a}, \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb47}{47}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\code{ix} and \code{iy} can be factors but without any missing values

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap8}\raggedright\small
\NWtarget{nuweb9a}{} $\langle\,${\itshape Check ix}\nobreak\ {\footnotesize {9a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (is.null(attr(ix, "levels"))) {@\\
\mbox{}\verb@    rg <- range(ix)@\\
\mbox{}\verb@    if (anyNA(rg))@\\
\mbox{}\verb@        stop("no missing values allowed in ix")@\\
\mbox{}\verb@    stopifnot(rg[1] >= 0)@\\
\mbox{}\verb@    attr(ix, "levels") <- seq_len(rg[2])@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    ## lev can be data.frame (see inum::inum)@\\
\mbox{}\verb@    lev <- attr(ix, "levels")@\\
\mbox{}\verb@    if (!is.vector(lev)) lev <- seq_len(NROW(lev))@\\
\mbox{}\verb@    attr(ix, "levels") <- lev@\\
\mbox{}\verb@    if (checkNAs) stopifnot(!anyNA(ix))@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb8}{8}\NWlink{nuweb15b}{, 15b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap9}\raggedright\small
\NWtarget{nuweb9b}{} $\langle\,${\itshape Check iy}\nobreak\ {\footnotesize {9b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (is.null(attr(iy, "levels"))) {@\\
\mbox{}\verb@    rg <- range(iy)@\\
\mbox{}\verb@    if (anyNA(rg))@\\
\mbox{}\verb@        stop("no missing values allowed in iy")@\\
\mbox{}\verb@    stopifnot(rg[1] >= 0)@\\
\mbox{}\verb@    attr(iy, "levels") <- seq_len(rg[2])@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    ## lev can be data.frame (see inum::inum)@\\
\mbox{}\verb@    lev <- attr(iy, "levels")@\\
\mbox{}\verb@    if (!is.vector(lev)) lev <- seq_len(NROW(lev))@\\
\mbox{}\verb@    attr(iy, "levels") <- lev@\\
\mbox{}\verb@    if (checkNAs) stopifnot(!anyNA(iy))@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb8}{8}\NWlink{nuweb15b}{, 15b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
In our small example, we can set-up the data in the following way
<<2dex-1>>=
X <- rbind(0, diag(nlevels(x)))
ix <- unclass(x)
ylev <- sort(unique(y))
Y <- rbind(0, matrix(ylev, ncol = 1))
iy <- .bincode(y, breaks = c(-Inf, ylev, Inf))
ls3 <- LinStatExpCov(X = X, ix = ix, Y = Y, iy = iy)
all.equal(ls1[-grep("Table", names(ls1))],
          ls3[-grep("Table", names(ls3))])
### works also with factors
ls3 <- LinStatExpCov(X = X, ix = factor(ix), Y = Y, iy = factor(iy))
all.equal(ls1[-grep("Table", names(ls1))],
          ls3[-grep("Table", names(ls3))])
@
Similar to the one-dimensional case, we can also omit the \code{X} matrix
here
<<2dex-2>>=
ls4 <- LinStatExpCov(ix = ix, Y = Y, iy = iy)
all.equal(ls3[-grep("Xfactor", names(ls3))],
          ls4[-grep("Xfactor", names(ls4))])
@
It is important to note that all computations are based on the tabulations
<<2dex-3>>=
ls3$Table
xtabs(~ ix + iy)
@
where the former would record missing values in the first row / column.

\subsection{Methods and Tests}

Objects of class \code{"LinStatExpCov"} returned by \code{LinStatExpCov()}
contain the symmetric covariance matrix as a vector of the lower triangular
elements. The \code{vcov} method allows to extract the full covariance
matrix from such an object.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap10}\raggedright\small
\NWtarget{nuweb10}{} $\langle\,${\itshape vcov LinStatExpCov}\nobreak\ {\footnotesize {10}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@vcov.LinStatExpCov <-@\\
\mbox{}\verb@function(object, ...)@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (object$varonly)@\\
\mbox{}\verb@        stop("cannot extract covariance matrix")@\\
\mbox{}\verb@    drop(.Call(R_unpack_sym, object$Covariance, NULL, 0L))@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb3a}{3a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb135}{135}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<vcov-1>>=
ls1$Covariance
vcov(ls1)
@

The most important task is, however, to compute test statistics and
$p$-values. \code{doTest()} allows to compute the statistics $c_\text{max}$
(taking \code{alternative} into account) and $c_\text{quad}$ along with the
corresponding $p$-values. If \code{nresample = 0} was used in the call to
\code{LinStatExpCov()}, $p$-values are obtained from the limiting asymptotic
distribution whenever such a thing is available at reasonable costs.
Otherwise, the permutation $p$-value is returned (along with the permuted
test statistics when \code{PermutedStatistics} is \code{TRUE}). The
$p$-values (\code{lower = FALSE}) or $(1 - p)$-values (\code{lower = TRUE})
can be computed on the log-scale.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap11}\raggedright\small
\NWtarget{nuweb11}{} $\langle\,${\itshape doTest Prototype}\nobreak\ {\footnotesize {11}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@(object, teststat = c("maximum", "quadratic", "scalar"),@\\
\mbox{}\verb@ alternative = c("two.sided", "less", "greater"), pvalue = TRUE,@\\
\mbox{}\verb@ lower = FALSE, log = FALSE, PermutedStatistics = FALSE,@\\
\mbox{}\verb@ minbucket = 10L, ordered = TRUE, maxselect = object$Xfactor,@\\
\mbox{}\verb@ pargs = GenzBretz())@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb12}{12}\NWlink{nuweb18}{, 18}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap12}\raggedright\small
\NWtarget{nuweb12}{} $\langle\,${\itshape doTest}\nobreak\ {\footnotesize {12}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@### note: lower = FALSE => p-value; lower = TRUE => 1 - p-value@\\
\mbox{}\verb@doTest <-@\\
\mbox{}\verb@function@\hbox{$\langle\,${\itshape doTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb11}{11}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    teststat <- match.arg(teststat, choices = c("maximum", "quadratic", "scalar"))@\\
\mbox{}\verb@    if (!any(teststat == c("maximum", "quadratic", "scalar")))@\\
\mbox{}\verb@        stop("incorrect teststat")@\\
\mbox{}\verb@    alternative <- alternative[1]@\\
\mbox{}\verb@    if (!any(alternative == c("two.sided", "less", "greater")))@\\
\mbox{}\verb@        stop("incorrect alternative")@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (maxselect)@\\
\mbox{}\verb@        stopifnot(object$Xfactor)@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (teststat == "quadratic" || maxselect) {@\\
\mbox{}\verb@        if (alternative != "two.sided")@\\
\mbox{}\verb@            stop("incorrect alternative")@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    test <- which(c("maximum", "quadratic", "scalar") == teststat)@\\
\mbox{}\verb@    if (test == 3) {@\\
\mbox{}\verb@        if (length(object$LinearStatistic) != 1)@\\
\mbox{}\verb@            stop("scalar test statistic not applicable")@\\
\mbox{}\verb@        test <- 1L # scalar is maximum internally@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    alt <- which(c("two.sided", "less", "greater") == alternative)@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (!pvalue && (NCOL(object$PermutedLinearStatistic) > 0))@\\
\mbox{}\verb@        object$PermutedLinearStatistic <- matrix(NA_real_, nrow = 0, ncol = 0)@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (!maxselect) {@\\
\mbox{}\verb@        if (teststat == "quadratic") {@\\
\mbox{}\verb@            ret <- .Call(R_QuadraticTest, object, as.integer(pvalue), as.integer(lower),@\\
\mbox{}\verb@                         as.integer(log), as.integer(PermutedStatistics))@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            ret <- .Call(R_MaximumTest, object, as.integer(alt), as.integer(pvalue),@\\
\mbox{}\verb@                         as.integer(lower), as.integer(log), as.integer(PermutedStatistics),@\\
\mbox{}\verb@                         as.integer(pargs$maxpts), as.double(pargs$releps),@\\
\mbox{}\verb@                         as.double(pargs$abseps))@\\
\mbox{}\verb@            if (teststat == "scalar") {@\\
\mbox{}\verb@                var <- if (object$varonly) object$Variance else object$Covariance@\\
\mbox{}\verb@                ret$TestStatistic <- object$LinearStatistic - object$Expectation@\\
\mbox{}\verb@                ret$TestStatistic <-@\\
\mbox{}\verb@                    if (var > object$tol) ret$TestStatistic / sqrt(var) else NaN@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        ret <- .Call(R_MaximallySelectedTest, object, as.integer(ordered), as.integer(test),@\\
\mbox{}\verb@                     as.integer(minbucket), as.integer(lower), as.integer(log))@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    if (!PermutedStatistics) ret$PermutedStatistics <- NULL@\\
\mbox{}\verb@    ret@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb3a}{3a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<doTest-1>>=
### c_max test statistic
### no p-value
doTest(ls1, teststat = "maximum", pvalue = FALSE)
### p-value
doTest(ls1, teststat = "maximum")
### log(p)-value
doTest(ls1, teststat = "maximum", log = TRUE)
### (1-p)-value
doTest(ls1, teststat = "maximum", lower = TRUE)
### log(1 - p)-value
doTest(ls1, teststat = "maximum", lower = TRUE, log = TRUE)
### quadratic
doTest(ls1, teststat = "quadratic")
@

Sometimes we are interested in contrasts of linear statistics and their
corresponding properties. Examples include linear-by-linear association
tests, where we assign numeric scores to each level of a factor. To
implement this, we implement \code{lmult()} so that we can then left-multiply a
matrix to an object of class \code{"LinStatExpCov"}.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap13}\raggedright\small
\NWtarget{nuweb14}{} $\langle\,${\itshape Contrasts}\nobreak\ {\footnotesize {14}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@lmult <-@\\
\mbox{}\verb@function(x, object)@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    stopifnot(!object$varonly)@\\
\mbox{}\verb@    stopifnot(is.numeric(x))@\\
\mbox{}\verb@    if (is.vector(x)) x <- matrix(x, nrow = 1)@\\
\mbox{}\verb@    P <- object$dimension[1]@\\
\mbox{}\verb@    stopifnot(ncol(x) == P)@\\
\mbox{}\verb@    Q <- object$dimension[2]@\\
\mbox{}\verb@    ret <- object@\\
\mbox{}\verb@    xLS <- x %*% matrix(object$LinearStatistic, nrow = P)@\\
\mbox{}\verb@    xExp <- x %*% matrix(object$Expectation, nrow = P)@\\
\mbox{}\verb@    xExpX <- x %*% matrix(object$ExpectationX, nrow = P)@\\
\mbox{}\verb@    if (Q == 1) {@\\
\mbox{}\verb@        xCov <- tcrossprod(x %*% vcov(object), x)@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        zmat <- matrix(0, nrow = P * Q, ncol = nrow(x))@\\
\mbox{}\verb@        mat <- rbind(t(x), zmat)@\\
\mbox{}\verb@        mat <- mat[rep.int(seq_len(nrow(mat)), Q - 1),, drop = FALSE]@\\
\mbox{}\verb@        mat <- rbind(mat, t(x))@\\
\mbox{}\verb@        mat <- matrix(mat, ncol = Q * nrow(x))@\\
\mbox{}\verb@        mat <- t(mat)@\\
\mbox{}\verb@        xCov <- tcrossprod(mat %*% vcov(object), mat)@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    if (!is.matrix(xCov)) xCov <- matrix(xCov)@\\
\mbox{}\verb@    if (length(object$PermutedLinearStatistic) > 0) {@\\
\mbox{}\verb@        xPS <- apply(object$PermutedLinearStatistic, 2, function(y)@\\
\mbox{}\verb@                     as.vector(x %*% matrix(y, nrow = P)))@\\
\mbox{}\verb@        if (!is.matrix(xPS)) xPS <- matrix(xPS, nrow = 1)@\\
\mbox{}\verb@        ret$PermutedLinearStatistic <- xPS@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    ret$LinearStatistic <- as.vector(xLS)@\\
\mbox{}\verb@    ret$Expectation <- as.vector(xExp)@\\
\mbox{}\verb@    ret$ExpectationX <- as.vector(xExpX)@\\
\mbox{}\verb@    ret$Covariance <- as.vector(xCov[lower.tri(xCov, diag = TRUE)])@\\
\mbox{}\verb@    ret$Variance <- diag(xCov)@\\
\mbox{}\verb@    ret$dimension <- c(NROW(x), Q)@\\
\mbox{}\verb@    ret$Xfactor <- FALSE@\\
\mbox{}\verb@    if (length(object$StandardisedPermutedLinearStatistic) > 0)@\\
\mbox{}\verb@        ret$StandardisedPermutedLinearStatistic <-@\\
\mbox{}\verb@            .Call(R_StandardisePermutedLinearStatistic, ret)@\\
\mbox{}\verb@    ret@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb3a}{3a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Here is an example for a linear-by-linear association test.
<<Contrasts-1>>=
set.seed(29)
ls1d <- LinStatExpCov(X = model.matrix(~ x - 1), Y = matrix(y, ncol = 1),
                      nresample = 10, standardise = TRUE)
set.seed(29)
ls1s <- LinStatExpCov(X = as.double(1:5)[x], Y = matrix(y, ncol = 1),
                      nresample = 10, standardise = TRUE)
ls1c <- lmult(1:5, ls1d)
stopifnot(isequal(ls1c, ls1s))
set.seed(29)
ls1d <- LinStatExpCov(X = model.matrix(~ x - 1), Y = matrix(c(y, y), ncol = 2),
                      nresample = 10, standardise = TRUE)
set.seed(29)
ls1s <- LinStatExpCov(X = as.double(1:5)[x], Y = matrix(c(y, y), ncol = 2),
                      nresample = 10, standardise = TRUE)
ls1c <- lmult(1:5, ls1d)
stopifnot(isequal(ls1c, ls1s))
@

\subsection{Tabulations}

The tabulation of \code{ix} and \code{iy} can be computed without
necessarily computing the corresponding linear statistics via
\code{ctabs()}.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap14}\raggedright\small
\NWtarget{nuweb15a}{} $\langle\,${\itshape ctabs Prototype}\nobreak\ {\footnotesize {15a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@(ix, iy = integer(0), block = integer(0), weights = integer(0),@\\
\mbox{}\verb@ subset = integer(0), checkNAs = TRUE)@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb15b}{15b}\NWlink{nuweb19}{, 19}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap15}\raggedright\small
\NWtarget{nuweb15b}{} \verb@"R/ctabs.R"@\nobreak\ {\footnotesize {15b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@ctabs <-@\\
\mbox{}\verb@function@\hbox{$\langle\,${\itshape ctabs Prototype}\nobreak\ {\footnotesize \NWlink{nuweb15a}{15a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    stopifnot(is.integer(ix) || is.factor(ix))@\\
\mbox{}\verb@    N <- length(ix)@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Check ix}\nobreak\ {\footnotesize \NWlink{nuweb9a}{9a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (length(iy) > 0) {@\\
\mbox{}\verb@        stopifnot(length(iy) == N)@\\
\mbox{}\verb@        stopifnot(is.integer(iy) || is.factor(iy))@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Check iy}\nobreak\ {\footnotesize \NWlink{nuweb9b}{9b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Check weights, subset, block}\nobreak\ {\footnotesize \NWlink{nuweb5a}{5a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (length(iy) == 0)@\\
\mbox{}\verb@        if (length(block) == 0)@\\
\mbox{}\verb@            .Call(R_OneTableSums, ix, weights, subset)@\\
\mbox{}\verb@        else@\\
\mbox{}\verb@            .Call(R_TwoTableSums, ix, block, weights, subset)[, -1, drop = FALSE]@\\
\mbox{}\verb@    else if (length(block) == 0)@\\
\mbox{}\verb@        .Call(R_TwoTableSums, ix, iy, weights, subset)@\\
\mbox{}\verb@    else@\\
\mbox{}\verb@        .Call(R_ThreeTableSums, ix, iy, block, weights, subset)@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb107b}{107b}, \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb115a}{115a}, \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb111a}{111a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<ctabsex-1>>=
t1 <- ctabs(ix = ix, iy = iy)
t2 <- xtabs(~ ix + iy)
max(abs(t1[-1, -1] - t2))
@

\section{Manual Pages}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap16}\raggedright\small
\NWtarget{nuweb17}{} \verb@"man/LinStatExpCov.Rd"@\nobreak\ {\footnotesize {17}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape Rd Header}\nobreak\ {\footnotesize \NWlink{nuweb151b}{151b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@\name{LinStatExpCov}@\\
\mbox{}\verb@\alias{LinStatExpCov}@\\
\mbox{}\verb@\alias{lmult}@\\
\mbox{}\verb@\title{@\\
\mbox{}\verb@  Linear Statistics with Expectation and Covariance@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\description{@\\
\mbox{}\verb@  Strasser-Weber type linear statistics and their expectation@\\
\mbox{}\verb@  and covariance under the independence hypothesis@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\usage{@\\
\mbox{}\verb@LinStatExpCov@\hbox{$\langle\,${\itshape LinStatExpCov Prototype}\nobreak\ {\footnotesize \NWlink{nuweb3b}{3b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@lmult(x, object)@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\arguments{@\\
\mbox{}\verb@  \item{X}{numeric matrix of transformations.}@\\
\mbox{}\verb@  \item{Y}{numeric matrix of influence functions.}@\\
\mbox{}\verb@  \item{ix}{an optional integer vector expanding \code{X}.}@\\
\mbox{}\verb@  \item{iy}{an optional integer vector expanding \code{Y}.}@\\
\mbox{}\verb@  \item{weights}{an optional integer vector of non-negative case weights.}@\\
\mbox{}\verb@  \item{subset}{an optional integer vector defining a subset of observations.}@\\
\mbox{}\verb@  \item{block}{an optional factor defining independent blocks of observations.}@\\
\mbox{}\verb@  \item{checkNAs}{a logical for switching off missing value checks.  This@\\
\mbox{}\verb@    included switching off checks for suitable values of \code{subset}.@\\
\mbox{}\verb@    Use at your own risk.}@\\
\mbox{}\verb@  \item{varonly}{a logical asking for variances only.}@\\
\mbox{}\verb@  \item{nresample}{an integer defining the number of permuted statistics to draw.}@\\
\mbox{}\verb@  \item{standardise}{a logical asking to standardise the permuted statistics.}@\\
\mbox{}\verb@  \item{tol}{tolerance for zero variances.}@\\
\mbox{}\verb@  \item{x}{a contrast matrix to be left-multiplied in case \code{X} was a factor.}@\\
\mbox{}\verb@  \item{object}{an object of class \code{"LinStatExpCov"}.}@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\details{@\\
\mbox{}\verb@@\\
\mbox{}\verb@  This function implements the permutation test framework by@\\
\mbox{}\verb@  \bibcitet{libcoin::Strasser+Weber:1999}, see also@\\
\mbox{}\verb@  \bibcitet{libcoin::Hothorn+Hornik+vandeWiel+Zeileis:2006} and@\\
\mbox{}\verb@  \bibcitet{libcoin::Hothorn+Hornik+vandeWiel+Zeileis:2008}.@\\
\mbox{}\verb@@\\
\mbox{}\verb@  The function, after minimal preprocessing, calls the underlying C code@\\
\mbox{}\verb@  and computes the linear statistic, its expectation and covariance and,@\\
\mbox{}\verb@  optionally, \code{nresample} samples from its permutation distribution.@\\
\mbox{}\verb@@\\
\mbox{}\verb@  When both \code{ix} and \code{iy} are missing, the number of rows of@\\
\mbox{}\verb@  \code{X} and \code{Y} is the same, i.e., the number of observations.@\\
\mbox{}\verb@@\\
\mbox{}\verb@  When \code{X} is missing and \code{ix} a factor, the code proceeds as@\\
\mbox{}\verb@  if \code{X} were a dummy matrix of \code{ix} without explicitly@\\
\mbox{}\verb@  computing this matrix.@\\
\mbox{}\verb@@\\
\mbox{}\verb@  Both \code{ix} and \code{iy} being present means the code treats them@\\
\mbox{}\verb@  as subsetting vectors for \code{X} and \code{Y}.  Note that \code{ix = 0}@\\
\mbox{}\verb@  or \code{iy = 0} means that the corresponding observation is missing@\\
\mbox{}\verb@  and the first row or \code{X} and \code{Y} must be zero.@\\
\mbox{}\verb@@\\
\mbox{}\verb@  \code{lmult} allows left-multiplication of a contrast matrix when \code{X}@\\
\mbox{}\verb@  was (equivalent to) a factor.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\value{@\\
\mbox{}\verb@  A list.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\references{\bibshow{*}}@\\
\mbox{}\verb@\examples{@\\
\mbox{}\verb@wilcox.test(Ozone ~ Month, data = airquality, subset = Month \%in\% c(5, 8),@\\
\mbox{}\verb@            exact = FALSE, correct = FALSE)@\\
\mbox{}\verb@@\\
\mbox{}\verb@aq <- subset(airquality, Month \%in\% c(5, 8))@\\
\mbox{}\verb@X <- as.double(aq$Month == 5)@\\
\mbox{}\verb@Y <- as.double(rank(aq$Ozone, na.last = "keep"))@\\
\mbox{}\verb@doTest(LinStatExpCov(X, Y))@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\keyword{htest}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap17}\raggedright\small
\NWtarget{nuweb18}{} \verb@"man/doTest.Rd"@\nobreak\ {\footnotesize {18}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape Rd Header}\nobreak\ {\footnotesize \NWlink{nuweb151b}{151b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@\name{doTest}@\\
\mbox{}\verb@\alias{doTest}@\\
\mbox{}\verb@\title{@\\
\mbox{}\verb@  Permutation Test@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\description{@\\
\mbox{}\verb@  Perform permutation test for a linear statistic@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\usage{@\\
\mbox{}\verb@doTest@\hbox{$\langle\,${\itshape doTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb11}{11}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\arguments{@\\
\mbox{}\verb@  \item{object}{an object returned by \code{\link{LinStatExpCov}}.}@\\
\mbox{}\verb@  \item{teststat}{type of test statistic to use.}@\\
\mbox{}\verb@  \item{alternative}{alternative for scalar or maximum-type statistics.}@\\
\mbox{}\verb@  \item{pvalue}{a logical indicating if a p-value shall be computed.}@\\
\mbox{}\verb@  \item{lower}{a logical indicating if a p-value (\code{lower} is \code{FALSE})@\\
\mbox{}\verb@    or 1 - p-value (\code{lower} is \code{TRUE}) shall be returned.}@\\
\mbox{}\verb@  \item{log}{a logical, if \code{TRUE} probabilities are log-probabilities.}@\\
\mbox{}\verb@  \item{PermutedStatistics}{a logical, return permuted test statistics.}@\\
\mbox{}\verb@  \item{minbucket}{minimum weight in either of two groups for maximally selected@\\
\mbox{}\verb@    statistics.}@\\
\mbox{}\verb@  \item{ordered}{a logical, if \code{TRUE} maximally selected statistics assume@\\
\mbox{}\verb@    that the cutpoints are ordered.}@\\
\mbox{}\verb@  \item{maxselect}{a logical, if \code{TRUE} maximally selected statistics are@\\
\mbox{}\verb@    computed.  This requires that \code{X} was an implicitly defined design@\\
\mbox{}\verb@    matrix in \code{\link{LinStatExpCov}}.}@\\
\mbox{}\verb@  \item{pargs}{arguments as in \code{\link[mvtnorm:algorithms]{GenzBretz}}.}@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\details{@\\
\mbox{}\verb@  Computes a test statistic, a corresponding p-value and, optionally, cutpoints@\\
\mbox{}\verb@  for maximally selected statistics.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\value{@\\
\mbox{}\verb@  A list.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\keyword{htest}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap18}\raggedright\small
\NWtarget{nuweb19}{} \verb@"man/ctabs.Rd"@\nobreak\ {\footnotesize {19}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape Rd Header}\nobreak\ {\footnotesize \NWlink{nuweb151b}{151b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@\name{ctabs}@\\
\mbox{}\verb@\alias{ctabs}@\\
\mbox{}\verb@\title{@\\
\mbox{}\verb@  Cross Tabulation@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\description{@\\
\mbox{}\verb@  Efficient weighted cross tabulation of two factors and a block@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\usage{@\\
\mbox{}\verb@ctabs@\hbox{$\langle\,${\itshape ctabs Prototype}\nobreak\ {\footnotesize \NWlink{nuweb15a}{15a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\arguments{@\\
\mbox{}\verb@  \item{ix}{a integer of positive values with zero indicating a missing.}@\\
\mbox{}\verb@  \item{iy}{an optional integer of positive values with zero indicating a@\\
\mbox{}\verb@    missing.}@\\
\mbox{}\verb@  \item{block}{an optional blocking factor without missings.}@\\
\mbox{}\verb@  \item{weights}{an optional vector of case weights, integer or double.}@\\
\mbox{}\verb@  \item{subset}{an optional integer vector indicating a subset.}@\\
\mbox{}\verb@  \item{checkNAs}{a logical for switching off missing value checks.}@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\details{@\\
\mbox{}\verb@  A faster version of \code{xtabs(weights ~ ix + iy + block, subset)}.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\value{@\\
\mbox{}\verb@  If \code{block} is present, a three-way table. Otherwise,@\\
\mbox{}\verb@  a one- or two-dimensional table.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\examples{@\\
\mbox{}\verb@ctabs(ix = 1:5, iy = 1:5, weights = 1:5 / 5)@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\keyword{univar}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\chapter{\proglang{C} Code}

The main motivation to implement the \pkg{libcoin} package comes from the
demand to compute high-dimensional linear statistics (with large $P$ and
$Q$) and the corresponding test statistics very often, either for sampling
from the permutation null distribution $H_0$ or for different subsets of the
data. Especially the latter task can be performed \emph{without} actually
subsetting the data via the \code{subset} argument very efficiently (in
terms of memory consumption and, depending on the circumstances, speed).

We start with the definition of some macros and global variables in the
header files.

\section{Header and Source Files}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap19}\raggedright\small
\NWtarget{nuweb20a}{} \verb@"src/libcoin_internal.h"@\nobreak\ {\footnotesize {20a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Includes}\nobreak\ {\footnotesize \NWlink{nuweb20b}{20b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Macros}\nobreak\ {\footnotesize \NWlink{nuweb20c}{20c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Global Variables}\nobreak\ {\footnotesize \NWlink{nuweb21a}{21a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
These includes provide some \proglang{R} infrastructure at \proglang{C}
level.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap20}\raggedright\small
\NWtarget{nuweb20b}{} $\langle\,${\itshape R Includes}\nobreak\ {\footnotesize {20b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@#define USE_FC_LEN_T@\\
\mbox{}\verb@#include <float.h>        /* for DBL_MIN */@\\
\mbox{}\verb@#include <R.h>@\\
\mbox{}\verb@#include <Rinternals.h>@\\
\mbox{}\verb@#include <Rversion.h>     /* for R_VERSION */@\\
\mbox{}\verb@#include <R_ext/Lapack.h> /* for dspev */@\\
\mbox{}\verb@#ifndef FCONE@\\
\mbox{}\verb@# define FCONE@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb20a}{20a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
We need three macros: \code{S} computes the element $\sigma_{ij}$ of a
symmetric $n \times n$ matrix when only the lower triangular elements are
stored. \code{LE} implements $\le$ with some tolerance, \code{GE} implements
$\ge$.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap21}\raggedright\small
\NWtarget{nuweb20c}{} $\langle\,${\itshape C Macros}\nobreak\ {\footnotesize {20c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@#define S(i, j, n) ((i) >= (j) ? (n) * (j) + (i) - (j) * ((j) + 1) / 2 : (n) * (i) + (j) - (i) * ((i) + 1) / 2)@\\
\mbox{}\verb@#define LE(x, y, tol) ((x) < (y)) || (fabs((x) - (y)) < (tol))@\\
\mbox{}\verb@#define GE(x, y, tol) ((x) > (y)) || (fabs((x) - (y)) < (tol))@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb20a}{20a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@GE@\nobreak\ \NWlink{nuweb50}{50}\NWlink{nuweb53}{, 53}, \verb@LE@\nobreak\ \NWlink{nuweb53}{53}, \verb@S@\nobreak\ \NWlink{nuweb34b}{34b}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb56b}{, 56b}\NWlink{nuweb57b}{, 57b}\NWlink{nuweb58b}{, 58b}\NWlink{nuweb61a}{, 61a}\NWlink{nuweb62a}{, 62a}\NWlink{nuweb66}{, 66}\NWlink{nuweb67a}{, 67a}\NWlink{nuweb70b}{, 70b}\NWlink{nuweb74b}{, 74b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb96}{, 96}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{b}\NWlink{nuweb133}{, 133}\NWlink{nuweb139a}{, 139a}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap22}\raggedright\small
\NWtarget{nuweb21a}{} $\langle\,${\itshape C Global Variables}\nobreak\ {\footnotesize {21a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@#define ALTERNATIVE_twosided                            1@\\
\mbox{}\verb@#define ALTERNATIVE_less                                2@\\
\mbox{}\verb@#define ALTERNATIVE_greater                             3@\\
\mbox{}\verb@@\\
\mbox{}\verb@#define TESTSTAT_maximum                                1@\\
\mbox{}\verb@#define TESTSTAT_quadratic                              2@\\
\mbox{}\verb@@\\
\mbox{}\verb@#define LinearStatistic_SLOT                            0@\\
\mbox{}\verb@#define Expectation_SLOT                                1@\\
\mbox{}\verb@#define Covariance_SLOT                                 2@\\
\mbox{}\verb@#define Variance_SLOT                                   3@\\
\mbox{}\verb@#define ExpectationX_SLOT                               4@\\
\mbox{}\verb@#define varonly_SLOT                                    5@\\
\mbox{}\verb@#define dim_SLOT                                        6@\\
\mbox{}\verb@#define ExpectationInfluence_SLOT                       7@\\
\mbox{}\verb@#define CovarianceInfluence_SLOT                        8@\\
\mbox{}\verb@#define VarianceInfluence_SLOT                          9@\\
\mbox{}\verb@#define Xfactor_SLOT                                    10@\\
\mbox{}\verb@#define tol_SLOT                                        11@\\
\mbox{}\verb@#define PermutedLinearStatistic_SLOT                    12@\\
\mbox{}\verb@#define StandardisedPermutedLinearStatistic_SLOT        13@\\
\mbox{}\verb@#define TableBlock_SLOT                                 14@\\
\mbox{}\verb@#define Sumweights_SLOT                                 15@\\
\mbox{}\verb@#define Table_SLOT                                      16@\\
\mbox{}\verb@@\\
\mbox{}\verb@#define DoSymmetric                                     1@\\
\mbox{}\verb@#define DoCenter                                        1@\\
\mbox{}\verb@#define DoVarOnly                                       1@\\
\mbox{}\verb@#define Power1                                          1@\\
\mbox{}\verb@#define Power2                                          2@\\
\mbox{}\verb@#define Offset0                                         0@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb20a}{20a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@ALTERNATIVE_greater@\nobreak\ \NWlink{nuweb61b}{61b}\NWlink{nuweb64}{, 64}\NWlink{nuweb67a}{, 67a}, \verb@ALTERNATIVE_less@\nobreak\ \NWlink{nuweb53}{53}\NWlink{nuweb61b}{, 61b}\NWlink{nuweb64}{, 64}\NWlink{nuweb67a}{, 67a}, \verb@ALTERNATIVE_twosided@\nobreak\ \NWlink{nuweb61b}{61b}\NWlink{nuweb64}{, 64}\NWlink{nuweb67a}{, 67a}\NWlink{nuweb71b}{, 71b}, \verb@CovarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb140b}{140b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb139a}{139a}\NWlink{nuweb139b}{b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@dim_SLOT@\nobreak\ \NWlink{nuweb137c}{137c}\NWlink{nuweb137d}{d}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@DoCenter@\nobreak\ \NWlink{nuweb75d}{75d}\NWlink{nuweb79c}{, 79c}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb103b}{, 103b}, \verb@DoSymmetric@\nobreak\ \NWlink{nuweb75d}{75d}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb85b}{, 85b}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb34b}{34b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb43}{, 43}, \verb@ExpectationInfluence_SLOT@\nobreak\ \NWlink{nuweb140a}{140a}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@ExpectationX_SLOT@\nobreak\ \NWlink{nuweb139c}{139c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@Expectation_SLOT@\nobreak\ \NWlink{nuweb138d}{138d}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@LinearStatistic_SLOT@\nobreak\ \NWlink{nuweb138c}{138c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@Offset0@\nobreak\ \NWlink{nuweb32b}{32b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123a}{, 123a}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb142a}{142a}\NWlink{nuweb142b}{b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@Power1@\nobreak\ \NWlink{nuweb79c}{79c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb103b}{, 103b}, \verb@Power2@\nobreak\ \NWlink{nuweb82a}{82a}\NWlink{nuweb85b}{, 85b}, \verb@StandardisedPermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb143}{143}\NWlink{nuweb144}{, 144}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb141a}{141a}\NWlink{nuweb141d}{d}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}\NWlink{nuweb145b}{, 145b}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb140d}{, 140d}\NWlink{nuweb141d}{, 141d}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}\NWlink{nuweb145b}{, 145b}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb141b}{141b}\NWlink{nuweb141c}{c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}\NWlink{nuweb146}{, 146}, \verb@TESTSTAT_maximum@\nobreak\ \NWlink{nuweb68}{68}\NWlink{nuweb70a}{, 70a}\NWlink{nuweb70b}{b}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb71b}{b}\NWlink{nuweb72}{, 72}\NWlink{nuweb74b}{, 74b}\NWlink{nuweb75a}{, 75a}, \verb@TESTSTAT_quadratic@\nobreak\ \NWlink{nuweb70a}{70a}, \verb@tol_SLOT@\nobreak\ \NWlink{nuweb142c}{142c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@VarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb140c}{140c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@Variance_SLOT@\nobreak\ \NWlink{nuweb139a}{139a}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@varonly_SLOT@\nobreak\ \NWlink{nuweb138a}{138a}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}, \verb@Xfactor_SLOT@\nobreak\ \NWlink{nuweb138b}{138b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The corresponding header file contains definitions of
functions that can be called via \code{.Call()} from the \pkg{libcoin}
package. In addition, packages linking to \pkg{libcoin} can access these
function at \proglang{C} level (at your own risk, of course!).

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap23}\raggedright\small
\NWtarget{nuweb21b}{} \verb@"src/libcoin.h"@\nobreak\ {\footnotesize {21b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@#include "libcoin_internal.h"@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Function Prototypes}\nobreak\ {\footnotesize \NWlink{nuweb22a}{22a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap24}\raggedright\small
\NWtarget{nuweb22a}{} $\langle\,${\itshape Function Prototypes}\nobreak\ {\footnotesize {22a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_ExpectationCovarianceStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb29c}{29c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_PermutedLinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb35b}{35b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_StandardisePermutedLinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb37b}{37b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_ExpectationCovarianceStatistic_2d Prototype}\nobreak\ {\footnotesize \NWlink{nuweb39a}{39a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_PermutedLinearStatistic_2d Prototype}\nobreak\ {\footnotesize \NWlink{nuweb46a}{46a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_QuadraticTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb49b}{49b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_MaximumTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb51b}{51b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_MaximallySelectedTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb54a}{54a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_ExpectationInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb78b}{78b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_CovarianceInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb80}{80}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_ExpectationX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb82b}{82b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_CovarianceX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb84a}{84a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_Sums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb87a}{87a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_KronSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb91a}{91a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_KronSums_Permutation Prototype}\nobreak\ {\footnotesize \NWlink{nuweb99a}{99a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_colSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb103a}{103a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_OneTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb107a}{107a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_TwoTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb110b}{110b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_ThreeTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb114b}{114b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_order_subset_wrt_block Prototype}\nobreak\ {\footnotesize \NWlink{nuweb119a}{119a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_quadform Prototype}\nobreak\ {\footnotesize \NWlink{nuweb59b}{59b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_kronecker Prototype}\nobreak\ {\footnotesize \NWlink{nuweb128b}{128b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_MPinv_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb131a}{131a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_unpack_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb134a}{134a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R_pack_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb136a}{136a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb21b}{21b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The \proglang{C} file \file{libcoin.c} contains all \proglang{C}
functions and corresponding \proglang{R} interfaces.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap25}\raggedright\small
\NWtarget{nuweb22b}{} \verb@"src/libcoin.c"@\nobreak\ {\footnotesize {22b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@#include "libcoin_internal.h"@\\
\mbox{}\verb@#include <R_ext/stats_stubs.h>  /* for S_rcont2 */@\\
\mbox{}\verb@#include <mvtnormAPI.h>         /* for calling mvtnorm */@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Function Definitions}\nobreak\ {\footnotesize \NWlink{nuweb22c}{22c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap26}\raggedright\small
\NWtarget{nuweb22c}{} $\langle\,${\itshape Function Definitions}\nobreak\ {\footnotesize {22c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape MoreUtils}\nobreak\ {\footnotesize \NWlink{nuweb125b}{125b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Memory}\nobreak\ {\footnotesize \NWlink{nuweb137a}{137a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape P-Values}\nobreak\ {\footnotesize \NWlink{nuweb62b}{62b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape KronSums}\nobreak\ {\footnotesize \NWlink{nuweb90b}{90b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape colSums}\nobreak\ {\footnotesize \NWlink{nuweb102d}{102d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape SimpleSums}\nobreak\ {\footnotesize \NWlink{nuweb86d}{86d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Tables}\nobreak\ {\footnotesize \NWlink{nuweb106b}{106b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Utils}\nobreak\ {\footnotesize \NWlink{nuweb118b}{118b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape LinearStatistics}\nobreak\ {\footnotesize \NWlink{nuweb75b}{75b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Permutations}\nobreak\ {\footnotesize \NWlink{nuweb123b}{123b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape ExpectationCovariances}\nobreak\ {\footnotesize \NWlink{nuweb76a}{76a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Test Statistics}\nobreak\ {\footnotesize \NWlink{nuweb56a}{56a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape User Interface}\nobreak\ {\footnotesize \NWlink{nuweb29a}{29a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape 2d User Interface}\nobreak\ {\footnotesize \NWlink{nuweb38b}{38b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Tests}\nobreak\ {\footnotesize \NWlink{nuweb49a}{49a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22b}{22b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Variables}

$N$ is the number of observations

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap27}\raggedright\small
\NWtarget{nuweb23a}{} $\langle\,${\itshape R N Input}\nobreak\ {\footnotesize {23a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP N,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb87a}{87a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb5a}{5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15b}{, 15b}\NWlink{nuweb23b}{, 23b}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb65}{, 65}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb86b}{b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90a}{, 90a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb120b}{b}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb130b}{, 130b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
which at \proglang{C} level is represented as \code{R_xlen_t} to allow for
$N > $ \code{INT_MAX}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap28}\raggedright\small
\NWtarget{nuweb23b}{} $\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize {23b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@R_xlen_t N@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23e}{23e}\NWlink{nuweb23f}{f}\NWlink{nuweb31}{, 31}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79b}{b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb81b}{b}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb87c}{, 87c}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb89b}{b}\NWlink{nuweb89c}{c}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb119c}{c}\NWlink{nuweb120b}{, 120b}\NWlink{nuweb121}{, 121}\NWlink{nuweb122b}{, 122b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb5a}{5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15b}{, 15b}\NWlink{nuweb23a}{, 23a}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb65}{, 65}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb86b}{b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90a}{, 90a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb120b}{b}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb130b}{, 130b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The regressors $\x_i, i = 1, \dots, N$

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap29}\raggedright\small
\NWtarget{nuweb23c}{} $\langle\,${\itshape R x Input}\nobreak\ {\footnotesize {23c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP x,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb84a}{, 84a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb99a}{, 99a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb114b}{, 114b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb14}{, 14}\NWlink{nuweb17}{, 17}\NWlink{nuweb20c}{, 20c}\NWlink{nuweb23e}{, 23e}\NWlink{nuweb23f}{f}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb47}{, 47}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb126a}{, 126a}\NWlink{nuweb126b}{b}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb130b}{, 130b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb131b}{b}\NWlink{nuweb132}{, 132}\NWlink{nuweb133}{, 133}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb135}{, 135}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb136b}{b}\NWlink{nuweb136c}{c}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
are either represented as a real matrix with $N$ rows and $P$ columns

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap30}\raggedright\small
\NWtarget{nuweb23d}{} $\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize {23d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int P@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23e}{23e}\NWlink{nuweb23f}{f}\NWlink{nuweb31}{, 31}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb146}{, 146}.
\item \NWtxtIdentsDefed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb30b}{, 30b}\NWlink{nuweb30c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb45}{, 45}\NWlink{nuweb47}{, 47}\NWlink{nuweb50}{, 50}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb53}{, 53}\NWlink{nuweb55}{, 55}\NWlink{nuweb68}{, 68}\NWlink{nuweb69}{, 69}\NWlink{nuweb70a}{, 70a}\NWlink{nuweb70b}{b}\NWlink{nuweb72}{, 72}\NWlink{nuweb73a}{, 73a}\NWlink{nuweb73b}{b}\NWlink{nuweb74a}{, 74a}\NWlink{nuweb74b}{b}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84a}{, 84a}\NWlink{nuweb84b}{b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb91b}{b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99a}{, 99a}\NWlink{nuweb99b}{b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb130b}{, 130b}\NWlink{nuweb142d}{, 142d}\NWlink{nuweb144}{, 144}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap31}\raggedright\small
\NWtarget{nuweb23e}{} $\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize {23e}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *x,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb92c}{92c}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb101b}{b}\NWlink{nuweb104b}{, 104b}\NWlink{nuweb130b}{, 130b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb14}{, 14}\NWlink{nuweb17}{, 17}\NWlink{nuweb20c}{, 20c}\NWlink{nuweb23c}{, 23c}\NWlink{nuweb23f}{f}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb47}{, 47}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb126a}{, 126a}\NWlink{nuweb126b}{b}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb130b}{, 130b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb131b}{b}\NWlink{nuweb132}{, 132}\NWlink{nuweb133}{, 133}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb135}{, 135}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb136b}{b}\NWlink{nuweb136c}{c}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
or as a factor (an integer at \proglang{C} level) at $P$ levels

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap32}\raggedright\small
\NWtarget{nuweb23f}{} $\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize {23f}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int *x,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb97a}{97a}\NWlink{nuweb102a}{, 102a}\NWlink{nuweb102b}{b}\NWlink{nuweb108b}{, 108b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb116b}{, 116b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb14}{, 14}\NWlink{nuweb17}{, 17}\NWlink{nuweb20c}{, 20c}\NWlink{nuweb23c}{, 23c}\NWlink{nuweb23e}{e}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb47}{, 47}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb126a}{, 126a}\NWlink{nuweb126b}{b}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb130b}{, 130b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb131b}{b}\NWlink{nuweb132}{, 132}\NWlink{nuweb133}{, 133}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb135}{, 135}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb136b}{b}\NWlink{nuweb136c}{c}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The influence functions are also either a $N \times Q$ real matrix

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap33}\raggedright\small
\NWtarget{nuweb24a}{} $\langle\,${\itshape R y Input}\nobreak\ {\footnotesize {24a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP y,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb78b}{, 78b}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb80}{, 80}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb99a}{, 99a}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb119a}{, 119a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@y@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb20c}{, 20c}\NWlink{nuweb24c}{, 24c}\NWlink{nuweb24d}{d}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap34}\raggedright\small
\NWtarget{nuweb24b}{} $\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize {24b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int Q@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24c}{24c}\NWlink{nuweb24d}{d}\NWlink{nuweb31}{, 31}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79b}{b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb81b}{b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb146}{, 146}.
\item \NWtxtIdentsDefed\nobreak\  \verb@Q@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb30b}{, 30b}\NWlink{nuweb30c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb45}{, 45}\NWlink{nuweb47}{, 47}\NWlink{nuweb50}{, 50}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb53}{, 53}\NWlink{nuweb68}{, 68}\NWlink{nuweb69}{, 69}\NWlink{nuweb70a}{, 70a}\NWlink{nuweb70b}{b}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb71b}{b}\NWlink{nuweb72}{, 72}\NWlink{nuweb74a}{, 74a}\NWlink{nuweb74b}{b}\NWlink{nuweb75a}{, 75a}\NWlink{nuweb75d}{d}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb142d}{, 142d}\NWlink{nuweb144}{, 144}\NWlink{nuweb145a}{, 145a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap35}\raggedright\small
\NWtarget{nuweb24c}{} $\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize {24c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *y,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb75c}{75c}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb92c}{c}\NWlink{nuweb97a}{, 97a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb101b}{b}\NWlink{nuweb102a}{, 102a}\NWlink{nuweb102b}{b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@y@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb20c}{, 20c}\NWlink{nuweb24a}{, 24a}\NWlink{nuweb24d}{d}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
or a factor at $Q$ levels

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap36}\raggedright\small
\NWtarget{nuweb24d}{} $\langle\,${\itshape C integer y Input}\nobreak\ {\footnotesize {24d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int *y,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb112b}{112b}\NWlink{nuweb116b}{, 116b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@y@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb20c}{, 20c}\NWlink{nuweb24a}{, 24a}\NWlink{nuweb24c}{c}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The case weights $w_i, i = 1, \dots, N$

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap37}\raggedright\small
\NWtarget{nuweb24e}{} $\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize {24e}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP weights@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb78b}{, 78b}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb80}{, 80}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb84a}{, 84a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87c}{c}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb91c}{c}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb103c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107c}{c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb115b}{, 115b}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@weights@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}\NWlink{nuweb24f}{, 24f}\NWlink{nuweb25a}{, 25a}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb33b}{, 33b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb48a}{, 48a}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
can be constant one (\code{XLENGTH(weights) == 0} or \code{weights = integer(0)})
or integer-valued, with \code{HAS_WEIGHTS == 0} in the former case

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap38}\raggedright\small
\NWtarget{nuweb24f}{} $\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize {24f}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int *weights,@\\
\mbox{}\verb@int HAS_WEIGHTS,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb89a}{89a}\NWlink{nuweb89b}{b}\NWlink{nuweb94b}{, 94b}\NWlink{nuweb94c}{c}\NWlink{nuweb97c}{, 97c}\NWlink{nuweb97d}{d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb105b}{b}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113b}{b}\NWlink{nuweb117a}{, 117a}\NWlink{nuweb117b}{b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb25a}{25a}\NWlink{nuweb90a}{, 90a}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}, \verb@weights@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}\NWlink{nuweb24e}{, 24e}\NWlink{nuweb25a}{, 25a}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb33b}{, 33b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb48a}{, 48a}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Case weights larger than \code{INT_MAX} are stored as double

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap39}\raggedright\small
\NWtarget{nuweb25a}{} $\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize {25a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *weights,@\\
\mbox{}\verb@int HAS_WEIGHTS,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb88b}{88b}\NWlink{nuweb89c}{, 89c}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb95}{, 95}\NWlink{nuweb97b}{, 97b}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb104d}{, 104d}\NWlink{nuweb105c}{, 105c}\NWlink{nuweb108d}{, 108d}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb112d}{, 112d}\NWlink{nuweb113c}{, 113c}\NWlink{nuweb116d}{, 116d}\NWlink{nuweb117c}{, 117c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb24f}{24f}\NWlink{nuweb90a}{, 90a}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}, \verb@weights@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}\NWlink{nuweb24e}{, 24e}\NWlink{nuweb24f}{f}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb33b}{, 33b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb48a}{, 48a}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The sum of all case weights is a double

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap40}\raggedright\small
\NWtarget{nuweb25b}{} $\langle\,${\itshape C sumweights Input}\nobreak\ {\footnotesize {25b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double sumweights@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb77}{77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb81b}{, 81b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@sumweights@\nobreak\ \NWlink{nuweb31}{31}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb42b}{b}\NWlink{nuweb43}{, 43}\NWlink{nuweb45}{, 45}\NWlink{nuweb47}{, 47}\NWlink{nuweb48b}{, 48b}\NWlink{nuweb48d}{d}\NWlink{nuweb69}{, 69}\NWlink{nuweb70a}{, 70a}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb75a}{, 75a}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb141a}{, 141a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Subsets $\A \subseteq \{1, \dots, N\}$ are \proglang{R} style indices

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap41}\raggedright\small
\NWtarget{nuweb25c}{} $\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize {25c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP subset@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb78b}{, 78b}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb80}{, 80}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb84a}{, 84a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87c}{c}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb91c}{c}\NWlink{nuweb99a}{, 99a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb103c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107c}{c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb115b}{, 115b}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb119c}{c}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb122b}{b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@subset@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}\NWlink{nuweb25f}{, 25f}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb31}{, 31}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb86c}{c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb124a}{, 124a}\NWlink{nuweb124b}{b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
are either not existent (\code{XLENGTH(subset) == 0}) or of length

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap42}\raggedright\small
\NWtarget{nuweb25d}{} $\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize {25d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@R_xlen_t Nsubset@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb25e}{25e}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb124a}{, 124a}\NWlink{nuweb124b}{b}\NWlink{nuweb125a}{, 125a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@Nsubset@\nobreak\ \NWlink{nuweb33b}{33b}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb86b}{b}\NWlink{nuweb86c}{c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90a}{, 90a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb124a}{, 124a}\NWlink{nuweb124b}{b}\NWlink{nuweb125a}{, 125a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Optionally, one can specify a subset of the subset via

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap43}\raggedright\small
\NWtarget{nuweb25e}{} $\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize {25e}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@R_xlen_t offset,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb25f}{25f}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb87c}{, 87c}\NWlink{nuweb91c}{, 91c}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb103c}{, 103c}\NWlink{nuweb107c}{, 107c}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb115b}{, 115b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@offset@\nobreak\ \NWlink{nuweb31}{31}\NWlink{nuweb33b}{, 33b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79c}{, 79c}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb116a}{, 116a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
where \code{offset} is a \proglang{C} style index for \code{subset}.

Subsets are stored either as integer

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap44}\raggedright\small
\NWtarget{nuweb25f}{} $\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize {25f}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int *subset,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb89b}{89b}\NWlink{nuweb89c}{c}\NWlink{nuweb94c}{, 94c}\NWlink{nuweb95}{, 95}\NWlink{nuweb97d}{, 97d}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb102b}{, 102b}\NWlink{nuweb105b}{, 105b}\NWlink{nuweb105c}{c}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb109c}{c}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb113c}{c}\NWlink{nuweb117b}{, 117b}\NWlink{nuweb117c}{c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@subset@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}\NWlink{nuweb25c}{, 25c}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb31}{, 31}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb86c}{c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb124a}{, 124a}\NWlink{nuweb124b}{b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
or double (to allow for indices larger than \code{INT_MAX})

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap45}\raggedright\small
\NWtarget{nuweb26a}{} $\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize {26a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *subset,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb88b}{88b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb94b}{b}\NWlink{nuweb97b}{, 97b}\NWlink{nuweb97c}{c}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb102a}{, 102a}\NWlink{nuweb104d}{, 104d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb108d}{, 108d}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb112d}{, 112d}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb116d}{, 116d}\NWlink{nuweb117a}{, 117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@subset@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}\NWlink{nuweb25c}{, 25c}\NWlink{nuweb25f}{f}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb31}{, 31}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb86c}{c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb124a}{, 124a}\NWlink{nuweb124b}{b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Blocks $\text{block}_i, i = 1, \dots, N$

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap46}\raggedright\small
\NWtarget{nuweb26b}{} $\langle\,${\itshape R block Input}\nobreak\ {\footnotesize {26b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP block@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb119c}{c}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}\NWlink{nuweb26d}{, 26d}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb140d}{, 140d}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
at $B$ levels

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap47}\raggedright\small
\NWtarget{nuweb26c}{} $\langle\,${\itshape C integer B Input}\nobreak\ {\footnotesize {26c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int B@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb26d}{26d}\NWlink{nuweb31}{, 31}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb146}{, 146}.
\item \NWtxtIdentsDefed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb30b}{30b}\NWlink{nuweb30c}{c}\NWlink{nuweb31}{, 31}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45}{, 45}\NWlink{nuweb47}{, 47}\NWlink{nuweb48b}{, 48b}\NWlink{nuweb68}{, 68}\NWlink{nuweb69}{, 69}\NWlink{nuweb72}{, 72}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb128b}{b}\NWlink{nuweb128c}{c}\NWlink{nuweb129a}{, 129a}\NWlink{nuweb129b}{b}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb142d}{, 142d}\NWlink{nuweb144}{, 144}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb146}{, 146}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
are stored as a factor

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap48}\raggedright\small
\NWtarget{nuweb26d}{} $\langle\,${\itshape C integer block Input}\nobreak\ {\footnotesize {26d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int *block,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer B Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb116b}{116b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}\NWlink{nuweb26b}{, 26b}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb140d}{, 140d}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The tabulation of block (potentially in subsets) is

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap49}\raggedright\small
\NWtarget{nuweb26e}{} $\langle\,${\itshape R blockTable Input}\nobreak\ {\footnotesize {26e}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP blockTable@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb119c}{119c}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@blockTable@\nobreak\ \NWlink{nuweb36}{36}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
where the table is of length $B + 1$ and the first element
counts the number of missing values (although these are NOT allowed in
block).

\subsection{Example Data and Code}

We start with setting-up some toy data sets to be used as test bed. The data
over both the 1d and the 2d case, including case weights, subsets and blocks.
<<ex-setup>>=
N <- 20L
P <- 3L
Lx <- 10L
Ly <- 5L
Q <- 4L
B <- 2L
iX2d <- rbind(0, matrix(runif(Lx * P), nrow = Lx))
ix <- sample(1:Lx, size = N, replace = TRUE)
levels(ix) <- 1:Lx
ixf <- factor(ix, levels = 1:Lx, labels = 1:Lx)
x <- iX2d[ix + 1,]
Xfactor <- diag(Lx)[ix,]
iY2d <- rbind(0, matrix(runif(Ly * Q), nrow = Ly))
iy <- sample(1:Ly, size = N, replace = TRUE)
levels(iy) <- 1:Ly
iyf <- factor(iy, levels = 1:Ly, labels = 1:Ly)
y <- iY2d[iy + 1,]
weights <- sample(0:5, size = N, replace = TRUE)
block <- sample(gl(B, ceiling(N / B))[1:N])
subset <- sort(sample(1:N, floor(N * 1.5), replace = TRUE))
subsety <- sample(1:N, floor(N * 1.5), replace = TRUE)
r1 <- rep(1:ncol(x), ncol(y))
r1Xfactor <- rep(1:ncol(Xfactor), ncol(y))
r2 <- rep(1:ncol(y), each = ncol(x))
r2Xfactor <- rep(1:ncol(y), each = ncol(Xfactor))
@

As a benchmark, we implement linear statistics, their expectation and
covariance, taking case weights, subsets and blocks into account, at \proglang{R}
level. In a sense, the core of the \pkg{libcoin} package is ``just'' a less
memory-hungry and sometimes faster version of this simple function.

<<Rlibcoin>>=
LSEC <-
function(X, Y, weights = integer(0), subset = integer(0), block = integer(0))
{
    if (length(weights) == 0) weights <- rep.int(1, NROW(X))
    if (length(subset) == 0) subset <- seq_len(NROW(X))

    X <- X[subset,, drop = FALSE]
    Y <- Y[subset,, drop = FALSE]
    weights <- weights[subset]

    if (length(block) == 0) {
        w. <- sum(weights)
        wX <- weights * X
        wY <- weights * Y
        ExpX <- colSums(wX)
        ExpY <- colSums(wY) / w.
        CovX <- crossprod(X, wX)
        Yc <- t(t(Y) - ExpY)
        CovY <- crossprod(Yc, weights * Yc) / w.
        T <- crossprod(X, wY)
        Exp <- kronecker(ExpY, ExpX)
        Cov <- w. / (w. - 1) * kronecker(CovY, CovX) -
                1 / (w. - 1) * kronecker(CovY, tcrossprod(ExpX))

        list(LinearStatistic = as.vector(T), Expectation = as.vector(Exp),
             Covariance = Cov, Variance = diag(Cov))
    } else {
        block <- block[subset]
        ret <- list(LinearStatistic = 0, Expectation = 0,
                    Covariance = 0, Variance = 0)
        for (b in levels(block)) {
            tmp <- LSEC(X = X, Y = Y, weights = weights, subset = which(block == b))
            for (l in names(ret)) ret[[l]] <- ret[[l]] + tmp[[l]]
        }
        ret
    }
}
@

<<cmpr>>=
cmpr <-
function(ret1, ret2)
{
    if (inherits(ret1, "LinStatExpCov")) {
        if (!ret1$varonly)
            ret1$Covariance <- vcov(ret1)
    }
    ret1 <- ret1[!sapply(ret1, is.null)]
    ret2 <- ret2[!sapply(ret2, is.null)]
    nm1 <- names(ret1)
    nm2 <- names(ret2)
    nm <- c(nm1, nm2)
    nm <- names(table(nm))[table(nm) == 2]
    isequal(ret1[nm], ret2[nm])
}
@

We now compute the linear statistic along with corresponding expectation,
variance and covariance for later reuse.

<<benchmarks>>=
LECVxyws <- LinStatExpCov(x, y, weights = weights, subset = subset)
LEVxyws <- LinStatExpCov(x, y, weights = weights, subset = subset, varonly = TRUE)
@

The following tests compare the high-level \proglang{R} implementation
(function \code{LSEC()}) with the 1d and 2d \proglang{C} level
implementations in the two situations with and without specification of
\code{X} (i.e., the dummy matrix in the latter case).

<<tests>>=
### with X given
testit <-
function(...)
{
    a <- LinStatExpCov(x, y, ...)
    b <- LSEC(x, y, ...)
    d <- LinStatExpCov(X = iX2d, ix = ix, Y = iY2d, iy = iy, ...)
    cmpr(a, b) && cmpr(d, b)
}

stopifnot(
    testit() && testit(weights = weights) &&
    testit(subset = subset) && testit(weights = weights, subset = subset) &&
    testit(block = block) && testit(weights = weights, block = block) &&
    testit(subset = subset, block = block) &&
    testit(weights = weights, subset = subset, block = block)
)

### without dummy matrix X
testit <-
function(...)
{
    a <- LinStatExpCov(X = ix, y, ...)
    b <- LSEC(Xfactor, y, ...)
    d <- LinStatExpCov(X = integer(0), ix = ix, Y = iY2d, iy = iy, ...)
    cmpr(a, b) && cmpr(d, b)
}

stopifnot(
    testit() && testit(weights = weights) &&
    testit(subset = subset) && testit(weights = weights, subset = subset) &&
    testit(block = block) && testit(weights = weights, block = block) &&
    testit(subset = subset, block = block) &&
    testit(weights = weights, subset = subset, block = block)
)
@

All three implementations give the same results.

\section{Conventions}

Functions starting with \code{R_} are \proglang{C} functions callable via
\code{.Call()} from \proglang{R}. That means they all return \code{SEXP}.
These functions allocate memory handled by \proglang{R}.

Functions starting with \code{RC_} are \proglang{C} functions with
\code{SEXP} or pointer arguments and possibly an \code{SEXP} return value.

Functions starting with \code{C_} are \proglang{C} functions with pointer
arguments only and return a scalar or nothing.

Return values (arguments modified by a function) are named \code{ans},
sometimes with dimension (for example: \code{PQ_ans}).

\section{\proglang{C} User Interface}

\subsection{One-Dimensional Case (``1d'')}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap50}\raggedright\small
\NWtarget{nuweb29a}{} $\langle\,${\itshape User Interface}\nobreak\ {\footnotesize {29a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_ExpectationCovarianceStatistic}\nobreak\ {\footnotesize \NWlink{nuweb31}{31}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ExpectationCovarianceStatistic}\nobreak\ {\footnotesize \NWlink{nuweb30b}{30b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_PermutedLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb36}{36}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_StandardisePermutedLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb38a}{38a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The data are given as $\x_i$ and $\y_i$ for $i = 1, \dots, N$, optionally
with case weights, subset and blocks. The latter three variables are ignored when
specified as \code{integer(0)}.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap51}\raggedright\small
\NWtarget{nuweb29b}{} $\langle\,${\itshape User Interface Input}\nobreak\ {\footnotesize {29b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29c}{29c}\NWlink{nuweb31}{, 31}\NWlink{nuweb35b}{, 35b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap52}\raggedright\small
\NWtarget{nuweb29c}{} $\langle\,${\itshape R_ExpectationCovarianceStatistic Prototype}\nobreak\ {\footnotesize {29c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_ExpectationCovarianceStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb29b}{29b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP varonly,@\\
\mbox{}\verb@    SEXP tol@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb30b}{, 30b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap53}\raggedright\small
\NWtarget{nuweb30a}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {30a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@#include <R_ext/Rdynload.h>@\\
\mbox{}\verb@#include <libcoin.h>@\\
\mbox{}\verb@@\\
\mbox{}\verb@extern SEXP libcoin_R_ExpectationCovarianceStatistic(@\\
\mbox{}\verb@    SEXP x, SEXP y, SEXP weights, SEXP subset, SEXP block, SEXP varonly,@\\
\mbox{}\verb@    SEXP tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_ExpectationCovarianceStatistic");@\\
\mbox{}\verb@    return fun(x, y, weights, subset, block, varonly, tol);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The \proglang{C} interface essentially sets-up the necessary memory and
calls a \proglang{C} level function for the computations.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap54}\raggedright\small
\NWtarget{nuweb30b}{} $\langle\,${\itshape R_ExpectationCovarianceStatistic}\nobreak\ {\footnotesize {30b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ExpectationCovarianceStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb29c}{29c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Dimensions}\nobreak\ {\footnotesize \NWlink{nuweb30c}{30c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = RC_init_LECV_1d(P, Q, INTEGER(varonly)[0], B, TYPEOF(x) == INTSXP, REAL(tol)[0]));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    RC_ExpectationCovarianceStatistic(x, y, weights, subset, block, ans);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29a}{29a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb6}{6}\NWlink{nuweb29c}{, 29c}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160c}{c}\NWlink{nuweb160d}{d}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb31}{31}\NWlink{nuweb44}{, 44}, \verb@RC_init_LECV_1d@\nobreak\ \NWlink{nuweb145b}{145b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
$P$, $Q$ and $B$ are first extracted from the data. The case where \code{X}
is an implicitly specified dummy matrix, the dimension $P$ is the number of
levels of \code{x}.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap55}\raggedright\small
\NWtarget{nuweb30c}{} $\langle\,${\itshape Setup Dimensions}\nobreak\ {\footnotesize {30c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int P, Q, B;@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (TYPEOF(x) == INTSXP) {@\\
\mbox{}\verb@    P = NLEVELS(x);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    P = NCOL(x);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@Q = NCOL(y);@\\
\mbox{}\verb@@\\
\mbox{}\verb@B = 1;@\\
\mbox{}\verb@if (LENGTH(block) > 0)@\\
\mbox{}\verb@    B = NLEVELS(block);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb30b}{30b}\NWlink{nuweb36}{, 36}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb127a}{127a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The core function first computes the linear statistic (as there is no need
to pay attention to blocks) and, in a second step, starts a loop over
potential blocks.

FIXME:  \code{x} being an integer (\code{Xfactor}) with some 0 elements is not handled
        correctly (as \code{sumweights} doesn't take this information into
        account; use \code{subset} to exclude these missings (as done in
        \code{LinStatExpCov()})

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap56}\raggedright\small
\NWtarget{nuweb31}{} $\langle\,${\itshape RC_ExpectationCovarianceStatistic}\nobreak\ {\footnotesize {31}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_ExpectationCovarianceStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb29b}{29b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer B Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    double *sumweights, *table;@\\
\mbox{}\verb@    double *ExpInf, *VarInf, *CovInf, *ExpX, *ExpXtotal, *VarX, *CovX;@\\
\mbox{}\verb@    double *tmpV, *tmpCV;@\\
\mbox{}\verb@    SEXP nullvec, subset_block;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Extract Dimensions}\nobreak\ {\footnotesize \NWlink{nuweb32a}{32a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Compute Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb32b}{32b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Memory and Subsets in Blocks}\nobreak\ {\footnotesize \NWlink{nuweb33a}{33a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* start with subset[0] */@\\
\mbox{}\verb@    R_xlen_t offset = (R_xlen_t) table[0];@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int b = 0; b < B; b++) {@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Compute Sum of Weights in Block}\nobreak\ {\footnotesize \NWlink{nuweb33b}{33b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        /* don't do anything for empty blocks or blocks with weight 1 */@\\
\mbox{}\verb@        if (sumweights[b] > 1) {@\\
\mbox{}\verb@@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute Expectation Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb34a}{34a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute Covariance Influence}\nobreak\ {\footnotesize \NWlink{nuweb34b}{34b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@            if (C_get_varonly(ans)) {@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape Compute Variance Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb34c}{34c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            } else {@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape Compute Covariance Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb34d}{34d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@@\\
\mbox{}\verb@        /* next iteration starts with subset[cumsum(table[1:(b + 1)])] */@\\
\mbox{}\verb@        offset += (R_xlen_t) table[b + 1];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Compute Variance from Covariance}\nobreak\ {\footnotesize \NWlink{nuweb35a}{35a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    R_Free(ExpX); R_Free(VarX); R_Free(CovX);@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29a}{29a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The dimensions are available from the return object:

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap57}\raggedright\small
\NWtarget{nuweb32a}{} $\langle\,${\itshape Extract Dimensions}\nobreak\ {\footnotesize {32a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@P = C_get_P(ans);@\\
\mbox{}\verb@Q = C_get_Q(ans);@\\
\mbox{}\verb@N = NROW(x);@\\
\mbox{}\verb@B = C_get_B(ans);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31}{31}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@C_get_B@\nobreak\ \NWlink{nuweb141d}{141d}, \verb@C_get_P@\nobreak\ \NWlink{nuweb137c}{137c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb137d}{137d}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The linear statistic $\T(\A)$ can be computed without taking blocks into account.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap58}\raggedright\small
\NWtarget{nuweb32b}{} $\langle\,${\itshape Compute Linear Statistic}\nobreak\ {\footnotesize {32b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@RC_LinearStatistic(x, N, P, REAL(y), Q, weights, subset,@\\
\mbox{}\verb@                   Offset0, XLENGTH(subset),@\\
\mbox{}\verb@                   C_get_LinearStatistic(ans));@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31}{31}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb138c}{138c}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_LinearStatistic@\nobreak\ \NWlink{nuweb75d}{75d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
We next extract memory from the return object and allocate some additional
memory. The most important step is to tabulate blocks and to order the
subset with respect to blocks. In absence of block, this just returns
subset.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap59}\raggedright\small
\NWtarget{nuweb33a}{} $\langle\,${\itshape Setup Memory and Subsets in Blocks}\nobreak\ {\footnotesize {33a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@ExpInf = C_get_ExpectationInfluence(ans);@\\
\mbox{}\verb@VarInf = C_get_VarianceInfluence(ans);@\\
\mbox{}\verb@CovInf = C_get_CovarianceInfluence(ans);@\\
\mbox{}\verb@ExpXtotal = C_get_ExpectationX(ans);@\\
\mbox{}\verb@for (int p = 0; p < P; p++) ExpXtotal[p] = 0.0;@\\
\mbox{}\verb@ExpX = R_Calloc(P, double);@\\
\mbox{}\verb@/* Fix by Joanidis Kristoforos: P > INT_MAX is possible@\\
\mbox{}\verb@   for maximally selected statistics (when X is an integer).@\\
\mbox{}\verb@   2018-12-13 */@\\
\mbox{}\verb@if (C_get_varonly(ans)) {@\\
\mbox{}\verb@    VarX = R_Calloc(P, double);@\\
\mbox{}\verb@    CovX = R_Calloc(1, double);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    VarX = R_Calloc(1, double);@\\
\mbox{}\verb@    CovX = R_Calloc(PP12(P), double);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@table = C_get_TableBlock(ans);@\\
\mbox{}\verb@sumweights = C_get_Sumweights(ans);@\\
\mbox{}\verb@PROTECT(nullvec = allocVector(INTSXP, 0));@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (B == 1) {@\\
\mbox{}\verb@    table[0] = 0.0;@\\
\mbox{}\verb@    table[1] = RC_Sums(N, nullvec, subset, Offset0, XLENGTH(subset));@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    RC_OneTableSums(INTEGER(block), N, B + 1, nullvec, subset, Offset0,@\\
\mbox{}\verb@                    XLENGTH(subset), table);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@if (table[0] > 0)@\\
\mbox{}\verb@    error("No missing values allowed in block");@\\
\mbox{}\verb@PROTECT(subset_block = RC_order_subset_wrt_block(N, subset, block,@\\
\mbox{}\verb@                                                 VECTOR_ELT(ans, TableBlock_SLOT)));@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31}{31}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@C_get_ExpectationInfluence@\nobreak\ \NWlink{nuweb140a}{140a}, \verb@C_get_ExpectationX@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@C_get_Sumweights@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@C_get_TableBlock@\nobreak\ \NWlink{nuweb140d}{140d}, \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb140c}{140c}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@PP12@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb108a}{108a}, \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb120a}{120a}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
We compute $\mub(\A)$ based on $\E(h \mid S(\A))$ and $\sum_{i \in \A} w_i \x_i$
for the subset given by subset and the $b$th level of block. The expectation
is initialised zero when $b = 0$ and values add-up over blocks.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap60}\raggedright\small
\NWtarget{nuweb33b}{} $\langle\,${\itshape Compute Sum of Weights in Block}\nobreak\ {\footnotesize {33b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* compute sum of case weights in block b of subset */@\\
\mbox{}\verb@if (table[b + 1] > 0) {@\\
\mbox{}\verb@    sumweights[b] = RC_Sums(N, weights, subset_block,@\\
\mbox{}\verb@                            offset, (R_xlen_t) table[b + 1]);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    /* offset = something and Nsubset = 0 means Nsubset = N in@\\
\mbox{}\verb@       RC_Sums; catch empty or zero-weight block levels here */@\\
\mbox{}\verb@    sumweights[b] = 0.0;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31}{31}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap61}\raggedright\small
\NWtarget{nuweb34a}{} $\langle\,${\itshape Compute Expectation Linear Statistic}\nobreak\ {\footnotesize {34a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@RC_ExpectationInfluence(N, y, Q, weights, subset_block, offset,@\\
\mbox{}\verb@                        (R_xlen_t) table[b + 1], sumweights[b], ExpInf + b * Q);@\\
\mbox{}\verb@RC_ExpectationX(x, N, P, weights, subset_block, offset,@\\
\mbox{}\verb@                (R_xlen_t) table[b + 1], ExpX);@\\
\mbox{}\verb@for (int p = 0; p < P; p++) ExpXtotal[p] += ExpX[p];@\\
\mbox{}\verb@C_ExpectationLinearStatistic(P, Q, ExpInf + b * Q, ExpX, b,@\\
\mbox{}\verb@                             C_get_Expectation(ans));@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31}{31}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_ExpectationLinearStatistic@\nobreak\ \NWlink{nuweb76b}{76b}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb138d}{138d}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb79c}{79c}, \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb83b}{83b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The covariance $\V(h \mid S(\A))$ is now computed for the subset given by
subset and the $b$th level of block. Note that \code{CovInf} stores the
values for each block in the return object (for later reuse).

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap62}\raggedright\small
\NWtarget{nuweb34b}{} $\langle\,${\itshape Compute Covariance Influence}\nobreak\ {\footnotesize {34b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* C_ordered_Xfactor and C_unordered_Xfactor need both VarInf and CovInf */@\\
\mbox{}\verb@RC_CovarianceInfluence(N, y, Q, weights, subset_block, offset,@\\
\mbox{}\verb@                      (R_xlen_t) table[b + 1], ExpInf + b * Q, sumweights[b],@\\
\mbox{}\verb@                      !DoVarOnly, CovInf + b * Q * (Q + 1) / 2);@\\
\mbox{}\verb@/* extract variance from covariance */@\\
\mbox{}\verb@tmpCV = CovInf + b * Q * (Q + 1) / 2;@\\
\mbox{}\verb@tmpV = VarInf + b * Q;@\\
\mbox{}\verb@for (int q = 0; q < Q; q++) tmpV[q] = tmpCV[S(q, q, Q)];@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31}{31}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_ordered_Xfactor@\nobreak\ \NWlink{nuweb68}{68}, \verb@C_unordered_Xfactor@\nobreak\ \NWlink{nuweb72}{72}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_CovarianceInfluence@\nobreak\ \NWlink{nuweb82a}{82a}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
We can now compute the variance or covariance of the linear statistic
$\Sigmab(\A)$:

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap63}\raggedright\small
\NWtarget{nuweb34c}{} $\langle\,${\itshape Compute Variance Linear Statistic}\nobreak\ {\footnotesize {34c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@RC_CovarianceX(x, N, P, weights, subset_block, offset,@\\
\mbox{}\verb@               (R_xlen_t) table[b + 1], ExpX, DoVarOnly, VarX);@\\
\mbox{}\verb@C_VarianceLinearStatistic(P, Q, VarInf + b * Q, ExpX, VarX, sumweights[b],@\\
\mbox{}\verb@                          b, C_get_Variance(ans));@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31}{31}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_Variance@\nobreak\ \NWlink{nuweb139a}{139a}, \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb78a}{78a}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb85b}{85b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap64}\raggedright\small
\NWtarget{nuweb34d}{} $\langle\,${\itshape Compute Covariance Linear Statistic}\nobreak\ {\footnotesize {34d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@RC_CovarianceX(x, N, P, weights, subset_block, offset,@\\
\mbox{}\verb@               (R_xlen_t) table[b + 1], ExpX, !DoVarOnly, CovX);@\\
\mbox{}\verb@C_CovarianceLinearStatistic(P, Q, CovInf + b * Q * (Q + 1) / 2,@\\
\mbox{}\verb@                            ExpX, CovX, sumweights[b], b,@\\
\mbox{}\verb@                            C_get_Covariance(ans));@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31}{31}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb77}{77}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb85b}{85b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap65}\raggedright\small
\NWtarget{nuweb35a}{} $\langle\,${\itshape Compute Variance from Covariance}\nobreak\ {\footnotesize {35a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* always return variances */@\\
\mbox{}\verb@if (!C_get_varonly(ans)) {@\\
\mbox{}\verb@    for (int p = 0; p < mPQB(P, Q, 1); p++)@\\
\mbox{}\verb@        C_get_Variance(ans)[p] = C_get_Covariance(ans)[S(p, p, mPQB(P, Q, 1))];@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31}{31}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb139a}{139a}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The computation of permuted linear statistics is done outside this general
function. The user interface is the same, except for an additional number of
permutations to be specified.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap66}\raggedright\small
\NWtarget{nuweb35b}{} $\langle\,${\itshape R_PermutedLinearStatistic Prototype}\nobreak\ {\footnotesize {35b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_PermutedLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb29b}{29b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP nresample@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb36}{, 36}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb36}{36}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap67}\raggedright\small
\NWtarget{nuweb35c}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {35c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_PermutedLinearStatistic(@\\
\mbox{}\verb@    SEXP x, SEXP y, SEXP weights, SEXP subset, SEXP block, SEXP nresample@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_PermutedLinearStatistic");@\\
\mbox{}\verb@    return fun(x, y, weights, subset, block, nresample);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb36}{36}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The dimensions are extracted from the data in the same ways as above. The
function differentiates between the absence and presence of blocks.
Case weights are removed by expanding subset accordingly. Once within-block
permutations were set-up the Kronecker product of \code{X} and \code{Y} is
computed. Note that this function returns the matrix of permuted linear
statistics; the \proglang{R} interface assigns this matrix to the
corresponding element of the \code{LinStatExpCov} object (because we are not
allowed to modify existing \proglang{R} objects at \proglang{C} level).

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap68}\raggedright\small
\NWtarget{nuweb36}{} $\langle\,${\itshape R_PermutedLinearStatistic}\nobreak\ {\footnotesize {36}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_PermutedLinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb35b}{35b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, expand_subset, block_subset, perm, tmp, blockTable;@\\
\mbox{}\verb@    double *linstat;@\\
\mbox{}\verb@    int PQ;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    R_xlen_t inresample;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Dimensions}\nobreak\ {\footnotesize \NWlink{nuweb30c}{30c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    PQ = mPQB(P, Q, 1);@\\
\mbox{}\verb@    N = NROW(y);@\\
\mbox{}\verb@    inresample = (R_xlen_t) REAL(nresample)[0];@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocMatrix(REALSXP, PQ, inresample));@\\
\mbox{}\verb@    PROTECT(expand_subset = RC_setup_subset(N, weights, subset));@\\
\mbox{}\verb@    Nsubset = XLENGTH(expand_subset);@\\
\mbox{}\verb@    PROTECT(tmp = allocVector(REALSXP, Nsubset));@\\
\mbox{}\verb@    PROTECT(perm = allocVector(REALSXP, Nsubset));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    GetRNGstate();@\\
\mbox{}\verb@    if (B == 1) {@\\
\mbox{}\verb@        for (R_xlen_t np = 0; np < inresample; np++) {@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Setup Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb37a}{37a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            C_doPermute(REAL(expand_subset), Nsubset, REAL(tmp), REAL(perm));@\\
\mbox{}\verb@            RC_KronSums_Permutation(x, NROW(x), P, REAL(y), Q, expand_subset,@\\
\mbox{}\verb@                                    Offset0, Nsubset, perm, linstat);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PROTECT(blockTable = allocVector(REALSXP, B + 1));@\\
\mbox{}\verb@        /* same as RC_OneTableSums(block, noweights, expand_subset) */@\\
\mbox{}\verb@        RC_OneTableSums(INTEGER(block), XLENGTH(block), B + 1, weights, subset, Offset0,@\\
\mbox{}\verb@                        XLENGTH(subset), REAL(blockTable));@\\
\mbox{}\verb@        PROTECT(block_subset = RC_order_subset_wrt_block(XLENGTH(block), expand_subset,@\\
\mbox{}\verb@                                                         block, blockTable));@\\
\mbox{}\verb@@\\
\mbox{}\verb@        for (R_xlen_t np = 0; np < inresample; np++) {@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Setup Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb37a}{37a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            C_doPermuteBlock(REAL(block_subset), Nsubset, REAL(blockTable),@\\
\mbox{}\verb@                             B + 1, REAL(tmp), REAL(perm));@\\
\mbox{}\verb@            RC_KronSums_Permutation(x, NROW(x), P, REAL(y), Q, block_subset,@\\
\mbox{}\verb@                                    Offset0, Nsubset, perm, linstat);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        UNPROTECT(2);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    PutRNGstate();@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(4);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29a}{29a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb6}{6}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb35c}{c}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb26e}{26e}, \verb@C_doPermute@\nobreak\ \NWlink{nuweb124b}{124b}, \verb@C_doPermuteBlock@\nobreak\ \NWlink{nuweb125a}{125a}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_KronSums_Permutation@\nobreak\ \NWlink{nuweb100b}{100b}, \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb108a}{108a}, \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb120a}{120a}, \verb@RC_setup_subset@\nobreak\ \NWlink{nuweb123a}{123a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap69}\raggedright\small
\NWtarget{nuweb37a}{} $\langle\,${\itshape Setup Linear Statistic}\nobreak\ {\footnotesize {37a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (np % 256 == 0) R_CheckUserInterrupt();@\\
\mbox{}\verb@linstat = REAL(ans) + PQ * np;@\\
\mbox{}\verb@for (int p = 0; p < PQ; p++)@\\
\mbox{}\verb@    linstat[p] = 0.0;@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb36}{36}\NWlink{nuweb47}{, 47}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This small function takes an object containing permuted linear statistics
and returns the matrix of standardised linear statistics.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap70}\raggedright\small
\NWtarget{nuweb37b}{} $\langle\,${\itshape R_StandardisePermutedLinearStatistic Prototype}\nobreak\ {\footnotesize {37b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_StandardisePermutedLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP LECV@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb38a}{, 38a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap71}\raggedright\small
\NWtarget{nuweb37c}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {37c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_StandardisePermutedLinearStatistic(@\\
\mbox{}\verb@    SEXP LECV@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_StandardisePermutedLinearStatistic");@\\
\mbox{}\verb@    return fun(LECV);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap72}\raggedright\small
\NWtarget{nuweb38a}{} $\langle\,${\itshape R_StandardisePermutedLinearStatistic}\nobreak\ {\footnotesize {38a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_StandardisePermutedLinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb37b}{37b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    R_xlen_t nresample = C_get_nresample(LECV);@\\
\mbox{}\verb@    double *ls;@\\
\mbox{}\verb@    if (!nresample) return(R_NilValue);@\\
\mbox{}\verb@    int PQ = C_get_P(LECV) * C_get_Q(LECV);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocMatrix(REALSXP, PQ, nresample));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (R_xlen_t np = 0; np < nresample; np++) {@\\
\mbox{}\verb@        ls = REAL(ans) + PQ * np;@\\
\mbox{}\verb@        /* copy first; standarisation is in place */@\\
\mbox{}\verb@        for (int p = 0; p < PQ; p++)@\\
\mbox{}\verb@            ls[p] = C_get_PermutedLinearStatistic(LECV)[p + PQ * np];@\\
\mbox{}\verb@        if (C_get_varonly(LECV)) {@\\
\mbox{}\verb@            C_standardise(PQ, ls, C_get_Expectation(LECV),@\\
\mbox{}\verb@                          C_get_Variance(LECV), 1, C_get_tol(LECV));@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_standardise(PQ, ls, C_get_Expectation(LECV),@\\
\mbox{}\verb@                          C_get_Covariance(LECV), 0, C_get_tol(LECV));@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb29a}{29a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb138d}{138d}, \verb@C_get_nresample@\nobreak\ \NWlink{nuweb142a}{142a}, \verb@C_get_P@\nobreak\ \NWlink{nuweb137c}{137c}, \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb142b}{142b}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb137d}{137d}, \verb@C_get_tol@\nobreak\ \NWlink{nuweb142c}{142c}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb139a}{139a}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@C_standardise@\nobreak\ \NWlink{nuweb62a}{62a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Two-Dimensional Case (``2d'')}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap73}\raggedright\small
\NWtarget{nuweb38b}{} $\langle\,${\itshape 2d User Interface}\nobreak\ {\footnotesize {38b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_ExpectationCovarianceStatistic_2d}\nobreak\ {\footnotesize \NWlink{nuweb44}{44}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ExpectationCovarianceStatistic_2d}\nobreak\ {\footnotesize \NWlink{nuweb40a}{40a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_PermutedLinearStatistic_2d}\nobreak\ {\footnotesize \NWlink{nuweb47}{47}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap74}\raggedright\small
\NWtarget{nuweb38c}{} $\langle\,${\itshape 2d User Interface Input}\nobreak\ {\footnotesize {38c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@SEXP ix,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@SEXP iy,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb39a}{39a}\NWlink{nuweb44}{, 44}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap75}\raggedright\small
\NWtarget{nuweb39a}{} $\langle\,${\itshape R_ExpectationCovarianceStatistic_2d Prototype}\nobreak\ {\footnotesize {39a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_ExpectationCovarianceStatistic_2d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape 2d User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb38c}{38c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP varonly,@\\
\mbox{}\verb@    SEXP tol@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb40a}{, 40a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb40a}{40a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap76}\raggedright\small
\NWtarget{nuweb39b}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {39b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_ExpectationCovarianceStatistic_2d(@\\
\mbox{}\verb@    SEXP x, SEXP ix, SEXP y, SEXP iy, SEXP weights, SEXP subset, SEXP block,@\\
\mbox{}\verb@    SEXP varonly, SEXP tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_ExpectationCovarianceStatistic_2d");@\\
\mbox{}\verb@    return fun(x, ix, y, iy, weights, subset, block, varonly, tol);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb40a}{40a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap77}\raggedright\small
\NWtarget{nuweb40a}{} $\langle\,${\itshape R_ExpectationCovarianceStatistic_2d}\nobreak\ {\footnotesize {40a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ExpectationCovarianceStatistic_2d Prototype}\nobreak\ {\footnotesize \NWlink{nuweb39a}{39a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    int Xfactor;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    N = XLENGTH(ix);@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@    Xfactor = XLENGTH(x) == 0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Dimensions 2d}\nobreak\ {\footnotesize \NWlink{nuweb40b}{40b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = RC_init_LECV_2d(P, Q, INTEGER(varonly)[0],@\\
\mbox{}\verb@                                  Lx, Ly, B, Xfactor, REAL(tol)[0]));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (B == 1) {@\\
\mbox{}\verb@        RC_TwoTableSums(INTEGER(ix), N, Lx + 1, INTEGER(iy), Ly + 1,@\\
\mbox{}\verb@                        weights, subset, Offset0, Nsubset,@\\
\mbox{}\verb@                        C_get_Table(ans));@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        RC_ThreeTableSums(INTEGER(ix), N, Lx + 1, INTEGER(iy), Ly + 1,@\\
\mbox{}\verb@                          INTEGER(block), B, weights, subset, Offset0, Nsubset,@\\
\mbox{}\verb@                          C_get_Table(ans));@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    RC_ExpectationCovarianceStatistic_2d(x, ix, y, iy, weights,@\\
\mbox{}\verb@                                         subset, block, ans);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb38b}{38b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb39a}{, 39a}\NWlink{nuweb39b}{b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@C_get_Table@\nobreak\ \NWlink{nuweb141b}{141b}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_init_LECV_2d@\nobreak\ \NWlink{nuweb146}{146}, \verb@RC_ThreeTableSums@\nobreak\ \NWlink{nuweb116a}{116a}, \verb@RC_TwoTableSums@\nobreak\ \NWlink{nuweb112a}{112a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap78}\raggedright\small
\NWtarget{nuweb40b}{} $\langle\,${\itshape Setup Dimensions 2d}\nobreak\ {\footnotesize {40b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int P, Q, B, Lx, Ly;@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (XLENGTH(x) == 0) {@\\
\mbox{}\verb@    P = NLEVELS(ix);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    P = NCOL(x);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@Q = NCOL(y);@\\
\mbox{}\verb@@\\
\mbox{}\verb@B = 1;@\\
\mbox{}\verb@if (XLENGTH(block) > 0)@\\
\mbox{}\verb@    B = NLEVELS(block);@\\
\mbox{}\verb@@\\
\mbox{}\verb@Lx = NLEVELS(ix);@\\
\mbox{}\verb@Ly = NLEVELS(iy);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb40a}{40a}\NWlink{nuweb47}{, 47}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb127a}{127a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap79}\raggedright\small
\NWtarget{nuweb41a}{} $\langle\,${\itshape Linear Statistic 2d}\nobreak\ {\footnotesize {41a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (Xfactor) {@\\
\mbox{}\verb@    for (int j = 1; j < Lyp1; j++) {     /* j = 0 means NA */@\\
\mbox{}\verb@        for (int i = 1; i < Lxp1; i++) { /* i = 0 means NA */@\\
\mbox{}\verb@            for (int q = 0; q < Q; q++)@\\
\mbox{}\verb@                linstat[q * (Lxp1 - 1) + (i - 1)] +=@\\
\mbox{}\verb@                    btab[j * Lxp1 + i] * REAL(y)[q * Lyp1 + j];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@        for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@            int qPp = q * P + p;@\\
\mbox{}\verb@            int qLy = q * Lyp1;@\\
\mbox{}\verb@            for (int i = 0; i < Lxp1; i++) {@\\
\mbox{}\verb@                int pLxi = p * Lxp1 + i;@\\
\mbox{}\verb@                for (int j = 0; j < Lyp1; j++)@\\
\mbox{}\verb@                    linstat[qPp] += REAL(y)[qLy + j] * REAL(x)[pLxi] * btab[j * Lxp1 + i];@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb44}{44}\NWlink{nuweb48d}{, 48d}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap80}\raggedright\small
\NWtarget{nuweb41b}{} $\langle\,${\itshape 2d Total Table}\nobreak\ {\footnotesize {41b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@for (int i = 0; i < Lxp1 * Lyp1; i++)@\\
\mbox{}\verb@    table2d[i] = 0.0;@\\
\mbox{}\verb@for (int b = 0; b < B; b++) {@\\
\mbox{}\verb@    for (int i = 0; i < Lxp1; i++) {@\\
\mbox{}\verb@        for (int j = 0; j < Lyp1; j++)@\\
\mbox{}\verb@            table2d[j * Lxp1 + i] += table[b * Lxp1 * Lyp1 + j * Lxp1 + i];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb44}{44}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap81}\raggedright\small
\NWtarget{nuweb42a}{} $\langle\,${\itshape Col Row Total Sums}\nobreak\ {\footnotesize {42a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* Remember: first row / column count NAs */@\\
\mbox{}\verb@/* column sums */@\\
\mbox{}\verb@for (int q = 1; q < Lyp1; q++) {@\\
\mbox{}\verb@    csum[q] = 0;@\\
\mbox{}\verb@    for (int p = 1; p < Lxp1; p++)@\\
\mbox{}\verb@        csum[q] += btab[q * Lxp1 + p];@\\
\mbox{}\verb@}@\\
\mbox{}\verb@csum[0] = 0; /* NA */@\\
\mbox{}\verb@/* row sums */@\\
\mbox{}\verb@for (int p = 1; p < Lxp1; p++) {@\\
\mbox{}\verb@    rsum[p] = 0;@\\
\mbox{}\verb@    for (int q = 1; q < Lyp1; q++)@\\
\mbox{}\verb@        rsum[p] += btab[q * Lxp1 + p];@\\
\mbox{}\verb@}@\\
\mbox{}\verb@rsum[0] = 0; /* NA */@\\
\mbox{}\verb@/* total sum */@\\
\mbox{}\verb@sumweights[b] = 0;@\\
\mbox{}\verb@for (int i = 1; i < Lxp1; i++) sumweights[b] += rsum[i];@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb44}{44}\NWlink{nuweb47}{, 47}.
\item \NWtxtIdentsUsed\nobreak\  \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap82}\raggedright\small
\NWtarget{nuweb42b}{} $\langle\,${\itshape 2d Expectation}\nobreak\ {\footnotesize {42b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@RC_ExpectationInfluence(NROW(y), y, Q, Rcsum, subset, Offset0, 0, sumweights[b], ExpInf);@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (LENGTH(x) == 0) {@\\
\mbox{}\verb@    for (int p = 0; p < P; p++)@\\
\mbox{}\verb@        ExpX[p] = rsum[p + 1];@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        RC_ExpectationX(x, NROW(x), P, Rrsum, subset, Offset0, 0, ExpX);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@C_ExpectationLinearStatistic(P, Q, ExpInf, ExpX, b, C_get_Expectation(ans));@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb44}{44}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_ExpectationLinearStatistic@\nobreak\ \NWlink{nuweb76b}{76b}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb138d}{138d}, \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb79c}{79c}, \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb83b}{83b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap83}\raggedright\small
\NWtarget{nuweb43}{} $\langle\,${\itshape 2d Covariance}\nobreak\ {\footnotesize {43}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* C_ordered_Xfactor needs both VarInf and CovInf */@\\
\mbox{}\verb@RC_CovarianceInfluence(NROW(y), y, Q, Rcsum, subset, Offset0, 0, ExpInf, sumweights[b],@\\
\mbox{}\verb@                       !DoVarOnly, C_get_CovarianceInfluence(ans));@\\
\mbox{}\verb@for (int q = 0; q < Q; q++)@\\
\mbox{}\verb@    C_get_VarianceInfluence(ans)[q] = C_get_CovarianceInfluence(ans)[S(q, q, Q)];@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (C_get_varonly(ans)) {@\\
\mbox{}\verb@    if (LENGTH(x) == 0) {@\\
\mbox{}\verb@        for (int p = 0; p < P; p++) CovX[p] = ExpX[p];@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        RC_CovarianceX(x, NROW(x), P, Rrsum, subset, Offset0, 0, ExpX, DoVarOnly, CovX);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    C_VarianceLinearStatistic(P, Q, C_get_VarianceInfluence(ans),@\\
\mbox{}\verb@                              ExpX, CovX, sumweights[b], b,@\\
\mbox{}\verb@                              C_get_Variance(ans));@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    if (LENGTH(x) == 0) {@\\
\mbox{}\verb@        for (int p = 0; p < PP12(P); p++) CovX[p] = 0.0;@\\
\mbox{}\verb@        for (int p = 0; p < P; p++) CovX[S(p, p, P)] = ExpX[p];@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        RC_CovarianceX(x, NROW(x), P, Rrsum, subset, Offset0, 0, ExpX, !DoVarOnly, CovX);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    C_CovarianceLinearStatistic(P, Q, C_get_CovarianceInfluence(ans),@\\
\mbox{}\verb@                                ExpX, CovX, sumweights[b], b,@\\
\mbox{}\verb@                                C_get_Covariance(ans));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb44}{44}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb77}{77}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb139a}{139a}, \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb140c}{140c}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@C_ordered_Xfactor@\nobreak\ \NWlink{nuweb68}{68}, \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb78a}{78a}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@PP12@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_CovarianceInfluence@\nobreak\ \NWlink{nuweb82a}{82a}, \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb85b}{85b}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap84}\raggedright\small
\NWtarget{nuweb44}{} $\langle\,${\itshape RC_ExpectationCovarianceStatistic_2d}\nobreak\ {\footnotesize {44}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_ExpectationCovarianceStatistic_2d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape 2d User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb38c}{38c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape 2d Memory}\nobreak\ {\footnotesize \NWlink{nuweb45}{45}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape 2d Total Table}\nobreak\ {\footnotesize \NWlink{nuweb41b}{41b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    linstat = C_get_LinearStatistic(ans);@\\
\mbox{}\verb@    for (int p = 0; p < mPQB(P, Q, 1); p++)@\\
\mbox{}\verb@        linstat[p] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int b = 0; b < B; b++) {@\\
\mbox{}\verb@        btab = table + Lxp1 * Lyp1 * b;@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Linear Statistic 2d}\nobreak\ {\footnotesize \NWlink{nuweb41a}{41a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Col Row Total Sums}\nobreak\ {\footnotesize \NWlink{nuweb42a}{42a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape 2d Expectation}\nobreak\ {\footnotesize \NWlink{nuweb42b}{42b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape 2d Covariance}\nobreak\ {\footnotesize \NWlink{nuweb43}{43}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* always return variances */@\\
\mbox{}\verb@    if (!C_get_varonly(ans)) {@\\
\mbox{}\verb@        for (int p = 0; p < mPQB(P, Q, 1); p++)@\\
\mbox{}\verb@            C_get_Variance(ans)[p] = C_get_Covariance(ans)[S(p, p, mPQB(P, Q, 1))];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    R_Free(CovX);@\\
\mbox{}\verb@    R_Free(table2d);@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb38b}{38b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}\NWlink{nuweb31}{, 31}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb138c}{138c}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb139a}{139a}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap85}\raggedright\small
\NWtarget{nuweb45}{} $\langle\,${\itshape 2d Memory}\nobreak\ {\footnotesize {45}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP Rcsum, Rrsum;@\\
\mbox{}\verb@int P, Q, Lxp1, Lyp1, B, Xfactor;@\\
\mbox{}\verb@double *ExpInf, *ExpX, *CovX;@\\
\mbox{}\verb@double *table, *table2d, *csum, *rsum, *sumweights, *btab, *linstat;@\\
\mbox{}\verb@@\\
\mbox{}\verb@P = C_get_P(ans);@\\
\mbox{}\verb@Q = C_get_Q(ans);@\\
\mbox{}\verb@@\\
\mbox{}\verb@ExpInf = C_get_ExpectationInfluence(ans);@\\
\mbox{}\verb@ExpX = C_get_ExpectationX(ans);@\\
\mbox{}\verb@table = C_get_Table(ans);@\\
\mbox{}\verb@sumweights = C_get_Sumweights(ans);@\\
\mbox{}\verb@@\\
\mbox{}\verb@Lxp1 = C_get_dimTable(ans)[0];@\\
\mbox{}\verb@Lyp1 = C_get_dimTable(ans)[1];@\\
\mbox{}\verb@B = C_get_B(ans);@\\
\mbox{}\verb@Xfactor = C_get_Xfactor(ans);@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (C_get_varonly(ans)) {@\\
\mbox{}\verb@    CovX = R_Calloc(P, double);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    CovX = R_Calloc(PP12(P), double);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@table2d = R_Calloc(Lxp1 * Lyp1, double);@\\
\mbox{}\verb@PROTECT(Rcsum = allocVector(REALSXP, Lyp1));@\\
\mbox{}\verb@csum = REAL(Rcsum);@\\
\mbox{}\verb@PROTECT(Rrsum = allocVector(REALSXP, Lxp1));@\\
\mbox{}\verb@rsum = REAL(Rrsum);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb44}{44}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@C_get_B@\nobreak\ \NWlink{nuweb141d}{141d}, \verb@C_get_dimTable@\nobreak\ \NWlink{nuweb141c}{141c}, \verb@C_get_ExpectationInfluence@\nobreak\ \NWlink{nuweb140a}{140a}, \verb@C_get_ExpectationX@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@C_get_P@\nobreak\ \NWlink{nuweb137c}{137c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb137d}{137d}, \verb@C_get_Sumweights@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@C_get_Table@\nobreak\ \NWlink{nuweb141b}{141b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@C_get_Xfactor@\nobreak\ \NWlink{nuweb138b}{138b}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@PP12@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<permutations-2d>>=
LinStatExpCov(X = iX2d, ix = ix, Y = iY2d, iy = iy,
              weights = weights, subset = subset, nresample = 10)$PermutedLinearStatistic
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap86}\raggedright\small
\NWtarget{nuweb46a}{} $\langle\,${\itshape R_PermutedLinearStatistic_2d Prototype}\nobreak\ {\footnotesize {46a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_PermutedLinearStatistic_2d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP ix,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP iy,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP nresample,@\\
\mbox{}\verb@    SEXP itable@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb47}{, 47}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb47}{47}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap87}\raggedright\small
\NWtarget{nuweb46b}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {46b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_PermutedLinearStatistic_2d(@\\
\mbox{}\verb@    SEXP x, SEXP ix, SEXP y, SEXP iy, SEXP block, SEXP nresample,@\\
\mbox{}\verb@    SEXP itable@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_PermutedLinearStatistic_2d");@\\
\mbox{}\verb@    return fun(x, ix, y, iy, block, nresample, itable);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb47}{47}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap88}\raggedright\small
\NWtarget{nuweb47}{} $\langle\,${\itshape R_PermutedLinearStatistic_2d}\nobreak\ {\footnotesize {47}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_PermutedLinearStatistic_2d Prototype}\nobreak\ {\footnotesize \NWlink{nuweb46a}{46a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, Ritable;@\\
\mbox{}\verb@    int *csum, *rsum, *sumweights, *jwork, *table, *rtable2, maxn = 0, Lxp1, Lyp1, *btab, PQ, Xfactor;@\\
\mbox{}\verb@    R_xlen_t inresample;@\\
\mbox{}\verb@    double *fact, *linstat;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Dimensions 2d}\nobreak\ {\footnotesize \NWlink{nuweb40b}{40b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PQ = mPQB(P, Q, 1);@\\
\mbox{}\verb@    Xfactor = XLENGTH(x) == 0;@\\
\mbox{}\verb@    Lxp1 = Lx + 1;@\\
\mbox{}\verb@    Lyp1 = Ly + 1;@\\
\mbox{}\verb@    inresample = (R_xlen_t) REAL(nresample)[0];@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocMatrix(REALSXP, PQ, inresample));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Working Memory}\nobreak\ {\footnotesize \NWlink{nuweb48b}{48b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Convert Table to Integer}\nobreak\ {\footnotesize \NWlink{nuweb48a}{48a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int b = 0; b < B; b++) {@\\
\mbox{}\verb@        btab = INTEGER(Ritable) + Lxp1 * Lyp1 * b;@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Col Row Total Sums}\nobreak\ {\footnotesize \NWlink{nuweb42a}{42a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@        if (sumweights[b] > maxn) maxn = sumweights[b];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Log-Factorials}\nobreak\ {\footnotesize \NWlink{nuweb48c}{48c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    GetRNGstate();@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (R_xlen_t np = 0; np < inresample; np++) {@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Setup Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb37a}{37a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        for (int p = 0; p < Lxp1 * Lyp1; p++)@\\
\mbox{}\verb@            table[p] = 0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@        for (int b = 0; b < B; b++) {@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute Permuted Linear Statistic 2d}\nobreak\ {\footnotesize \NWlink{nuweb48d}{48d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PutRNGstate();@\\
\mbox{}\verb@@\\
\mbox{}\verb@    R_Free(csum); R_Free(rsum); R_Free(sumweights); R_Free(rtable2);@\\
\mbox{}\verb@    R_Free(jwork); R_Free(fact); R_Free(table);@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb38b}{38b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb46b}{b}\NWlink{nuweb48a}{, 48a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap89}\raggedright\small
\NWtarget{nuweb48a}{} $\langle\,${\itshape Convert Table to Integer}\nobreak\ {\footnotesize {48a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@PROTECT(Ritable = allocVector(INTSXP, LENGTH(itable)));@\\
\mbox{}\verb@for (int i = 0; i < LENGTH(itable); i++) {@\\
\mbox{}\verb@    if (REAL(itable)[i] > INT_MAX)@\\
\mbox{}\verb@        error("cannot deal with weights larger INT_MAX in R_PermutedLinearStatistic_2d");@\\
\mbox{}\verb@    INTEGER(Ritable)[i] = (int) REAL(itable)[i];@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb47}{47}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb47}{47}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap90}\raggedright\small
\NWtarget{nuweb48b}{} $\langle\,${\itshape Setup Working Memory}\nobreak\ {\footnotesize {48b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@csum = R_Calloc(Lyp1 * B, int);@\\
\mbox{}\verb@rsum = R_Calloc(Lxp1 * B, int);@\\
\mbox{}\verb@sumweights = R_Calloc(B, int);@\\
\mbox{}\verb@table = R_Calloc(Lxp1 * Lyp1, int);@\\
\mbox{}\verb@rtable2 = R_Calloc(Lx * Ly , int);@\\
\mbox{}\verb@jwork = R_Calloc(Lyp1, int);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb47}{47}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap91}\raggedright\small
\NWtarget{nuweb48c}{} $\langle\,${\itshape Setup Log-Factorials}\nobreak\ {\footnotesize {48c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@fact = R_Calloc(maxn + 1, double);@\\
\mbox{}\verb@/* Calculate log-factorials.  fact[i] = lgamma(i+1) */@\\
\mbox{}\verb@fact[0] = fact[1] = 0.;@\\
\mbox{}\verb@for (int j = 2; j <= maxn; j++)@\\
\mbox{}\verb@    fact[j] = fact[j - 1] + log(j);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb47}{47}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Note: the interface to \code{S_rcont2} changed in \textsf{R}-4.1.0.
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap92}\raggedright\small
\NWtarget{nuweb48d}{} $\langle\,${\itshape Compute Permuted Linear Statistic 2d}\nobreak\ {\footnotesize {48d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@#if defined(R_VERSION) && R_VERSION >= R_Version(4, 1, 0)@\\
\mbox{}\verb@            S_rcont2(Lx, Ly,@\\
\mbox{}\verb@                     rsum + Lxp1 * b + 1,@\\
\mbox{}\verb@                     csum + Lyp1 * b + 1,@\\
\mbox{}\verb@                     sumweights[b], fact, jwork, rtable2);@\\
\mbox{}\verb@#else@\\
\mbox{}\verb@            S_rcont2(&Lx, &Ly,@\\
\mbox{}\verb@                     rsum + Lxp1 * b + 1,@\\
\mbox{}\verb@                     csum + Lyp1 * b + 1,@\\
\mbox{}\verb@                     sumweights + b, fact, jwork, rtable2);@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int j1 = 1; j1 <= Lx; j1++) {@\\
\mbox{}\verb@    for (int j2 = 1; j2 <= Ly; j2++)@\\
\mbox{}\verb@        table[j2 * Lxp1 + j1] = rtable2[(j2 - 1) * Lx + (j1 - 1)];@\\
\mbox{}\verb@}@\\
\mbox{}\verb@btab = table;@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Linear Statistic 2d}\nobreak\ {\footnotesize \NWlink{nuweb41a}{41a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb47}{47}.
\item \NWtxtIdentsUsed\nobreak\  \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Tests}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap93}\raggedright\small
\NWtarget{nuweb49a}{} $\langle\,${\itshape Tests}\nobreak\ {\footnotesize {49a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_QuadraticTest}\nobreak\ {\footnotesize \NWlink{nuweb50}{50}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_MaximumTest}\nobreak\ {\footnotesize \NWlink{nuweb53}{53}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_MaximallySelectedTest}\nobreak\ {\footnotesize \NWlink{nuweb55}{55}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap94}\raggedright\small
\NWtarget{nuweb49b}{} $\langle\,${\itshape R_QuadraticTest Prototype}\nobreak\ {\footnotesize {49b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_QuadraticTest@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP pvalue,@\\
\mbox{}\verb@    SEXP lower,@\\
\mbox{}\verb@    SEXP give_log,@\\
\mbox{}\verb@    SEXP PermutedStatistics@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb50}{, 50}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap95}\raggedright\small
\NWtarget{nuweb49c}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {49c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_QuadraticTest(@\\
\mbox{}\verb@    SEXP LECV, SEXP pvalue, SEXP lower, SEXP give_log, SEXP PermutedStatistics@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP, SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_QuadraticTest");@\\
\mbox{}\verb@    return fun(LECV, pvalue, lower, give_log, PermutedStatistics);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap96}\raggedright\small
\NWtarget{nuweb50}{} $\langle\,${\itshape R_QuadraticTest}\nobreak\ {\footnotesize {50}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_QuadraticTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb49b}{49b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, stat, pval, names, permstat;@\\
\mbox{}\verb@    double *MPinv, *ls, st, pst, *ex;@\\
\mbox{}\verb@    int rank, P, Q, PQ, greater = 0;@\\
\mbox{}\verb@    R_xlen_t nresample;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Test Memory}\nobreak\ {\footnotesize \NWlink{nuweb51a}{51a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    MPinv = R_Calloc(PP12(PQ), double); /* was: C_get_MPinv(LECV); */@\\
\mbox{}\verb@    C_MPinv_sym(C_get_Covariance(LECV), PQ, C_get_tol(LECV), MPinv, &rank);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    REAL(stat)[0] = C_quadform(PQ, C_get_LinearStatistic(LECV),@\\
\mbox{}\verb@                               C_get_Expectation(LECV), MPinv);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (!PVALUE) {@\\
\mbox{}\verb@        UNPROTECT(2);@\\
\mbox{}\verb@        R_Free(MPinv);@\\
\mbox{}\verb@        return(ans);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (C_get_nresample(LECV) == 0) {@\\
\mbox{}\verb@        REAL(pval)[0] = C_chisq_pvalue(REAL(stat)[0], rank, LOWER, GIVELOG);@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        nresample = C_get_nresample(LECV);@\\
\mbox{}\verb@        ls = C_get_PermutedLinearStatistic(LECV);@\\
\mbox{}\verb@        st = REAL(stat)[0];@\\
\mbox{}\verb@        ex = C_get_Expectation(LECV);@\\
\mbox{}\verb@        greater = 0;@\\
\mbox{}\verb@        for (R_xlen_t np = 0; np < nresample; np++) {@\\
\mbox{}\verb@            pst = C_quadform(PQ, ls + PQ * np, ex, MPinv);@\\
\mbox{}\verb@            if (GE(pst, st, C_get_tol(LECV)))@\\
\mbox{}\verb@                greater++;@\\
\mbox{}\verb@            if (PSTAT) REAL(permstat)[np] = pst;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        REAL(pval)[0] = C_perm_pvalue(greater, nresample, LOWER, GIVELOG);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    R_Free(MPinv);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb49a}{49a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_chisq_pvalue@\nobreak\ \NWlink{nuweb62c}{62c}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb138d}{138d}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb138c}{138c}, \verb@C_get_nresample@\nobreak\ \NWlink{nuweb142a}{142a}, \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb142b}{142b}, \verb@C_get_tol@\nobreak\ \NWlink{nuweb142c}{142c}, \verb@C_perm_pvalue@\nobreak\ \NWlink{nuweb63}{63}, \verb@C_quadform@\nobreak\ \NWlink{nuweb61a}{61a}, \verb@GE@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@PP12@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap97}\raggedright\small
\NWtarget{nuweb51a}{} $\langle\,${\itshape Setup Test Memory}\nobreak\ {\footnotesize {51a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@P = C_get_P(LECV);@\\
\mbox{}\verb@Q = C_get_Q(LECV);@\\
\mbox{}\verb@PQ = mPQB(P, Q, 1);@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (C_get_varonly(LECV) && PQ > 1)@\\
\mbox{}\verb@        error("cannot compute adjusted p-value based on variances only");@\\
\mbox{}\verb@/*  if (C_get_nresample(LECV) > 0 && INTEGER(PermutedStatistics)[0]) { */@\\
\mbox{}\verb@    PROTECT(ans = allocVector(VECSXP, 3));@\\
\mbox{}\verb@    PROTECT(names = allocVector(STRSXP, 3));@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, 2, permstat = allocVector(REALSXP, C_get_nresample(LECV)));@\\
\mbox{}\verb@    SET_STRING_ELT(names, 2, mkChar("PermutedStatistics"));@\\
\mbox{}\verb@/*  } else {@\\
\mbox{}\verb@    PROTECT(ans = allocVector(VECSXP, 2));@\\
\mbox{}\verb@    PROTECT(names = allocVector(STRSXP, 2));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@*/@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, 0, stat = allocVector(REALSXP, 1));@\\
\mbox{}\verb@SET_STRING_ELT(names, 0, mkChar("TestStatistic"));@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, 1, pval = allocVector(REALSXP, 1));@\\
\mbox{}\verb@SET_STRING_ELT(names, 1, mkChar("p.value"));@\\
\mbox{}\verb@namesgets(ans, names);@\\
\mbox{}\verb@REAL(pval)[0] = NA_REAL;@\\
\mbox{}\verb@int LOWER = INTEGER(lower)[0];@\\
\mbox{}\verb@int GIVELOG = INTEGER(give_log)[0];@\\
\mbox{}\verb@int PVALUE = INTEGER(pvalue)[0];@\\
\mbox{}\verb@int PSTAT = INTEGER(PermutedStatistics)[0];@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb50}{50}\NWlink{nuweb53}{, 53}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_nresample@\nobreak\ \NWlink{nuweb142a}{142a}, \verb@C_get_P@\nobreak\ \NWlink{nuweb137c}{137c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb137d}{137d}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap98}\raggedright\small
\NWtarget{nuweb51b}{} $\langle\,${\itshape R_MaximumTest Prototype}\nobreak\ {\footnotesize {51b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_MaximumTest@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP alternative,@\\
\mbox{}\verb@    SEXP pvalue,@\\
\mbox{}\verb@    SEXP lower,@\\
\mbox{}\verb@    SEXP give_log,@\\
\mbox{}\verb@    SEXP PermutedStatistics,@\\
\mbox{}\verb@    SEXP maxpts,@\\
\mbox{}\verb@    SEXP releps,@\\
\mbox{}\verb@    SEXP abseps@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb53}{, 53}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap99}\raggedright\small
\NWtarget{nuweb52}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {52}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_MaximumTest(@\\
\mbox{}\verb@    SEXP LECV, SEXP alternative, SEXP pvalue, SEXP lower, SEXP give_log,@\\
\mbox{}\verb@    SEXP PermutedStatistics, SEXP maxpts, SEXP releps, SEXP abseps@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@  static SEXP(*fun)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_MaximumTest");@\\
\mbox{}\verb@    return fun(LECV, alternative, pvalue, lower, give_log, PermutedStatistics, maxpts, releps,@\\
\mbox{}\verb@               abseps);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap100}\raggedright\small
\NWtarget{nuweb53}{} $\langle\,${\itshape R_MaximumTest}\nobreak\ {\footnotesize {53}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_MaximumTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb51b}{51b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, stat, pval, names, permstat;@\\
\mbox{}\verb@    double st, pst, *ex, *cv, *ls, tl;@\\
\mbox{}\verb@    int P, Q, PQ, vo, alt, greater;@\\
\mbox{}\verb@    R_xlen_t nresample;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Test Memory}\nobreak\ {\footnotesize \NWlink{nuweb51a}{51a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (C_get_varonly(LECV)) {@\\
\mbox{}\verb@        cv = C_get_Variance(LECV);@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        cv = C_get_Covariance(LECV);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    REAL(stat)[0] = C_maxtype(PQ, C_get_LinearStatistic(LECV),@\\
\mbox{}\verb@        C_get_Expectation(LECV), cv, C_get_varonly(LECV), C_get_tol(LECV),@\\
\mbox{}\verb@        INTEGER(alternative)[0]);@\\
\mbox{}\verb@    if (!PVALUE) {@\\
\mbox{}\verb@        UNPROTECT(2);@\\
\mbox{}\verb@        return(ans);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (C_get_nresample(LECV) == 0) {@\\
\mbox{}\verb@        if (C_get_varonly(LECV) && PQ > 1) {@\\
\mbox{}\verb@            REAL(pval)[0] = NA_REAL;@\\
\mbox{}\verb@            UNPROTECT(2);@\\
\mbox{}\verb@            return(ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        REAL(pval)[0] = C_maxtype_pvalue(REAL(stat)[0], cv,@\\
\mbox{}\verb@            PQ, INTEGER(alternative)[0], LOWER, GIVELOG, INTEGER(maxpts)[0],@\\
\mbox{}\verb@            REAL(releps)[0], REAL(abseps)[0], C_get_tol(LECV));@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        nresample = C_get_nresample(LECV);@\\
\mbox{}\verb@        ls = C_get_PermutedLinearStatistic(LECV);@\\
\mbox{}\verb@        ex = C_get_Expectation(LECV);@\\
\mbox{}\verb@        vo = C_get_varonly(LECV);@\\
\mbox{}\verb@        alt = INTEGER(alternative)[0];@\\
\mbox{}\verb@        st = REAL(stat)[0];@\\
\mbox{}\verb@        tl = C_get_tol(LECV);@\\
\mbox{}\verb@        greater = 0;@\\
\mbox{}\verb@        for (R_xlen_t np = 0; np < nresample; np++) {@\\
\mbox{}\verb@            pst = C_maxtype(PQ, ls + PQ * np, ex, cv, vo, tl, alt);@\\
\mbox{}\verb@            if (alt == ALTERNATIVE_less) {@\\
\mbox{}\verb@                if (LE(pst, st, tl)) greater++;@\\
\mbox{}\verb@            } else {@\\
\mbox{}\verb@                if (GE(pst, st, tl)) greater++;@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@            if (PSTAT) REAL(permstat)[np] = pst;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        REAL(pval)[0] = C_perm_pvalue(greater, nresample, LOWER, GIVELOG);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb49a}{49a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@ALTERNATIVE_less@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb138d}{138d}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb138c}{138c}, \verb@C_get_nresample@\nobreak\ \NWlink{nuweb142a}{142a}, \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb142b}{142b}, \verb@C_get_tol@\nobreak\ \NWlink{nuweb142c}{142c}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb139a}{139a}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@C_maxtype@\nobreak\ \NWlink{nuweb61b}{61b}, \verb@C_maxtype_pvalue@\nobreak\ \NWlink{nuweb65}{65}, \verb@C_perm_pvalue@\nobreak\ \NWlink{nuweb63}{63}, \verb@GE@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@LE@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap101}\raggedright\small
\NWtarget{nuweb54a}{} $\langle\,${\itshape R_MaximallySelectedTest Prototype}\nobreak\ {\footnotesize {54a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_MaximallySelectedTest@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP LECV,@\\
\mbox{}\verb@    SEXP ordered,@\\
\mbox{}\verb@    SEXP teststat,@\\
\mbox{}\verb@    SEXP minbucket,@\\
\mbox{}\verb@    SEXP lower,@\\
\mbox{}\verb@    SEXP give_log@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb55}{, 55}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap102}\raggedright\small
\NWtarget{nuweb54b}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {54b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_MaximallySelectedTest(@\\
\mbox{}\verb@    SEXP LECV, SEXP ordered, SEXP teststat, SEXP minbucket, SEXP lower, SEXP give_log@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_MaximallySelectedTest");@\\
\mbox{}\verb@    return fun(LECV, ordered, teststat, minbucket, lower, give_log);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap103}\raggedright\small
\NWtarget{nuweb55}{} $\langle\,${\itshape R_MaximallySelectedTest}\nobreak\ {\footnotesize {55}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_MaximallySelectedTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb54a}{54a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, index, stat, pval, names, permstat;@\\
\mbox{}\verb@    int P, mb;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    P = C_get_P(LECV);@\\
\mbox{}\verb@    mb = INTEGER(minbucket)[0];@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(VECSXP, 4));@\\
\mbox{}\verb@    PROTECT(names = allocVector(STRSXP, 4));@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, 0, stat = allocVector(REALSXP, 1));@\\
\mbox{}\verb@    SET_STRING_ELT(names, 0, mkChar("TestStatistic"));@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, 1, pval = allocVector(REALSXP, 1));@\\
\mbox{}\verb@    SET_STRING_ELT(names, 1, mkChar("p.value"));@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, 3, permstat = allocVector(REALSXP, C_get_nresample(LECV)));@\\
\mbox{}\verb@    SET_STRING_ELT(names, 3, mkChar("PermutedStatistics"));@\\
\mbox{}\verb@    REAL(pval)[0] = NA_REAL;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (INTEGER(ordered)[0]) {@\\
\mbox{}\verb@        SET_VECTOR_ELT(ans, 2, index = allocVector(INTSXP, 1));@\\
\mbox{}\verb@        C_ordered_Xfactor(LECV, mb, INTEGER(teststat)[0],@\\
\mbox{}\verb@                          INTEGER(index), REAL(stat), REAL(permstat),@\\
\mbox{}\verb@                          REAL(pval), INTEGER(lower)[0],@\\
\mbox{}\verb@                          INTEGER(give_log)[0]);@\\
\mbox{}\verb@        if (REAL(stat)[0] > 0)@\\
\mbox{}\verb@            INTEGER(index)[0]++; /* R style indexing */@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        SET_VECTOR_ELT(ans, 2, index = allocVector(INTSXP, P));@\\
\mbox{}\verb@        C_unordered_Xfactor(LECV, mb, INTEGER(teststat)[0],@\\
\mbox{}\verb@                            INTEGER(index), REAL(stat), REAL(permstat),@\\
\mbox{}\verb@                            REAL(pval), INTEGER(lower)[0],@\\
\mbox{}\verb@                            INTEGER(give_log)[0]);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    SET_STRING_ELT(names, 2, mkChar("index"));@\\
\mbox{}\verb@    namesgets(ans, names);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb49a}{49a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_nresample@\nobreak\ \NWlink{nuweb142a}{142a}, \verb@C_get_P@\nobreak\ \NWlink{nuweb137c}{137c}, \verb@C_ordered_Xfactor@\nobreak\ \NWlink{nuweb68}{68}, \verb@C_unordered_Xfactor@\nobreak\ \NWlink{nuweb72}{72}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Test Statistics}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap104}\raggedright\small
\NWtarget{nuweb56a}{} $\langle\,${\itshape Test Statistics}\nobreak\ {\footnotesize {56a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_maxstand_Covariance}\nobreak\ {\footnotesize \NWlink{nuweb56b}{56b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_maxstand_Variance}\nobreak\ {\footnotesize \NWlink{nuweb57a}{57a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_minstand_Covariance}\nobreak\ {\footnotesize \NWlink{nuweb57b}{57b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_minstand_Variance}\nobreak\ {\footnotesize \NWlink{nuweb58a}{58a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_maxabsstand_Covariance}\nobreak\ {\footnotesize \NWlink{nuweb58b}{58b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_maxabsstand_Variance}\nobreak\ {\footnotesize \NWlink{nuweb59a}{59a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_quadform}\nobreak\ {\footnotesize \NWlink{nuweb61a}{61a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_quadform}\nobreak\ {\footnotesize \NWlink{nuweb60b}{60b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_maxtype}\nobreak\ {\footnotesize \NWlink{nuweb61b}{61b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_standardise}\nobreak\ {\footnotesize \NWlink{nuweb62a}{62a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_ordered_Xfactor}\nobreak\ {\footnotesize \NWlink{nuweb68}{68}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_unordered_Xfactor}\nobreak\ {\footnotesize \NWlink{nuweb72}{72}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap105}\raggedright\small
\NWtarget{nuweb56b}{} $\langle\,${\itshape C_maxstand_Covariance}\nobreak\ {\footnotesize {56b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_maxstand_Covariance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int PQ,@\\
\mbox{}\verb@    const double *linstat,@\\
\mbox{}\verb@    const double *expect,@\\
\mbox{}\verb@    const double *covar_sym,@\\
\mbox{}\verb@    const double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ans = R_NegInf, tmp = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < PQ; p++) {@\\
\mbox{}\verb@        tmp = 0.0;@\\
\mbox{}\verb@        if (covar_sym[S(p, p, PQ)] > tol)@\\
\mbox{}\verb@            tmp = (linstat[p] - expect[p]) / sqrt(covar_sym[S(p, p, PQ)]);@\\
\mbox{}\verb@        if (tmp > ans) ans = tmp;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxstand_Covariance@\nobreak\ \NWlink{nuweb61b}{61b}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap106}\raggedright\small
\NWtarget{nuweb57a}{} $\langle\,${\itshape C_maxstand_Variance}\nobreak\ {\footnotesize {57a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_maxstand_Variance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int PQ,@\\
\mbox{}\verb@    const double *linstat,@\\
\mbox{}\verb@    const double *expect,@\\
\mbox{}\verb@    const double *var,@\\
\mbox{}\verb@    const double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ans = R_NegInf, tmp = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < PQ; p++) {@\\
\mbox{}\verb@        tmp = 0.0;@\\
\mbox{}\verb@        if (var[p] > tol)@\\
\mbox{}\verb@            tmp = (linstat[p] - expect[p]) / sqrt(var[p]);@\\
\mbox{}\verb@        if (tmp > ans) ans = tmp;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxstand_Variance@\nobreak\ \NWlink{nuweb61b}{61b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap107}\raggedright\small
\NWtarget{nuweb57b}{} $\langle\,${\itshape C_minstand_Covariance}\nobreak\ {\footnotesize {57b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_minstand_Covariance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int PQ,@\\
\mbox{}\verb@    const double *linstat,@\\
\mbox{}\verb@    const double *expect,@\\
\mbox{}\verb@    const double *covar_sym,@\\
\mbox{}\verb@    const double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ans = R_PosInf, tmp = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < PQ; p++) {@\\
\mbox{}\verb@        tmp = 0.0;@\\
\mbox{}\verb@        if (covar_sym[S(p, p, PQ)] > tol)@\\
\mbox{}\verb@            tmp = (linstat[p] - expect[p]) / sqrt(covar_sym[S(p, p, PQ)]);@\\
\mbox{}\verb@        if (tmp < ans) ans = tmp;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_minstand_Covariance@\nobreak\ \NWlink{nuweb61b}{61b}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap108}\raggedright\small
\NWtarget{nuweb58a}{} $\langle\,${\itshape C_minstand_Variance}\nobreak\ {\footnotesize {58a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_minstand_Variance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int PQ,@\\
\mbox{}\verb@    const double *linstat,@\\
\mbox{}\verb@    const double *expect,@\\
\mbox{}\verb@    const double *var,@\\
\mbox{}\verb@    const double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ans = R_PosInf, tmp = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < PQ; p++) {@\\
\mbox{}\verb@        tmp = 0.0;@\\
\mbox{}\verb@        if (var[p] > tol)@\\
\mbox{}\verb@            tmp = (linstat[p] - expect[p]) / sqrt(var[p]);@\\
\mbox{}\verb@        if (tmp < ans) ans = tmp;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_minstand_Variance@\nobreak\ \NWlink{nuweb61b}{61b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap109}\raggedright\small
\NWtarget{nuweb58b}{} $\langle\,${\itshape C_maxabsstand_Covariance}\nobreak\ {\footnotesize {58b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_maxabsstand_Covariance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int PQ,@\\
\mbox{}\verb@    const double *linstat,@\\
\mbox{}\verb@    const double *expect,@\\
\mbox{}\verb@    const double *covar_sym,@\\
\mbox{}\verb@    const double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ans = R_NegInf, tmp = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < PQ; p++) {@\\
\mbox{}\verb@        tmp = 0.0;@\\
\mbox{}\verb@        if (covar_sym[S(p, p, PQ)] > tol)@\\
\mbox{}\verb@            tmp = fabs((linstat[p] - expect[p]) /@\\
\mbox{}\verb@                  sqrt(covar_sym[S(p, p, PQ)]));@\\
\mbox{}\verb@        if (tmp > ans) ans = tmp;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxabsstand_Covariance@\nobreak\ \NWlink{nuweb61b}{61b}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap110}\raggedright\small
\NWtarget{nuweb59a}{} $\langle\,${\itshape C_maxabsstand_Variance}\nobreak\ {\footnotesize {59a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_maxabsstand_Variance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int PQ,@\\
\mbox{}\verb@    const double *linstat,@\\
\mbox{}\verb@    const double *expect,@\\
\mbox{}\verb@    const double *var,@\\
\mbox{}\verb@    const double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ans = R_NegInf, tmp = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < PQ; p++) {@\\
\mbox{}\verb@        tmp = 0.0;@\\
\mbox{}\verb@        if (var[p] > tol)@\\
\mbox{}\verb@            tmp = fabs((linstat[p] - expect[p]) / sqrt(var[p]));@\\
\mbox{}\verb@        if (tmp > ans) ans = tmp;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxabsstand_Variance@\nobreak\ \NWlink{nuweb61b}{61b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<quadform>>=
MPinverse <-
function(x, tol = sqrt(.Machine$double.eps))
{
    SVD <- svd(x)
    pos <- SVD$d > max(tol * SVD$d[1L], 0)
    inv <- SVD$v[, pos, drop = FALSE] %*%
             ((1/SVD$d[pos]) * t(SVD$u[, pos, drop = FALSE]))
    list(MPinv = inv, rank = sum(pos))
}

quadform <-
function(linstat, expect, MPinv)
{
    censtat <- linstat - expect
    censtat %*% MPinv %*% censtat
}

linstat <- ls1$LinearStatistic
expect <- ls1$Expectation
MPinv <- MPinverse(vcov(ls1))$MPinv
MPinv_sym <- MPinv[lower.tri(MPinv, diag = TRUE)]
qf1 <- quadform(linstat, expect, MPinv)
qf2 <- .Call(libcoin:::R_quadform, linstat, expect, MPinv_sym)

stopifnot(isequal(qf1, qf2))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap111}\raggedright\small
\NWtarget{nuweb59b}{} $\langle\,${\itshape R_quadform Prototype}\nobreak\ {\footnotesize {59b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_quadform@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP linstat,@\\
\mbox{}\verb@    SEXP expect,@\\
\mbox{}\verb@    SEXP MPinv_sym@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb60b}{, 60b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_quadform@\nobreak\ \NWlink{nuweb60b}{60b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap112}\raggedright\small
\NWtarget{nuweb60a}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {60a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_quadform(@\\
\mbox{}\verb@    SEXP linstat, SEXP expect, SEXP MPinv_sym@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_quadform");@\\
\mbox{}\verb@    return fun(linstat, expect, MPinv_sym);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_quadform@\nobreak\ \NWlink{nuweb60b}{60b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap113}\raggedright\small
\NWtarget{nuweb60b}{} $\langle\,${\itshape R_quadform}\nobreak\ {\footnotesize {60b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_quadform Prototype}\nobreak\ {\footnotesize \NWlink{nuweb59b}{59b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    int n, PQ;@\\
\mbox{}\verb@    double *dlinstat, *dexpect, *dMPinv_sym, *dans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    n = NCOL(linstat);@\\
\mbox{}\verb@    PQ = NROW(linstat);@\\
\mbox{}\verb@    dlinstat = REAL(linstat);@\\
\mbox{}\verb@    dexpect = REAL(expect);@\\
\mbox{}\verb@    dMPinv_sym = REAL(MPinv_sym);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, n));@\\
\mbox{}\verb@    dans = REAL(ans);@\\
\mbox{}\verb@    for (int i = 0; i < n; i++)@\\
\mbox{}\verb@      dans[i] = C_quadform(PQ, dlinstat + PQ * i, dexpect, dMPinv_sym);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_quadform@\nobreak\ \NWlink{nuweb59b}{59b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb155a}{, 155a}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_quadform@\nobreak\ \NWlink{nuweb61a}{61a}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap114}\raggedright\small
\NWtarget{nuweb61a}{} $\langle\,${\itshape C_quadform}\nobreak\ {\footnotesize {61a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_quadform@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int PQ,@\\
\mbox{}\verb@    const double *linstat,@\\
\mbox{}\verb@    const double *expect,@\\
\mbox{}\verb@    const double *MPinv_sym@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ans = 0.0, tmp = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int q = 0; q < PQ; q++) {@\\
\mbox{}\verb@        tmp = 0.0;@\\
\mbox{}\verb@        for (int p = 0; p < PQ; p++)@\\
\mbox{}\verb@            tmp += (linstat[p] - expect[p]) * MPinv_sym[S(p, q, PQ)];@\\
\mbox{}\verb@        ans += tmp * (linstat[q] - expect[q]);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_quadform@\nobreak\ \NWlink{nuweb50}{50}\NWlink{nuweb60b}{, 60b}\NWlink{nuweb71b}{, 71b}\NWlink{nuweb155a}{, 155a}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap115}\raggedright\small
\NWtarget{nuweb61b}{} $\langle\,${\itshape C_maxtype}\nobreak\ {\footnotesize {61b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_maxtype@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int PQ,@\\
\mbox{}\verb@    const double *linstat,@\\
\mbox{}\verb@    const double *expect,@\\
\mbox{}\verb@    const double *covar,@\\
\mbox{}\verb@    const int varonly,@\\
\mbox{}\verb@    const double tol,@\\
\mbox{}\verb@    const int alternative@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ret = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (varonly) {@\\
\mbox{}\verb@        if (alternative == ALTERNATIVE_twosided) {@\\
\mbox{}\verb@            ret = C_maxabsstand_Variance(PQ, linstat, expect, covar, tol);@\\
\mbox{}\verb@        } else if (alternative == ALTERNATIVE_less) {@\\
\mbox{}\verb@            ret = C_minstand_Variance(PQ, linstat, expect, covar, tol);@\\
\mbox{}\verb@        } else if (alternative == ALTERNATIVE_greater) {@\\
\mbox{}\verb@            ret = C_maxstand_Variance(PQ, linstat, expect, covar, tol);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (alternative == ALTERNATIVE_twosided) {@\\
\mbox{}\verb@            ret = C_maxabsstand_Covariance(PQ, linstat, expect, covar, tol);@\\
\mbox{}\verb@        } else if (alternative == ALTERNATIVE_less) {@\\
\mbox{}\verb@            ret = C_minstand_Covariance(PQ, linstat, expect, covar, tol);@\\
\mbox{}\verb@        } else if (alternative == ALTERNATIVE_greater) {@\\
\mbox{}\verb@            ret = C_maxstand_Covariance(PQ, linstat, expect, covar, tol);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(ret);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxtype@\nobreak\ \NWlink{nuweb53}{53}\NWlink{nuweb71b}{, 71b}.\item \NWtxtIdentsUsed\nobreak\  \verb@ALTERNATIVE_greater@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ALTERNATIVE_less@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ALTERNATIVE_twosided@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@C_maxabsstand_Covariance@\nobreak\ \NWlink{nuweb58b}{58b}, \verb@C_maxabsstand_Variance@\nobreak\ \NWlink{nuweb59a}{59a}, \verb@C_maxstand_Covariance@\nobreak\ \NWlink{nuweb56b}{56b}, \verb@C_maxstand_Variance@\nobreak\ \NWlink{nuweb57a}{57a}, \verb@C_minstand_Covariance@\nobreak\ \NWlink{nuweb57b}{57b}, \verb@C_minstand_Variance@\nobreak\ \NWlink{nuweb58a}{58a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap116}\raggedright\small
\NWtarget{nuweb62a}{} $\langle\,${\itshape C_standardise}\nobreak\ {\footnotesize {62a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_standardise@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int PQ,@\\
\mbox{}\verb@    double *linstat,      /* in place standardisation */@\\
\mbox{}\verb@    const double *expect,@\\
\mbox{}\verb@    const double *covar,@\\
\mbox{}\verb@    const int varonly,@\\
\mbox{}\verb@    const double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double var;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < PQ; p++) {@\\
\mbox{}\verb@        if (varonly) {@\\
\mbox{}\verb@            var = covar[p];@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            var = covar[S(p, p, PQ)];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        if (var > tol) {@\\
\mbox{}\verb@            linstat[p] = (linstat[p] - expect[p]) / sqrt(var);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            linstat[p] = NAN;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_standardise@\nobreak\ \NWlink{nuweb38a}{38a}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap117}\raggedright\small
\NWtarget{nuweb62b}{} $\langle\,${\itshape P-Values}\nobreak\ {\footnotesize {62b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_chisq_pvalue}\nobreak\ {\footnotesize \NWlink{nuweb62c}{62c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_perm_pvalue}\nobreak\ {\footnotesize \NWlink{nuweb63}{63}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_norm_pvalue}\nobreak\ {\footnotesize \NWlink{nuweb64}{64}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_maxtype_pvalue}\nobreak\ {\footnotesize \NWlink{nuweb65}{65}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap118}\raggedright\small
\NWtarget{nuweb62c}{} $\langle\,${\itshape C_chisq_pvalue}\nobreak\ {\footnotesize {62c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* lower = 1 means p-value, lower = 0 means 1 - p-value */@\\
\mbox{}\verb@double C_chisq_pvalue@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const double stat,@\\
\mbox{}\verb@    const int df,@\\
\mbox{}\verb@    const int lower,@\\
\mbox{}\verb@    const int give_log@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(pchisq(stat, (double) df, lower, give_log));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb62b}{62b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_chisq_pvalue@\nobreak\ \NWlink{nuweb50}{50}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap119}\raggedright\small
\NWtarget{nuweb63}{} $\langle\,${\itshape C_perm_pvalue}\nobreak\ {\footnotesize {63}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_perm_pvalue@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const int greater,@\\
\mbox{}\verb@    const double nresample,@\\
\mbox{}\verb@    const int lower,@\\
\mbox{}\verb@    const int give_log@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ret;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (give_log) {@\\
\mbox{}\verb@         if (lower) {@\\
\mbox{}\verb@             ret = log1p(- (double) greater / nresample);@\\
\mbox{}\verb@         } else {@\\
\mbox{}\verb@             ret = log(greater) - log(nresample);@\\
\mbox{}\verb@         }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (lower) {@\\
\mbox{}\verb@            ret = 1.0 - (double) greater / nresample;@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            ret = (double) greater / nresample;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(ret);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb62b}{62b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_perm_pvalue@\nobreak\ \NWlink{nuweb50}{50}\NWlink{nuweb53}{, 53}\NWlink{nuweb71c}{, 71c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap120}\raggedright\small
\NWtarget{nuweb64}{} $\langle\,${\itshape C_norm_pvalue}\nobreak\ {\footnotesize {64}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_norm_pvalue@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const double stat,@\\
\mbox{}\verb@    const int alternative,@\\
\mbox{}\verb@    const int lower,@\\
\mbox{}\verb@    const int give_log@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ret;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (alternative == ALTERNATIVE_less) {@\\
\mbox{}\verb@        return(pnorm(stat, 0.0, 1.0, 1 - lower, give_log));@\\
\mbox{}\verb@    } else if (alternative == ALTERNATIVE_greater) {@\\
\mbox{}\verb@        return(pnorm(stat, 0.0, 1.0, lower, give_log));@\\
\mbox{}\verb@    } else if (alternative == ALTERNATIVE_twosided) {@\\
\mbox{}\verb@        if (lower) {@\\
\mbox{}\verb@            ret = pnorm(fabs(stat)*-1.0, 0.0, 1.0, 1, 0);@\\
\mbox{}\verb@            if (give_log) {@\\
\mbox{}\verb@                return(log1p(- 2 * ret));@\\
\mbox{}\verb@            } else {@\\
\mbox{}\verb@                return(1 - 2 * ret);@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            ret = pnorm(fabs(stat)*-1.0, 0.0, 1.0, 1, give_log);@\\
\mbox{}\verb@            if (give_log) {@\\
\mbox{}\verb@                return(ret + log(2));@\\
\mbox{}\verb@            } else {@\\
\mbox{}\verb@                return(2 * ret);@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(NA_REAL);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb62b}{62b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_norm_pvalue@\nobreak\ \NWlink{nuweb65}{65}.\item \NWtxtIdentsUsed\nobreak\  \verb@ALTERNATIVE_greater@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ALTERNATIVE_less@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ALTERNATIVE_twosided@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap121}\raggedright\small
\NWtarget{nuweb65}{} $\langle\,${\itshape C_maxtype_pvalue}\nobreak\ {\footnotesize {65}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_maxtype_pvalue@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const double stat,@\\
\mbox{}\verb@    const double *Covariance,@\\
\mbox{}\verb@    const int n,@\\
\mbox{}\verb@    const int alternative,@\\
\mbox{}\verb@    const int lower,@\\
\mbox{}\verb@    const int give_log,@\\
\mbox{}\verb@    int maxpts, /* const? */@\\
\mbox{}\verb@    double releps,@\\
\mbox{}\verb@    double abseps,@\\
\mbox{}\verb@    double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int nu = 0, inform, i, j, sub, nonzero, *infin, *index, rnd = 0;@\\
\mbox{}\verb@    double ans, myerror, *lowerbnd, *upperbnd, *delta, *corr, *sd;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* univariate problem */@\\
\mbox{}\verb@    if (n == 1)@\\
\mbox{}\verb@        return(C_norm_pvalue(stat, alternative, lower, give_log));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup mvtnorm Memory}\nobreak\ {\footnotesize \NWlink{nuweb66}{66}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup mvtnorm Correlation}\nobreak\ {\footnotesize \NWlink{nuweb67a}{67a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* call mvtnorm's mvtdst C function defined in mvtnorm/include/mvtnormAPI.h */@\\
\mbox{}\verb@    mvtnorm_C_mvtdst(&nonzero, &nu, lowerbnd, upperbnd, infin, corr, delta,@\\
\mbox{}\verb@                     &maxpts, &abseps, &releps, &myerror, &ans, &inform, &rnd);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* inform == 0 means: everything is OK */@\\
\mbox{}\verb@    switch (inform) {@\\
\mbox{}\verb@        case 0: break;@\\
\mbox{}\verb@        case 1: warning("cmvnorm: completion with ERROR > EPS"); break;@\\
\mbox{}\verb@        case 2: warning("cmvnorm: N > 1000 or N < 1");@\\
\mbox{}\verb@                ans = 0.0;@\\
\mbox{}\verb@                break;@\\
\mbox{}\verb@        case 3: warning("cmvnorm: correlation matrix not positive semi-definite");@\\
\mbox{}\verb@                ans = 0.0;@\\
\mbox{}\verb@                break;@\\
\mbox{}\verb@        default: warning("cmvnorm: unknown problem in MVTDST");@\\
\mbox{}\verb@                ans = 0.0;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    R_Free(corr); R_Free(sd); R_Free(lowerbnd); R_Free(upperbnd);@\\
\mbox{}\verb@    R_Free(infin); R_Free(delta); R_Free(index);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* ans = 1 - p-value */@\\
\mbox{}\verb@    if (lower) {@\\
\mbox{}\verb@        if (give_log)@\\
\mbox{}\verb@            return(log(ans));   /* log(1 - p-value) */@\\
\mbox{}\verb@        return(ans);            /* 1 - p-value */@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (give_log)@\\
\mbox{}\verb@            return(log1p(ans)); /* log(p-value) */@\\
\mbox{}\verb@        return(1 - ans);        /* p-value */@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb62b}{62b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxtype_pvalue@\nobreak\ \NWlink{nuweb53}{53}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_norm_pvalue@\nobreak\ \NWlink{nuweb64}{64}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap122}\raggedright\small
\NWtarget{nuweb66}{} $\langle\,${\itshape Setup mvtnorm Memory}\nobreak\ {\footnotesize {66}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (n == 2)@\\
\mbox{}\verb@    corr = R_Calloc(1, double);@\\
\mbox{}\verb@else@\\
\mbox{}\verb@    corr = R_Calloc(n + ((n - 2) * (n - 1))/2, double);@\\
\mbox{}\verb@@\\
\mbox{}\verb@sd = R_Calloc(n, double);@\\
\mbox{}\verb@lowerbnd = R_Calloc(n, double);@\\
\mbox{}\verb@upperbnd = R_Calloc(n, double);@\\
\mbox{}\verb@infin = R_Calloc(n, int);@\\
\mbox{}\verb@delta = R_Calloc(n, double);@\\
\mbox{}\verb@index = R_Calloc(n, int);@\\
\mbox{}\verb@@\\
\mbox{}\verb@/* determine elements with non-zero variance */@\\
\mbox{}\verb@@\\
\mbox{}\verb@nonzero = 0;@\\
\mbox{}\verb@for (i = 0; i < n; i++) {@\\
\mbox{}\verb@    if (Covariance[S(i, i, n)] > tol) {@\\
\mbox{}\verb@        index[nonzero] = i;@\\
\mbox{}\verb@        nonzero++;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb65}{65}.
\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\code{mvtdst} assumes the unique elements of the triangular
covariance matrix to be passed as argument \code{CORREL}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap123}\raggedright\small
\NWtarget{nuweb67a}{} $\langle\,${\itshape Setup mvtnorm Correlation}\nobreak\ {\footnotesize {67a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@for (int nz = 0; nz < nonzero; nz++) {@\\
\mbox{}\verb@    /* handle elements with non-zero variance only */@\\
\mbox{}\verb@    i = index[nz];@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* standard deviations */@\\
\mbox{}\verb@    sd[i] = sqrt(Covariance[S(i, i, n)]);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (alternative == ALTERNATIVE_less) {@\\
\mbox{}\verb@        lowerbnd[nz] = stat;@\\
\mbox{}\verb@        upperbnd[nz] = R_PosInf;@\\
\mbox{}\verb@        infin[nz] = 1;@\\
\mbox{}\verb@    } else if (alternative == ALTERNATIVE_greater) {@\\
\mbox{}\verb@        lowerbnd[nz] = R_NegInf;@\\
\mbox{}\verb@        upperbnd[nz] = stat;@\\
\mbox{}\verb@        infin[nz] = 0;@\\
\mbox{}\verb@    } else if (alternative == ALTERNATIVE_twosided) {@\\
\mbox{}\verb@        lowerbnd[nz] = fabs(stat) * -1.0;@\\
\mbox{}\verb@        upperbnd[nz] = fabs(stat);@\\
\mbox{}\verb@        infin[nz] = 2;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    delta[nz] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* set up vector of correlations, i.e., the upper@\\
\mbox{}\verb@       triangular part of the covariance matrix) */@\\
\mbox{}\verb@    for (int jz = 0; jz < nz; jz++) {@\\
\mbox{}\verb@        j = index[jz];@\\
\mbox{}\verb@        sub = (int) (jz + 1) + (double) ((nz - 1) * nz) / 2 - 1;@\\
\mbox{}\verb@        if (sd[i] == 0.0 || sd[j] == 0.0)@\\
\mbox{}\verb@            corr[sub] = 0.0;@\\
\mbox{}\verb@        else@\\
\mbox{}\verb@            corr[sub] = Covariance[S(i, j, n)] / (sd[i] * sd[j]);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb65}{65}.
\item \NWtxtIdentsUsed\nobreak\  \verb@ALTERNATIVE_greater@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ALTERNATIVE_less@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ALTERNATIVE_twosided@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap124}\raggedright\small
\NWtarget{nuweb67b}{} $\langle\,${\itshape maxstat Xfactor Variables}\nobreak\ {\footnotesize {67b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP LECV,@\\
\mbox{}\verb@const int minbucket,@\\
\mbox{}\verb@const int teststat,@\\
\mbox{}\verb@int *wmax,@\\
\mbox{}\verb@double *maxstat,@\\
\mbox{}\verb@double *bmaxstat,@\\
\mbox{}\verb@double *pval,@\\
\mbox{}\verb@const int lower,@\\
\mbox{}\verb@const int give_log@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap125}\raggedright\small
\NWtarget{nuweb68}{} $\langle\,${\itshape C_ordered_Xfactor}\nobreak\ {\footnotesize {68}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_ordered_Xfactor@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape maxstat Xfactor Variables}\nobreak\ {\footnotesize \NWlink{nuweb67b}{67b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup maxstat Variables}\nobreak\ {\footnotesize \NWlink{nuweb69}{69}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup maxstat Memory}\nobreak\ {\footnotesize \NWlink{nuweb70a}{70a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    wmax[0] = NA_INTEGER;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@        sumleft += ExpX[p];@\\
\mbox{}\verb@        sumright -= ExpX[p];@\\
\mbox{}\verb@@\\
\mbox{}\verb@        for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@            mlinstat[q] += linstat[q * P + p];@\\
\mbox{}\verb@            for (R_xlen_t np = 0; np < nresample; np++)@\\
\mbox{}\verb@                mblinstat[q + np * Q] += blinstat[q * P + p + np * PQ];@\\
\mbox{}\verb@            mexpect[q] += expect[q * P + p];@\\
\mbox{}\verb@            if (B == 1) {@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape Compute maxstat Variance / Covariance Directly}\nobreak\ {\footnotesize \NWlink{nuweb71a}{71a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            } else {@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape Compute maxstat Variance / Covariance from Total Covariance}\nobreak\ {\footnotesize \NWlink{nuweb70b}{70b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@@\\
\mbox{}\verb@        if ((sumleft >= minbucket) && (sumright >= minbucket) && (ExpX[p] > 0)) {@\\
\mbox{}\verb@            ls = mlinstat;@\\
\mbox{}\verb@            /* compute MPinv only once */@\\
\mbox{}\verb@            if (teststat != TESTSTAT_maximum)@\\
\mbox{}\verb@                C_MPinv_sym(mcovar, Q, tol, mMPinv, &rank);@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute maxstat Test Statistic}\nobreak\ {\footnotesize \NWlink{nuweb71b}{71b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            if (tmp > maxstat[0]) {@\\
\mbox{}\verb@                wmax[0] = p;@\\
\mbox{}\verb@                maxstat[0] = tmp;@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@@\\
\mbox{}\verb@            for (R_xlen_t np = 0; np < nresample; np++) {@\\
\mbox{}\verb@                ls = mblinstat + np * Q;@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape Compute maxstat Test Statistic}\nobreak\ {\footnotesize \NWlink{nuweb71b}{71b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@                if (tmp > bmaxstat[np])@\\
\mbox{}\verb@                    bmaxstat[np] = tmp;@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Compute maxstat Permutation P-Value}\nobreak\ {\footnotesize \NWlink{nuweb71c}{71c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    R_Free(mlinstat); R_Free(mexpect); R_Free(mblinstat);@\\
\mbox{}\verb@    R_Free(mvar); R_Free(mcovar); R_Free(mMPinv);@\\
\mbox{}\verb@    if (nresample == 0) R_Free(blinstat);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ordered_Xfactor@\nobreak\ \NWlink{nuweb34b}{34b}\NWlink{nuweb43}{, 43}\NWlink{nuweb55}{, 55}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@TESTSTAT_maximum@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap126}\raggedright\small
\NWtarget{nuweb69}{} $\langle\,${\itshape Setup maxstat Variables}\nobreak\ {\footnotesize {69}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *linstat, *expect, *covar, *varinf, *covinf, *ExpX, *blinstat, tol, *ls;@\\
\mbox{}\verb@int P, Q, B;@\\
\mbox{}\verb@R_xlen_t nresample;@\\
\mbox{}\verb@@\\
\mbox{}\verb@double *mlinstat, *mblinstat, *mexpect, *mvar, *mcovar, *mMPinv,@\\
\mbox{}\verb@       tmp, sumleft, sumright, sumweights;@\\
\mbox{}\verb@int rank, PQ, greater;@\\
\mbox{}\verb@@\\
\mbox{}\verb@Q = C_get_Q(LECV);@\\
\mbox{}\verb@P = C_get_P(LECV);@\\
\mbox{}\verb@PQ = mPQB(P, Q, 1);@\\
\mbox{}\verb@B = C_get_B(LECV);@\\
\mbox{}\verb@if (B > 1) {@\\
\mbox{}\verb@    if (C_get_varonly(LECV))@\\
\mbox{}\verb@        error("need covariance for maximally statistics with blocks");@\\
\mbox{}\verb@    covar = C_get_Covariance(LECV);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    covar = C_get_Variance(LECV); /* make -Wall happy */@\\
\mbox{}\verb@}@\\
\mbox{}\verb@linstat = C_get_LinearStatistic(LECV);@\\
\mbox{}\verb@expect = C_get_Expectation(LECV);@\\
\mbox{}\verb@ExpX = C_get_ExpectationX(LECV);@\\
\mbox{}\verb@/* both need to be there */@\\
\mbox{}\verb@varinf = C_get_VarianceInfluence(LECV);@\\
\mbox{}\verb@covinf = C_get_CovarianceInfluence(LECV);@\\
\mbox{}\verb@nresample = C_get_nresample(LECV);@\\
\mbox{}\verb@if (nresample > 0)@\\
\mbox{}\verb@    blinstat = C_get_PermutedLinearStatistic(LECV);@\\
\mbox{}\verb@tol = C_get_tol(LECV);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@C_get_B@\nobreak\ \NWlink{nuweb141d}{141d}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb138d}{138d}, \verb@C_get_ExpectationX@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb138c}{138c}, \verb@C_get_nresample@\nobreak\ \NWlink{nuweb142a}{142a}, \verb@C_get_P@\nobreak\ \NWlink{nuweb137c}{137c}, \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb142b}{142b}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb137d}{137d}, \verb@C_get_tol@\nobreak\ \NWlink{nuweb142c}{142c}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb139a}{139a}, \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb140c}{140c}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap127}\raggedright\small
\NWtarget{nuweb70a}{} $\langle\,${\itshape Setup maxstat Memory}\nobreak\ {\footnotesize {70a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@mlinstat = R_Calloc(Q, double);@\\
\mbox{}\verb@mexpect = R_Calloc(Q, double);@\\
\mbox{}\verb@if (teststat == TESTSTAT_maximum) {@\\
\mbox{}\verb@    mvar = R_Calloc(Q, double);@\\
\mbox{}\verb@    /* not needed, but allocate anyway to make -Wmaybe-uninitialized happy */@\\
\mbox{}\verb@    mcovar = R_Calloc(1, double);@\\
\mbox{}\verb@    mMPinv = R_Calloc(1, double);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    mcovar = R_Calloc(Q * (Q + 1) / 2, double);@\\
\mbox{}\verb@    mMPinv = R_Calloc(Q * (Q + 1) / 2, double);@\\
\mbox{}\verb@    /* not needed, but allocate anyway to make -Wmaybe-uninitialized happy */@\\
\mbox{}\verb@    mvar = R_Calloc(1, double);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@if (nresample > 0) {@\\
\mbox{}\verb@    mblinstat = R_Calloc(Q * nresample, double);@\\
\mbox{}\verb@} else { /* not needed, but allocate anyway to make -Wmaybe-uninitialized happy */@\\
\mbox{}\verb@    mblinstat = R_Calloc(1, double);@\\
\mbox{}\verb@    blinstat = R_Calloc(1, double);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@maxstat[0] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@    mlinstat[q] = 0.0;@\\
\mbox{}\verb@    mexpect[q] = 0.0;@\\
\mbox{}\verb@    if (teststat == TESTSTAT_maximum)@\\
\mbox{}\verb@        mvar[q] = 0.0;@\\
\mbox{}\verb@    for (R_xlen_t np = 0; np < nresample; np++) {@\\
\mbox{}\verb@        mblinstat[q + np * Q] = 0.0;@\\
\mbox{}\verb@        bmaxstat[np] = 0.0;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@if (teststat == TESTSTAT_quadratic) {@\\
\mbox{}\verb@    for (int q = 0; q < Q * (Q + 1) / 2; q++)@\\
\mbox{}\verb@        mcovar[q] = 0.0;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@sumleft = 0.0;@\\
\mbox{}\verb@sumright = 0.0;@\\
\mbox{}\verb@for (int p = 0; p < P; p++)@\\
\mbox{}\verb@    sumright += ExpX[p];@\\
\mbox{}\verb@sumweights = sumright;@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@TESTSTAT_maximum@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@TESTSTAT_quadratic@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap128}\raggedright\small
\NWtarget{nuweb70b}{} $\langle\,${\itshape Compute maxstat Variance / Covariance from Total Covariance}\nobreak\ {\footnotesize {70b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (teststat == TESTSTAT_maximum) {@\\
\mbox{}\verb@    for (int pp = 0; pp < p; pp++)@\\
\mbox{}\verb@        mvar[q] += 2 * covar[S(pp + q * P, p + P * q, mPQB(P, Q, 1))];@\\
\mbox{}\verb@    mvar[q] += covar[S(p + q * P, p + P * q, mPQB(P, Q, 1))];@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    for (int qq = 0; qq <= q; qq++) {@\\
\mbox{}\verb@        for (int pp = 0; pp < p; pp++)@\\
\mbox{}\verb@            mcovar[S(q, qq, Q)] += 2 * covar[S(pp + q * P, p + P * qq, mPQB(P, Q, 1))];@\\
\mbox{}\verb@        mcovar[S(q, qq, Q)] += covar[S(p + q * P, p + P * qq, mPQB(P, Q, 1))];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb68}{68}.
\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@TESTSTAT_maximum@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap129}\raggedright\small
\NWtarget{nuweb71a}{} $\langle\,${\itshape Compute maxstat Variance / Covariance Directly}\nobreak\ {\footnotesize {71a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* does not work with blocks! */@\\
\mbox{}\verb@if (teststat == TESTSTAT_maximum) {@\\
\mbox{}\verb@    C_VarianceLinearStatistic(1, Q, varinf, &sumleft, &sumleft,@\\
\mbox{}\verb@                              sumweights, 0, mvar);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    C_CovarianceLinearStatistic(1, Q, covinf, &sumleft, &sumleft,@\\
\mbox{}\verb@                                sumweights, 0, mcovar);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb68}{68}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb77}{77}, \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb78a}{78a}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@TESTSTAT_maximum@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap130}\raggedright\small
\NWtarget{nuweb71b}{} $\langle\,${\itshape Compute maxstat Test Statistic}\nobreak\ {\footnotesize {71b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (teststat == TESTSTAT_maximum) {@\\
\mbox{}\verb@    tmp = C_maxtype(Q, ls, mexpect, mvar, 1, tol,@\\
\mbox{}\verb@                    ALTERNATIVE_twosided);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    tmp = C_quadform(Q, ls, mexpect, mMPinv);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@ALTERNATIVE_twosided@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@C_maxtype@\nobreak\ \NWlink{nuweb61b}{61b}, \verb@C_quadform@\nobreak\ \NWlink{nuweb61a}{61a}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@TESTSTAT_maximum@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap131}\raggedright\small
\NWtarget{nuweb71c}{} $\langle\,${\itshape Compute maxstat Permutation P-Value}\nobreak\ {\footnotesize {71c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (nresample > 0) {@\\
\mbox{}\verb@    greater = 0;@\\
\mbox{}\verb@    for (R_xlen_t np = 0; np < nresample; np++) {@\\
\mbox{}\verb@        if (bmaxstat[np] > maxstat[0]) greater++;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    pval[0] = C_perm_pvalue(greater, nresample, lower, give_log);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_perm_pvalue@\nobreak\ \NWlink{nuweb63}{63}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap132}\raggedright\small
\NWtarget{nuweb72}{} $\langle\,${\itshape C_unordered_Xfactor}\nobreak\ {\footnotesize {72}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_unordered_Xfactor@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape maxstat Xfactor Variables}\nobreak\ {\footnotesize \NWlink{nuweb67b}{67b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *mtmp;@\\
\mbox{}\verb@    int qPp, nc, *levels, Pnonzero, *indl, *contrast;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup maxstat Variables}\nobreak\ {\footnotesize \NWlink{nuweb69}{69}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup maxstat Memory}\nobreak\ {\footnotesize \NWlink{nuweb70a}{70a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    mtmp = R_Calloc(P, double);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < P; p++) wmax[p] = NA_INTEGER;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Count Levels}\nobreak\ {\footnotesize \NWlink{nuweb73a}{73a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int j = 1; j < mi; j++) { /* go though all splits */@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Setup unordered maxstat Contrasts}\nobreak\ {\footnotesize \NWlink{nuweb73b}{73b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Compute unordered maxstat Linear Statistic and Expectation}\nobreak\ {\footnotesize \NWlink{nuweb74a}{74a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        if (B == 1) {@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute unordered maxstat Variance / Covariance Directly}\nobreak\ {\footnotesize \NWlink{nuweb75a}{75a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute unordered maxstat Variance / Covariance from Total Covariance}\nobreak\ {\footnotesize \NWlink{nuweb74b}{74b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@@\\
\mbox{}\verb@        if ((sumleft >= minbucket) && (sumright >= minbucket)) {@\\
\mbox{}\verb@            ls = mlinstat;@\\
\mbox{}\verb@            /* compute MPinv only once */@\\
\mbox{}\verb@            if (teststat != TESTSTAT_maximum)@\\
\mbox{}\verb@                C_MPinv_sym(mcovar, Q, tol, mMPinv, &rank);@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute maxstat Test Statistic}\nobreak\ {\footnotesize \NWlink{nuweb71b}{71b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            if (tmp > maxstat[0]) {@\\
\mbox{}\verb@                for (int p = 0; p < Pnonzero; p++)@\\
\mbox{}\verb@                    wmax[levels[p]] = contrast[levels[p]];@\\
\mbox{}\verb@                maxstat[0] = tmp;@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@@\\
\mbox{}\verb@            for (R_xlen_t np = 0; np < nresample; np++) {@\\
\mbox{}\verb@                ls = mblinstat + np * Q;@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape Compute maxstat Test Statistic}\nobreak\ {\footnotesize \NWlink{nuweb71b}{71b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@                if (tmp > bmaxstat[np])@\\
\mbox{}\verb@                    bmaxstat[np] = tmp;@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Compute maxstat Permutation P-Value}\nobreak\ {\footnotesize \NWlink{nuweb71c}{71c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    R_Free(mlinstat); R_Free(mexpect); R_Free(levels); R_Free(contrast); R_Free(indl); R_Free(mtmp);@\\
\mbox{}\verb@    R_Free(mblinstat); R_Free(mvar); R_Free(mcovar); R_Free(mMPinv);@\\
\mbox{}\verb@    if (nresample == 0) R_Free(blinstat);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb56a}{56a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_unordered_Xfactor@\nobreak\ \NWlink{nuweb34b}{34b}\NWlink{nuweb55}{, 55}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@TESTSTAT_maximum@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap133}\raggedright\small
\NWtarget{nuweb73a}{} $\langle\,${\itshape Count Levels}\nobreak\ {\footnotesize {73a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@contrast = R_Calloc(P, int);@\\
\mbox{}\verb@Pnonzero = 0;@\\
\mbox{}\verb@for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@    if (ExpX[p] > 0) Pnonzero++;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@levels = R_Calloc(Pnonzero, int);@\\
\mbox{}\verb@nc = 0;@\\
\mbox{}\verb@for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@    if (ExpX[p] > 0) {@\\
\mbox{}\verb@        levels[nc] = p;@\\
\mbox{}\verb@        nc++;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (Pnonzero >= 31)@\\
\mbox{}\verb@    error("cannot search for unordered splits in >= 31 levels");@\\
\mbox{}\verb@@\\
\mbox{}\verb@int mi = 1;@\\
\mbox{}\verb@for (int l = 1; l < Pnonzero; l++) mi *= 2;@\\
\mbox{}\verb@indl = R_Calloc(Pnonzero, int);@\\
\mbox{}\verb@for (int p = 0; p < Pnonzero; p++) indl[p] = 0;@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb72}{72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap134}\raggedright\small
\NWtarget{nuweb73b}{} $\langle\,${\itshape Setup unordered maxstat Contrasts}\nobreak\ {\footnotesize {73b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* indl determines if level p is left or right */@\\
\mbox{}\verb@int jj = j;@\\
\mbox{}\verb@for (int l = 1; l < Pnonzero; l++) {@\\
\mbox{}\verb@    indl[l] = (jj%2);@\\
\mbox{}\verb@    jj /= 2;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@sumleft = 0.0;@\\
\mbox{}\verb@sumright = 0.0;@\\
\mbox{}\verb@for (int p = 0; p < P; p++) contrast[p] = 0;@\\
\mbox{}\verb@for (int p = 0; p < Pnonzero; p++) {@\\
\mbox{}\verb@    sumleft += indl[p] * ExpX[levels[p]];@\\
\mbox{}\verb@    sumright += (1 - indl[p]) * ExpX[levels[p]];@\\
\mbox{}\verb@    contrast[levels[p]] = indl[p];@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb72}{72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap135}\raggedright\small
\NWtarget{nuweb74a}{} $\langle\,${\itshape Compute unordered maxstat Linear Statistic and Expectation}\nobreak\ {\footnotesize {74a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@    mlinstat[q] = 0.0;@\\
\mbox{}\verb@    mexpect[q] = 0.0;@\\
\mbox{}\verb@    for (R_xlen_t np = 0; np < nresample; np++)@\\
\mbox{}\verb@        mblinstat[q + np * Q] = 0.0;@\\
\mbox{}\verb@    for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@        qPp = q * P + p;@\\
\mbox{}\verb@        mlinstat[q] += contrast[p] * linstat[qPp];@\\
\mbox{}\verb@        mexpect[q] += contrast[p] * expect[qPp];@\\
\mbox{}\verb@        for (R_xlen_t np = 0; np < nresample; np++)@\\
\mbox{}\verb@            mblinstat[q + np * Q] += contrast[p] * blinstat[q * P + p + np * PQ];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb72}{72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap136}\raggedright\small
\NWtarget{nuweb74b}{} $\langle\,${\itshape Compute unordered maxstat Variance / Covariance from Total Covariance}\nobreak\ {\footnotesize {74b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (teststat == TESTSTAT_maximum) {@\\
\mbox{}\verb@    for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@        mvar[q] = 0.0;@\\
\mbox{}\verb@        for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@            qPp = q * P + p;@\\
\mbox{}\verb@            mtmp[p] = 0.0;@\\
\mbox{}\verb@            for (int pp = 0; pp < P; pp++)@\\
\mbox{}\verb@                mtmp[p] += contrast[pp] * covar[S(pp + q * P, qPp, PQ)];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        for (int p = 0; p < P; p++)@\\
\mbox{}\verb@            mvar[q] += contrast[p] * mtmp[p];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@        for (int qq = 0; qq <= q; qq++)@\\
\mbox{}\verb@            mcovar[S(q, qq, Q)] = 0.0;@\\
\mbox{}\verb@        for (int qq = 0; qq <= q; qq++) {@\\
\mbox{}\verb@            for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@                mtmp[p] = 0.0;@\\
\mbox{}\verb@                for (int pp = 0; pp < P; pp++)@\\
\mbox{}\verb@                    mtmp[p] += contrast[pp] * covar[S(pp + q * P, p + P * qq,@\\
\mbox{}\verb@                                                      mPQB(P, Q, 1))];@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@            for (int p = 0; p < P; p++)@\\
\mbox{}\verb@                mcovar[S(q, qq, Q)] += contrast[p] * mtmp[p];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb72}{72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@TESTSTAT_maximum@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap137}\raggedright\small
\NWtarget{nuweb75a}{} $\langle\,${\itshape Compute unordered maxstat Variance / Covariance Directly}\nobreak\ {\footnotesize {75a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (teststat == TESTSTAT_maximum) {@\\
\mbox{}\verb@    C_VarianceLinearStatistic(1, Q, varinf, &sumleft, &sumleft,@\\
\mbox{}\verb@                              sumweights, 0, mvar);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    C_CovarianceLinearStatistic(1, Q, covinf, &sumleft, &sumleft,@\\
\mbox{}\verb@                                sumweights, 0, mcovar);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb72}{72}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb77}{77}, \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb78a}{78a}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@TESTSTAT_maximum@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Linear Statistics}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap138}\raggedright\small
\NWtarget{nuweb75b}{} $\langle\,${\itshape LinearStatistics}\nobreak\ {\footnotesize {75b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_LinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb75d}{75d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap139}\raggedright\small
\NWtarget{nuweb75c}{} $\langle\,${\itshape RC_LinearStatistic Prototype}\nobreak\ {\footnotesize {75c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_LinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb75d}{75d}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_LinearStatistic@\nobreak\ \NWlink{nuweb75d}{75d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap140}\raggedright\small
\NWtarget{nuweb75d}{} $\langle\,${\itshape RC_LinearStatistic}\nobreak\ {\footnotesize {75d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_LinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb75c}{75c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    double center;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    RC_KronSums(x, N, P, y, Q, !DoSymmetric, &center, &center, !DoCenter, weights,@\\
\mbox{}\verb@                subset, offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb75b}{75b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_LinearStatistic@\nobreak\ \NWlink{nuweb32b}{32b}\NWlink{nuweb75c}{, 75c}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@DoSymmetric@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_KronSums@\nobreak\ \NWlink{nuweb92a}{92a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Expectation and Covariance}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap141}\raggedright\small
\NWtarget{nuweb76a}{} $\langle\,${\itshape ExpectationCovariances}\nobreak\ {\footnotesize {76a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_ExpectationInfluence}\nobreak\ {\footnotesize \NWlink{nuweb79c}{79c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ExpectationInfluence}\nobreak\ {\footnotesize \NWlink{nuweb79a}{79a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_CovarianceInfluence}\nobreak\ {\footnotesize \NWlink{nuweb82a}{82a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_CovarianceInfluence}\nobreak\ {\footnotesize \NWlink{nuweb81a}{81a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_ExpectationX}\nobreak\ {\footnotesize \NWlink{nuweb83b}{83b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ExpectationX}\nobreak\ {\footnotesize \NWlink{nuweb82c}{82c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_CovarianceX}\nobreak\ {\footnotesize \NWlink{nuweb85b}{85b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_CovarianceX}\nobreak\ {\footnotesize \NWlink{nuweb84b}{84b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_ExpectationLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb76b}{76b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_CovarianceLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb77}{77}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_VarianceLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb78a}{78a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Linear Statistic}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap142}\raggedright\small
\NWtarget{nuweb76b}{} $\langle\,${\itshape C_ExpectationLinearStatistic}\nobreak\ {\footnotesize {76b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_ExpectationLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *ExpInf,@\\
\mbox{}\verb@    double *ExpX,@\\
\mbox{}\verb@    const int add,@\\
\mbox{}\verb@    double *PQ_ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    if (!add)@\\
\mbox{}\verb@        for (int p = 0; p < mPQB(P, Q, 1); p++) PQ_ans[p] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@        for (int q = 0; q < Q; q++)@\\
\mbox{}\verb@            PQ_ans[q * P + p] += ExpX[p] * ExpInf[q];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ExpectationLinearStatistic@\nobreak\ \NWlink{nuweb34a}{34a}\NWlink{nuweb42b}{, 42b}.\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap143}\raggedright\small
\NWtarget{nuweb77}{} $\langle\,${\itshape C_CovarianceLinearStatistic}\nobreak\ {\footnotesize {77}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_CovarianceLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *CovInf,@\\
\mbox{}\verb@    double *ExpX,@\\
\mbox{}\verb@    double *CovX,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C sumweights Input}\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    const int add,@\\
\mbox{}\verb@    double *PQPQ_sym_ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double f1 = sumweights / (sumweights - 1);@\\
\mbox{}\verb@    double f2 = 1.0 / (sumweights - 1);@\\
\mbox{}\verb@    double tmp, *PP_sym_tmp;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (mPQB(P, Q, 1) == 1) {@\\
\mbox{}\verb@        tmp = f1 * CovInf[0] * CovX[0];@\\
\mbox{}\verb@        tmp -= f2 * CovInf[0] * ExpX[0] * ExpX[0];@\\
\mbox{}\verb@        if (add) {@\\
\mbox{}\verb@            PQPQ_sym_ans[0] += tmp;@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            PQPQ_sym_ans[0] = tmp;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PP_sym_tmp = R_Calloc(PP12(P), double);@\\
\mbox{}\verb@        C_KronSums_sym_(ExpX, 1, P,@\\
\mbox{}\verb@                        PP_sym_tmp);@\\
\mbox{}\verb@        for (int p = 0; p < PP12(P); p++)@\\
\mbox{}\verb@            PP_sym_tmp[p] = f1 * CovX[p] - f2 * PP_sym_tmp[p];@\\
\mbox{}\verb@        C_kronecker_sym(CovInf, Q, PP_sym_tmp, P, 1 - (add >= 1),@\\
\mbox{}\verb@                        PQPQ_sym_ans);@\\
\mbox{}\verb@        R_Free(PP_sym_tmp);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb34d}{34d}\NWlink{nuweb43}{, 43}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb75a}{, 75a}\NWlink{nuweb78a}{, 78a}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_kronecker_sym@\nobreak\ \NWlink{nuweb130a}{130a}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@PP12@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap144}\raggedright\small
\NWtarget{nuweb78a}{} $\langle\,${\itshape C_VarianceLinearStatistic}\nobreak\ {\footnotesize {78a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_VarianceLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *VarInf,@\\
\mbox{}\verb@    double *ExpX,@\\
\mbox{}\verb@    double *VarX,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C sumweights Input}\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    const int add,@\\
\mbox{}\verb@    double *PQ_ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    if (mPQB(P, Q, 1) == 1) {@\\
\mbox{}\verb@        C_CovarianceLinearStatistic(P, Q, VarInf, ExpX, VarX,@\\
\mbox{}\verb@                                    sumweights, (add >= 1),@\\
\mbox{}\verb@                                    PQ_ans);@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        double *P_tmp;@\\
\mbox{}\verb@        P_tmp = R_Calloc(P, double);@\\
\mbox{}\verb@        double f1 = sumweights / (sumweights - 1);@\\
\mbox{}\verb@        double f2 = 1.0 / (sumweights - 1);@\\
\mbox{}\verb@        for (int p = 0; p < P; p++)@\\
\mbox{}\verb@            P_tmp[p] = f1 * VarX[p] - f2 * ExpX[p] * ExpX[p];@\\
\mbox{}\verb@        C_kronecker(VarInf, 1, Q, P_tmp, 1, P, 1 - (add >= 1),@\\
\mbox{}\verb@                    PQ_ans);@\\
\mbox{}\verb@        R_Free(P_tmp);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb34c}{34c}\NWlink{nuweb43}{, 43}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb75a}{, 75a}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb77}{77}, \verb@C_kronecker@\nobreak\ \NWlink{nuweb129b}{129b}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Influence}

<<ExpectationInfluence>>=
sumweights <- sum(weights[subset])
expecty <- colSums(y[subset, ] * weights[subset]) / sumweights

a0 <- expecty
a1 <- .Call(libcoin:::R_ExpectationInfluence, y, weights, subset)
a2 <- .Call(libcoin:::R_ExpectationInfluence, y, as.double(weights), as.double(subset))
a3 <- .Call(libcoin:::R_ExpectationInfluence, y, weights, as.double(subset))
a4 <- .Call(libcoin:::R_ExpectationInfluence, y, as.double(weights), subset)
a5 <- LinStatExpCov(x, y, weights = weights, subset = subset)$ExpectationInfluence

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4) &&
          isequal(a0, a5))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap145}\raggedright\small
\NWtarget{nuweb78b}{} $\langle\,${\itshape R_ExpectationInfluence Prototype}\nobreak\ {\footnotesize {78b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_ExpectationInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb79a}{, 79a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb79a}{79a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap146}\raggedright\small
\NWtarget{nuweb79a}{} $\langle\,${\itshape R_ExpectationInfluence}\nobreak\ {\footnotesize {79a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ExpectationInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb78b}{78b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    double sumweights;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    Q = NCOL(y);@\\
\mbox{}\verb@    N = XLENGTH(y) / Q;@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    sumweights = RC_Sums(N, weights, subset, Offset0, Nsubset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, Q));@\\
\mbox{}\verb@    RC_ExpectationInfluence(N, y, Q, weights, subset, Offset0, Nsubset, sumweights, REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb78b}{78b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb79c}{79c}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap147}\raggedright\small
\NWtarget{nuweb79b}{} $\langle\,${\itshape RC_ExpectationInfluence Prototype}\nobreak\ {\footnotesize {79b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_ExpectationInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C sumweights Input}\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb104c}{104c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb79c}{79c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb79c}{79c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap148}\raggedright\small
\NWtarget{nuweb79c}{} $\langle\,${\itshape RC_ExpectationInfluence}\nobreak\ {\footnotesize {79c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_ExpectationInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb79b}{79b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    double center;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    RC_colSums(REAL(y), N, Q, Power1, &center, !DoCenter, weights,@\\
\mbox{}\verb@               subset, offset, Nsubset, P_ans);@\\
\mbox{}\verb@    for (int q = 0; q < Q; q++)@\\
\mbox{}\verb@        P_ans[q] = P_ans[q] / sumweights;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb34a}{34a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79b}{b}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@Power1@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb104a}{104a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<CovarianceInfluence>>=
sumweights <- sum(weights[subset])
yc <- t(t(y) - expecty)
r1y <- rep(1:ncol(y), ncol(y))
r2y <- rep(1:ncol(y), each = ncol(y))
a0 <- colSums(yc[subset, r1y] * yc[subset, r2y] * weights[subset]) / sumweights
a0 <- matrix(a0, ncol = ncol(y))
vary <- diag(a0)

a0 <- a0[lower.tri(a0, diag = TRUE)]
a1 <- .Call(libcoin:::R_CovarianceInfluence, y, weights, subset, 0L)
a2 <- .Call(libcoin:::R_CovarianceInfluence, y, as.double(weights), as.double(subset), 0L)
a3 <- .Call(libcoin:::R_CovarianceInfluence, y, weights, as.double(subset), 0L)
a4 <- .Call(libcoin:::R_CovarianceInfluence, y, as.double(weights), subset, 0L)
a5 <- LinStatExpCov(x, y, weights = weights, subset = subset)$CovarianceInfluence

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4) &&
          isequal(a0, a5))

a0 <- vary
a1 <- .Call(libcoin:::R_CovarianceInfluence, y, weights, subset, 1L)
a2 <- .Call(libcoin:::R_CovarianceInfluence, y, as.double(weights), as.double(subset), 1L)
a3 <- .Call(libcoin:::R_CovarianceInfluence, y, weights, as.double(subset), 1L)
a4 <- .Call(libcoin:::R_CovarianceInfluence, y, as.double(weights), subset, 1L)
a5 <- LinStatExpCov(x, y, weights = weights, subset = subset, varonly = TRUE)$VarianceInfluence

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4) &&
          isequal(a0, a5))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap149}\raggedright\small
\NWtarget{nuweb80}{} $\langle\,${\itshape R_CovarianceInfluence Prototype}\nobreak\ {\footnotesize {80}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_CovarianceInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP varonly@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb81a}{, 81a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_CovarianceInfluence@\nobreak\ \NWlink{nuweb81a}{81a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap150}\raggedright\small
\NWtarget{nuweb81a}{} $\langle\,${\itshape R_CovarianceInfluence}\nobreak\ {\footnotesize {81a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_CovarianceInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb80}{80}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    SEXP ExpInf;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    double sumweights;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    Q = NCOL(y);@\\
\mbox{}\verb@    N = XLENGTH(y) / Q;@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ExpInf = R_ExpectationInfluence(y, weights, subset));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    sumweights = RC_Sums(N, weights, subset, Offset0, Nsubset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (INTEGER(varonly)[0]) {@\\
\mbox{}\verb@        PROTECT(ans = allocVector(REALSXP, Q));@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PROTECT(ans = allocVector(REALSXP, Q * (Q + 1) / 2));@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    RC_CovarianceInfluence(N, y, Q, weights, subset, Offset0, Nsubset, REAL(ExpInf), sumweights,@\\
\mbox{}\verb@                           INTEGER(varonly)[0], REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_CovarianceInfluence@\nobreak\ \NWlink{nuweb80}{80}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_CovarianceInfluence@\nobreak\ \NWlink{nuweb82a}{82a}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb79a}{79a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap151}\raggedright\small
\NWtarget{nuweb81b}{} $\langle\,${\itshape RC_CovarianceInfluence Prototype}\nobreak\ {\footnotesize {81b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_CovarianceInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *ExpInf,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C sumweights Input}\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int VARONLY,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb82a}{82a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_CovarianceInfluence@\nobreak\ \NWlink{nuweb82a}{82a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap152}\raggedright\small
\NWtarget{nuweb82a}{} $\langle\,${\itshape RC_CovarianceInfluence}\nobreak\ {\footnotesize {82a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_CovarianceInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb81b}{81b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (VARONLY) {@\\
\mbox{}\verb@        RC_colSums(REAL(y), N, Q, Power2, ExpInf, DoCenter, weights,@\\
\mbox{}\verb@                   subset, offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@        for (int q = 0; q < Q; q++)@\\
\mbox{}\verb@            PQ_ans[q] = PQ_ans[q] / sumweights;@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        RC_KronSums(y, N, Q, REAL(y), Q, DoSymmetric, ExpInf, ExpInf, DoCenter, weights,@\\
\mbox{}\verb@                    subset, offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@        for (int q = 0; q < Q * (Q + 1) / 2; q++)@\\
\mbox{}\verb@            PQ_ans[q] = PQ_ans[q] / sumweights;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_CovarianceInfluence@\nobreak\ \NWlink{nuweb34b}{34b}\NWlink{nuweb43}{, 43}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb81b}{b}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@DoSymmetric@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@Power2@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb104a}{104a}, \verb@RC_KronSums@\nobreak\ \NWlink{nuweb92a}{92a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{X}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap153}\raggedright\small
\NWtarget{nuweb82b}{} $\langle\,${\itshape R_ExpectationX Prototype}\nobreak\ {\footnotesize {82b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_ExpectationX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP P,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb82c}{, 82c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb82c}{82c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap154}\raggedright\small
\NWtarget{nuweb82c}{} $\langle\,${\itshape R_ExpectationX}\nobreak\ {\footnotesize {82c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ExpectationX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb82b}{82b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    N = XLENGTH(x) / INTEGER(P)[0];@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, INTEGER(P)[0]));@\\
\mbox{}\verb@    RC_ExpectationX(x, N, INTEGER(P)[0], weights, subset,@\\
\mbox{}\verb@                    Offset0, Nsubset, REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb82b}{82b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb83b}{83b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap155}\raggedright\small
\NWtarget{nuweb83a}{} $\langle\,${\itshape RC_ExpectationX Prototype}\nobreak\ {\footnotesize {83a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_ExpectationX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb108c}{108c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb83b}{83b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb83b}{83b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap156}\raggedright\small
\NWtarget{nuweb83b}{} $\langle\,${\itshape RC_ExpectationX}\nobreak\ {\footnotesize {83b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_ExpectationX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb83a}{83a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    double center;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (TYPEOF(x) == INTSXP) {@\\
\mbox{}\verb@        double* Pp1tmp = R_Calloc(P + 1, double);@\\
\mbox{}\verb@        RC_OneTableSums(INTEGER(x), N, P + 1, weights, subset, offset, Nsubset, Pp1tmp);@\\
\mbox{}\verb@        for (int p = 0; p < P; p++) P_ans[p] = Pp1tmp[p + 1];@\\
\mbox{}\verb@        R_Free(Pp1tmp);@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        RC_colSums(REAL(x), N, P, Power1, &center, !DoCenter, weights, subset, offset, Nsubset, P_ans);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb34a}{34a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb83a}{, 83a}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Power1@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb104a}{104a}, \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb108a}{108a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<ExpectationCovarianceX>>=
a0 <- colSums(x[subset, ] * weights[subset])
a1 <- .Call(libcoin:::R_ExpectationX, x, P, weights, subset);
a2 <- .Call(libcoin:::R_ExpectationX, x, P, as.double(weights), as.double(subset))
a3 <- .Call(libcoin:::R_ExpectationX, x, P, weights, as.double(subset))
a4 <- .Call(libcoin:::R_ExpectationX, x, P, as.double(weights), subset)

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4) &&
          isequal(a0, LECVxyws$ExpectationX))

a0 <- colSums(x[subset, ]^2 * weights[subset])
a1 <- .Call(libcoin:::R_CovarianceX, x, P, weights, subset, 1L)
a2 <- .Call(libcoin:::R_CovarianceX, x, P, as.double(weights), as.double(subset), 1L)
a3 <- .Call(libcoin:::R_CovarianceX, x, P, weights, as.double(subset), 1L)
a4 <- .Call(libcoin:::R_CovarianceX, x, P, as.double(weights), subset, 1L)

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))

a0 <- as.vector(colSums(Xfactor[subset, ] * weights[subset]))
a1 <- .Call(libcoin:::R_ExpectationX, ix, Lx, weights, subset)
a2 <- .Call(libcoin:::R_ExpectationX, ix, Lx, as.double(weights), as.double(subset))
a3 <- .Call(libcoin:::R_ExpectationX, ix, Lx, weights, as.double(subset))
a4 <- .Call(libcoin:::R_ExpectationX, ix, Lx, as.double(weights), subset)

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))

a1 <- .Call(libcoin:::R_CovarianceX, ix, Lx, weights, subset, 1L)
a2 <- .Call(libcoin:::R_CovarianceX, ix, Lx, as.double(weights), as.double(subset), 1L)
a3 <- .Call(libcoin:::R_CovarianceX, ix, Lx, weights, as.double(subset), 1L)
a4 <- .Call(libcoin:::R_CovarianceX, ix, Lx, as.double(weights), subset, 1L)

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))

r1x <- rep(1:ncol(Xfactor), ncol(Xfactor))
r2x <- rep(1:ncol(Xfactor), each = ncol(Xfactor))
a0 <- colSums(Xfactor[subset, r1x] * Xfactor[subset, r2x] * weights[subset])
a0 <- matrix(a0, ncol = ncol(Xfactor))
vary <- diag(a0)

a0 <- a0[lower.tri(a0, diag = TRUE)]
a1 <- .Call(libcoin:::R_CovarianceX, ix, Lx, weights, subset, 0L)
a2 <- .Call(libcoin:::R_CovarianceX, ix, Lx, as.double(weights), as.double(subset), 0L)
a3 <- .Call(libcoin:::R_CovarianceX, ix, Lx, weights, as.double(subset), 0L)
a4 <- .Call(libcoin:::R_CovarianceX, ix, Lx, as.double(weights), subset, 0L)

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap157}\raggedright\small
\NWtarget{nuweb84a}{} $\langle\,${\itshape R_CovarianceX Prototype}\nobreak\ {\footnotesize {84a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_CovarianceX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP P,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP varonly@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb84b}{, 84b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@R_CovarianceX@\nobreak\ \NWlink{nuweb84b}{84b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap158}\raggedright\small
\NWtarget{nuweb84b}{} $\langle\,${\itshape R_CovarianceX}\nobreak\ {\footnotesize {84b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_CovarianceX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb84a}{84a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    SEXP ExpX;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    N = XLENGTH(x) / INTEGER(P)[0];@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ExpX = R_ExpectationX(x, P, weights, subset));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (INTEGER(varonly)[0]) {@\\
\mbox{}\verb@        PROTECT(ans = allocVector(REALSXP, INTEGER(P)[0]));@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PROTECT(ans = allocVector(REALSXP, INTEGER(P)[0] * (INTEGER(P)[0] + 1) / 2));@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    RC_CovarianceX(x, N, INTEGER(P)[0], weights, subset, Offset0, Nsubset, REAL(ExpX),@\\
\mbox{}\verb@                   INTEGER(varonly)[0], REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_CovarianceX@\nobreak\ \NWlink{nuweb84a}{84a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb85b}{85b}, \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb82c}{82c}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap159}\raggedright\small
\NWtarget{nuweb85a}{} $\langle\,${\itshape RC_CovarianceX Prototype}\nobreak\ {\footnotesize {85a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_CovarianceX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *ExpX,@\\
\mbox{}\verb@    int VARONLY,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb85b}{85b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb85b}{85b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap160}\raggedright\small
\NWtarget{nuweb85b}{} $\langle\,${\itshape RC_CovarianceX}\nobreak\ {\footnotesize {85b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_CovarianceX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb85a}{85a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    double center;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (TYPEOF(x) == INTSXP) {@\\
\mbox{}\verb@        if (VARONLY) {@\\
\mbox{}\verb@            for (int p = 0; p < P; p++) PQ_ans[p] = ExpX[p];@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            for (int p = 0; p < PP12(P); p++)@\\
\mbox{}\verb@                PQ_ans[p] = 0.0;@\\
\mbox{}\verb@            for (int p = 0; p < P; p++)@\\
\mbox{}\verb@                PQ_ans[S(p, p, P)] = ExpX[p];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (VARONLY) {@\\
\mbox{}\verb@            RC_colSums(REAL(x), N, P, Power2, &center, !DoCenter, weights,@\\
\mbox{}\verb@                       subset, offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            RC_KronSums(x, N, P, REAL(x), P, DoSymmetric, &center, &center, !DoCenter, weights,@\\
\mbox{}\verb@                        subset, offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb76a}{76a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb34c}{34c}\NWlink{nuweb34d}{d}\NWlink{nuweb43}{, 43}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85a}{, 85a}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@DoSymmetric@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Power2@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@PP12@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb104a}{104a}, \verb@RC_KronSums@\nobreak\ \NWlink{nuweb92a}{92a}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Computing Sums}

The core concept of all functions in the section is the computation of
various sums over observations, case weights, or blocks. We start with an
initialisation of the loop over all observations

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap161}\raggedright\small
\NWtarget{nuweb86a}{} $\langle\,${\itshape init subset loop}\nobreak\ {\footnotesize {86a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@R_xlen_t diff = 0;@\\
\mbox{}\verb@s = subset + offset;@\\
\mbox{}\verb@w = weights;@\\
\mbox{}\verb@/* subset is R-style index in 1:N */@\\
\mbox{}\verb@if (Nsubset > 0)@\\
\mbox{}\verb@    diff = (R_xlen_t) s[0] - 1;@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90a}{90a}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
and loop over $i = 1, \dots, N$ when no subset was specified or
over the subset of the subset given by \code{offset} and \code{Nsubset},
allowing for number of observations larger than \code{INT_MAX}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap162}\raggedright\small
\NWtarget{nuweb86b}{} $\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize {86b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@for (R_xlen_t i = 0; i < (Nsubset == 0 ? N : Nsubset) - 1; i++)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90a}{90a}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
After computations in the loop, we compute the next element

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap163}\raggedright\small
\NWtarget{nuweb86c}{} $\langle\,${\itshape continue subset loop}\nobreak\ {\footnotesize {86c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (Nsubset > 0) {@\\
\mbox{}\verb@    /* NB: diff also works with R style index */@\\
\mbox{}\verb@    diff = (R_xlen_t) s[1] - s[0];@\\
\mbox{}\verb@    if (diff < 0)@\\
\mbox{}\verb@        error("subset not sorted");@\\
\mbox{}\verb@    s++;@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    diff = 1;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90a}{90a}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Simple Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap164}\raggedright\small
\NWtarget{nuweb86d}{} $\langle\,${\itshape SimpleSums}\nobreak\ {\footnotesize {86d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_Sums_dweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb88b}{88b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_Sums_iweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb89a}{89a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_Sums_iweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb89b}{89b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_Sums_dweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb89c}{89c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_Sums}\nobreak\ {\footnotesize \NWlink{nuweb88a}{88a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_Sums}\nobreak\ {\footnotesize \NWlink{nuweb87b}{87b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<SimpleSums>>=
a0 <- sum(weights[subset])
a1 <- .Call(libcoin:::R_Sums, N, weights, subset)
a2 <- .Call(libcoin:::R_Sums, N, as.double(weights), as.double(subset))
a3 <- .Call(libcoin:::R_Sums, N, weights, as.double(subset))
a4 <- .Call(libcoin:::R_Sums, N, as.double(weights), subset)

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap165}\raggedright\small
\NWtarget{nuweb87a}{} $\langle\,${\itshape R_Sums Prototype}\nobreak\ {\footnotesize {87a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_Sums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R N Input}\nobreak\ {\footnotesize \NWlink{nuweb23a}{23a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb87b}{, 87b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_Sums@\nobreak\ \NWlink{nuweb87b}{87b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap166}\raggedright\small
\NWtarget{nuweb87b}{} $\langle\,${\itshape R_Sums}\nobreak\ {\footnotesize {87b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_Sums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb87a}{87a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, 1));@\\
\mbox{}\verb@    REAL(ans)[0] = RC_Sums(INTEGER(N)[0], weights, subset, Offset0, Nsubset);@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb86d}{86d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_Sums@\nobreak\ \NWlink{nuweb87a}{87a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap167}\raggedright\small
\NWtarget{nuweb87c}{} $\langle\,${\itshape RC_Sums Prototype}\nobreak\ {\footnotesize {87c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double RC_Sums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb88a}{88a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_Sums@\nobreak\ \NWlink{nuweb88a}{88a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap168}\raggedright\small
\NWtarget{nuweb88a}{} $\langle\,${\itshape RC_Sums}\nobreak\ {\footnotesize {88a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_Sums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb87c}{87c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (XLENGTH(weights) == 0) {@\\
\mbox{}\verb@        if (XLENGTH(subset) == 0) {@\\
\mbox{}\verb@            return((double) N);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            return((double) Nsubset);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    if (TYPEOF(weights) == INTSXP) {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            return(C_Sums_iweights_isubset(N, INTEGER(weights), XLENGTH(weights),@\\
\mbox{}\verb@                                           INTEGER(subset), offset, Nsubset));@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            return(C_Sums_iweights_dsubset(N, INTEGER(weights), XLENGTH(weights),@\\
\mbox{}\verb@                                           REAL(subset), offset, Nsubset));@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            return(C_Sums_dweights_isubset(N, REAL(weights), XLENGTH(weights),@\\
\mbox{}\verb@                                           INTEGER(subset), offset, Nsubset));@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            return(C_Sums_dweights_dsubset(N, REAL(weights), XLENGTH(weights),@\\
\mbox{}\verb@                                           REAL(subset), offset, Nsubset));@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb86d}{86d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_Sums@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb33b}{b}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb87c}{c}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123a}{, 123a}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_Sums_dweights_dsubset@\nobreak\ \NWlink{nuweb88b}{88b}, \verb@C_Sums_dweights_isubset@\nobreak\ \NWlink{nuweb89c}{89c}, \verb@C_Sums_iweights_dsubset@\nobreak\ \NWlink{nuweb89a}{89a}, \verb@C_Sums_iweights_isubset@\nobreak\ \NWlink{nuweb89b}{89b}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap169}\raggedright\small
\NWtarget{nuweb88b}{} $\langle\,${\itshape C_Sums_dweights_dsubset}\nobreak\ {\footnotesize {88b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_Sums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize \NWlink{nuweb90a}{90a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb86d}{86d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Sums_dweights_dsubset@\nobreak\ \NWlink{nuweb88a}{88a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap170}\raggedright\small
\NWtarget{nuweb89a}{} $\langle\,${\itshape C_Sums_iweights_dsubset}\nobreak\ {\footnotesize {89a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_Sums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize \NWlink{nuweb90a}{90a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb86d}{86d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Sums_iweights_dsubset@\nobreak\ \NWlink{nuweb88a}{88a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap171}\raggedright\small
\NWtarget{nuweb89b}{} $\langle\,${\itshape C_Sums_iweights_isubset}\nobreak\ {\footnotesize {89b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_Sums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize \NWlink{nuweb90a}{90a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb86d}{86d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Sums_iweights_isubset@\nobreak\ \NWlink{nuweb88a}{88a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap172}\raggedright\small
\NWtarget{nuweb89c}{} $\langle\,${\itshape C_Sums_dweights_isubset}\nobreak\ {\footnotesize {89c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_Sums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize \NWlink{nuweb90a}{90a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb86d}{86d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Sums_dweights_isubset@\nobreak\ \NWlink{nuweb88a}{88a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap173}\raggedright\small
\NWtarget{nuweb90a}{} $\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize {90a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double ans = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (Nsubset > 0) {@\\
\mbox{}\verb@    if (!HAS_WEIGHTS) return((double) Nsubset);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    if (!HAS_WEIGHTS) return((double) N);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape init subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    w = w + diff;@\\
\mbox{}\verb@    ans += w[0];@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape continue subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86c}{86c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@w = w + diff;@\\
\mbox{}\verb@ans += w[0];@\\
\mbox{}\verb@@\\
\mbox{}\verb@return(ans);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb88b}{88b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb89b}{b}\NWlink{nuweb89c}{c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb24f}{24f}\NWlink{nuweb25a}{, 25a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Kronecker Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap174}\raggedright\small
\NWtarget{nuweb90b}{} $\langle\,${\itshape KronSums}\nobreak\ {\footnotesize {90b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_KronSums_dweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_KronSums_iweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb94b}{94b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_KronSums_iweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb94c}{94c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_KronSums_dweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb95}{95}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_XfactorKronSums_dweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb97b}{97b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_XfactorKronSums_iweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb97c}{97c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_XfactorKronSums_iweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb97d}{97d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_XfactorKronSums_dweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb98a}{98a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_KronSums}\nobreak\ {\footnotesize \NWlink{nuweb92a}{92a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_KronSums}\nobreak\ {\footnotesize \NWlink{nuweb91b}{91b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_KronSums_Permutation_isubset}\nobreak\ {\footnotesize \NWlink{nuweb101b}{101b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_KronSums_Permutation_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb101a}{101a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_XfactorKronSums_Permutation_isubset}\nobreak\ {\footnotesize \NWlink{nuweb102b}{102b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_XfactorKronSums_Permutation_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb102a}{102a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_KronSums_Permutation}\nobreak\ {\footnotesize \NWlink{nuweb100b}{100b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_KronSums_Permutation}\nobreak\ {\footnotesize \NWlink{nuweb99b}{99b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<KronSums>>=
a0 <- colSums(x[subset, r1] * y[subset, r2] * weights[subset])
a1 <- .Call(libcoin:::R_KronSums, x, P, y, weights, subset, 0L)
a2 <- .Call(libcoin:::R_KronSums, x, P, y, as.double(weights), as.double(subset), 0L)
a3 <- .Call(libcoin:::R_KronSums, x, P, y, weights, as.double(subset), 0L)
a4 <- .Call(libcoin:::R_KronSums, x, P, y, as.double(weights), subset, 0L)

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))

a0 <- as.vector(colSums(Xfactor[subset, r1Xfactor] *
                        y[subset, r2Xfactor] * weights[subset]))
a1 <- .Call(libcoin:::R_KronSums, ix, Lx, y, weights, subset, 0L)
a2 <- .Call(libcoin:::R_KronSums, ix, Lx, y, as.double(weights), as.double(subset), 0L)
a3 <- .Call(libcoin:::R_KronSums, ix, Lx, y, weights, as.double(subset), 0L)
a4 <- .Call(libcoin:::R_KronSums, ix, Lx, y, as.double(weights), subset, 0L)

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap175}\raggedright\small
\NWtarget{nuweb91a}{} $\langle\,${\itshape R_KronSums Prototype}\nobreak\ {\footnotesize {91a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_KronSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP P,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP symmetric@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb91b}{, 91b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@R_KronSums@\nobreak\ \NWlink{nuweb91b}{91b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap176}\raggedright\small
\NWtarget{nuweb91b}{} $\langle\,${\itshape R_KronSums}\nobreak\ {\footnotesize {91b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_KronSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb91a}{91a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    double center;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    Q = NCOL(y);@\\
\mbox{}\verb@    N = XLENGTH(y) / Q;@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (INTEGER(symmetric)[0]) {@\\
\mbox{}\verb@        PROTECT(ans = allocVector(REALSXP, INTEGER(P)[0] * (INTEGER(P)[0] + 1) / 2));@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PROTECT(ans = allocVector(REALSXP, INTEGER(P)[0] * Q));@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    RC_KronSums(x, N, INTEGER(P)[0], REAL(y), Q, INTEGER(symmetric)[0], &center, &center,@\\
\mbox{}\verb@                !DoCenter, weights, subset, Offset0, Nsubset, REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_KronSums@\nobreak\ \NWlink{nuweb91a}{91a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_KronSums@\nobreak\ \NWlink{nuweb92a}{92a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap177}\raggedright\small
\NWtarget{nuweb91c}{} $\langle\,${\itshape RC_KronSums Prototype}\nobreak\ {\footnotesize {91c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_KronSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape RC KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb92b}{92b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb92a}{92a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_KronSums@\nobreak\ \NWlink{nuweb92a}{92a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap178}\raggedright\small
\NWtarget{nuweb92a}{} $\langle\,${\itshape RC_KronSums}\nobreak\ {\footnotesize {92a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_KronSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb91c}{91c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (TYPEOF(x) == INTSXP) {@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape KronSums Integer x}\nobreak\ {\footnotesize \NWlink{nuweb93a}{93a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape KronSums Double x}\nobreak\ {\footnotesize \NWlink{nuweb93b}{93b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_KronSums@\nobreak\ \NWlink{nuweb75d}{75d}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb91c}{c}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap179}\raggedright\small
\NWtarget{nuweb92b}{} $\langle\,${\itshape RC KronSums Input}\nobreak\ {\footnotesize {92b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@const int SYMMETRIC,@\\
\mbox{}\verb@double *centerx,@\\
\mbox{}\verb@double *centery,@\\
\mbox{}\verb@const int CENTER,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb91c}{91c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap180}\raggedright\small
\NWtarget{nuweb92c}{} $\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize {92c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize \NWlink{nuweb23e}{23e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@const int SYMMETRIC,@\\
\mbox{}\verb@double *centerx,@\\
\mbox{}\verb@double *centery,@\\
\mbox{}\verb@const int CENTER,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb94a}{94a}\NWlink{nuweb94b}{b}\NWlink{nuweb94c}{c}\NWlink{nuweb95}{, 95}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap181}\raggedright\small
\NWtarget{nuweb92d}{} $\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize {92d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *PQ_ans@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb75c}{75c}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb91c}{, 91c}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb94b}{b}\NWlink{nuweb94c}{c}\NWlink{nuweb95}{, 95}\NWlink{nuweb97b}{, 97b}\NWlink{nuweb97c}{c}\NWlink{nuweb97d}{d}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb101b}{b}\NWlink{nuweb102a}{, 102a}\NWlink{nuweb102b}{b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap182}\raggedright\small
\NWtarget{nuweb93a}{} $\langle\,${\itshape KronSums Integer x}\nobreak\ {\footnotesize {93a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (SYMMETRIC) error("not implemented");@\\
\mbox{}\verb@if (CENTER) error("not implemented");@\\
\mbox{}\verb@if (TYPEOF(weights) == INTSXP) {@\\
\mbox{}\verb@    if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@        C_XfactorKronSums_iweights_isubset(INTEGER(x), N, P, y, Q,@\\
\mbox{}\verb@            INTEGER(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@            offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        C_XfactorKronSums_iweights_dsubset(INTEGER(x), N, P, y, Q,@\\
\mbox{}\verb@            INTEGER(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@            offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@        C_XfactorKronSums_dweights_isubset(INTEGER(x), N, P, y, Q,@\\
\mbox{}\verb@            REAL(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@            offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        C_XfactorKronSums_dweights_dsubset(INTEGER(x), N, P, y, Q,@\\
\mbox{}\verb@            REAL(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@            offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb92a}{92a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_XfactorKronSums_dweights_dsubset@\nobreak\ \NWlink{nuweb97b}{97b}, \verb@C_XfactorKronSums_dweights_isubset@\nobreak\ \NWlink{nuweb98a}{98a}, \verb@C_XfactorKronSums_iweights_dsubset@\nobreak\ \NWlink{nuweb97c}{97c}, \verb@C_XfactorKronSums_iweights_isubset@\nobreak\ \NWlink{nuweb97d}{97d}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap183}\raggedright\small
\NWtarget{nuweb93b}{} $\langle\,${\itshape KronSums Double x}\nobreak\ {\footnotesize {93b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (TYPEOF(weights) == INTSXP) {@\\
\mbox{}\verb@    if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@        C_KronSums_iweights_isubset(REAL(x), N, P, y, Q, SYMMETRIC, centerx, centery, CENTER,@\\
\mbox{}\verb@            INTEGER(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@            offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        C_KronSums_iweights_dsubset(REAL(x), N, P, y, Q, SYMMETRIC, centerx, centery, CENTER,@\\
\mbox{}\verb@            INTEGER(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@            offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@        C_KronSums_dweights_isubset(REAL(x), N, P, y, Q, SYMMETRIC, centerx, centery, CENTER,@\\
\mbox{}\verb@            REAL(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@            offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        C_KronSums_dweights_dsubset(REAL(x), N, P, y, Q, SYMMETRIC, centerx, centery, CENTER,@\\
\mbox{}\verb@            REAL(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@            offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb92a}{92a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_KronSums_dweights_dsubset@\nobreak\ \NWlink{nuweb94a}{94a}, \verb@C_KronSums_dweights_isubset@\nobreak\ \NWlink{nuweb95}{95}, \verb@C_KronSums_iweights_dsubset@\nobreak\ \NWlink{nuweb94b}{94b}, \verb@C_KronSums_iweights_isubset@\nobreak\ \NWlink{nuweb94c}{94c}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap184}\raggedright\small
\NWtarget{nuweb94a}{} $\langle\,${\itshape C_KronSums_dweights_dsubset}\nobreak\ {\footnotesize {94a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_KronSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb92c}{92c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb96}{96}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_dweights_dsubset@\nobreak\ \NWlink{nuweb93b}{93b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap185}\raggedright\small
\NWtarget{nuweb94b}{} $\langle\,${\itshape C_KronSums_iweights_dsubset}\nobreak\ {\footnotesize {94b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_KronSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb92c}{92c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb96}{96}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_iweights_dsubset@\nobreak\ \NWlink{nuweb93b}{93b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap186}\raggedright\small
\NWtarget{nuweb94c}{} $\langle\,${\itshape C_KronSums_iweights_isubset}\nobreak\ {\footnotesize {94c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_KronSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb92c}{92c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb96}{96}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_iweights_isubset@\nobreak\ \NWlink{nuweb93b}{93b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap187}\raggedright\small
\NWtarget{nuweb95}{} $\langle\,${\itshape C_KronSums_dweights_isubset}\nobreak\ {\footnotesize {95}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_KronSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb92c}{92c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb96}{96}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_dweights_isubset@\nobreak\ \NWlink{nuweb93b}{93b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap188}\raggedright\small
\NWtarget{nuweb96}{} $\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize {96}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@    double *xx, *yy, cx = 0.0, cy = 0.0, *thisPQ_ans;@\\
\mbox{}\verb@    int idx;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@        for (int q = (SYMMETRIC ? p : 0); q < Q; q++) {@\\
\mbox{}\verb@            /* SYMMETRIC is column-wise, default@\\
\mbox{}\verb@               is row-wise (maybe need to change this) */@\\
\mbox{}\verb@            if (SYMMETRIC) {@\\
\mbox{}\verb@                idx = S(p, q, P);@\\
\mbox{}\verb@            } else {@\\
\mbox{}\verb@                idx = q * P + p;@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@            PQ_ans[idx] = 0.0;@\\
\mbox{}\verb@            thisPQ_ans = PQ_ans + idx;@\\
\mbox{}\verb@            yy = y + N * q;@\\
\mbox{}\verb@            xx = x + N * p;@\\
\mbox{}\verb@@\\
\mbox{}\verb@            if (CENTER) {@\\
\mbox{}\verb@                cx = centerx[p];@\\
\mbox{}\verb@                cy = centery[q];@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape init subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            {@\\
\mbox{}\verb@                xx = xx + diff;@\\
\mbox{}\verb@                yy = yy + diff;@\\
\mbox{}\verb@                if (HAS_WEIGHTS) {@\\
\mbox{}\verb@                    w = w + diff;@\\
\mbox{}\verb@                    if (CENTER) {@\\
\mbox{}\verb@                        thisPQ_ans[0] += (xx[0] - cx) * (yy[0] - cy) * w[0];@\\
\mbox{}\verb@                    } else {@\\
\mbox{}\verb@                        thisPQ_ans[0] += xx[0] * yy[0] * w[0];@\\
\mbox{}\verb@                    }@\\
\mbox{}\verb@                } else {@\\
\mbox{}\verb@                    if (CENTER) {@\\
\mbox{}\verb@                        thisPQ_ans[0] += (xx[0] - cx) * (yy[0] - cy);@\\
\mbox{}\verb@                    } else {@\\
\mbox{}\verb@                        thisPQ_ans[0] += xx[0] * yy[0];@\\
\mbox{}\verb@                    }@\\
\mbox{}\verb@                }@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape continue subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86c}{86c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@            xx = xx + diff;@\\
\mbox{}\verb@            yy = yy + diff;@\\
\mbox{}\verb@            if (HAS_WEIGHTS) {@\\
\mbox{}\verb@                w = w + diff;@\\
\mbox{}\verb@                thisPQ_ans[0] += (xx[0] - cx) * (yy[0] - cy) * w[0];@\\
\mbox{}\verb@            } else {@\\
\mbox{}\verb@                thisPQ_ans[0] += (xx[0] - cx) * (yy[0] - cy);@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb94a}{94a}\NWlink{nuweb94b}{b}\NWlink{nuweb94c}{c}\NWlink{nuweb95}{, 95}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb24f}{24f}\NWlink{nuweb25a}{, 25a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsubsection{Xfactor Kronecker Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap189}\raggedright\small
\NWtarget{nuweb97a}{} $\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize {97a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb23f}{23f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb97b}{97b}\NWlink{nuweb97c}{c}\NWlink{nuweb97d}{d}\NWlink{nuweb98a}{, 98a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap190}\raggedright\small
\NWtarget{nuweb97b}{} $\langle\,${\itshape C_XfactorKronSums_dweights_dsubset}\nobreak\ {\footnotesize {97b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_XfactorKronSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb97a}{97a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb98b}{98b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_dweights_dsubset@\nobreak\ \NWlink{nuweb93a}{93a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap191}\raggedright\small
\NWtarget{nuweb97c}{} $\langle\,${\itshape C_XfactorKronSums_iweights_dsubset}\nobreak\ {\footnotesize {97c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_XfactorKronSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb97a}{97a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb98b}{98b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_iweights_dsubset@\nobreak\ \NWlink{nuweb93a}{93a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap192}\raggedright\small
\NWtarget{nuweb97d}{} $\langle\,${\itshape C_XfactorKronSums_iweights_isubset}\nobreak\ {\footnotesize {97d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_XfactorKronSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb97a}{97a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb98b}{98b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_iweights_isubset@\nobreak\ \NWlink{nuweb93a}{93a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap193}\raggedright\small
\NWtarget{nuweb98a}{} $\langle\,${\itshape C_XfactorKronSums_dweights_isubset}\nobreak\ {\footnotesize {98a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_XfactorKronSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb97a}{97a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb98b}{98b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_dweights_isubset@\nobreak\ \NWlink{nuweb93a}{93a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap194}\raggedright\small
\NWtarget{nuweb98b}{} $\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize {98b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int *xx, ixi;@\\
\mbox{}\verb@double *yy;@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int p = 0; p < mPQB(P, Q, 1); p++) PQ_ans[p] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@    yy = y + N * q;@\\
\mbox{}\verb@    xx = x;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape init subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    {@\\
\mbox{}\verb@        xx = xx + diff;@\\
\mbox{}\verb@        yy = yy + diff;@\\
\mbox{}\verb@        ixi = xx[0] - 1;@\\
\mbox{}\verb@        if (HAS_WEIGHTS) {@\\
\mbox{}\verb@            w = w + diff;@\\
\mbox{}\verb@            if (ixi >= 0)@\\
\mbox{}\verb@                PQ_ans[ixi + q * P] += yy[0] * w[0];@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            if (ixi >= 0)@\\
\mbox{}\verb@                PQ_ans[ixi + q * P] += yy[0];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape continue subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86c}{86c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    xx = xx + diff;@\\
\mbox{}\verb@    yy = yy + diff;@\\
\mbox{}\verb@    ixi = xx[0] - 1;@\\
\mbox{}\verb@    if (HAS_WEIGHTS) {@\\
\mbox{}\verb@        w = w + diff;@\\
\mbox{}\verb@        if (ixi >= 0)@\\
\mbox{}\verb@            PQ_ans[ixi + q * P] += yy[0] * w[0];@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (ixi >= 0)@\\
\mbox{}\verb@            PQ_ans[ixi + q * P] += yy[0];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb97b}{97b}\NWlink{nuweb97c}{c}\NWlink{nuweb97d}{d}\NWlink{nuweb98a}{, 98a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb24f}{24f}\NWlink{nuweb25a}{, 25a}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsubsection{Permuted Kronecker Sums}

<<KronSums-Permutation>>=
a0 <- colSums(x[subset, r1] * y[subsety, r2])
a1 <- .Call(libcoin:::R_KronSums_Permutation, x, P, y, subset, subsety)
a2 <- .Call(libcoin:::R_KronSums_Permutation, x, P, y, as.double(subset), as.double(subsety))

stopifnot(isequal(a0, a1) && isequal(a0, a2))

a0 <- as.vector(colSums(Xfactor[subset, r1Xfactor] * y[subsety, r2Xfactor]))
a1 <- .Call(libcoin:::R_KronSums_Permutation, ix, Lx, y, subset, subsety)
a2 <- .Call(libcoin:::R_KronSums_Permutation, ix, Lx, y, as.double(subset), as.double(subsety))

stopifnot(isequal(a0, a1) && isequal(a0, a2))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap195}\raggedright\small
\NWtarget{nuweb99a}{} $\langle\,${\itshape R_KronSums_Permutation Prototype}\nobreak\ {\footnotesize {99a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_KronSums_Permutation@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP P,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP subsety@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb99b}{, 99b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@R_KronSums_Permutation@\nobreak\ \NWlink{nuweb99b}{99b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap196}\raggedright\small
\NWtarget{nuweb99b}{} $\langle\,${\itshape R_KronSums_Permutation}\nobreak\ {\footnotesize {99b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_KronSums_Permutation Prototype}\nobreak\ {\footnotesize \NWlink{nuweb99a}{99a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    Q = NCOL(y);@\\
\mbox{}\verb@    N = XLENGTH(y) / Q;@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, INTEGER(P)[0] * Q));@\\
\mbox{}\verb@    RC_KronSums_Permutation(x, N, INTEGER(P)[0], REAL(y), Q, subset, Offset0, Nsubset,@\\
\mbox{}\verb@                            subsety, REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_KronSums_Permutation@\nobreak\ \NWlink{nuweb99a}{99a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_KronSums_Permutation@\nobreak\ \NWlink{nuweb100b}{100b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap197}\raggedright\small
\NWtarget{nuweb100a}{} $\langle\,${\itshape RC_KronSums_Permutation Prototype}\nobreak\ {\footnotesize {100a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_KronSums_Permutation@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb100b}{100b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_KronSums_Permutation@\nobreak\ \NWlink{nuweb100b}{100b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap198}\raggedright\small
\NWtarget{nuweb100b}{} $\langle\,${\itshape RC_KronSums_Permutation}\nobreak\ {\footnotesize {100b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_KronSums_Permutation Prototype}\nobreak\ {\footnotesize \NWlink{nuweb100a}{100a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (TYPEOF(x) == INTSXP) {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_XfactorKronSums_Permutation_isubset(INTEGER(x), N, P, y, Q,@\\
\mbox{}\verb@                                                  INTEGER(subset), offset, Nsubset,@\\
\mbox{}\verb@                                                  INTEGER(subsety), PQ_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_XfactorKronSums_Permutation_dsubset(INTEGER(x), N, P, y, Q,@\\
\mbox{}\verb@                                                  REAL(subset), offset, Nsubset,@\\
\mbox{}\verb@                                                  REAL(subsety), PQ_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_KronSums_Permutation_isubset(REAL(x), N, P, y, Q,@\\
\mbox{}\verb@                                           INTEGER(subset), offset, Nsubset,@\\
\mbox{}\verb@                                           INTEGER(subsety), PQ_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_KronSums_Permutation_dsubset(REAL(x), N, P, y, Q,@\\
\mbox{}\verb@                                           REAL(subset), offset, Nsubset,@\\
\mbox{}\verb@                                           REAL(subsety), PQ_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_KronSums_Permutation@\nobreak\ \NWlink{nuweb36}{36}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100a}{, 100a}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_KronSums_Permutation_dsubset@\nobreak\ \NWlink{nuweb101a}{101a}, \verb@C_KronSums_Permutation_isubset@\nobreak\ \NWlink{nuweb101b}{101b}, \verb@C_XfactorKronSums_Permutation_dsubset@\nobreak\ \NWlink{nuweb102a}{102a}, \verb@C_XfactorKronSums_Permutation_isubset@\nobreak\ \NWlink{nuweb102b}{102b}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap199}\raggedright\small
\NWtarget{nuweb101a}{} $\langle\,${\itshape C_KronSums_Permutation_dsubset}\nobreak\ {\footnotesize {101a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_KronSums_Permutation_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize \NWlink{nuweb23e}{23e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Permutation Body}\nobreak\ {\footnotesize \NWlink{nuweb101c}{101c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_Permutation_dsubset@\nobreak\ \NWlink{nuweb100b}{100b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap200}\raggedright\small
\NWtarget{nuweb101b}{} $\langle\,${\itshape C_KronSums_Permutation_isubset}\nobreak\ {\footnotesize {101b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_KronSums_Permutation_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize \NWlink{nuweb23e}{23e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int *subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Permutation Body}\nobreak\ {\footnotesize \NWlink{nuweb101c}{101c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_Permutation_isubset@\nobreak\ \NWlink{nuweb100b}{100b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Because \code{subset} might not be ordered (in the presence of blocks) we
have to go through all elements explicitly here.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap201}\raggedright\small
\NWtarget{nuweb101c}{} $\langle\,${\itshape KronSums Permutation Body}\nobreak\ {\footnotesize {101c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@R_xlen_t qP, qN, pN, qPp;@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@    qN = q * N;@\\
\mbox{}\verb@    qP = q * P;@\\
\mbox{}\verb@    for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@        qPp = qP + p;@\\
\mbox{}\verb@        PQ_ans[qPp] = 0.0;@\\
\mbox{}\verb@        pN = p * N;@\\
\mbox{}\verb@        for (R_xlen_t i = offset; i < Nsubset; i++)@\\
\mbox{}\verb@            PQ_ans[qPp] += y[qN + (R_xlen_t) subsety[i] - 1] *@\\
\mbox{}\verb@                           x[pN + (R_xlen_t) subset[i] - 1];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb101a}{101a}\NWlink{nuweb101b}{b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsubsection{Xfactor Permuted Kronecker Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap202}\raggedright\small
\NWtarget{nuweb102a}{} $\langle\,${\itshape C_XfactorKronSums_Permutation_dsubset}\nobreak\ {\footnotesize {102a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_XfactorKronSums_Permutation_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb23f}{23f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Permutation Body}\nobreak\ {\footnotesize \NWlink{nuweb102c}{102c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_Permutation_dsubset@\nobreak\ \NWlink{nuweb100b}{100b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap203}\raggedright\small
\NWtarget{nuweb102b}{} $\langle\,${\itshape C_XfactorKronSums_Permutation_isubset}\nobreak\ {\footnotesize {102b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_XfactorKronSums_Permutation_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb23f}{23f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int *subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Permutation Body}\nobreak\ {\footnotesize \NWlink{nuweb102c}{102c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90b}{90b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_Permutation_isubset@\nobreak\ \NWlink{nuweb100b}{100b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap204}\raggedright\small
\NWtarget{nuweb102c}{} $\langle\,${\itshape XfactorKronSums Permutation Body}\nobreak\ {\footnotesize {102c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@R_xlen_t qP, qN;@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int p = 0; p < mPQB(P, Q, 1); p++) PQ_ans[p] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@    qP = q * P;@\\
\mbox{}\verb@    qN = q * N;@\\
\mbox{}\verb@    for (R_xlen_t i = offset; i < Nsubset; i++)@\\
\mbox{}\verb@        PQ_ans[x[(R_xlen_t) subset[i] - 1] - 1 + qP] += y[qN + (R_xlen_t) subsety[i] - 1];@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb102a}{102a}\NWlink{nuweb102b}{b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Column Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap205}\raggedright\small
\NWtarget{nuweb102d}{} $\langle\,${\itshape colSums}\nobreak\ {\footnotesize {102d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_colSums_dweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb104d}{104d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_colSums_iweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb105a}{105a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_colSums_iweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb105b}{105b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_colSums_dweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb105c}{105c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_colSums}\nobreak\ {\footnotesize \NWlink{nuweb104a}{104a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_colSums}\nobreak\ {\footnotesize \NWlink{nuweb103b}{103b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<colSums>>=
a0 <- colSums(x[subset, ] * weights[subset])
a1 <- .Call(libcoin:::R_colSums, x, weights, subset)
a2 <- .Call(libcoin:::R_colSums, x, as.double(weights), as.double(subset))
a3 <- .Call(libcoin:::R_colSums, x, weights, as.double(subset))
a4 <- .Call(libcoin:::R_colSums, x, as.double(weights), subset)

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap206}\raggedright\small
\NWtarget{nuweb103a}{} $\langle\,${\itshape R_colSums Prototype}\nobreak\ {\footnotesize {103a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_colSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb103b}{, 103b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_colSums@\nobreak\ \NWlink{nuweb103b}{103b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap207}\raggedright\small
\NWtarget{nuweb103b}{} $\langle\,${\itshape R_colSums}\nobreak\ {\footnotesize {103b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_colSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb103a}{103a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    int P;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    double center;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    P = NCOL(x);@\\
\mbox{}\verb@    N = XLENGTH(x) / P;@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, P));@\\
\mbox{}\verb@    RC_colSums(REAL(x), N, P, Power1, &center, !DoCenter, weights, subset, Offset0,@\\
\mbox{}\verb@               Nsubset, REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb102d}{102d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_colSums@\nobreak\ \NWlink{nuweb103a}{103a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Power1@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb104a}{104a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap208}\raggedright\small
\NWtarget{nuweb103c}{} $\langle\,${\itshape RC_colSums Prototype}\nobreak\ {\footnotesize {103c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_colSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb104b}{104b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb104c}{104c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb104a}{104a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_colSums@\nobreak\ \NWlink{nuweb104a}{104a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap209}\raggedright\small
\NWtarget{nuweb104a}{} $\langle\,${\itshape RC_colSums}\nobreak\ {\footnotesize {104a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_colSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb103c}{103c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (TYPEOF(weights) == INTSXP) {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_colSums_iweights_isubset(x, N, P, power, centerx, CENTER,@\\
\mbox{}\verb@                                       INTEGER(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@                                       offset, Nsubset, P_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_colSums_iweights_dsubset(x, N, P, power, centerx, CENTER,@\\
\mbox{}\verb@                                       INTEGER(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@                                       offset, Nsubset, P_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_colSums_dweights_isubset(x, N, P, power, centerx, CENTER,@\\
\mbox{}\verb@                                       REAL(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@                                       offset, Nsubset, P_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_colSums_dweights_dsubset(x, N, P, power, centerx, CENTER,@\\
\mbox{}\verb@                                       REAL(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@                                       offset, Nsubset, P_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb102d}{102d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_colSums@\nobreak\ \NWlink{nuweb79c}{79c}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb103c}{c}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_colSums_dweights_dsubset@\nobreak\ \NWlink{nuweb104d}{104d}, \verb@C_colSums_dweights_isubset@\nobreak\ \NWlink{nuweb105c}{105c}, \verb@C_colSums_iweights_dsubset@\nobreak\ \NWlink{nuweb105a}{105a}, \verb@C_colSums_iweights_isubset@\nobreak\ \NWlink{nuweb105b}{105b}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap210}\raggedright\small
\NWtarget{nuweb104b}{} $\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize {104b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize \NWlink{nuweb23e}{23e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@const int power,@\\
\mbox{}\verb@double *centerx,@\\
\mbox{}\verb@const int CENTER,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb103c}{103c}\NWlink{nuweb104d}{, 104d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb105b}{b}\NWlink{nuweb105c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap211}\raggedright\small
\NWtarget{nuweb104c}{} $\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize {104c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *P_ans@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb79b}{79b}\NWlink{nuweb103c}{, 103c}\NWlink{nuweb104d}{, 104d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb105b}{b}\NWlink{nuweb105c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap212}\raggedright\small
\NWtarget{nuweb104d}{} $\langle\,${\itshape C_colSums_dweights_dsubset}\nobreak\ {\footnotesize {104d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_colSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb104b}{104b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb104c}{104c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb102d}{102d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_colSums_dweights_dsubset@\nobreak\ \NWlink{nuweb104a}{104a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap213}\raggedright\small
\NWtarget{nuweb105a}{} $\langle\,${\itshape C_colSums_iweights_dsubset}\nobreak\ {\footnotesize {105a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_colSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb104b}{104b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb104c}{104c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb102d}{102d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_colSums_iweights_dsubset@\nobreak\ \NWlink{nuweb104a}{104a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap214}\raggedright\small
\NWtarget{nuweb105b}{} $\langle\,${\itshape C_colSums_iweights_isubset}\nobreak\ {\footnotesize {105b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_colSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb104b}{104b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb104c}{104c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb102d}{102d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_colSums_iweights_isubset@\nobreak\ \NWlink{nuweb104a}{104a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap215}\raggedright\small
\NWtarget{nuweb105c}{} $\langle\,${\itshape C_colSums_dweights_isubset}\nobreak\ {\footnotesize {105c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_colSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb104b}{104b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb104c}{104c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb102d}{102d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_colSums_dweights_isubset@\nobreak\ \NWlink{nuweb104a}{104a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap216}\raggedright\small
\NWtarget{nuweb106a}{} $\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize {106a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *xx, cx = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int p = 0; p < P; p++) {@\\
\mbox{}\verb@    P_ans[0] = 0.0;@\\
\mbox{}\verb@    xx = x + N * p;@\\
\mbox{}\verb@    if (CENTER) {@\\
\mbox{}\verb@        cx = centerx[p];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape init subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    {@\\
\mbox{}\verb@        xx = xx + diff;@\\
\mbox{}\verb@        if (HAS_WEIGHTS) {@\\
\mbox{}\verb@            w = w + diff;@\\
\mbox{}\verb@            P_ans[0] += pow(xx[0] - cx, power) * w[0];@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            P_ans[0] += pow(xx[0] - cx, power);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape continue subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86c}{86c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    xx = xx + diff;@\\
\mbox{}\verb@    if (HAS_WEIGHTS) {@\\
\mbox{}\verb@        w = w + diff;@\\
\mbox{}\verb@        P_ans[0] += pow(xx[0] - cx, power) * w[0];@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        P_ans[0] += pow(xx[0] - cx, power);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    P_ans++;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb104d}{104d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb105b}{b}\NWlink{nuweb105c}{c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb24f}{24f}\NWlink{nuweb25a}{, 25a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Tables}

\subsubsection{OneTable Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap217}\raggedright\small
\NWtarget{nuweb106b}{} $\langle\,${\itshape Tables}\nobreak\ {\footnotesize {106b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_OneTableSums_dweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb108d}{108d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_OneTableSums_iweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb109a}{109a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_OneTableSums_iweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb109b}{109b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_OneTableSums_dweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb109c}{109c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_OneTableSums}\nobreak\ {\footnotesize \NWlink{nuweb108a}{108a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_OneTableSums}\nobreak\ {\footnotesize \NWlink{nuweb107b}{107b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_TwoTableSums_dweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb112d}{112d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_TwoTableSums_iweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb113a}{113a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_TwoTableSums_iweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb113b}{113b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_TwoTableSums_dweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb113c}{113c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_TwoTableSums}\nobreak\ {\footnotesize \NWlink{nuweb112a}{112a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_TwoTableSums}\nobreak\ {\footnotesize \NWlink{nuweb111a}{111a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_ThreeTableSums_dweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb116d}{116d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_ThreeTableSums_iweights_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb117a}{117a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_ThreeTableSums_iweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb117b}{117b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_ThreeTableSums_dweights_isubset}\nobreak\ {\footnotesize \NWlink{nuweb117c}{117c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_ThreeTableSums}\nobreak\ {\footnotesize \NWlink{nuweb116a}{116a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ThreeTableSums}\nobreak\ {\footnotesize \NWlink{nuweb115a}{115a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<OneTableSum>>=
a0 <- as.vector(xtabs(weights ~ ixf, subset = subset))
a1 <- ctabs(ix, weights = weights, subset = subset)[-1]
a2 <- ctabs(ix, weights = as.double(weights), subset = as.double(subset))[-1]
a3 <- ctabs(ix, weights = weights, subset = as.double(subset))[-1]
a4 <- ctabs(ix, weights = as.double(weights), subset = subset)[-1]

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap218}\raggedright\small
\NWtarget{nuweb107a}{} $\langle\,${\itshape R_OneTableSums Prototype}\nobreak\ {\footnotesize {107a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_OneTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb107b}{, 107b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb107b}{107b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap219}\raggedright\small
\NWtarget{nuweb107b}{} $\langle\,${\itshape R_OneTableSums}\nobreak\ {\footnotesize {107b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_OneTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb107a}{107a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    int P;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    N = XLENGTH(x);@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@    P = NLEVELS(x) + 1;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, P));@\\
\mbox{}\verb@    RC_OneTableSums(INTEGER(x), N, P, weights, subset,@\\
\mbox{}\verb@                    Offset0, Nsubset, REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb15b}{15b}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb127a}{127a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb108a}{108a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap220}\raggedright\small
\NWtarget{nuweb107c}{} $\langle\,${\itshape RC_OneTableSums Prototype}\nobreak\ {\footnotesize {107c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_OneTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb108b}{108b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb108c}{108c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb108a}{108a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb108a}{108a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap221}\raggedright\small
\NWtarget{nuweb108a}{} $\langle\,${\itshape RC_OneTableSums}\nobreak\ {\footnotesize {108a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_OneTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb107c}{107c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (TYPEOF(weights) == INTSXP) {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_OneTableSums_iweights_isubset(x, N, P,@\\
\mbox{}\verb@                                        INTEGER(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, P_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_OneTableSums_iweights_dsubset(x, N, P,@\\
\mbox{}\verb@                                        INTEGER(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, P_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_OneTableSums_dweights_isubset(x, N, P,@\\
\mbox{}\verb@                                        REAL(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, P_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_OneTableSums_dweights_dsubset(x, N, P,@\\
\mbox{}\verb@                                        REAL(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, P_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb36}{, 36}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb107c}{c}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_OneTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb108d}{108d}, \verb@C_OneTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb109c}{109c}, \verb@C_OneTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb109a}{109a}, \verb@C_OneTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb109b}{109b}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap222}\raggedright\small
\NWtarget{nuweb108b}{} $\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize {108b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb23f}{23f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb107c}{107c}\NWlink{nuweb108d}{, 108d}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb109c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap223}\raggedright\small
\NWtarget{nuweb108c}{} $\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize {108c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *P_ans@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb83a}{83a}\NWlink{nuweb107c}{, 107c}\NWlink{nuweb108d}{, 108d}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb109c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap224}\raggedright\small
\NWtarget{nuweb108d}{} $\langle\,${\itshape C_OneTableSums_dweights_dsubset}\nobreak\ {\footnotesize {108d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_OneTableSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb108b}{108b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb108c}{108c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb110a}{110a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_OneTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb108a}{108a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap225}\raggedright\small
\NWtarget{nuweb109a}{} $\langle\,${\itshape C_OneTableSums_iweights_dsubset}\nobreak\ {\footnotesize {109a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_OneTableSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb108b}{108b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb108c}{108c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb110a}{110a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_OneTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb108a}{108a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap226}\raggedright\small
\NWtarget{nuweb109b}{} $\langle\,${\itshape C_OneTableSums_iweights_isubset}\nobreak\ {\footnotesize {109b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_OneTableSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb108b}{108b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb108c}{108c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb110a}{110a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_OneTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb108a}{108a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap227}\raggedright\small
\NWtarget{nuweb109c}{} $\langle\,${\itshape C_OneTableSums_dweights_isubset}\nobreak\ {\footnotesize {109c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_OneTableSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb108b}{108b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb108c}{108c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb110a}{110a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_OneTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb108a}{108a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap228}\raggedright\small
\NWtarget{nuweb110a}{} $\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize {110a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int *xx;@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int p = 0; p < P; p++) P_ans[p] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@xx = x;@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape init subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    xx = xx + diff;@\\
\mbox{}\verb@    if (HAS_WEIGHTS) {@\\
\mbox{}\verb@        w = w + diff;@\\
\mbox{}\verb@        P_ans[xx[0]] += (double) w[0];@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        P_ans[xx[0]]++;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape continue subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86c}{86c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@xx = xx + diff;@\\
\mbox{}\verb@if (HAS_WEIGHTS) {@\\
\mbox{}\verb@    w = w + diff;@\\
\mbox{}\verb@    P_ans[xx[0]] += w[0];@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    P_ans[xx[0]]++;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb108d}{108d}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb109c}{c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb24f}{24f}\NWlink{nuweb25a}{, 25a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsubsection{TwoTable Sums}

<<TwoTableSum>>=
a0 <- xtabs(weights ~ ixf + iyf, subset = subset)
class(a0) <- "matrix"
dimnames(a0) <- NULL
attributes(a0)$call <- NULL
a1 <- ctabs(ix, iy, weights = weights, subset = subset)[-1, -1]
a2 <- ctabs(ix, iy, weights = as.double(weights),
            subset = as.double(subset))[-1, -1]
a3 <- ctabs(ix, iy, weights = weights, subset = as.double(subset))[-1, -1]
a4 <- ctabs(ix, iy, weights = as.double(weights), subset = subset)[-1, -1]

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap229}\raggedright\small
\NWtarget{nuweb110b}{} $\langle\,${\itshape R_TwoTableSums Prototype}\nobreak\ {\footnotesize {110b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_TwoTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb111a}{, 111a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb111a}{111a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap230}\raggedright\small
\NWtarget{nuweb111a}{} $\langle\,${\itshape R_TwoTableSums}\nobreak\ {\footnotesize {111a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_TwoTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb110b}{110b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, dim;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    int P, Q;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    N = XLENGTH(x);@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@    P = NLEVELS(x) + 1;@\\
\mbox{}\verb@    Q = NLEVELS(y) + 1;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, mPQB(P, Q, 1)));@\\
\mbox{}\verb@    PROTECT(dim = allocVector(INTSXP, 2));@\\
\mbox{}\verb@    INTEGER(dim)[0] = P;@\\
\mbox{}\verb@    INTEGER(dim)[1] = Q;@\\
\mbox{}\verb@    dimgets(ans, dim);@\\
\mbox{}\verb@    RC_TwoTableSums(INTEGER(x), N, P, INTEGER(y), Q,@\\
\mbox{}\verb@                    weights, subset, Offset0, Nsubset, REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb15b}{15b}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb127a}{127a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_TwoTableSums@\nobreak\ \NWlink{nuweb112a}{112a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap231}\raggedright\small
\NWtarget{nuweb111b}{} $\langle\,${\itshape RC_TwoTableSums Prototype}\nobreak\ {\footnotesize {111b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_TwoTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb112b}{112b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb112c}{112c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb112a}{112a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_TwoTableSums@\nobreak\ \NWlink{nuweb112a}{112a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap232}\raggedright\small
\NWtarget{nuweb112a}{} $\langle\,${\itshape RC_TwoTableSums}\nobreak\ {\footnotesize {112a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_TwoTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb111b}{111b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (TYPEOF(weights) == INTSXP) {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_TwoTableSums_iweights_isubset(x, N, P, y, Q,@\\
\mbox{}\verb@                                        INTEGER(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_TwoTableSums_iweights_dsubset(x, N, P, y, Q,@\\
\mbox{}\verb@                                        INTEGER(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_TwoTableSums_dweights_isubset(x, N, P, y, Q,@\\
\mbox{}\verb@                                        REAL(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_TwoTableSums_dweights_dsubset(x, N, P, y, Q,@\\
\mbox{}\verb@                                        REAL(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, PQ_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_TwoTableSums@\nobreak\ \NWlink{nuweb40a}{40a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb111b}{b}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_TwoTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb112d}{112d}, \verb@C_TwoTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb113c}{113c}, \verb@C_TwoTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb113a}{113a}, \verb@C_TwoTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb113b}{113b}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap233}\raggedright\small
\NWtarget{nuweb112b}{} $\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize {112b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb23f}{23f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer y Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb111b}{111b}\NWlink{nuweb112d}{, 112d}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113b}{b}\NWlink{nuweb113c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap234}\raggedright\small
\NWtarget{nuweb112c}{} $\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize {112c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *PQ_ans@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb111b}{111b}\NWlink{nuweb112d}{, 112d}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113b}{b}\NWlink{nuweb113c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap235}\raggedright\small
\NWtarget{nuweb112d}{} $\langle\,${\itshape C_TwoTableSums_dweights_dsubset}\nobreak\ {\footnotesize {112d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_TwoTableSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb112b}{112b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb112c}{112c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb114a}{114a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_TwoTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb112a}{112a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap236}\raggedright\small
\NWtarget{nuweb113a}{} $\langle\,${\itshape C_TwoTableSums_iweights_dsubset}\nobreak\ {\footnotesize {113a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_TwoTableSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb112b}{112b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb112c}{112c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb114a}{114a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_TwoTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb112a}{112a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap237}\raggedright\small
\NWtarget{nuweb113b}{} $\langle\,${\itshape C_TwoTableSums_iweights_isubset}\nobreak\ {\footnotesize {113b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_TwoTableSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb112b}{112b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb112c}{112c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb114a}{114a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_TwoTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb112a}{112a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap238}\raggedright\small
\NWtarget{nuweb113c}{} $\langle\,${\itshape C_TwoTableSums_dweights_isubset}\nobreak\ {\footnotesize {113c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_TwoTableSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb112b}{112b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb112c}{112c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb114a}{114a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_TwoTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb112a}{112a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap239}\raggedright\small
\NWtarget{nuweb114a}{} $\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize {114a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int *xx, *yy;@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int p = 0; p < Q * P; p++) PQ_ans[p] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@yy = y;@\\
\mbox{}\verb@xx = x;@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape init subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    xx = xx + diff;@\\
\mbox{}\verb@    yy = yy + diff;@\\
\mbox{}\verb@    if (HAS_WEIGHTS) {@\\
\mbox{}\verb@        w = w + diff;@\\
\mbox{}\verb@        PQ_ans[yy[0] * P + xx[0]] += (double) w[0];@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PQ_ans[yy[0] * P + xx[0]]++;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape continue subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86c}{86c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@xx = xx + diff;@\\
\mbox{}\verb@yy = yy + diff;@\\
\mbox{}\verb@if (HAS_WEIGHTS) {@\\
\mbox{}\verb@    w = w + diff;@\\
\mbox{}\verb@    PQ_ans[yy[0] * P + xx[0]] += w[0];@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    PQ_ans[yy[0] * P + xx[0]]++;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb112d}{112d}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113b}{b}\NWlink{nuweb113c}{c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb24f}{24f}\NWlink{nuweb25a}{, 25a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsubsection{ThreeTable Sums}

<<ThreeTableSum>>=
a0 <- xtabs(weights ~ ixf + iyf + block, subset = subset)
class(a0) <- "array"
dimnames(a0) <- NULL
attributes(a0)$call <- NULL
a1 <- ctabs(ix, iy, block, weights, subset)[-1, -1,]
a2 <- ctabs(ix, iy, block, as.double(weights), as.double(subset))[-1,-1,]
a3 <- ctabs(ix, iy, block, weights, as.double(subset))[-1,-1,]
a4 <- ctabs(ix, iy, block, as.double(weights), subset)[-1,-1,]

stopifnot(isequal(a0, a1) && isequal(a0, a2) &&
          isequal(a0, a3) && isequal(a0, a4))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap240}\raggedright\small
\NWtarget{nuweb114b}{} $\langle\,${\itshape R_ThreeTableSums Prototype}\nobreak\ {\footnotesize {114b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_ThreeTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb115a}{, 115a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb115a}{115a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap241}\raggedright\small
\NWtarget{nuweb115a}{} $\langle\,${\itshape R_ThreeTableSums}\nobreak\ {\footnotesize {115a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_ThreeTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb114b}{114b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, dim;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    int P, Q, B;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    N = XLENGTH(x);@\\
\mbox{}\verb@    Nsubset = XLENGTH(subset);@\\
\mbox{}\verb@    P = NLEVELS(x) + 1;@\\
\mbox{}\verb@    Q = NLEVELS(y) + 1;@\\
\mbox{}\verb@    B = NLEVELS(block);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, mPQB(P, Q, B)));@\\
\mbox{}\verb@    PROTECT(dim = allocVector(INTSXP, 3));@\\
\mbox{}\verb@    INTEGER(dim)[0] = P;@\\
\mbox{}\verb@    INTEGER(dim)[1] = Q;@\\
\mbox{}\verb@    INTEGER(dim)[2] = B;@\\
\mbox{}\verb@    dimgets(ans, dim);@\\
\mbox{}\verb@    RC_ThreeTableSums(INTEGER(x), N, P, INTEGER(y), Q,@\\
\mbox{}\verb@                      INTEGER(block), B,@\\
\mbox{}\verb@                      weights, subset, Offset0, Nsubset, REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb15b}{15b}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb127a}{127a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@RC_ThreeTableSums@\nobreak\ \NWlink{nuweb116a}{116a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap242}\raggedright\small
\NWtarget{nuweb115b}{} $\langle\,${\itshape RC_ThreeTableSums Prototype}\nobreak\ {\footnotesize {115b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void RC_ThreeTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb116c}{116c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb116a}{116a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_ThreeTableSums@\nobreak\ \NWlink{nuweb116a}{116a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap243}\raggedright\small
\NWtarget{nuweb116a}{} $\langle\,${\itshape RC_ThreeTableSums}\nobreak\ {\footnotesize {116a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_ThreeTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb115b}{115b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (TYPEOF(weights) == INTSXP) {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_ThreeTableSums_iweights_isubset(x, N, P, y, Q, block, B,@\\
\mbox{}\verb@                                        INTEGER(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, PQL_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_ThreeTableSums_iweights_dsubset(x, N, P, y, Q, block, B,@\\
\mbox{}\verb@                                        INTEGER(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, PQL_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@            C_ThreeTableSums_dweights_isubset(x, N, P, y, Q, block, B,@\\
\mbox{}\verb@                                        REAL(weights), XLENGTH(weights) > 0, INTEGER(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, PQL_ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_ThreeTableSums_dweights_dsubset(x, N, P, y, Q, block, B,@\\
\mbox{}\verb@                                        REAL(weights), XLENGTH(weights) > 0, REAL(subset),@\\
\mbox{}\verb@                                        offset, Nsubset, PQL_ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ThreeTableSums@\nobreak\ \NWlink{nuweb40a}{40a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb115b}{b}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@C_ThreeTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb116d}{116d}, \verb@C_ThreeTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb117c}{117c}, \verb@C_ThreeTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb117a}{117a}, \verb@C_ThreeTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb117b}{117b}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@offset@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap244}\raggedright\small
\NWtarget{nuweb116b}{} $\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize {116b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb23f}{23f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer y Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer block Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb115b}{115b}\NWlink{nuweb116d}{, 116d}\NWlink{nuweb117a}{, 117a}\NWlink{nuweb117b}{b}\NWlink{nuweb117c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap245}\raggedright\small
\NWtarget{nuweb116c}{} $\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize {116c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double *PQL_ans@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb115b}{115b}\NWlink{nuweb116d}{, 116d}\NWlink{nuweb117a}{, 117a}\NWlink{nuweb117b}{b}\NWlink{nuweb117c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap246}\raggedright\small
\NWtarget{nuweb116d}{} $\langle\,${\itshape C_ThreeTableSums_dweights_dsubset}\nobreak\ {\footnotesize {116d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_ThreeTableSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb116c}{116c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb118a}{118a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ThreeTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb116a}{116a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap247}\raggedright\small
\NWtarget{nuweb117a}{} $\langle\,${\itshape C_ThreeTableSums_iweights_dsubset}\nobreak\ {\footnotesize {117a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_ThreeTableSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb116c}{116c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb118a}{118a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ThreeTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb116a}{116a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap248}\raggedright\small
\NWtarget{nuweb117b}{} $\langle\,${\itshape C_ThreeTableSums_iweights_isubset}\nobreak\ {\footnotesize {117b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_ThreeTableSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb116c}{116c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb118a}{118a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ThreeTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb116a}{116a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap249}\raggedright\small
\NWtarget{nuweb117c}{} $\langle\,${\itshape C_ThreeTableSums_dweights_isubset}\nobreak\ {\footnotesize {117c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_ThreeTableSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb116c}{116c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb118a}{118a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ThreeTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb116a}{116a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap250}\raggedright\small
\NWtarget{nuweb118a}{} $\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize {118a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int *xx, *yy, *bb, PQ = mPQB(P, Q, 1);@\\
\mbox{}\verb@@\\
\mbox{}\verb@for (int p = 0; p < PQ * B; p++) PQL_ans[p] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@yy = y;@\\
\mbox{}\verb@xx = x;@\\
\mbox{}\verb@bb = block;@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape init subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    xx = xx + diff;@\\
\mbox{}\verb@    yy = yy + diff;@\\
\mbox{}\verb@    bb = bb + diff;@\\
\mbox{}\verb@    if (HAS_WEIGHTS) {@\\
\mbox{}\verb@        w = w + diff;@\\
\mbox{}\verb@        PQL_ans[(bb[0] - 1) * PQ + yy[0] * P + xx[0]] += (double) w[0];@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PQL_ans[(bb[0] - 1) * PQ + yy[0] * P + xx[0]]++;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape continue subset loop}\nobreak\ {\footnotesize \NWlink{nuweb86c}{86c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@xx = xx + diff;@\\
\mbox{}\verb@yy = yy + diff;@\\
\mbox{}\verb@bb = bb + diff;@\\
\mbox{}\verb@if (HAS_WEIGHTS) {@\\
\mbox{}\verb@    w = w + diff;@\\
\mbox{}\verb@    PQL_ans[(bb[0] - 1) * PQ + yy[0] * P + xx[0]] += w[0];@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    PQL_ans[(bb[0] - 1) * PQ + yy[0] * P + xx[0]]++;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb116d}{116d}\NWlink{nuweb117a}{, 117a}\NWlink{nuweb117b}{b}\NWlink{nuweb117c}{c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb24f}{24f}\NWlink{nuweb25a}{, 25a}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Utilities}

\subsection{Blocks}

<<blocks>>=
sb <- sample(block)

ns1 <- do.call(c, tapply(subset, sb[subset], function(i) i))
ns2 <- .Call(libcoin:::R_order_subset_wrt_block, y, integer(0), subset, sb)

stopifnot(isequal(ns1, ns2))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap251}\raggedright\small
\NWtarget{nuweb118b}{} $\langle\,${\itshape Utils}\nobreak\ {\footnotesize {118b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_setup_subset}\nobreak\ {\footnotesize \NWlink{nuweb120b}{120b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_setup_subset_block}\nobreak\ {\footnotesize \NWlink{nuweb121}{121}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_order_subset_wrt_block}\nobreak\ {\footnotesize \NWlink{nuweb122a}{122a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_order_subset_wrt_block}\nobreak\ {\footnotesize \NWlink{nuweb120a}{120a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_order_subset_wrt_block}\nobreak\ {\footnotesize \NWlink{nuweb119b}{119b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap252}\raggedright\small
\NWtarget{nuweb119a}{} $\langle\,${\itshape R_order_subset_wrt_block Prototype}\nobreak\ {\footnotesize {119a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_order_subset_wrt_block@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb119b}{, 119b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_order_subset_wrt_block@\nobreak\ \NWlink{nuweb119b}{119b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap253}\raggedright\small
\NWtarget{nuweb119b}{} $\langle\,${\itshape R_order_subset_wrt_block}\nobreak\ {\footnotesize {119b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_order_subset_wrt_block Prototype}\nobreak\ {\footnotesize \NWlink{nuweb119a}{119a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    SEXP blockTable, ans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    N = XLENGTH(y) / NCOL(y);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (XLENGTH(weights) > 0)@\\
\mbox{}\verb@        error("cannot deal with weights here");@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (NLEVELS(block) > 1) {@\\
\mbox{}\verb@        PROTECT(blockTable = R_OneTableSums(block, weights, subset));@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PROTECT(blockTable = allocVector(REALSXP, 2));@\\
\mbox{}\verb@        REAL(blockTable)[0] = 0.0;@\\
\mbox{}\verb@        REAL(blockTable)[1] = RC_Sums(N, weights, subset, Offset0, XLENGTH(subset));@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = RC_order_subset_wrt_block(N, subset, block, blockTable));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb118b}{118b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_order_subset_wrt_block@\nobreak\ \NWlink{nuweb119a}{119a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb26e}{26e}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb127a}{127a}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb120a}{120a}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb107b}{107b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap254}\raggedright\small
\NWtarget{nuweb119c}{} $\langle\,${\itshape RC_order_subset_wrt_block Prototype}\nobreak\ {\footnotesize {119c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP RC_order_subset_wrt_block@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R blockTable Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb120a}{120a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb120a}{120a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap255}\raggedright\small
\NWtarget{nuweb120a}{} $\langle\,${\itshape RC_order_subset_wrt_block}\nobreak\ {\footnotesize {120a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_order_subset_wrt_block Prototype}\nobreak\ {\footnotesize \NWlink{nuweb119c}{119c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    int NOBLOCK = (XLENGTH(block) == 0 || XLENGTH(blockTable) == 2);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (XLENGTH(subset) > 0) {@\\
\mbox{}\verb@        if (NOBLOCK) {@\\
\mbox{}\verb@            return(subset);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            PROTECT(ans = allocVector(TYPEOF(subset), XLENGTH(subset)));@\\
\mbox{}\verb@            C_order_subset_wrt_block(subset, block, blockTable, ans);@\\
\mbox{}\verb@            UNPROTECT(1);@\\
\mbox{}\verb@            return(ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PROTECT(ans = allocVector(TYPEOF(subset), N));@\\
\mbox{}\verb@        if (NOBLOCK) {@\\
\mbox{}\verb@            C_setup_subset(N, ans);@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            C_setup_subset_block(N, block, blockTable, ans);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        UNPROTECT(1);@\\
\mbox{}\verb@        return(ans);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb118b}{118b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb36}{, 36}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb119c}{c}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb26e}{26e}, \verb@C_order_subset_wrt_block@\nobreak\ \NWlink{nuweb122a}{122a}, \verb@C_setup_subset@\nobreak\ \NWlink{nuweb120b}{120b}, \verb@C_setup_subset_block@\nobreak\ \NWlink{nuweb121}{121}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap256}\raggedright\small
\NWtarget{nuweb120b}{} $\langle\,${\itshape C_setup_subset}\nobreak\ {\footnotesize {120b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_setup_subset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    for (R_xlen_t i = 0; i < N; i++) {@\\
\mbox{}\verb@        /* ans is R style index in 1:N */@\\
\mbox{}\verb@        if (TYPEOF(ans) == INTSXP) {@\\
\mbox{}\verb@            INTEGER(ans)[i] = i + 1;@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            REAL(ans)[i] = (double) i + 1;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb118b}{118b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_setup_subset@\nobreak\ \NWlink{nuweb120a}{120a}\NWlink{nuweb123a}{, 123a}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap257}\raggedright\small
\NWtarget{nuweb121}{} $\langle\,${\itshape C_setup_subset_block}\nobreak\ {\footnotesize {121}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_setup_subset_block@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R blockTable Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *cumtable;@\\
\mbox{}\verb@    int Nlevels = LENGTH(blockTable);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    cumtable = R_Calloc(Nlevels, double);@\\
\mbox{}\verb@    for (int k = 0; k < Nlevels; k++) cumtable[k] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* table[0] are missings, i.e. block == 0 ! */@\\
\mbox{}\verb@    for (int k = 1; k < Nlevels; k++)@\\
\mbox{}\verb@        cumtable[k] = cumtable[k - 1] + REAL(blockTable)[k - 1];@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (R_xlen_t i = 0; i < N; i++) {@\\
\mbox{}\verb@        /* ans is R style index in 1:N */@\\
\mbox{}\verb@        if (TYPEOF(ans) == INTSXP) {@\\
\mbox{}\verb@            INTEGER(ans)[(int) cumtable[INTEGER(block)[i]]++] = i + 1;@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            REAL(ans)[(R_xlen_t) cumtable[INTEGER(block)[i]]++] = (double) i + 1;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    R_Free(cumtable);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb118b}{118b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_setup_subset_block@\nobreak\ \NWlink{nuweb120a}{120a}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb26e}{26e}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap258}\raggedright\small
\NWtarget{nuweb122a}{} $\langle\,${\itshape C_order_subset_wrt_block}\nobreak\ {\footnotesize {122a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_order_subset_wrt_block@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R blockTable Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *cumtable;@\\
\mbox{}\verb@    int Nlevels = LENGTH(blockTable);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    cumtable = R_Calloc(Nlevels, double);@\\
\mbox{}\verb@    for (int k = 0; k < Nlevels; k++) cumtable[k] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* table[0] are missings, ie block == 0 ! */@\\
\mbox{}\verb@    for (int k = 1; k < Nlevels; k++)@\\
\mbox{}\verb@        cumtable[k] = cumtable[k - 1] + REAL(blockTable)[k - 1];@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* subset is R style index in 1:N */@\\
\mbox{}\verb@    if (TYPEOF(subset) == INTSXP) {@\\
\mbox{}\verb@        for (R_xlen_t i = 0; i < XLENGTH(subset); i++)@\\
\mbox{}\verb@            INTEGER(ans)[(int) cumtable[INTEGER(block)[INTEGER(subset)[i] - 1]]++] = INTEGER(subset)[i];@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        for (R_xlen_t i = 0; i < XLENGTH(subset); i++)@\\
\mbox{}\verb@            REAL(ans)[(R_xlen_t) cumtable[INTEGER(block)[(R_xlen_t) REAL(subset)[i] - 1]]++] = REAL(subset)[i];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    R_Free(cumtable);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb118b}{118b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_order_subset_wrt_block@\nobreak\ \NWlink{nuweb120a}{120a}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb26e}{26e}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap259}\raggedright\small
\NWtarget{nuweb122b}{} $\langle\,${\itshape RC_setup_subset Prototype}\nobreak\ {\footnotesize {122b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP RC_setup_subset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb123a}{123a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_setup_subset@\nobreak\ \NWlink{nuweb123a}{123a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Because this will only be used when really needed (in Permutations) we can
be a little bit more generous with memory here. The return value is always
\code{REALSXP}.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap260}\raggedright\small
\NWtarget{nuweb123a}{} $\langle\,${\itshape RC_setup_subset}\nobreak\ {\footnotesize {123a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_setup_subset Prototype}\nobreak\ {\footnotesize \NWlink{nuweb122b}{122b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, mysubset;@\\
\mbox{}\verb@    R_xlen_t sumweights;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (XLENGTH(subset) == 0) {@\\
\mbox{}\verb@        PROTECT(mysubset = allocVector(REALSXP, N));@\\
\mbox{}\verb@        C_setup_subset(N, mysubset);@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PROTECT(mysubset = coerceVector(subset, REALSXP));@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (XLENGTH(weights) == 0) {@\\
\mbox{}\verb@        UNPROTECT(1);@\\
\mbox{}\verb@        return(mysubset);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    sumweights = (R_xlen_t) RC_Sums(N, weights, mysubset, Offset0, XLENGTH(subset));@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, sumweights));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    R_xlen_t itmp = 0;@\\
\mbox{}\verb@    for (R_xlen_t i = 0; i < XLENGTH(mysubset); i++) {@\\
\mbox{}\verb@        if (TYPEOF(weights) == REALSXP) {@\\
\mbox{}\verb@            for (R_xlen_t j = 0; j < REAL(weights)[(R_xlen_t) REAL(mysubset)[i] - 1]; j++)@\\
\mbox{}\verb@                REAL(ans)[itmp++] = REAL(mysubset)[i];@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            for (R_xlen_t j = 0; j < INTEGER(weights)[(R_xlen_t) REAL(mysubset)[i] - 1]; j++)@\\
\mbox{}\verb@                REAL(ans)[itmp++] = REAL(mysubset)[i];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb123b}{123b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_setup_subset@\nobreak\ \NWlink{nuweb36}{36}\NWlink{nuweb122b}{, 122b}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_setup_subset@\nobreak\ \NWlink{nuweb120b}{120b}, \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@Offset0@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Permutation Helpers}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap261}\raggedright\small
\NWtarget{nuweb123b}{} $\langle\,${\itshape Permutations}\nobreak\ {\footnotesize {123b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_setup_subset}\nobreak\ {\footnotesize \NWlink{nuweb123a}{123a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_Permute}\nobreak\ {\footnotesize \NWlink{nuweb124a}{124a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_doPermute}\nobreak\ {\footnotesize \NWlink{nuweb124b}{124b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_PermuteBlock}\nobreak\ {\footnotesize \NWlink{nuweb124c}{124c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_doPermuteBlock}\nobreak\ {\footnotesize \NWlink{nuweb125a}{125a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap262}\raggedright\small
\NWtarget{nuweb124a}{} $\langle\,${\itshape C_Permute}\nobreak\ {\footnotesize {124a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_Permute@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    double *subset,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    R_xlen_t n = Nsubset, j;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (R_xlen_t i = 0; i < Nsubset; i++) {@\\
\mbox{}\verb@        j = n * unif_rand();@\\
\mbox{}\verb@        ans[i] = subset[j];@\\
\mbox{}\verb@        subset[j] = subset[--n];@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb123b}{123b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Permute@\nobreak\ \NWlink{nuweb124b}{124b}\NWlink{nuweb124c}{c}.\item \NWtxtIdentsUsed\nobreak\  \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap263}\raggedright\small
\NWtarget{nuweb124b}{} $\langle\,${\itshape C_doPermute}\nobreak\ {\footnotesize {124b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_doPermute@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    double *subset,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *Nsubset_tmp,@\\
\mbox{}\verb@    double *perm@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    Memcpy(Nsubset_tmp, subset, Nsubset);@\\
\mbox{}\verb@    C_Permute(Nsubset_tmp, Nsubset, perm);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb123b}{123b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_doPermute@\nobreak\ \NWlink{nuweb36}{36}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_Permute@\nobreak\ \NWlink{nuweb124a}{124a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap264}\raggedright\small
\NWtarget{nuweb124c}{} $\langle\,${\itshape C_PermuteBlock}\nobreak\ {\footnotesize {124c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_PermuteBlock@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    double *subset,@\\
\mbox{}\verb@    double *table,@\\
\mbox{}\verb@    int Nlevels,@\\
\mbox{}\verb@    double *ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *px, *pans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    px = subset;@\\
\mbox{}\verb@    pans = ans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (R_xlen_t j = 0; j < Nlevels; j++) {@\\
\mbox{}\verb@        if (table[j] > 0) {@\\
\mbox{}\verb@            C_Permute(px, (R_xlen_t) table[j], pans);@\\
\mbox{}\verb@            px += (R_xlen_t) table[j];@\\
\mbox{}\verb@            pans += (R_xlen_t) table[j];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb123b}{123b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_PermuteBlock@\nobreak\ \NWlink{nuweb125a}{125a}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_Permute@\nobreak\ \NWlink{nuweb124a}{124a}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap265}\raggedright\small
\NWtarget{nuweb125a}{} $\langle\,${\itshape C_doPermuteBlock}\nobreak\ {\footnotesize {125a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_doPermuteBlock@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    double *subset,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *table,@\\
\mbox{}\verb@    int Nlevels,@\\
\mbox{}\verb@    double *Nsubset_tmp,@\\
\mbox{}\verb@    double *perm@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    Memcpy(Nsubset_tmp, subset, Nsubset);@\\
\mbox{}\verb@    C_PermuteBlock(Nsubset_tmp, table, Nlevels, perm);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb123b}{123b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_doPermuteBlock@\nobreak\ \NWlink{nuweb36}{36}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_PermuteBlock@\nobreak\ \NWlink{nuweb124c}{124c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb25d}{25d}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Other Utils}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap266}\raggedright\small
\NWtarget{nuweb125b}{} $\langle\,${\itshape MoreUtils}\nobreak\ {\footnotesize {125b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape NROW}\nobreak\ {\footnotesize \NWlink{nuweb126a}{126a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape NCOL}\nobreak\ {\footnotesize \NWlink{nuweb126b}{126b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape NLEVELS}\nobreak\ {\footnotesize \NWlink{nuweb127a}{127a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_kronecker}\nobreak\ {\footnotesize \NWlink{nuweb129b}{129b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_kronecker}\nobreak\ {\footnotesize \NWlink{nuweb129a}{129a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_kronecker_sym}\nobreak\ {\footnotesize \NWlink{nuweb130a}{130a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_KronSums_sym}\nobreak\ {\footnotesize \NWlink{nuweb130b}{130b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_MPinv_sym}\nobreak\ {\footnotesize \NWlink{nuweb133}{133}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_MPinv_sym}\nobreak\ {\footnotesize \NWlink{nuweb132}{132}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_unpack_sym}\nobreak\ {\footnotesize \NWlink{nuweb135}{135}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_pack_sym}\nobreak\ {\footnotesize \NWlink{nuweb136c}{136c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap267}\raggedright\small
\NWtarget{nuweb126a}{} $\langle\,${\itshape NROW}\nobreak\ {\footnotesize {126a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@R_xlen_t NROW@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP x@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    SEXP a;@\\
\mbox{}\verb@    R_xlen_t ret;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(a = getAttrib(x, R_DimSymbol)); // rchk warning@\\
\mbox{}\verb@    if (a == R_NilValue) {@\\
\mbox{}\verb@        UNPROTECT(1);@\\
\mbox{}\verb@        return(XLENGTH(x));@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    if (TYPEOF(a) == REALSXP) {@\\
\mbox{}\verb@        ret = (R_xlen_t) REAL(a)[0];@\\
\mbox{}\verb@        UNPROTECT(1);@\\
\mbox{}\verb@        return(ret);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    ret = (R_xlen_t) INTEGER(a)[0];@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ret);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb6}{6}\NWlink{nuweb8}{, 8}\NWlink{nuweb9a}{, 9a}\NWlink{nuweb9b}{b}\NWlink{nuweb14}{, 14}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb36}{, 36}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb60b}{, 60b}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb129a}{, 129a}\NWlink{nuweb136c}{, 136c}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap268}\raggedright\small
\NWtarget{nuweb126b}{} $\langle\,${\itshape NCOL}\nobreak\ {\footnotesize {126b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int NCOL@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP x@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    SEXP a;@\\
\mbox{}\verb@    int ret;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(a = getAttrib(x, R_DimSymbol));  // rchk warning@\\
\mbox{}\verb@    if (a == R_NilValue) {@\\
\mbox{}\verb@        UNPROTECT(1);@\\
\mbox{}\verb@        return(1);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    if (TYPEOF(a) == REALSXP) {@\\
\mbox{}\verb@        ret = (int) REAL(a)[1];@\\
\mbox{}\verb@        UNPROTECT(1);@\\
\mbox{}\verb@        return(ret);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    ret = INTEGER(a)[1];@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ret);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@NCOL@\nobreak\ \NWlink{nuweb12}{12}\NWlink{nuweb30c}{, 30c}\NWlink{nuweb40b}{, 40b}\NWlink{nuweb60b}{, 60b}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb129a}{, 129a}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap269}\raggedright\small
\NWtarget{nuweb127a}{} $\langle\,${\itshape NLEVELS}\nobreak\ {\footnotesize {127a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int NLEVELS@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP x@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    SEXP a;@\\
\mbox{}\verb@    int maxlev = 0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(a = getAttrib(x, R_LevelsSymbol));@\\
\mbox{}\verb@    if (a == R_NilValue) {@\\
\mbox{}\verb@        if (TYPEOF(x) != INTSXP)@\\
\mbox{}\verb@            error("cannot determine number of levels");@\\
\mbox{}\verb@        for (R_xlen_t i = 0; i < XLENGTH(x); i++) {@\\
\mbox{}\verb@            if (INTEGER(x)[i] > maxlev)@\\
\mbox{}\verb@                maxlev = INTEGER(x)[i];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        UNPROTECT(1);@\\
\mbox{}\verb@        return(maxlev);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    maxlev = NROW(a);@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(maxlev);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@NLEVELS@\nobreak\ \NWlink{nuweb30c}{30c}\NWlink{nuweb40b}{, 40b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb119b}{, 119b}.\item \NWtxtIdentsUsed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Check for integer overflow when computing $P (P + 1) / 2$ and $P Q$.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap270}\raggedright\small
\NWtarget{nuweb127b}{} $\langle\,${\itshape PP12}\nobreak\ {\footnotesize {127b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int PP12@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    int P@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double dP = (double) P;@\\
\mbox{}\verb@    double ans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    ans = dP * (dP + 1) / 2;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (ans > INT_MAX)@\\
\mbox{}\verb@        error("cannot allocate memory: number of levels too large");@\\
\mbox{}\verb@@\\
\mbox{}\verb@    return((int) ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@PP12@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb43}{, 43}\NWlink{nuweb45}{, 45}\NWlink{nuweb50}{, 50}\NWlink{nuweb77}{, 77}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb144}{, 144}\NWlink{nuweb145a}{, 145a}.\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap271}\raggedright\small
\NWtarget{nuweb128a}{} $\langle\,${\itshape mPQB}\nobreak\ {\footnotesize {128a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int mPQB@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    int P,@\\
\mbox{}\verb@    int Q,@\\
\mbox{}\verb@    int B@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double ans = P * Q * B;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (ans > INT_MAX)@\\
\mbox{}\verb@        error("cannot allocate memory: number of levels too large");@\\
\mbox{}\verb@@\\
\mbox{}\verb@    return((int) ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb35a}{35a}\NWlink{nuweb36}{, 36}\NWlink{nuweb44}{, 44}\NWlink{nuweb47}{, 47}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb69}{, 69}\NWlink{nuweb70b}{, 70b}\NWlink{nuweb74b}{, 74b}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb144}{, 144}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<kronecker>>=
A <- matrix(runif(12), ncol = 3)
B <- matrix(runif(10), ncol = 2)

K1 <- kronecker(A, B)
K2 <- .Call(libcoin:::R_kronecker, A, B)

stopifnot(isequal(K1, K2))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap272}\raggedright\small
\NWtarget{nuweb128b}{} $\langle\,${\itshape R_kronecker Prototype}\nobreak\ {\footnotesize {128b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_kronecker@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP A,@\\
\mbox{}\verb@    SEXP B@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb129a}{, 129a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap273}\raggedright\small
\NWtarget{nuweb128c}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {128c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_kronecker(@\\
\mbox{}\verb@    SEXP A, SEXP B@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_kronecker");@\\
\mbox{}\verb@    return fun(A, B);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap274}\raggedright\small
\NWtarget{nuweb129a}{} $\langle\,${\itshape R_kronecker}\nobreak\ {\footnotesize {129a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_kronecker Prototype}\nobreak\ {\footnotesize \NWlink{nuweb128b}{128b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    int m, n, r, s;@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (!isReal(A) || !isReal(B))@\\
\mbox{}\verb@        error("R_kronecker: A and / or B are not of type REALSXP");@\\
\mbox{}\verb@@\\
\mbox{}\verb@    m = NROW(A);@\\
\mbox{}\verb@    n = NCOL(A);@\\
\mbox{}\verb@    r = NROW(B);@\\
\mbox{}\verb@    s = NCOL(B);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocMatrix(REALSXP, m * n, r * s));@\\
\mbox{}\verb@    C_kronecker(REAL(A), m, n, REAL(B), r, s, 1, REAL(ans));@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@C_kronecker@\nobreak\ \NWlink{nuweb129b}{129b}, \verb@NCOL@\nobreak\ \NWlink{nuweb126b}{126b}, \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap275}\raggedright\small
\NWtarget{nuweb129b}{} $\langle\,${\itshape C_kronecker}\nobreak\ {\footnotesize {129b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_kronecker@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const double *A,@\\
\mbox{}\verb@    const int m,@\\
\mbox{}\verb@    const int n,@\\
\mbox{}\verb@    const double *B,@\\
\mbox{}\verb@    const int r,@\\
\mbox{}\verb@    const int s,@\\
\mbox{}\verb@    const int overwrite,@\\
\mbox{}\verb@    double *ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int mr, js, ir;@\\
\mbox{}\verb@    double y;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (overwrite) {@\\
\mbox{}\verb@        for (int i = 0; i < m * r * n * s; i++) ans[i] = 0.0;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    mr = m * r;@\\
\mbox{}\verb@    for (int i = 0; i < m; i++) {@\\
\mbox{}\verb@        ir = i * r;@\\
\mbox{}\verb@        for (int j = 0; j < n; j++) {@\\
\mbox{}\verb@            js = j * s;@\\
\mbox{}\verb@            y = A[j*m + i];@\\
\mbox{}\verb@            for (int k = 0; k < r; k++) {@\\
\mbox{}\verb@                for (int l = 0; l < s; l++)@\\
\mbox{}\verb@                    ans[(js + l) * mr + ir + k] += y * B[l * r + k];@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_kronecker@\nobreak\ \NWlink{nuweb78a}{78a}\NWlink{nuweb129a}{, 129a}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap276}\raggedright\small
\NWtarget{nuweb130a}{} $\langle\,${\itshape C_kronecker_sym}\nobreak\ {\footnotesize {130a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_kronecker_sym@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const double *A,@\\
\mbox{}\verb@    const int m,@\\
\mbox{}\verb@    const double *B,@\\
\mbox{}\verb@    const int r,@\\
\mbox{}\verb@    const int overwrite,@\\
\mbox{}\verb@    double *ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int mr, js, ir, s;@\\
\mbox{}\verb@    double y;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    mr = m * r;@\\
\mbox{}\verb@    s = r;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (overwrite) {@\\
\mbox{}\verb@        for (int i = 0; i < mr * (mr + 1) / 2; i++) ans[i] = 0.0;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int i = 0; i < m; i++) {@\\
\mbox{}\verb@        ir = i * r;@\\
\mbox{}\verb@        for (int j = 0; j <= i; j++) {@\\
\mbox{}\verb@            js = j * s;@\\
\mbox{}\verb@            y = A[S(i, j, m)];@\\
\mbox{}\verb@            for (int k = 0; k < r; k++) {@\\
\mbox{}\verb@                for (int l = 0; l < (j < i ? s : k + 1); l++) {@\\
\mbox{}\verb@                    ans[S(ir + k, js + l, mr)] += y * B[S(k, l, r)];@\\
\mbox{}\verb@                }@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_kronecker_sym@\nobreak\ \NWlink{nuweb77}{77}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap277}\raggedright\small
\NWtarget{nuweb130b}{} $\langle\,${\itshape C_KronSums_sym}\nobreak\ {\footnotesize {130b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* sum_i (t(x[i,]) %*% x[i,]) */@\\
\mbox{}\verb@void C_KronSums_sym_@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize \NWlink{nuweb23e}{23e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    double *PP_sym_ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int pN, qN, SpqP;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (int q = 0; q < P; q++) {@\\
\mbox{}\verb@        qN = q * N;@\\
\mbox{}\verb@        for (int p = 0; p <= q; p++) {@\\
\mbox{}\verb@            PP_sym_ans[S(p, q, P)] = 0.0;@\\
\mbox{}\verb@            pN = p * N;@\\
\mbox{}\verb@            SpqP = S(p, q, P);@\\
\mbox{}\verb@            for (int i = 0; i < N; i++)@\\
\mbox{}\verb@                 PP_sym_ans[SpqP] += x[qN + i] * x[pN + i];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_sym@\nobreak\ \NWtxtIdentsNotUsed.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb23a}{23a}\NWlink{nuweb23b}{b}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<MPinv>>=
covar <- vcov(ls1)
covar_sym <- ls1$Covariance
n <- (sqrt(1 + 8 * length(covar_sym)) - 1) / 2

tol <- sqrt(.Machine$double.eps)
MP1 <- MPinverse(covar, tol)
MP2 <- .Call(libcoin:::R_MPinv_sym, covar_sym, as.integer(n), tol)

lt <- lower.tri(covar, diag = TRUE)
stopifnot(isequal(MP1$MPinv[lt], MP2$MPinv) &&
          isequal(MP1$rank, MP2$rank))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap278}\raggedright\small
\NWtarget{nuweb131a}{} $\langle\,${\itshape R_MPinv_sym Prototype}\nobreak\ {\footnotesize {131a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_MPinv_sym@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP x,@\\
\mbox{}\verb@    SEXP n,@\\
\mbox{}\verb@    SEXP tol@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb132}{, 132}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb132}{132}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap279}\raggedright\small
\NWtarget{nuweb131b}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {131b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_MPinv_sym(@\\
\mbox{}\verb@    SEXP x, SEXP n, SEXP tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_MPinv_sym");@\\
\mbox{}\verb@    return fun(x, n, tol);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb132}{132}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap280}\raggedright\small
\NWtarget{nuweb132}{} $\langle\,${\itshape R_MPinv_sym}\nobreak\ {\footnotesize {132}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_MPinv_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb131a}{131a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    int m;@\\
\mbox{}\verb@    SEXP ans, names, MPinv, rank;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    m = INTEGER(n)[0];@\\
\mbox{}\verb@    if (m == 0)@\\
\mbox{}\verb@        m = (int) (sqrt(0.25 + 2 * LENGTH(x)) - 0.5);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(ans = allocVector(VECSXP, 2));@\\
\mbox{}\verb@    PROTECT(names = allocVector(STRSXP, 2));@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, 0, MPinv = allocVector(REALSXP, LENGTH(x)));@\\
\mbox{}\verb@    SET_STRING_ELT(names, 0, mkChar("MPinv"));@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, 1, rank = allocVector(INTSXP, 1));@\\
\mbox{}\verb@    SET_STRING_ELT(names, 1, mkChar("rank"));@\\
\mbox{}\verb@    namesgets(ans, names);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    C_MPinv_sym(REAL(x), m, REAL(tol)[0], REAL(MPinv), INTEGER(rank));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb131a}{131a}\NWlink{nuweb131b}{b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb155a}{, 155a}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap281}\raggedright\small
\NWtarget{nuweb133}{} $\langle\,${\itshape C_MPinv_sym}\nobreak\ {\footnotesize {133}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void C_MPinv_sym@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const double *x,@\\
\mbox{}\verb@    const int n,@\\
\mbox{}\verb@    const double tol,@\\
\mbox{}\verb@    double *dMP,@\\
\mbox{}\verb@    int *rank@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *val, *vec, dtol, *rx, *work, valinv;@\\
\mbox{}\verb@    int valzero = 0, info = 0, kn;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (n == 1) {@\\
\mbox{}\verb@        if (x[0] > tol) {@\\
\mbox{}\verb@            dMP[0] = 1 / x[0];@\\
\mbox{}\verb@            rank[0] = 1;@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            dMP[0] = 0;@\\
\mbox{}\verb@            rank[0] = 0;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        rx = R_Calloc(n * (n + 1) / 2, double);@\\
\mbox{}\verb@        Memcpy(rx, x, n * (n + 1) / 2);@\\
\mbox{}\verb@        work = R_Calloc(3 * n, double);@\\
\mbox{}\verb@        val = R_Calloc(n, double);@\\
\mbox{}\verb@        vec = R_Calloc(n * n, double);@\\
\mbox{}\verb@@\\
\mbox{}\verb@        F77_CALL(dspev)("V", "L", &n, rx, val, vec, &n, work,@\\
\mbox{}\verb@                        &info FCONE FCONE);@\\
\mbox{}\verb@@\\
\mbox{}\verb@        dtol = val[n - 1] * tol;@\\
\mbox{}\verb@@\\
\mbox{}\verb@        for (int k = 0; k < n; k++)@\\
\mbox{}\verb@            valzero += (val[k] < dtol);@\\
\mbox{}\verb@        rank[0] = n - valzero;@\\
\mbox{}\verb@@\\
\mbox{}\verb@        for (int k = 0; k < n * (n + 1) / 2; k++) dMP[k] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@        for (int k = valzero; k < n; k++) {@\\
\mbox{}\verb@            valinv = 1 / val[k];@\\
\mbox{}\verb@            kn = k * n;@\\
\mbox{}\verb@            for (int i = 0; i < n; i++) {@\\
\mbox{}\verb@                for (int j = 0; j <= i; j++) {@\\
\mbox{}\verb@                    /* MP is symmetric */@\\
\mbox{}\verb@                    dMP[S(i, j, n)] += valinv * vec[kn + i] * vec[kn + j];@\\
\mbox{}\verb@                }@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        R_Free(rx); R_Free(work); R_Free(val); R_Free(vec);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<unpack>>=
m <- matrix(c(3, 2, 1,
              2, 4, 2,
              1, 2, 5),
            ncol = 3)

s <- m[lower.tri(m, diag = TRUE)]
u1 <- .Call(libcoin:::R_unpack_sym, s, NULL, 0L)
u2 <- .Call(libcoin:::R_unpack_sym, s, NULL, 1L)

stopifnot(isequal(m, u1) && isequal(diag(m), u2))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap282}\raggedright\small
\NWtarget{nuweb134a}{} $\langle\,${\itshape R_unpack_sym Prototype}\nobreak\ {\footnotesize {134a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_unpack_sym@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP x,@\\
\mbox{}\verb@    SEXP names,@\\
\mbox{}\verb@    SEXP diagonly@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb135}{, 135}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb135}{135}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap283}\raggedright\small
\NWtarget{nuweb134b}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {134b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_unpack_sym(@\\
\mbox{}\verb@    SEXP x, SEXP names, SEXP diagonly@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP, SEXP, SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP, SEXP, SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_unpack_sym");@\\
\mbox{}\verb@    return fun(x, names, diagonly);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb135}{135}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap284}\raggedright\small
\NWtarget{nuweb135}{} $\langle\,${\itshape R_unpack_sym}\nobreak\ {\footnotesize {135}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_unpack_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb134a}{134a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    R_xlen_t n, k = 0;@\\
\mbox{}\verb@    SEXP ans, dimnames;@\\
\mbox{}\verb@    double *dx, *dans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    /* m = n * (n + 1)/2 <=> n^2 + n - 2 * m = 0 */@\\
\mbox{}\verb@    n = sqrt(0.25 + 2 * XLENGTH(x)) - 0.5;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    dx = REAL(x);@\\
\mbox{}\verb@    if (INTEGER(diagonly)[0]) {@\\
\mbox{}\verb@        PROTECT(ans = allocVector(REALSXP, n));@\\
\mbox{}\verb@        if (names != R_NilValue) {@\\
\mbox{}\verb@            namesgets(ans, names);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        dans = REAL(ans);@\\
\mbox{}\verb@        for (R_xlen_t i = 0; i < n; i++) {@\\
\mbox{}\verb@            dans[i] = dx[k];@\\
\mbox{}\verb@            k += n - i;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        PROTECT(ans = allocMatrix(REALSXP, n, n));@\\
\mbox{}\verb@        if (names != R_NilValue) {@\\
\mbox{}\verb@            PROTECT(dimnames = allocVector(VECSXP, 2));@\\
\mbox{}\verb@            SET_VECTOR_ELT(dimnames, 0, names);@\\
\mbox{}\verb@            SET_VECTOR_ELT(dimnames, 1, names);@\\
\mbox{}\verb@            dimnamesgets(ans, dimnames);@\\
\mbox{}\verb@            UNPROTECT(1);@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@        dans = REAL(ans);@\\
\mbox{}\verb@        for (R_xlen_t i = 0; i < n; i++) {@\\
\mbox{}\verb@            dans[i * n + i] = dx[k];     /* diagonal */@\\
\mbox{}\verb@            k++;@\\
\mbox{}\verb@            for (R_xlen_t j = i + 1; j < n; j++) {@\\
\mbox{}\verb@                dans[i * n + j] = dx[k]; /* lower triangular */@\\
\mbox{}\verb@                dans[j * n + i] = dx[k]; /* upper triangular */@\\
\mbox{}\verb@                k++;@\\
\mbox{}\verb@            }@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return ans;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb10}{10}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb155a}{, 155a}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<pack>>=
m <- matrix(c(4, 3, 2, 1,
              3, 5, 4, 2,
              2, 4, 6, 5,
              1, 2, 5, 7),
            ncol = 4)

s <- m[lower.tri(m, diag = TRUE)]
p <- .Call(libcoin:::R_pack_sym, m)

stopifnot(isequal(s, p))
@

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap285}\raggedright\small
\NWtarget{nuweb136a}{} $\langle\,${\itshape R_pack_sym Prototype}\nobreak\ {\footnotesize {136a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP R_pack_sym@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP x@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22a}{22a}\NWlink{nuweb136c}{, 136c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_pack_sym@\nobreak\ \NWlink{nuweb136c}{136c}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
This function can be called from other packages.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap286}\raggedright\small
\NWtarget{nuweb136b}{} \verb@"src/libcoinAPI.h"@\nobreak\ {\footnotesize {136b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@extern SEXP libcoin_R_pack_sym(@\\
\mbox{}\verb@    SEXP x@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    static SEXP(*fun)(SEXP) = NULL;@\\
\mbox{}\verb@    if (fun == NULL)@\\
\mbox{}\verb@        fun = (SEXP(*)(SEXP))@\\
\mbox{}\verb@            R_GetCCallable("libcoin", "R_pack_sym");@\\
\mbox{}\verb@    return fun(x);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_pack_sym@\nobreak\ \NWlink{nuweb136c}{136c}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap287}\raggedright\small
\NWtarget{nuweb136c}{} $\langle\,${\itshape R_pack_sym}\nobreak\ {\footnotesize {136c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R_pack_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb136a}{136a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    R_xlen_t n, k = 0;@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    double *dx, *dans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    n = NROW(x);@\\
\mbox{}\verb@    dx = REAL(x);@\\
\mbox{}\verb@    PROTECT(ans = allocVector(REALSXP, n * (n + 1) / 2));@\\
\mbox{}\verb@    dans = REAL(ans);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (R_xlen_t i = 0; i < n; i++) {@\\
\mbox{}\verb@        for (R_xlen_t j = i; j < n; j++) {@\\
\mbox{}\verb@          dans[k] = dx[i * n + j];@\\
\mbox{}\verb@          k++;@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(1);@\\
\mbox{}\verb@    return ans;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb125b}{125b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_pack_sym@\nobreak\ \NWlink{nuweb136a}{136a}\NWlink{nuweb136b}{b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb154d}{, 154d}.\item \NWtxtIdentsUsed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb126a}{126a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Memory}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap288}\raggedright\small
\NWtarget{nuweb137a}{} $\langle\,${\itshape Memory}\nobreak\ {\footnotesize {137a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_P}\nobreak\ {\footnotesize \NWlink{nuweb137c}{137c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_Q}\nobreak\ {\footnotesize \NWlink{nuweb137d}{137d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape PP12}\nobreak\ {\footnotesize \NWlink{nuweb127b}{127b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape mPQB}\nobreak\ {\footnotesize \NWlink{nuweb128a}{128a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_varonly}\nobreak\ {\footnotesize \NWlink{nuweb138a}{138a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_Xfactor}\nobreak\ {\footnotesize \NWlink{nuweb138b}{138b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_LinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb138c}{138c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_Expectation}\nobreak\ {\footnotesize \NWlink{nuweb138d}{138d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_Variance}\nobreak\ {\footnotesize \NWlink{nuweb139a}{139a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_Covariance}\nobreak\ {\footnotesize \NWlink{nuweb139b}{139b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_ExpectationX}\nobreak\ {\footnotesize \NWlink{nuweb139c}{139c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_ExpectationInfluence}\nobreak\ {\footnotesize \NWlink{nuweb140a}{140a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_CovarianceInfluence}\nobreak\ {\footnotesize \NWlink{nuweb140b}{140b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_VarianceInfluence}\nobreak\ {\footnotesize \NWlink{nuweb140c}{140c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_TableBlock}\nobreak\ {\footnotesize \NWlink{nuweb140d}{140d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_Sumweights}\nobreak\ {\footnotesize \NWlink{nuweb141a}{141a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_Table}\nobreak\ {\footnotesize \NWlink{nuweb141b}{141b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_dimTable}\nobreak\ {\footnotesize \NWlink{nuweb141c}{141c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_B}\nobreak\ {\footnotesize \NWlink{nuweb141d}{141d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_nresample}\nobreak\ {\footnotesize \NWlink{nuweb142a}{142a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_PermutedLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb142b}{142b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C_get_tol}\nobreak\ {\footnotesize \NWlink{nuweb142c}{142c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_init_LECV_1d}\nobreak\ {\footnotesize \NWlink{nuweb145b}{145b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC_init_LECV_2d}\nobreak\ {\footnotesize \NWlink{nuweb146}{146}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb22c}{22c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap289}\raggedright\small
\NWtarget{nuweb137b}{} $\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize {137b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP LECV@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb49b}{49b}\NWlink{nuweb51b}{, 51b}\NWlink{nuweb137c}{, 137c}\NWlink{nuweb137d}{d}\NWlink{nuweb138a}{, 138a}\NWlink{nuweb138b}{b}\NWlink{nuweb138c}{c}\NWlink{nuweb138d}{d}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb139b}{b}\NWlink{nuweb139c}{c}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb140b}{b}\NWlink{nuweb140c}{c}\NWlink{nuweb140d}{d}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb141b}{b}\NWlink{nuweb141c}{c}\NWlink{nuweb141d}{d}\NWlink{nuweb142a}{, 142a}\NWlink{nuweb142b}{b}\NWlink{nuweb142c}{c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb37b}{37b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb50}{, 50}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb52}{, 52}\NWlink{nuweb53}{, 53}\NWlink{nuweb54a}{, 54a}\NWlink{nuweb54b}{b}\NWlink{nuweb55}{, 55}\NWlink{nuweb67b}{, 67b}\NWlink{nuweb69}{, 69}\NWlink{nuweb137c}{, 137c}\NWlink{nuweb137d}{d}\NWlink{nuweb138a}{, 138a}\NWlink{nuweb138b}{b}\NWlink{nuweb138c}{c}\NWlink{nuweb138d}{d}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb139b}{b}\NWlink{nuweb139c}{c}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb140b}{b}\NWlink{nuweb140c}{c}\NWlink{nuweb140d}{d}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb141b}{b}\NWlink{nuweb141c}{c}\NWlink{nuweb141d}{d}\NWlink{nuweb142a}{, 142a}\NWlink{nuweb142b}{b}\NWlink{nuweb142c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap290}\raggedright\small
\NWtarget{nuweb137c}{} $\langle\,${\itshape C_get_P}\nobreak\ {\footnotesize {137c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int C_get_P@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(INTEGER(VECTOR_ELT(LECV, dim_SLOT))[0]);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_P@\nobreak\ \NWlink{nuweb32a}{32a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb45}{, 45}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb55}{, 55}\NWlink{nuweb69}{, 69}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb139b}{b}\NWlink{nuweb142a}{, 142a}.\item \NWtxtIdentsUsed\nobreak\  \verb@dim_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap291}\raggedright\small
\NWtarget{nuweb137d}{} $\langle\,${\itshape C_get_Q}\nobreak\ {\footnotesize {137d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int C_get_Q@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(INTEGER(VECTOR_ELT(LECV, dim_SLOT))[1]);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Q@\nobreak\ \NWlink{nuweb32a}{32a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb45}{, 45}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb69}{, 69}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb139b}{b}\NWlink{nuweb142a}{, 142a}.\item \NWtxtIdentsUsed\nobreak\  \verb@dim_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap292}\raggedright\small
\NWtarget{nuweb138a}{} $\langle\,${\itshape C_get_varonly}\nobreak\ {\footnotesize {138a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int C_get_varonly@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(INTEGER(VECTOR_ELT(LECV, varonly_SLOT))[0]);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_varonly@\nobreak\ \NWlink{nuweb31}{31}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb45}{, 45}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}\NWlink{nuweb139b}{, 139b}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@varonly_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap293}\raggedright\small
\NWtarget{nuweb138b}{} $\langle\,${\itshape C_get_Xfactor}\nobreak\ {\footnotesize {138b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int C_get_Xfactor@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(INTEGER(VECTOR_ELT(LECV, Xfactor_SLOT))[0]);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Xfactor@\nobreak\ \NWlink{nuweb45}{45}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@Xfactor_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap294}\raggedright\small
\NWtarget{nuweb138c}{} $\langle\,${\itshape C_get_LinearStatistic}\nobreak\ {\footnotesize {138c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_LinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, LinearStatistic_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb32b}{32b}\NWlink{nuweb44}{, 44}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}\NWlink{nuweb145a}{, 145a}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@LinearStatistic_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap295}\raggedright\small
\NWtarget{nuweb138d}{} $\langle\,${\itshape C_get_Expectation}\nobreak\ {\footnotesize {138d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_Expectation@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, Expectation_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb34a}{34a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}\NWlink{nuweb145a}{, 145a}.\item \NWtxtIdentsUsed\nobreak\  \verb@Expectation_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap296}\raggedright\small
\NWtarget{nuweb139a}{} $\langle\,${\itshape C_get_Variance}\nobreak\ {\footnotesize {139a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_Variance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int PQ = C_get_P(LECV) * C_get_Q(LECV);@\\
\mbox{}\verb@    double *var, *covar;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (isNull(VECTOR_ELT(LECV, Variance_SLOT))) {@\\
\mbox{}\verb@        SET_VECTOR_ELT(LECV, Variance_SLOT,@\\
\mbox{}\verb@                       allocVector(REALSXP, PQ));@\\
\mbox{}\verb@        if (!isNull(VECTOR_ELT(LECV, Covariance_SLOT))) {@\\
\mbox{}\verb@            covar = REAL(VECTOR_ELT(LECV, Covariance_SLOT));@\\
\mbox{}\verb@            var = REAL(VECTOR_ELT(LECV, Variance_SLOT));@\\
\mbox{}\verb@            for (int p = 0; p < PQ; p++)@\\
\mbox{}\verb@                var[p] = covar[S(p, p, PQ)];@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, Variance_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Variance@\nobreak\ \NWlink{nuweb34c}{34c}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}\NWlink{nuweb139b}{, 139b}\NWlink{nuweb145a}{, 145a}.\item \NWtxtIdentsUsed\nobreak\  \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@C_get_P@\nobreak\ \NWlink{nuweb137c}{137c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb137d}{137d}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@S@\nobreak\ \NWlink{nuweb20c}{20c}, \verb@Variance_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap297}\raggedright\small
\NWtarget{nuweb139b}{} $\langle\,${\itshape C_get_Covariance}\nobreak\ {\footnotesize {139b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_Covariance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int PQ = C_get_P(LECV) * C_get_Q(LECV);@\\
\mbox{}\verb@    if (C_get_varonly(LECV) && PQ > 1)@\\
\mbox{}\verb@        error("Cannot extract covariance from variance only object");@\\
\mbox{}\verb@    if (C_get_varonly(LECV) && PQ == 1)@\\
\mbox{}\verb@        return(C_get_Variance(LECV));@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, Covariance_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb34d}{34d}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}\NWlink{nuweb145a}{, 145a}.\item \NWtxtIdentsUsed\nobreak\  \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@C_get_P@\nobreak\ \NWlink{nuweb137c}{137c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb137d}{137d}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb139a}{139a}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap298}\raggedright\small
\NWtarget{nuweb139c}{} $\langle\,${\itshape C_get_ExpectationX}\nobreak\ {\footnotesize {139c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_ExpectationX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, ExpectationX_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_ExpectationX@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb45}{, 45}\NWlink{nuweb69}{, 69}.\item \NWtxtIdentsUsed\nobreak\  \verb@ExpectationX_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap299}\raggedright\small
\NWtarget{nuweb140a}{} $\langle\,${\itshape C_get_ExpectationInfluence}\nobreak\ {\footnotesize {140a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_ExpectationInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, ExpectationInfluence_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_ExpectationInfluence@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb45}{, 45}\NWlink{nuweb145a}{, 145a}.\item \NWtxtIdentsUsed\nobreak\  \verb@ExpectationInfluence_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap300}\raggedright\small
\NWtarget{nuweb140b}{} $\langle\,${\itshape C_get_CovarianceInfluence}\nobreak\ {\footnotesize {140b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_CovarianceInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, CovarianceInfluence_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb43}{, 43}\NWlink{nuweb69}{, 69}\NWlink{nuweb145a}{, 145a}.\item \NWtxtIdentsUsed\nobreak\  \verb@CovarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap301}\raggedright\small
\NWtarget{nuweb140c}{} $\langle\,${\itshape C_get_VarianceInfluence}\nobreak\ {\footnotesize {140c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_VarianceInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, VarianceInfluence_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb43}{, 43}\NWlink{nuweb69}{, 69}\NWlink{nuweb145a}{, 145a}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@VarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap302}\raggedright\small
\NWtarget{nuweb140d}{} $\langle\,${\itshape C_get_TableBlock}\nobreak\ {\footnotesize {140d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_TableBlock@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    if (VECTOR_ELT(LECV, TableBlock_SLOT) == R_NilValue)@\\
\mbox{}\verb@        error("object does not contain table block slot");@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, TableBlock_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_TableBlock@\nobreak\ \NWlink{nuweb33a}{33a}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap303}\raggedright\small
\NWtarget{nuweb141a}{} $\langle\,${\itshape C_get_Sumweights}\nobreak\ {\footnotesize {141a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_Sumweights@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    if (VECTOR_ELT(LECV, Sumweights_SLOT) == R_NilValue)@\\
\mbox{}\verb@        error("object does not contain sumweights slot");@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, Sumweights_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Sumweights@\nobreak\ \NWlink{nuweb33a}{33a}\NWlink{nuweb45}{, 45}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@sumweights@\nobreak\ \NWlink{nuweb25b}{25b}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap304}\raggedright\small
\NWtarget{nuweb141b}{} $\langle\,${\itshape C_get_Table}\nobreak\ {\footnotesize {141b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_Table@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    if (LENGTH(LECV) <= Table_SLOT)@\\
\mbox{}\verb@        error("Cannot extract table from object");@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, Table_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Table@\nobreak\ \NWlink{nuweb40a}{40a}\NWlink{nuweb45}{, 45}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap305}\raggedright\small
\NWtarget{nuweb141c}{} $\langle\,${\itshape C_get_dimTable}\nobreak\ {\footnotesize {141c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int* C_get_dimTable@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    if (LENGTH(LECV) <= Table_SLOT)@\\
\mbox{}\verb@        error("Cannot extract table from object");@\\
\mbox{}\verb@    return(INTEGER(getAttrib(VECTOR_ELT(LECV, Table_SLOT),@\\
\mbox{}\verb@                             R_DimSymbol)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_dimTable@\nobreak\ \NWlink{nuweb45}{45}\NWlink{nuweb141d}{, 141d}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap306}\raggedright\small
\NWtarget{nuweb141d}{} $\langle\,${\itshape C_get_B}\nobreak\ {\footnotesize {141d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@int C_get_B@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    if (VECTOR_ELT(LECV, TableBlock_SLOT) != R_NilValue)@\\
\mbox{}\verb@        return(LENGTH(VECTOR_ELT(LECV, Sumweights_SLOT)));@\\
\mbox{}\verb@    return(C_get_dimTable(LECV)[2]);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_B@\nobreak\ \NWlink{nuweb32a}{32a}\NWlink{nuweb45}{, 45}\NWlink{nuweb69}{, 69}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_dimTable@\nobreak\ \NWlink{nuweb141c}{141c}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap307}\raggedright\small
\NWtarget{nuweb142a}{} $\langle\,${\itshape C_get_nresample}\nobreak\ {\footnotesize {142a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@R_xlen_t C_get_nresample@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int PQ = C_get_P(LECV) * C_get_Q(LECV);@\\
\mbox{}\verb@    return(XLENGTH(VECTOR_ELT(LECV, PermutedLinearStatistic_SLOT)) / PQ);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_nresample@\nobreak\ \NWlink{nuweb38a}{38a}\NWlink{nuweb50}{, 50}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb53}{, 53}\NWlink{nuweb55}{, 55}\NWlink{nuweb69}{, 69}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_P@\nobreak\ \NWlink{nuweb137c}{137c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb137d}{137d}, \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap308}\raggedright\small
\NWtarget{nuweb142b}{} $\langle\,${\itshape C_get_PermutedLinearStatistic}\nobreak\ {\footnotesize {142b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double* C_get_PermutedLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, PermutedLinearStatistic_SLOT)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb38a}{38a}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap309}\raggedright\small
\NWtarget{nuweb142c}{} $\langle\,${\itshape C_get_tol}\nobreak\ {\footnotesize {142c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@double C_get_tol@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    return(REAL(VECTOR_ELT(LECV, tol_SLOT))[0]);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_tol@\nobreak\ \NWlink{nuweb38a}{38a}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@tol_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap310}\raggedright\small
\NWtarget{nuweb142d}{} $\langle\,${\itshape Memory Input Checks}\nobreak\ {\footnotesize {142d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@if (P <= 0)@\\
\mbox{}\verb@    error("P is not positive");@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (Q <= 0)@\\
\mbox{}\verb@    error("Q is not positive");@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (B <= 0)@\\
\mbox{}\verb@    error("B is not positive");@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (varonly < 0 || varonly > 1)@\\
\mbox{}\verb@    error("varonly is not 0 or 1");@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (Xfactor < 0 || Xfactor > 1)@\\
\mbox{}\verb@    error("Xfactor is not 0 or 1");@\\
\mbox{}\verb@@\\
\mbox{}\verb@if (tol <= DBL_MIN)@\\
\mbox{}\verb@    error("tol is not positive");@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb144}{144}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap311}\raggedright\small
\NWtarget{nuweb143}{} $\langle\,${\itshape Memory Names}\nobreak\ {\footnotesize {143}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@PROTECT(names = allocVector(STRSXP, Table_SLOT + 1));@\\
\mbox{}\verb@SET_STRING_ELT(names, LinearStatistic_SLOT, mkChar("LinearStatistic"));@\\
\mbox{}\verb@SET_STRING_ELT(names, Expectation_SLOT, mkChar("Expectation"));@\\
\mbox{}\verb@SET_STRING_ELT(names, varonly_SLOT, mkChar("varonly"));@\\
\mbox{}\verb@SET_STRING_ELT(names, Variance_SLOT, mkChar("Variance"));@\\
\mbox{}\verb@SET_STRING_ELT(names, Covariance_SLOT, mkChar("Covariance"));@\\
\mbox{}\verb@SET_STRING_ELT(names, ExpectationX_SLOT, mkChar("ExpectationX"));@\\
\mbox{}\verb@SET_STRING_ELT(names, dim_SLOT, mkChar("dimension"));@\\
\mbox{}\verb@SET_STRING_ELT(names, ExpectationInfluence_SLOT,@\\
\mbox{}\verb@               mkChar("ExpectationInfluence"));@\\
\mbox{}\verb@SET_STRING_ELT(names, Xfactor_SLOT, mkChar("Xfactor"));@\\
\mbox{}\verb@SET_STRING_ELT(names, CovarianceInfluence_SLOT,@\\
\mbox{}\verb@               mkChar("CovarianceInfluence"));@\\
\mbox{}\verb@SET_STRING_ELT(names, VarianceInfluence_SLOT,@\\
\mbox{}\verb@               mkChar("VarianceInfluence"));@\\
\mbox{}\verb@SET_STRING_ELT(names, TableBlock_SLOT, mkChar("TableBlock"));@\\
\mbox{}\verb@SET_STRING_ELT(names, Sumweights_SLOT, mkChar("Sumweights"));@\\
\mbox{}\verb@SET_STRING_ELT(names, PermutedLinearStatistic_SLOT,@\\
\mbox{}\verb@               mkChar("PermutedLinearStatistic"));@\\
\mbox{}\verb@SET_STRING_ELT(names, StandardisedPermutedLinearStatistic_SLOT,@\\
\mbox{}\verb@               mkChar("StandardisedPermutedLinearStatistic"));@\\
\mbox{}\verb@SET_STRING_ELT(names, tol_SLOT, mkChar("tol"));@\\
\mbox{}\verb@SET_STRING_ELT(names, Table_SLOT, mkChar("Table"));@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb144}{144}.
\item \NWtxtIdentsUsed\nobreak\  \verb@CovarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@dim_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ExpectationInfluence_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ExpectationX_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Expectation_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@LinearStatistic_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@StandardisedPermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@tol_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@VarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Variance_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@varonly_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Xfactor_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap312}\raggedright\small
\NWtarget{nuweb144}{} $\langle\,${\itshape R_init_LECV}\nobreak\ {\footnotesize {144}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP vo, d, names, tolerance, tmp;@\\
\mbox{}\verb@int PQ;@\\
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Memory Input Checks}\nobreak\ {\footnotesize \NWlink{nuweb142d}{142d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@PQ = mPQB(P, Q, 1);@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Memory Names}\nobreak\ {\footnotesize \NWlink{nuweb143}{143}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@/* Table_SLOT is always last and only used in 2d case, ie omitted here */@\\
\mbox{}\verb@PROTECT(ans = allocVector(VECSXP, Table_SLOT + 1));@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, LinearStatistic_SLOT, allocVector(REALSXP, PQ));@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, Expectation_SLOT, allocVector(REALSXP, PQ));@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, varonly_SLOT, vo = allocVector(INTSXP, 1));@\\
\mbox{}\verb@INTEGER(vo)[0] = varonly;@\\
\mbox{}\verb@if (varonly) {@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, Variance_SLOT, tmp = allocVector(REALSXP, PQ));@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    /* always return variance */@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, Variance_SLOT, tmp = allocVector(REALSXP, PQ));@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, Covariance_SLOT,@\\
\mbox{}\verb@                   tmp = allocVector(REALSXP, PP12(PQ)));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, ExpectationX_SLOT, allocVector(REALSXP, P));@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, dim_SLOT, d = allocVector(INTSXP, 2));@\\
\mbox{}\verb@INTEGER(d)[0] = P;@\\
\mbox{}\verb@INTEGER(d)[1] = Q;@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, ExpectationInfluence_SLOT,@\\
\mbox{}\verb@               tmp = allocVector(REALSXP, B * Q));@\\
\mbox{}\verb@for (int q = 0; q < B * Q; q++) REAL(tmp)[q] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@/* should always _both_ be there */@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, VarianceInfluence_SLOT,@\\
\mbox{}\verb@               tmp = allocVector(REALSXP, B * Q));@\\
\mbox{}\verb@for (int q = 0; q < B * Q; q++) REAL(tmp)[q] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, CovarianceInfluence_SLOT,@\\
\mbox{}\verb@               tmp = allocVector(REALSXP, B * Q * (Q + 1) / 2));@\\
\mbox{}\verb@for (int q = 0; q < B * Q * (Q + 1) / 2; q++) REAL(tmp)[q] = 0.0;@\\
\mbox{}\verb@@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, Xfactor_SLOT, allocVector(INTSXP, 1));@\\
\mbox{}\verb@INTEGER(VECTOR_ELT(ans, Xfactor_SLOT))[0] = Xfactor;@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, TableBlock_SLOT, tmp = allocVector(REALSXP, B + 1));@\\
\mbox{}\verb@for (int q = 0; q < B + 1; q++) REAL(tmp)[q] = 0.0;@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, Sumweights_SLOT, allocVector(REALSXP, B));@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, PermutedLinearStatistic_SLOT,@\\
\mbox{}\verb@               allocMatrix(REALSXP, 0, 0));@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, StandardisedPermutedLinearStatistic_SLOT,@\\
\mbox{}\verb@               allocMatrix(REALSXP, 0, 0));@\\
\mbox{}\verb@SET_VECTOR_ELT(ans, tol_SLOT, tolerance = allocVector(REALSXP, 1));@\\
\mbox{}\verb@REAL(tolerance)[0] = tol;@\\
\mbox{}\verb@namesgets(ans, names);@\\
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Initialise Zero}\nobreak\ {\footnotesize \NWlink{nuweb145a}{145a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb145b}{145b}\NWlink{nuweb146}{, 146}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@CovarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@dim_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ExpectationInfluence_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@ExpectationX_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Expectation_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@LinearStatistic_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@mPQB@\nobreak\ \NWlink{nuweb128a}{128a}, \verb@P@\nobreak\ \NWlink{nuweb23d}{23d}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@PP12@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}, \verb@StandardisedPermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@tol_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@VarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Variance_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@varonly_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@Xfactor_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap313}\raggedright\small
\NWtarget{nuweb145a}{} $\langle\,${\itshape Initialise Zero}\nobreak\ {\footnotesize {145a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/* set initial zeros */@\\
\mbox{}\verb@for (int p = 0; p < PQ; p++) {@\\
\mbox{}\verb@    C_get_LinearStatistic(ans)[p] = 0.0;@\\
\mbox{}\verb@    C_get_Expectation(ans)[p] = 0.0;@\\
\mbox{}\verb@    if (varonly)@\\
\mbox{}\verb@        C_get_Variance(ans)[p] = 0.0;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@if (!varonly) {@\\
\mbox{}\verb@    for (int p = 0; p < PP12(PQ); p++)@\\
\mbox{}\verb@        C_get_Covariance(ans)[p] = 0.0;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@for (int q = 0; q < Q; q++) {@\\
\mbox{}\verb@    C_get_ExpectationInfluence(ans)[q] = 0.0;@\\
\mbox{}\verb@    C_get_VarianceInfluence(ans)[q] = 0.0;@\\
\mbox{}\verb@}@\\
\mbox{}\verb@for (int q = 0; q < Q * (Q + 1) / 2; q++)@\\
\mbox{}\verb@    C_get_CovarianceInfluence(ans)[q] = 0.0;@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb144}{144}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb138d}{138d}, \verb@C_get_ExpectationInfluence@\nobreak\ \NWlink{nuweb140a}{140a}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb138c}{138c}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb139a}{139a}, \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb140c}{140c}, \verb@PP12@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@Q@\nobreak\ \NWlink{nuweb24b}{24b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap314}\raggedright\small
\NWtarget{nuweb145b}{} $\langle\,${\itshape RC_init_LECV_1d}\nobreak\ {\footnotesize {145b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP RC_init_LECV_1d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int varonly,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer B Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int Xfactor,@\\
\mbox{}\verb@    double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R_init_LECV}\nobreak\ {\footnotesize \NWlink{nuweb144}{144}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, TableBlock_SLOT,@\\
\mbox{}\verb@                   allocVector(REALSXP, B + 1));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, Sumweights_SLOT,@\\
\mbox{}\verb@                   allocVector(REALSXP, B));@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(2);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_init_LECV_1d@\nobreak\ \NWlink{nuweb30b}{30b}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap315}\raggedright\small
\NWtarget{nuweb146}{} $\langle\,${\itshape RC_init_LECV_2d}\nobreak\ {\footnotesize {146}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@SEXP RC_init_LECV_2d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int varonly,@\\
\mbox{}\verb@    int Lx,@\\
\mbox{}\verb@    int Ly,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer B Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int Xfactor,@\\
\mbox{}\verb@    double tol@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    SEXP ans, tabdim, tab;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (Lx <= 0)@\\
\mbox{}\verb@        error("Lx is not positive");@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (Ly <= 0)@\\
\mbox{}\verb@        error("Ly is not positive");@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R_init_LECV}\nobreak\ {\footnotesize \NWlink{nuweb144}{144}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PROTECT(tabdim = allocVector(INTSXP, 3));@\\
\mbox{}\verb@    INTEGER(tabdim)[0] = Lx + 1;@\\
\mbox{}\verb@    INTEGER(tabdim)[1] = Ly + 1;@\\
\mbox{}\verb@    INTEGER(tabdim)[2] = B;@\\
\mbox{}\verb@    SET_VECTOR_ELT(ans, Table_SLOT,@\\
\mbox{}\verb@                   tab = allocVector(REALSXP,@\\
\mbox{}\verb@                       INTEGER(tabdim)[0] *@\\
\mbox{}\verb@                       INTEGER(tabdim)[1] *@\\
\mbox{}\verb@                       INTEGER(tabdim)[2]));@\\
\mbox{}\verb@    dimgets(tab, tabdim);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    UNPROTECT(3);@\\
\mbox{}\verb@    return(ans);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb137a}{137a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_init_LECV_2d@\nobreak\ \NWlink{nuweb40a}{40a}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb21a}{21a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\chapter{Package Infrastructure}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap316}\raggedright\small
\NWtarget{nuweb147a}{} \verb@"R/AAA.R"@\nobreak\ {\footnotesize {147a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@.onUnload <-@\\
\mbox{}\verb@function(libpath)@\\
\mbox{}\verb@    library.dynam.unload("libcoin", libpath)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap317}\raggedright\small
\NWtarget{nuweb147b}{} \verb@"DESCRIPTION"@\nobreak\ {\footnotesize {147b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@Package: libcoin@\\
\mbox{}\verb@Title: Linear Test Statistics for Permutation Inference@\\
\mbox{}\verb@Date: 2026-06-03@\\
\mbox{}\verb@Version: 1.0-13@\\
\mbox{}\verb@Authors@{\tt @}\verb@R: c(person("Torsten", "Hothorn", role = c("aut", "cre"),@\\
\mbox{}\verb@                    email = "Torsten.Hothorn@{\tt @}\verb@R-project.org",@\\
\mbox{}\verb@                    comment = c(ORCID = "0000-0001-8301-0471")),@\\
\mbox{}\verb@             person("Henric", "Winell", role = "aut",@\\
\mbox{}\verb@                    comment = c(ORCID = "0000-0001-7995-3047")))@\\
\mbox{}\verb@Description: Basic infrastructure for linear test statistics and permutation@\\
\mbox{}\verb@  inference in the framework of Strasser and Weber (1999) <https://epub.wu.ac.at/102/>.@\\
\mbox{}\verb@  This package must not be used by end-users. CRAN package 'coin' implements all@\\
\mbox{}\verb@  user interfaces and is ready to be used by anyone.@\\
\mbox{}\verb@Depends: R (>= 3.4.0)@\\
\mbox{}\verb@Suggests: coin, bibtex@\\
\mbox{}\verb@Imports: stats, mvtnorm@\\
\mbox{}\verb@LinkingTo: mvtnorm@\\
\mbox{}\verb@NeedsCompilation: yes@\\
\mbox{}\verb@License: GPL-2@\\
\mbox{}\verb@URL: https://codeberg.org/thothorn/coin/@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap318}\raggedright\small
\NWtarget{nuweb147c}{} \verb@"NAMESPACE"@\nobreak\ {\footnotesize {147c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@useDynLib(libcoin, .registration = TRUE)@\\
\mbox{}\verb@@\\
\mbox{}\verb@importFrom("stats", complete.cases, vcov)@\\
\mbox{}\verb@importFrom("mvtnorm", GenzBretz)@\\
\mbox{}\verb@@\\
\mbox{}\verb@export(LinStatExpCov, doTest, ctabs, lmult)@\\
\mbox{}\verb@@\\
\mbox{}\verb@S3method(vcov, LinStatExpCov)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Add flag \code{-g} to \code{PKG_CFLAGS} for \code{operf} profiling (this is
not portable).
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap319}\raggedright\small
\NWtarget{nuweb148a}{} \verb@"src/Makevars"@\nobreak\ {\footnotesize {148a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@PKG_CFLAGS=$(C_VISIBILITY)@\\
\mbox{}\verb@PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap320}\raggedright\small
\NWtarget{nuweb148b}{} \verb@"src/libcoin-win.def"@\nobreak\ {\footnotesize {148b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape def Header}\nobreak\ {\footnotesize \NWlink{nuweb152b}{152b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@LIBRARY libcoin.dll@\\
\mbox{}\verb@EXPORTS@\\
\mbox{}\verb@  R_init_libcoin@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Other packages can link against \pkg{libcoin}. A small example package
is contained in \texttt{libcoin/inst/C_API_example}.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap321}\raggedright\small
\NWtarget{nuweb149}{} \verb@"src/libcoin-init.c"@\nobreak\ {\footnotesize {149}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@#include "libcoin.h"@\\
\mbox{}\verb@#include <R_ext/Rdynload.h>@\\
\mbox{}\verb@#include <R_ext/Visibility.h>@\\
\mbox{}\verb@@\\
\mbox{}\verb@#define CALLDEF(name, n) {#name, (DL_FUNC) &name, n}@\\
\mbox{}\verb@#define REGCALL(name) R_RegisterCCallable("libcoin", #name, (DL_FUNC) &name)@\\
\mbox{}\verb@@\\
\mbox{}\verb@static const R_CallMethodDef callMethods[] = {@\\
\mbox{}\verb@    CALLDEF(R_ExpectationCovarianceStatistic, 7),@\\
\mbox{}\verb@    CALLDEF(R_PermutedLinearStatistic, 6),@\\
\mbox{}\verb@    CALLDEF(R_StandardisePermutedLinearStatistic, 1),@\\
\mbox{}\verb@    CALLDEF(R_ExpectationCovarianceStatistic_2d, 9),@\\
\mbox{}\verb@    CALLDEF(R_PermutedLinearStatistic_2d, 7),@\\
\mbox{}\verb@    CALLDEF(R_QuadraticTest, 5),@\\
\mbox{}\verb@    CALLDEF(R_MaximumTest, 9),@\\
\mbox{}\verb@    CALLDEF(R_MaximallySelectedTest, 6),@\\
\mbox{}\verb@    CALLDEF(R_ExpectationInfluence, 3),@\\
\mbox{}\verb@    CALLDEF(R_CovarianceInfluence, 4),@\\
\mbox{}\verb@    CALLDEF(R_ExpectationX, 4),@\\
\mbox{}\verb@    CALLDEF(R_CovarianceX, 5),@\\
\mbox{}\verb@    CALLDEF(R_Sums, 3),@\\
\mbox{}\verb@    CALLDEF(R_KronSums, 6),@\\
\mbox{}\verb@    CALLDEF(R_KronSums_Permutation, 5),@\\
\mbox{}\verb@    CALLDEF(R_colSums, 3),@\\
\mbox{}\verb@    CALLDEF(R_OneTableSums, 3),@\\
\mbox{}\verb@    CALLDEF(R_TwoTableSums, 4),@\\
\mbox{}\verb@    CALLDEF(R_ThreeTableSums, 5),@\\
\mbox{}\verb@    CALLDEF(R_order_subset_wrt_block, 4),@\\
\mbox{}\verb@    CALLDEF(R_quadform, 3),@\\
\mbox{}\verb@    CALLDEF(R_kronecker, 2),@\\
\mbox{}\verb@    CALLDEF(R_MPinv_sym, 3),@\\
\mbox{}\verb@    CALLDEF(R_unpack_sym, 3),@\\
\mbox{}\verb@    CALLDEF(R_pack_sym, 1),@\\
\mbox{}\verb@    {NULL, NULL, 0}@\\
\mbox{}\verb@};@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb149}{149}\NWlink{nuweb150}{, 150}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_colSums@\nobreak\ \NWlink{nuweb103b}{103b}, \verb@R_CovarianceInfluence@\nobreak\ \NWlink{nuweb81a}{81a}, \verb@R_CovarianceX@\nobreak\ \NWlink{nuweb84b}{84b}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}, \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb40a}{40a}, \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb79a}{79a}, \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb82c}{82c}, \verb@R_KronSums@\nobreak\ \NWlink{nuweb91b}{91b}, \verb@R_KronSums_Permutation@\nobreak\ \NWlink{nuweb99b}{99b}, \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb132}{132}, \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb107b}{107b}, \verb@R_order_subset_wrt_block@\nobreak\ \NWlink{nuweb119b}{119b}, \verb@R_pack_sym@\nobreak\ \NWlink{nuweb136c}{136c}, \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb36}{36}, \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb47}{47}, \verb@R_quadform@\nobreak\ \NWlink{nuweb60b}{60b}, \verb@R_Sums@\nobreak\ \NWlink{nuweb87b}{87b}, \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb115a}{115a}, \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb111a}{111a}, \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb135}{135}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap322}\raggedright\small
\NWtarget{nuweb150}{} \verb@"src/libcoin-init.c"@\nobreak\ {\footnotesize {150}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@void attribute_visible R_init_libcoin@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    DllInfo *dll@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    R_registerRoutines(dll, NULL, callMethods, NULL, NULL);@\\
\mbox{}\verb@    R_useDynamicSymbols(dll, FALSE);@\\
\mbox{}\verb@    R_forceSymbols(dll, TRUE);@\\
\mbox{}\verb@    REGCALL(R_ExpectationCovarianceStatistic);@\\
\mbox{}\verb@    REGCALL(R_PermutedLinearStatistic);@\\
\mbox{}\verb@    REGCALL(R_StandardisePermutedLinearStatistic);@\\
\mbox{}\verb@    REGCALL(R_ExpectationCovarianceStatistic_2d);@\\
\mbox{}\verb@    REGCALL(R_PermutedLinearStatistic_2d);@\\
\mbox{}\verb@    REGCALL(R_QuadraticTest);@\\
\mbox{}\verb@    REGCALL(R_MaximumTest);@\\
\mbox{}\verb@    REGCALL(R_MaximallySelectedTest);@\\
\mbox{}\verb@    REGCALL(R_ExpectationInfluence);@\\
\mbox{}\verb@    REGCALL(R_CovarianceInfluence);@\\
\mbox{}\verb@    REGCALL(R_ExpectationX);@\\
\mbox{}\verb@    REGCALL(R_CovarianceX);@\\
\mbox{}\verb@    REGCALL(R_Sums);@\\
\mbox{}\verb@    REGCALL(R_KronSums);@\\
\mbox{}\verb@    REGCALL(R_KronSums_Permutation);@\\
\mbox{}\verb@    REGCALL(R_colSums);@\\
\mbox{}\verb@    REGCALL(R_OneTableSums);@\\
\mbox{}\verb@    REGCALL(R_TwoTableSums);@\\
\mbox{}\verb@    REGCALL(R_ThreeTableSums);@\\
\mbox{}\verb@    REGCALL(R_order_subset_wrt_block);@\\
\mbox{}\verb@    REGCALL(R_quadform);@\\
\mbox{}\verb@    REGCALL(R_kronecker);@\\
\mbox{}\verb@    REGCALL(R_MPinv_sym);@\\
\mbox{}\verb@    REGCALL(R_unpack_sym);@\\
\mbox{}\verb@    REGCALL(R_pack_sym);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb149}{149}\NWlink{nuweb150}{, 150}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_colSums@\nobreak\ \NWlink{nuweb103b}{103b}, \verb@R_CovarianceInfluence@\nobreak\ \NWlink{nuweb81a}{81a}, \verb@R_CovarianceX@\nobreak\ \NWlink{nuweb84b}{84b}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}, \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb40a}{40a}, \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb79a}{79a}, \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb82c}{82c}, \verb@R_KronSums@\nobreak\ \NWlink{nuweb91b}{91b}, \verb@R_KronSums_Permutation@\nobreak\ \NWlink{nuweb99b}{99b}, \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb132}{132}, \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb107b}{107b}, \verb@R_order_subset_wrt_block@\nobreak\ \NWlink{nuweb119b}{119b}, \verb@R_pack_sym@\nobreak\ \NWlink{nuweb136c}{136c}, \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb36}{36}, \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb47}{47}, \verb@R_quadform@\nobreak\ \NWlink{nuweb60b}{60b}, \verb@R_Sums@\nobreak\ \NWlink{nuweb87b}{87b}, \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb115a}{115a}, \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb111a}{111a}, \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb135}{135}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap323}\raggedright\small
\NWtarget{nuweb151a}{} $\langle\,${\itshape R Header}\nobreak\ {\footnotesize {151a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@###    Copyright (C) 2016-2026 Torsten Hothorn@\\
\mbox{}\verb@###@\\
\mbox{}\verb@###    This file is part of the 'libcoin' R add-on package.@\\
\mbox{}\verb@###@\\
\mbox{}\verb@###    'libcoin' is free software: you can redistribute it and/or modify@\\
\mbox{}\verb@###    it under the terms of the GNU General Public License as published by@\\
\mbox{}\verb@###    the Free Software Foundation, version 2.@\\
\mbox{}\verb@###@\\
\mbox{}\verb@###    'libcoin' is distributed in the hope that it will be useful,@\\
\mbox{}\verb@###    but WITHOUT ANY WARRANTY; without even the implied warranty of@\\
\mbox{}\verb@###    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the@\\
\mbox{}\verb@###    GNU General Public License for more details.@\\
\mbox{}\verb@###@\\
\mbox{}\verb@###    You should have received a copy of the GNU General Public License@\\
\mbox{}\verb@###    along with 'libcoin'.  If not, see <http://www.gnu.org/licenses/>.@\\
\mbox{}\verb@###@\\
\mbox{}\verb@###@\\
\mbox{}\verb@###    DO NOT EDIT THIS FILE@\\
\mbox{}\verb@###@\\
\mbox{}\verb@###    Edit 'libcoin.w' and run 'nuweb -r libcoin.w'@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb3a}{3a}\NWlink{nuweb15b}{, 15b}\NWlink{nuweb147a}{, 147a}\NWlink{nuweb147b}{b}\NWlink{nuweb147c}{c}\NWlink{nuweb148a}{, 148a}\NWlink{nuweb158a}{, 158a}\NWlink{nuweb158b}{b}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb159c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap324}\raggedright\small
\NWtarget{nuweb151b}{} $\langle\,${\itshape Rd Header}\nobreak\ {\footnotesize {151b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@%%%    Copyright (C) 2016-2026 Torsten Hothorn@\\
\mbox{}\verb@%%%@\\
\mbox{}\verb@%%%    This file is part of the 'libcoin' R add-on package.@\\
\mbox{}\verb@%%%@\\
\mbox{}\verb@%%%    'libcoin' is free software: you can redistribute it and/or modify@\\
\mbox{}\verb@%%%    it under the terms of the GNU General Public License as published by@\\
\mbox{}\verb@%%%    the Free Software Foundation, version 2.@\\
\mbox{}\verb@%%%@\\
\mbox{}\verb@%%%    'libcoin' is distributed in the hope that it will be useful,@\\
\mbox{}\verb@%%%    but WITHOUT ANY WARRANTY; without even the implied warranty of@\\
\mbox{}\verb@%%%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the@\\
\mbox{}\verb@%%%    GNU General Public License for more details.@\\
\mbox{}\verb@%%%@\\
\mbox{}\verb@%%%    You should have received a copy of the GNU General Public License@\\
\mbox{}\verb@%%%    along with 'libcoin'.  If not, see <http://www.gnu.org/licenses/>.@\\
\mbox{}\verb@%%%@\\
\mbox{}\verb@%%%@\\
\mbox{}\verb@%%%    DO NOT EDIT THIS FILE@\\
\mbox{}\verb@%%%@\\
\mbox{}\verb@%%%    Edit 'libcoin.w' and run 'nuweb -r libcoin.w'@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb17}{17}\NWlink{nuweb18}{, 18}\NWlink{nuweb19}{, 19}\NWlink{nuweb152c}{, 152c}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb159a}{, 159a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap325}\raggedright\small
\NWtarget{nuweb152a}{} $\langle\,${\itshape C Header}\nobreak\ {\footnotesize {152a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@/*@\\
\mbox{}\verb@    Copyright (C) 2016-2026 Torsten Hothorn@\\
\mbox{}\verb@@\\
\mbox{}\verb@    This file is part of the 'libcoin' R add-on package.@\\
\mbox{}\verb@@\\
\mbox{}\verb@    'libcoin' is free software: you can redistribute it and/or modify@\\
\mbox{}\verb@    it under the terms of the GNU General Public License as published by@\\
\mbox{}\verb@    the Free Software Foundation, version 2.@\\
\mbox{}\verb@@\\
\mbox{}\verb@    'libcoin' is distributed in the hope that it will be useful,@\\
\mbox{}\verb@    but WITHOUT ANY WARRANTY; without even the implied warranty of@\\
\mbox{}\verb@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the@\\
\mbox{}\verb@    GNU General Public License for more details.@\\
\mbox{}\verb@@\\
\mbox{}\verb@    You should have received a copy of the GNU General Public License@\\
\mbox{}\verb@    along with 'libcoin'.  If not, see <http://www.gnu.org/licenses/>.@\\
\mbox{}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    DO NOT EDIT THIS FILE@\\
\mbox{}\verb@@\\
\mbox{}\verb@    Edit 'libcoin.w' and run 'nuweb -r libcoin.w'@\\
\mbox{}\verb@*/@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb20a}{20a}\NWlink{nuweb21b}{, 21b}\NWlink{nuweb22b}{, 22b}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb149}{, 149}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160c}{c}\NWlink{nuweb160d}{d}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap326}\raggedright\small
\NWtarget{nuweb152b}{} $\langle\,${\itshape def Header}\nobreak\ {\footnotesize {152b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@;;;    Copyright (C) 2016-2026 Torsten Hothorn@\\
\mbox{}\verb@;;;@\\
\mbox{}\verb@;;;    This file is part of the 'libcoin' R add-on package.@\\
\mbox{}\verb@;;;@\\
\mbox{}\verb@;;;    'libcoin' is free software: you can redistribute it and/or modify@\\
\mbox{}\verb@;;;    it under the terms of the GNU General Public License as published by@\\
\mbox{}\verb@;;;    the Free Software Foundation, version 2.@\\
\mbox{}\verb@;;;@\\
\mbox{}\verb@;;;    'libcoin' is distributed in the hope that it will be useful,@\\
\mbox{}\verb@;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of@\\
\mbox{}\verb@;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the@\\
\mbox{}\verb@;;;    GNU General Public License for more details.@\\
\mbox{}\verb@;;;@\\
\mbox{}\verb@;;;    You should have received a copy of the GNU General Public License@\\
\mbox{}\verb@;;;    along with 'libcoin'.  If not, see <http://www.gnu.org/licenses/>.@\\
\mbox{}\verb@;;;@\\
\mbox{}\verb@;;;@\\
\mbox{}\verb@;;;    DO NOT EDIT THIS FILE@\\
\mbox{}\verb@;;;@\\
\mbox{}\verb@;;;    Edit 'libcoin.w' and run 'nuweb -r libcoin.w'@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb148b}{148b}\NWlink{nuweb160a}{, 160a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap327}\raggedright\small
\NWtarget{nuweb152c}{} $\langle\,${\itshape BibTeX Header}\nobreak\ {\footnotesize {152c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape Rd Header}\nobreak\ {\footnotesize \NWlink{nuweb151b}{151b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb157a}{157a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap328}\raggedright\small
\NWtarget{nuweb153a}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {153a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape Rd Header}\nobreak\ {\footnotesize \NWlink{nuweb151b}{151b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@\newcommand{\C}{\ifelse{latex}{\out{\textsf{C}}}{C}}@\\
\mbox{}\verb@\newcommand{\nuweb}{\ifelse{latex}{\out{\textsf{nuweb}}}{nuweb}}@\\
\mbox{}\verb@@\\
\mbox{}\verb@\name{NEWS}@\\
\mbox{}\verb@\title{NEWS file for the \pkg{libcoin} package}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap329}\raggedright\small
\NWtarget{nuweb153b}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {153b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-13 (2026-06-03)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item \file{NEWS.Rd} is now generated by \file{libcoin.w}.@\\
\mbox{}\verb@    \item Remove the no longer needed \code{STRICT_R_HEADERS}.@\\
\mbox{}\verb@    \item Documentation updates.@\\
\mbox{}\verb@    \item Makefile improvements.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap330}\raggedright\small
\NWtarget{nuweb153c}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {153c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-12 (2026-03-16)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item \code{PROTECT} calls to \code{getAttrib} as adviced by \code{rchk}.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap331}\raggedright\small
\NWtarget{nuweb153d}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {153d}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-11 (2026-03-06)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Use \file{REFERENCES.bib}.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap332}\raggedright\small
\NWtarget{nuweb153e}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {153e}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-10 (2023-09-26)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Add Henric Winell as author.@\\
\mbox{}\verb@    \item Enable \code{STRICT_R_HEADERS}.@\\
\mbox{}\verb@    \item The \nuweb source code is now included (see \file{../inst/nuweb/}).@\\
\mbox{}\verb@    \item Documentation updates.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap333}\raggedright\small
\NWtarget{nuweb154a}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {154a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-9 (2021-09-27)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item \code{R_MPinv_sym} can now determine the full dimension of the packed@\\
\mbox{}\verb@          input \code{x} by setting \code{n} to \code{0L}.@\\
\mbox{}\verb@    \item Add \code{#define USE_FC_LEN_T} to header as requested by CRAN@\\
\mbox{}\verb@          2021-09-25.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb132}{132}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap334}\raggedright\small
\NWtarget{nuweb154b}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {154b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-8 (2021-02-08)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Fix \LaTeX problem.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap335}\raggedright\small
\NWtarget{nuweb154c}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {154c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-7 (2021-01-15)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Correct spelling in error message.@\\
\mbox{}\verb@    \item Regression tests updated for \pkg{coin} 1.4-0.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap336}\raggedright\small
\NWtarget{nuweb154d}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {154d}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-6 (2020-08-13)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Interface to \code{S_rcont2} changed in \pkg{stats}, thanks@\\
\mbox{}\verb@          to Martin Maechler for a fix.@\\
\mbox{}\verb@    \item New \C function \code{R_pack_sym} for transforming a symmetric matrix@\\
\mbox{}\verb@          to lower-packed storage mode.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_pack_sym@\nobreak\ \NWlink{nuweb136c}{136c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap337}\raggedright\small
\NWtarget{nuweb155a}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {155a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-5 (2019-08-22)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item New \C function \code{R_unpack_sym} for unpacking a symmetric matrix@\\
\mbox{}\verb@          stored in lower-packed storage mode.@\\
\mbox{}\verb@    \item New \C functions \code{R_quadform} and \code{R_MPinv_sym} providing@\\
\mbox{}\verb@          interfaces to the internal functions \code{C_quadform} and@\\
\mbox{}\verb@          \code{C_MPinv_sym}.@\\
\mbox{}\verb@    \item Function \code{libcoin_StandardisePermutedLinearStatistic} was renamed@\\
\mbox{}\verb@          to \code{libcoin_R_StandardisePermutedLinearStatistic}.@\\
\mbox{}\verb@    \item Documentation updates.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_quadform@\nobreak\ \NWlink{nuweb61a}{61a}, \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb132}{132}, \verb@R_quadform@\nobreak\ \NWlink{nuweb60b}{60b}, \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb135}{135}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap338}\raggedright\small
\NWtarget{nuweb155b}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {155b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-4 (2019-02-28)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Bugfix in regression tests.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap339}\raggedright\small
\NWtarget{nuweb155c}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {155c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-3 (2019-02-18)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Parts of the covariance matrix were not set to zero initially.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap340}\raggedright\small
\NWtarget{nuweb155d}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {155d}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-2 (2018-12-13)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Maximally selected statistics failed for large sample sizes because of@\\
\mbox{}\verb@          unnecessary memory allocation.  Report and fix by Joanidis@\\
\mbox{}\verb@          Kristoforos.@\\
\mbox{}\verb@    \item Some additional checks for integer overflow.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap341}\raggedright\small
\NWtarget{nuweb155e}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {155e}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-1 (2017-12-13)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Make valgrind happy.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap342}\raggedright\small
\NWtarget{nuweb156a}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {156a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 1.0-0 (2017-12-12)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Make the package truly literate; there is one single \nuweb file@\\
\mbox{}\verb@          called \file{libcoin.w} which generates the complete package.@\\
\mbox{}\verb@    \item The package can now deal with long vectors.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap343}\raggedright\small
\NWtarget{nuweb156b}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {156b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 0.9-3 (2017-07-02)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Remove copy of \code{rcont2} from the \pkg{stats} package as it is@\\
\mbox{}\verb@          exported now.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap344}\raggedright\small
\NWtarget{nuweb156c}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {156c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 0.9-2 (2017-04-04)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Fix protect problem in \code{R_MaximumTest} reported by Tomas@\\
\mbox{}\verb@          Kalibera.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap345}\raggedright\small
\NWtarget{nuweb156d}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {156d}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 0.9-1 (2017-02-06)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item Calling \pkg{libcoin}'s \C routines (using \code{.Call()}) now@\\
\mbox{}\verb@          requires the entry points to be specified as \R objects, i.e., the use@\\
\mbox{}\verb@          of character strings is no longer allowed.@\\
\mbox{}\verb@    \item Stop when all observations are missing.@\\
\mbox{}\verb@    \item 2d case with missings in at least one variable used incorrect sample@\\
\mbox{}\verb@          sizes and thus produced wrong results.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap346}\raggedright\small
\NWtarget{nuweb156e}{} \verb@"inst/NEWS.Rd"@\nobreak\ {\footnotesize {156e}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@\section{Changes in Version 0.9-0 (2016-12-09)}{@\\
\mbox{}\verb@  \itemize{@\\
\mbox{}\verb@    \item \pkg{libcoin} published on CRAN.@\\
\mbox{}\verb@  }@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap347}\raggedright\small
\NWtarget{nuweb157a}{} \verb@"inst/REFERENCES.bib"@\nobreak\ {\footnotesize {157a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape BibTeX Header}\nobreak\ {\footnotesize \NWlink{nuweb152c}{152c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb157a}{157a}\NWlink{nuweb157b}{b}\NWlink{nuweb157c}{c}\NWlink{nuweb157d}{d}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap348}\raggedright\small
\NWtarget{nuweb157b}{} \verb@"inst/REFERENCES.bib"@\nobreak\ {\footnotesize {157b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@{\tt @}\verb@article{Hothorn+Hornik+vandeWiel+Zeileis:2006,@\\
\mbox{}\verb@  author  = {Torsten Hothorn and Kurt Hornik and Mark A van de Wiel and Achim@\\
\mbox{}\verb@             Zeileis},@\\
\mbox{}\verb@  title   = {A {L}ego System for Conditional Inference},@\\
\mbox{}\verb@  journal = {The American Statistician},@\\
\mbox{}\verb@  year    = {2006},@\\
\mbox{}\verb@  volume  = {60},@\\
\mbox{}\verb@  number  = {3},@\\
\mbox{}\verb@  pages   = {257--263},@\\
\mbox{}\verb@  doi     = {10.1198/000313006X118430},@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb157a}{157a}\NWlink{nuweb157b}{b}\NWlink{nuweb157c}{c}\NWlink{nuweb157d}{d}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap349}\raggedright\small
\NWtarget{nuweb157c}{} \verb@"inst/REFERENCES.bib"@\nobreak\ {\footnotesize {157c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@{\tt @}\verb@article{Hothorn+Hornik+vandeWiel+Zeileis:2008,@\\
\mbox{}\verb@  author  = {Torsten Hothorn and Kurt Hornik and Mark A van de Wiel and Achim@\\
\mbox{}\verb@             Zeileis},@\\
\mbox{}\verb@  title   = {Implementing a Class of Permutation Tests: The coin Package},@\\
\mbox{}\verb@  journal = {Journal of Statistical Software},@\\
\mbox{}\verb@  year    = {2008},@\\
\mbox{}\verb@  volume  = {28},@\\
\mbox{}\verb@  number  = {8},@\\
\mbox{}\verb@  pages   = {1--23},@\\
\mbox{}\verb@  doi     = {10.18637/jss.v028.i08},@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb157a}{157a}\NWlink{nuweb157b}{b}\NWlink{nuweb157c}{c}\NWlink{nuweb157d}{d}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap350}\raggedright\small
\NWtarget{nuweb157d}{} \verb@"inst/REFERENCES.bib"@\nobreak\ {\footnotesize {157d}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@{\tt @}\verb@article{Strasser+Weber:1999,@\\
\mbox{}\verb@  author  = {Helmut Strasser and Christian Weber},@\\
\mbox{}\verb@  title   = {The Asymptotic Theory of Permutation Statistics},@\\
\mbox{}\verb@  journal = {Mathematical Methods of Statistics},@\\
\mbox{}\verb@  year    = {1999},@\\
\mbox{}\verb@  volume  = {8},@\\
\mbox{}\verb@  number  = {2},@\\
\mbox{}\verb@  pages   = {220--250},@\\
\mbox{}\verb@  note    = {Preprint available from \url{https://epub.wu.ac.at/102}}@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb157a}{157a}\NWlink{nuweb157b}{b}\NWlink{nuweb157c}{c}\NWlink{nuweb157d}{d}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap351}\raggedright\small
\NWtarget{nuweb158a}{} \verb@"inst/C_API_example/DESCRIPTION"@\nobreak\ {\footnotesize {158a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@Package: libcoinEx@\\
\mbox{}\verb@Title: A 'libcoin' C API Usage Example@\\
\mbox{}\verb@Version: 1.0-0@\\
\mbox{}\verb@Authors@{\tt @}\verb@R: c(person("Torsten", "Hothorn", role = c("aut", "cre"),@\\
\mbox{}\verb@                    email = "Torsten.Hothorn@{\tt @}\verb@R-project.org",@\\
\mbox{}\verb@                    comment = c(ORCID = "0000-0001-8301-0471")),@\\
\mbox{}\verb@             person("Henric", "Winell", role = "aut",@\\
\mbox{}\verb@                    comment = c(ORCID = "0000-0001-7995-3047")))@\\
\mbox{}\verb@Description: Example use of the 'libcoin' C API.@\\
\mbox{}\verb@Depends: R (>= 3.4.0)@\\
\mbox{}\verb@Imports: libcoin@\\
\mbox{}\verb@LinkingTo: libcoin@\\
\mbox{}\verb@NeedsCompilation: yes@\\
\mbox{}\verb@License: GPL-2@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap352}\raggedright\small
\NWtarget{nuweb158b}{} \verb@"inst/C_API_example/NAMESPACE"@\nobreak\ {\footnotesize {158b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@useDynLib(libcoinEx, .registration = TRUE)@\\
\mbox{}\verb@@\\
\mbox{}\verb@import("libcoin")@\\
\mbox{}\verb@export(ExpectationCovarianceStatistic)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap353}\raggedright\small
\NWtarget{nuweb159a}{} \verb@"inst/C_API_example/man/ExpectationCovarianceStatistic.Rd"@\nobreak\ {\footnotesize {159a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape Rd Header}\nobreak\ {\footnotesize \NWlink{nuweb151b}{151b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@\name{ExpectationCovarianceStatistic}@\\
\mbox{}\verb@\alias{ExpectationCovarianceStatistic}@\\
\mbox{}\verb@\title{@\\
\mbox{}\verb@  \pkg{libcoin} C API Example@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\description{@\\
\mbox{}\verb@  A working example of calling compiled code from the \pkg{libcoin} package.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\usage{@\\
\mbox{}\verb@ExpectationCovarianceStatistic(x, y)@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\arguments{@\\
\mbox{}\verb@  \item{x}{A numeric matrix.}@\\
\mbox{}\verb@  \item{y}{A numeric matrix.}@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\details{@\\
\mbox{}\verb@  This function calls the C function  \code{R_ExpectationCovarianceStatistic}, a@\\
\mbox{}\verb@  simple wrapper for the C function@\\
\mbox{}\verb@  \code{libcoin_R_ExpectationCovarianceStatistic} defined in the \pkg{libcoin}@\\
\mbox{}\verb@  package.@\\
\mbox{}\verb@@\\
\mbox{}\verb@  For more information on this approach, consult section 5.4.2 of the Writing R@\\
\mbox{}\verb@  Extensions manual.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\value{@\\
\mbox{}\verb@  A list.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\examples{@\\
\mbox{}\verb@n <- 100@\\
\mbox{}\verb@p <- 4@\\
\mbox{}\verb@q <- 2@\\
\mbox{}\verb@X <- matrix(runif(p * n), nc = p)@\\
\mbox{}\verb@Y <- matrix(runif(q * n), nc = q)@\\
\mbox{}\verb@ExpectationCovarianceStatistic(X, Y)@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap354}\raggedright\small
\NWtarget{nuweb159b}{} \verb@"inst/C_API_example/R/ExpectationCovarianceStatistic.R"@\nobreak\ {\footnotesize {159b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@ExpectationCovarianceStatistic <- function(x, y) {@\\
\mbox{}\verb@    .Call(R_ExpectationCovarianceStatistic,@\\
\mbox{}\verb@          x, y, integer(0), integer(0), integer(0), 0L,@\\
\mbox{}\verb@          sqrt(.Machine$double.eps))@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap355}\raggedright\small
\NWtarget{nuweb159c}{} \verb@"inst/C_API_example/src/Makevars"@\nobreak\ {\footnotesize {159c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@PKG_CFLAGS=$(C_VISIBILITY)@\\
\mbox{}\verb@PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap356}\raggedright\small
\NWtarget{nuweb160a}{} \verb@"inst/C_API_example/src/libcoinEx-win.def"@\nobreak\ {\footnotesize {160a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape def Header}\nobreak\ {\footnotesize \NWlink{nuweb152b}{152b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@LIBRARY libcoinEx.dll@\\
\mbox{}\verb@EXPORTS@\\
\mbox{}\verb@  R_init_libcoinEx@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap357}\raggedright\small
\NWtarget{nuweb160b}{} \verb@"inst/C_API_example/src/libcoinEx.h"@\nobreak\ {\footnotesize {160b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@#include <Rinternals.h>@\\
\mbox{}\verb@@\\
\mbox{}\verb@extern SEXP R_ExpectationCovarianceStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    const SEXP x,@\\
\mbox{}\verb@    const SEXP y,@\\
\mbox{}\verb@    const SEXP weights,@\\
\mbox{}\verb@    const SEXP subset,@\\
\mbox{}\verb@    const SEXP block,@\\
\mbox{}\verb@    const SEXP varonly,@\\
\mbox{}\verb@    const SEXP tol@\\
\mbox{}\verb@);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap358}\raggedright\small
\NWtarget{nuweb160c}{} \verb@"inst/C_API_example/src/libcoinEx-init.c"@\nobreak\ {\footnotesize {160c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@#include "libcoinEx.h"@\\
\mbox{}\verb@#include <R_ext/Rdynload.h>@\\
\mbox{}\verb@#include <R_ext/Visibility.h>@\\
\mbox{}\verb@@\\
\mbox{}\verb@#define CALLDEF(name, n) {#name, (DL_FUNC) &name, n}@\\
\mbox{}\verb@@\\
\mbox{}\verb@static const R_CallMethodDef callMethods[] = {@\\
\mbox{}\verb@    CALLDEF(R_ExpectationCovarianceStatistic, 7),@\\
\mbox{}\verb@    {NULL, NULL, 0}@\\
\mbox{}\verb@};@\\
\mbox{}\verb@@\\
\mbox{}\verb@void attribute_visible R_init_libcoinEx(DllInfo *dll) {@\\
\mbox{}\verb@    R_registerRoutines(dll, NULL, callMethods, NULL, NULL);@\\
\mbox{}\verb@    R_useDynamicSymbols(dll, FALSE);@\\
\mbox{}\verb@    R_forceSymbols(dll, TRUE);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap359}\raggedright\small
\NWtarget{nuweb160d}{} \verb@"inst/C_API_example/src/R_ExpectationCovarianceStatistic.c"@\nobreak\ {\footnotesize {160d}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@#include <R_ext/Rdynload.h>  /* required by R */@\\
\mbox{}\verb@#include <libcoinAPI.h>@\\
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_ExpectationCovarianceStatistic(SEXP x, SEXP y, SEXP weights, SEXP subset,@\\
\mbox{}\verb@                                      SEXP block, SEXP varonly, SEXP tol)@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    return(libcoin_R_ExpectationCovarianceStatistic(x, y, weights, subset,@\\
\mbox{}\verb@                                                    block, varonly, tol));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb26b}{26b}\NWlink{nuweb26d}{d}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb30b}{30b}, \verb@subset@\nobreak\ \NWlink{nuweb25c}{25c}\NWlink{nuweb25f}{f}\NWlink{nuweb26a}{, 26a}, \verb@weights@\nobreak\ \NWlink{nuweb24e}{24e}\NWlink{nuweb24f}{f}\NWlink{nuweb25a}{, 25a}, \verb@x@\nobreak\ \NWlink{nuweb23c}{23c}\NWlink{nuweb23e}{e}\NWlink{nuweb23f}{f}, \verb@y@\nobreak\ \NWlink{nuweb24a}{24a}\NWlink{nuweb24c}{c}\NWlink{nuweb24d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\chapter*{Index}

\section*{Files}


{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \verb@"DESCRIPTION"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb147b}{147b}.}
\item \verb@"inst/C_API_example/DESCRIPTION"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb158a}{158a}.}
\item \verb@"inst/C_API_example/man/ExpectationCovarianceStatistic.Rd"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb159a}{159a}.}
\item \verb@"inst/C_API_example/NAMESPACE"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb158b}{158b}.}
\item \verb@"inst/C_API_example/R/ExpectationCovarianceStatistic.R"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb159b}{159b}.}
\item \verb@"inst/C_API_example/src/libcoinEx-init.c"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb160c}{160c}.}
\item \verb@"inst/C_API_example/src/libcoinEx-win.def"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb160a}{160a}.}
\item \verb@"inst/C_API_example/src/libcoinEx.h"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb160b}{160b}.}
\item \verb@"inst/C_API_example/src/Makevars"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb159c}{159c}.}
\item \verb@"inst/C_API_example/src/R_ExpectationCovarianceStatistic.c"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb160d}{160d}.}
\item \verb@"inst/NEWS.Rd"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb153a}{153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb153d}{d}\NWlink{nuweb153e}{e}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb154d}{d}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb155d}{d}\NWlink{nuweb155e}{e}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}\NWlink{nuweb156e}{e}.
}
\item \verb@"inst/REFERENCES.bib"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb157a}{157a}\NWlink{nuweb157b}{b}\NWlink{nuweb157c}{c}\NWlink{nuweb157d}{d}.
}
\item \verb@"man/ctabs.Rd"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb19}{19}.}
\item \verb@"man/doTest.Rd"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb18}{18}.}
\item \verb@"man/LinStatExpCov.Rd"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb17}{17}.}
\item \verb@"NAMESPACE"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb147c}{147c}.}
\item \verb@"R/AAA.R"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb147a}{147a}.}
\item \verb@"R/ctabs.R"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb15b}{15b}.}
\item \verb@"R/libcoin.R"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb3a}{3a}.}
\item \verb@"src/libcoin-init.c"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb149}{149}\NWlink{nuweb150}{, 150}.
}
\item \verb@"src/libcoin-win.def"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb148b}{148b}.}
\item \verb@"src/libcoin.c"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb22b}{22b}.}
\item \verb@"src/libcoin.h"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb21b}{21b}.}
\item \verb@"src/libcoinAPI.h"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb30a}{30a}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb37c}{, 37c}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb52}{, 52}\NWlink{nuweb54b}{, 54b}\NWlink{nuweb60a}{, 60a}\NWlink{nuweb128c}{, 128c}\NWlink{nuweb131b}{, 131b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb136b}{, 136b}.
}
\item \verb@"src/libcoin_internal.h"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb20a}{20a}.}
\item \verb@"src/Makevars"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb148a}{148a}.}
\end{list}}

\section*{Fragments}


{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item $\langle\,$2d Covariance\nobreak\ {\footnotesize \NWlink{nuweb43}{43}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb44}{44}.}
\item $\langle\,$2d Expectation\nobreak\ {\footnotesize \NWlink{nuweb42b}{42b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb44}{44}.}
\item $\langle\,$2d Memory\nobreak\ {\footnotesize \NWlink{nuweb45}{45}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb44}{44}.}
\item $\langle\,$2d Total Table\nobreak\ {\footnotesize \NWlink{nuweb41b}{41b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb44}{44}.}
\item $\langle\,$2d User Interface\nobreak\ {\footnotesize \NWlink{nuweb38b}{38b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$2d User Interface Input\nobreak\ {\footnotesize \NWlink{nuweb38c}{38c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb39a}{39a}\NWlink{nuweb44}{, 44}.
}
\item $\langle\,$BibTeX Header\nobreak\ {\footnotesize \NWlink{nuweb152c}{152c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb157a}{157a}.}
\item $\langle\,$C colSums Answer\nobreak\ {\footnotesize \NWlink{nuweb104c}{104c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb79b}{79b}\NWlink{nuweb103c}{, 103c}\NWlink{nuweb104d}{, 104d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb105b}{b}\NWlink{nuweb105c}{c}.
}
\item $\langle\,$C colSums Input\nobreak\ {\footnotesize \NWlink{nuweb104b}{104b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb103c}{103c}\NWlink{nuweb104d}{, 104d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb105b}{b}\NWlink{nuweb105c}{c}.
}
\item $\langle\,$C Global Variables\nobreak\ {\footnotesize \NWlink{nuweb21a}{21a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb20a}{20a}.}
\item $\langle\,$C Header\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb20a}{20a}\NWlink{nuweb21b}{, 21b}\NWlink{nuweb22b}{, 22b}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb149}{, 149}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160c}{c}\NWlink{nuweb160d}{d}.
}
\item $\langle\,$C integer B Input\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb26d}{26d}\NWlink{nuweb31}{, 31}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb146}{, 146}.
}
\item $\langle\,$C integer block Input\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb116b}{116b}.}
\item $\langle\,$C integer N Input\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23e}{23e}\NWlink{nuweb23f}{f}\NWlink{nuweb31}{, 31}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79b}{b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb81b}{b}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb87c}{, 87c}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb89b}{b}\NWlink{nuweb89c}{c}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb119c}{c}\NWlink{nuweb120b}{, 120b}\NWlink{nuweb121}{, 121}\NWlink{nuweb122b}{, 122b}.
}
\item $\langle\,$C integer Nsubset Input\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb25e}{25e}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb124a}{, 124a}\NWlink{nuweb124b}{b}\NWlink{nuweb125a}{, 125a}.
}
\item $\langle\,$C integer P Input\nobreak\ {\footnotesize \NWlink{nuweb23d}{23d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23e}{23e}\NWlink{nuweb23f}{f}\NWlink{nuweb31}{, 31}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb146}{, 146}.
}
\item $\langle\,$C integer Q Input\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24c}{24c}\NWlink{nuweb24d}{d}\NWlink{nuweb31}{, 31}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79b}{b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb81b}{b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb146}{, 146}.
}
\item $\langle\,$C integer subset Input\nobreak\ {\footnotesize \NWlink{nuweb25f}{25f}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb89b}{89b}\NWlink{nuweb89c}{c}\NWlink{nuweb94c}{, 94c}\NWlink{nuweb95}{, 95}\NWlink{nuweb97d}{, 97d}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb102b}{, 102b}\NWlink{nuweb105b}{, 105b}\NWlink{nuweb105c}{c}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb109c}{c}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb113c}{c}\NWlink{nuweb117b}{, 117b}\NWlink{nuweb117c}{c}.
}
\item $\langle\,$C integer weights Input\nobreak\ {\footnotesize \NWlink{nuweb24f}{24f}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb89a}{89a}\NWlink{nuweb89b}{b}\NWlink{nuweb94b}{, 94b}\NWlink{nuweb94c}{c}\NWlink{nuweb97c}{, 97c}\NWlink{nuweb97d}{d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb105b}{b}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113b}{b}\NWlink{nuweb117a}{, 117a}\NWlink{nuweb117b}{b}.
}
\item $\langle\,$C integer x Input\nobreak\ {\footnotesize \NWlink{nuweb23f}{23f}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb97a}{97a}\NWlink{nuweb102a}{, 102a}\NWlink{nuweb102b}{b}\NWlink{nuweb108b}{, 108b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb116b}{, 116b}.
}
\item $\langle\,$C integer y Input\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb112b}{112b}\NWlink{nuweb116b}{, 116b}.
}
\item $\langle\,$C KronSums Answer\nobreak\ {\footnotesize \NWlink{nuweb92d}{92d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb75c}{75c}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb91c}{, 91c}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb94b}{b}\NWlink{nuweb94c}{c}\NWlink{nuweb95}{, 95}\NWlink{nuweb97b}{, 97b}\NWlink{nuweb97c}{c}\NWlink{nuweb97d}{d}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb101b}{b}\NWlink{nuweb102a}{, 102a}\NWlink{nuweb102b}{b}.
}
\item $\langle\,$C KronSums Input\nobreak\ {\footnotesize \NWlink{nuweb92c}{92c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb94a}{94a}\NWlink{nuweb94b}{b}\NWlink{nuweb94c}{c}\NWlink{nuweb95}{, 95}.
}
\item $\langle\,$C Macros\nobreak\ {\footnotesize \NWlink{nuweb20c}{20c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb20a}{20a}.}
\item $\langle\,$C OneTableSums Answer\nobreak\ {\footnotesize \NWlink{nuweb108c}{108c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb83a}{83a}\NWlink{nuweb107c}{, 107c}\NWlink{nuweb108d}{, 108d}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb109c}{c}.
}
\item $\langle\,$C OneTableSums Input\nobreak\ {\footnotesize \NWlink{nuweb108b}{108b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb107c}{107c}\NWlink{nuweb108d}{, 108d}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb109c}{c}.
}
\item $\langle\,$C real subset Input\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb88b}{88b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb94b}{b}\NWlink{nuweb97b}{, 97b}\NWlink{nuweb97c}{c}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb102a}{, 102a}\NWlink{nuweb104d}{, 104d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb108d}{, 108d}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb112d}{, 112d}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb116d}{, 116d}\NWlink{nuweb117a}{, 117a}.
}
\item $\langle\,$C real weights Input\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb88b}{88b}\NWlink{nuweb89c}{, 89c}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb95}{, 95}\NWlink{nuweb97b}{, 97b}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb104d}{, 104d}\NWlink{nuweb105c}{, 105c}\NWlink{nuweb108d}{, 108d}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb112d}{, 112d}\NWlink{nuweb113c}{, 113c}\NWlink{nuweb116d}{, 116d}\NWlink{nuweb117c}{, 117c}.
}
\item $\langle\,$C real x Input\nobreak\ {\footnotesize \NWlink{nuweb23e}{23e}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb92c}{92c}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb101b}{b}\NWlink{nuweb104b}{, 104b}\NWlink{nuweb130b}{, 130b}.
}
\item $\langle\,$C real y Input\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb75c}{75c}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb92c}{c}\NWlink{nuweb97a}{, 97a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb101b}{b}\NWlink{nuweb102a}{, 102a}\NWlink{nuweb102b}{b}.
}
\item $\langle\,$C subset range Input\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb25f}{25f}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb87c}{, 87c}\NWlink{nuweb91c}{, 91c}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb103c}{, 103c}\NWlink{nuweb107c}{, 107c}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb115b}{, 115b}.
}
\item $\langle\,$C sumweights Input\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb77}{77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb81b}{, 81b}.
}
\item $\langle\,$C ThreeTableSums Answer\nobreak\ {\footnotesize \NWlink{nuweb116c}{116c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb115b}{115b}\NWlink{nuweb116d}{, 116d}\NWlink{nuweb117a}{, 117a}\NWlink{nuweb117b}{b}\NWlink{nuweb117c}{c}.
}
\item $\langle\,$C ThreeTableSums Input\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb115b}{115b}\NWlink{nuweb116d}{, 116d}\NWlink{nuweb117a}{, 117a}\NWlink{nuweb117b}{b}\NWlink{nuweb117c}{c}.
}
\item $\langle\,$C TwoTableSums Answer\nobreak\ {\footnotesize \NWlink{nuweb112c}{112c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb111b}{111b}\NWlink{nuweb112d}{, 112d}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113b}{b}\NWlink{nuweb113c}{c}.
}
\item $\langle\,$C TwoTableSums Input\nobreak\ {\footnotesize \NWlink{nuweb112b}{112b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb111b}{111b}\NWlink{nuweb112d}{, 112d}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113b}{b}\NWlink{nuweb113c}{c}.
}
\item $\langle\,$C XfactorKronSums Input\nobreak\ {\footnotesize \NWlink{nuweb97a}{97a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb97b}{97b}\NWlink{nuweb97c}{c}\NWlink{nuweb97d}{d}\NWlink{nuweb98a}{, 98a}.
}
\item $\langle\,$Check ix\nobreak\ {\footnotesize \NWlink{nuweb9a}{9a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb8}{8}\NWlink{nuweb15b}{, 15b}.
}
\item $\langle\,$Check iy\nobreak\ {\footnotesize \NWlink{nuweb9b}{9b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb8}{8}\NWlink{nuweb15b}{, 15b}.
}
\item $\langle\,$Check weights, subset, block\nobreak\ {\footnotesize \NWlink{nuweb5a}{5a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb6}{6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15b}{, 15b}.
}
\item $\langle\,$Col Row Total Sums\nobreak\ {\footnotesize \NWlink{nuweb42a}{42a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb44}{44}\NWlink{nuweb47}{, 47}.
}
\item $\langle\,$colSums\nobreak\ {\footnotesize \NWlink{nuweb102d}{102d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$colSums Body\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb104d}{104d}\NWlink{nuweb105a}{, 105a}\NWlink{nuweb105b}{b}\NWlink{nuweb105c}{c}.
}
\item $\langle\,$Compute Covariance Influence\nobreak\ {\footnotesize \NWlink{nuweb34b}{34b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31}{31}.}
\item $\langle\,$Compute Covariance Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb34d}{34d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31}{31}.}
\item $\langle\,$Compute Expectation Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb34a}{34a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31}{31}.}
\item $\langle\,$Compute Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb32b}{32b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31}{31}.}
\item $\langle\,$Compute maxstat Permutation P-Value\nobreak\ {\footnotesize \NWlink{nuweb71c}{71c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
}
\item $\langle\,$Compute maxstat Test Statistic\nobreak\ {\footnotesize \NWlink{nuweb71b}{71b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
}
\item $\langle\,$Compute maxstat Variance / Covariance Directly\nobreak\ {\footnotesize \NWlink{nuweb71a}{71a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb68}{68}.}
\item $\langle\,$Compute maxstat Variance / Covariance from Total Covariance\nobreak\ {\footnotesize \NWlink{nuweb70b}{70b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb68}{68}.}
\item $\langle\,$Compute Permuted Linear Statistic 2d\nobreak\ {\footnotesize \NWlink{nuweb48d}{48d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb47}{47}.}
\item $\langle\,$Compute Sum of Weights in Block\nobreak\ {\footnotesize \NWlink{nuweb33b}{33b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31}{31}.}
\item $\langle\,$Compute unordered maxstat Linear Statistic and Expectation\nobreak\ {\footnotesize \NWlink{nuweb74a}{74a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb72}{72}.}
\item $\langle\,$Compute unordered maxstat Variance / Covariance Directly\nobreak\ {\footnotesize \NWlink{nuweb75a}{75a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb72}{72}.}
\item $\langle\,$Compute unordered maxstat Variance / Covariance from Total Covariance\nobreak\ {\footnotesize \NWlink{nuweb74b}{74b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb72}{72}.}
\item $\langle\,$Compute Variance from Covariance\nobreak\ {\footnotesize \NWlink{nuweb35a}{35a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31}{31}.}
\item $\langle\,$Compute Variance Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb34c}{34c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31}{31}.}
\item $\langle\,$continue subset loop\nobreak\ {\footnotesize \NWlink{nuweb86c}{86c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90a}{90a}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}.
}
\item $\langle\,$Contrasts\nobreak\ {\footnotesize \NWlink{nuweb14}{14}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}.}
\item $\langle\,$Convert Table to Integer\nobreak\ {\footnotesize \NWlink{nuweb48a}{48a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb47}{47}.}
\item $\langle\,$Count Levels\nobreak\ {\footnotesize \NWlink{nuweb73a}{73a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb72}{72}.}
\item $\langle\,$ctabs Prototype\nobreak\ {\footnotesize \NWlink{nuweb15a}{15a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb15b}{15b}\NWlink{nuweb19}{, 19}.
}
\item $\langle\,$C_chisq_pvalue\nobreak\ {\footnotesize \NWlink{nuweb62c}{62c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb62b}{62b}.}
\item $\langle\,$C_colSums_dweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb104d}{104d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb102d}{102d}.}
\item $\langle\,$C_colSums_dweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb105c}{105c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb102d}{102d}.}
\item $\langle\,$C_colSums_iweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb105a}{105a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb102d}{102d}.}
\item $\langle\,$C_colSums_iweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb105b}{105b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb102d}{102d}.}
\item $\langle\,$C_CovarianceLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb77}{77}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$C_doPermute\nobreak\ {\footnotesize \NWlink{nuweb124b}{124b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123b}{123b}.}
\item $\langle\,$C_doPermuteBlock\nobreak\ {\footnotesize \NWlink{nuweb125a}{125a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123b}{123b}.}
\item $\langle\,$C_ExpectationLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb76b}{76b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$C_get_B\nobreak\ {\footnotesize \NWlink{nuweb141d}{141d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_Covariance\nobreak\ {\footnotesize \NWlink{nuweb139b}{139b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_CovarianceInfluence\nobreak\ {\footnotesize \NWlink{nuweb140b}{140b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_dimTable\nobreak\ {\footnotesize \NWlink{nuweb141c}{141c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_Expectation\nobreak\ {\footnotesize \NWlink{nuweb138d}{138d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_ExpectationInfluence\nobreak\ {\footnotesize \NWlink{nuweb140a}{140a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_ExpectationX\nobreak\ {\footnotesize \NWlink{nuweb139c}{139c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_LinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb138c}{138c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_nresample\nobreak\ {\footnotesize \NWlink{nuweb142a}{142a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_P\nobreak\ {\footnotesize \NWlink{nuweb137c}{137c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_PermutedLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb142b}{142b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_Q\nobreak\ {\footnotesize \NWlink{nuweb137d}{137d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_Sumweights\nobreak\ {\footnotesize \NWlink{nuweb141a}{141a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_Table\nobreak\ {\footnotesize \NWlink{nuweb141b}{141b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_TableBlock\nobreak\ {\footnotesize \NWlink{nuweb140d}{140d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_tol\nobreak\ {\footnotesize \NWlink{nuweb142c}{142c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_Variance\nobreak\ {\footnotesize \NWlink{nuweb139a}{139a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_VarianceInfluence\nobreak\ {\footnotesize \NWlink{nuweb140c}{140c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_varonly\nobreak\ {\footnotesize \NWlink{nuweb138a}{138a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_get_Xfactor\nobreak\ {\footnotesize \NWlink{nuweb138b}{138b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$C_kronecker\nobreak\ {\footnotesize \NWlink{nuweb129b}{129b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$C_kronecker_sym\nobreak\ {\footnotesize \NWlink{nuweb130a}{130a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$C_KronSums_dweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_KronSums_dweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb95}{95}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_KronSums_iweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb94b}{94b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_KronSums_iweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb94c}{94c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_KronSums_Permutation_dsubset\nobreak\ {\footnotesize \NWlink{nuweb101a}{101a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_KronSums_Permutation_isubset\nobreak\ {\footnotesize \NWlink{nuweb101b}{101b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_KronSums_sym\nobreak\ {\footnotesize \NWlink{nuweb130b}{130b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$C_maxabsstand_Covariance\nobreak\ {\footnotesize \NWlink{nuweb58b}{58b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_maxabsstand_Variance\nobreak\ {\footnotesize \NWlink{nuweb59a}{59a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_maxstand_Covariance\nobreak\ {\footnotesize \NWlink{nuweb56b}{56b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_maxstand_Variance\nobreak\ {\footnotesize \NWlink{nuweb57a}{57a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_maxtype\nobreak\ {\footnotesize \NWlink{nuweb61b}{61b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_maxtype_pvalue\nobreak\ {\footnotesize \NWlink{nuweb65}{65}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb62b}{62b}.}
\item $\langle\,$C_minstand_Covariance\nobreak\ {\footnotesize \NWlink{nuweb57b}{57b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_minstand_Variance\nobreak\ {\footnotesize \NWlink{nuweb58a}{58a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_MPinv_sym\nobreak\ {\footnotesize \NWlink{nuweb133}{133}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$C_norm_pvalue\nobreak\ {\footnotesize \NWlink{nuweb64}{64}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb62b}{62b}.}
\item $\langle\,$C_OneTableSums_dweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb108d}{108d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_OneTableSums_dweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb109c}{109c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_OneTableSums_iweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb109a}{109a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_OneTableSums_iweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb109b}{109b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_ordered_Xfactor\nobreak\ {\footnotesize \NWlink{nuweb68}{68}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_order_subset_wrt_block\nobreak\ {\footnotesize \NWlink{nuweb122a}{122a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb118b}{118b}.}
\item $\langle\,$C_Permute\nobreak\ {\footnotesize \NWlink{nuweb124a}{124a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123b}{123b}.}
\item $\langle\,$C_PermuteBlock\nobreak\ {\footnotesize \NWlink{nuweb124c}{124c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123b}{123b}.}
\item $\langle\,$C_perm_pvalue\nobreak\ {\footnotesize \NWlink{nuweb63}{63}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb62b}{62b}.}
\item $\langle\,$C_quadform\nobreak\ {\footnotesize \NWlink{nuweb61a}{61a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_setup_subset\nobreak\ {\footnotesize \NWlink{nuweb120b}{120b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb118b}{118b}.}
\item $\langle\,$C_setup_subset_block\nobreak\ {\footnotesize \NWlink{nuweb121}{121}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb118b}{118b}.}
\item $\langle\,$C_standardise\nobreak\ {\footnotesize \NWlink{nuweb62a}{62a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_Sums_dweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb88b}{88b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb86d}{86d}.}
\item $\langle\,$C_Sums_dweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb89c}{89c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb86d}{86d}.}
\item $\langle\,$C_Sums_iweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb89a}{89a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb86d}{86d}.}
\item $\langle\,$C_Sums_iweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb89b}{89b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb86d}{86d}.}
\item $\langle\,$C_ThreeTableSums_dweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb116d}{116d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_ThreeTableSums_dweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb117c}{117c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_ThreeTableSums_iweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb117a}{117a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_ThreeTableSums_iweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb117b}{117b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_TwoTableSums_dweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb112d}{112d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_TwoTableSums_dweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb113c}{113c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_TwoTableSums_iweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb113a}{113a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_TwoTableSums_iweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb113b}{113b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$C_unordered_Xfactor\nobreak\ {\footnotesize \NWlink{nuweb72}{72}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$C_VarianceLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb78a}{78a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$C_XfactorKronSums_dweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb97b}{97b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_XfactorKronSums_dweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb98a}{98a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_XfactorKronSums_iweights_dsubset\nobreak\ {\footnotesize \NWlink{nuweb97c}{97c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_XfactorKronSums_iweights_isubset\nobreak\ {\footnotesize \NWlink{nuweb97d}{97d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_XfactorKronSums_Permutation_dsubset\nobreak\ {\footnotesize \NWlink{nuweb102a}{102a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$C_XfactorKronSums_Permutation_isubset\nobreak\ {\footnotesize \NWlink{nuweb102b}{102b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$def Header\nobreak\ {\footnotesize \NWlink{nuweb152b}{152b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb148b}{148b}\NWlink{nuweb160a}{, 160a}.
}
\item $\langle\,$doTest\nobreak\ {\footnotesize \NWlink{nuweb12}{12}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}.}
\item $\langle\,$doTest Prototype\nobreak\ {\footnotesize \NWlink{nuweb11}{11}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb12}{12}\NWlink{nuweb18}{, 18}.
}
\item $\langle\,$ExpectationCovariances\nobreak\ {\footnotesize \NWlink{nuweb76a}{76a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$Extract Dimensions\nobreak\ {\footnotesize \NWlink{nuweb32a}{32a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31}{31}.}
\item $\langle\,$Function Definitions\nobreak\ {\footnotesize \NWlink{nuweb22c}{22c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22b}{22b}.}
\item $\langle\,$Function Prototypes\nobreak\ {\footnotesize \NWlink{nuweb22a}{22a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb21b}{21b}.}
\item $\langle\,$Handle Missing Values\nobreak\ {\footnotesize \NWlink{nuweb5b}{5b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb6}{6}.}
\item $\langle\,$init subset loop\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90a}{90a}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}.
}
\item $\langle\,$Initialise Zero\nobreak\ {\footnotesize \NWlink{nuweb145a}{145a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb144}{144}.}
\item $\langle\,$KronSums\nobreak\ {\footnotesize \NWlink{nuweb90b}{90b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$KronSums Body\nobreak\ {\footnotesize \NWlink{nuweb96}{96}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb94a}{94a}\NWlink{nuweb94b}{b}\NWlink{nuweb94c}{c}\NWlink{nuweb95}{, 95}.
}
\item $\langle\,$KronSums Double x\nobreak\ {\footnotesize \NWlink{nuweb93b}{93b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb92a}{92a}.}
\item $\langle\,$KronSums Integer x\nobreak\ {\footnotesize \NWlink{nuweb93a}{93a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb92a}{92a}.}
\item $\langle\,$KronSums Permutation Body\nobreak\ {\footnotesize \NWlink{nuweb101c}{101c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb101a}{101a}\NWlink{nuweb101b}{b}.
}
\item $\langle\,$Linear Statistic 2d\nobreak\ {\footnotesize \NWlink{nuweb41a}{41a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb44}{44}\NWlink{nuweb48d}{, 48d}.
}
\item $\langle\,$LinearStatistics\nobreak\ {\footnotesize \NWlink{nuweb75b}{75b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$LinStatExpCov\nobreak\ {\footnotesize \NWlink{nuweb4}{4}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}.}
\item $\langle\,$LinStatExpCov Prototype\nobreak\ {\footnotesize \NWlink{nuweb3b}{3b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb4}{4}\NWlink{nuweb17}{, 17}.
}
\item $\langle\,$LinStatExpCov1d\nobreak\ {\footnotesize \NWlink{nuweb6}{6}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}.}
\item $\langle\,$LinStatExpCov2d\nobreak\ {\footnotesize \NWlink{nuweb8}{8}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}.}
\item $\langle\,$maxstat Xfactor Variables\nobreak\ {\footnotesize \NWlink{nuweb67b}{67b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
}
\item $\langle\,$Memory\nobreak\ {\footnotesize \NWlink{nuweb137a}{137a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$Memory Input Checks\nobreak\ {\footnotesize \NWlink{nuweb142d}{142d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb144}{144}.}
\item $\langle\,$Memory Names\nobreak\ {\footnotesize \NWlink{nuweb143}{143}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb144}{144}.}
\item $\langle\,$MoreUtils\nobreak\ {\footnotesize \NWlink{nuweb125b}{125b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$mPQB\nobreak\ {\footnotesize \NWlink{nuweb128a}{128a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$NCOL\nobreak\ {\footnotesize \NWlink{nuweb126b}{126b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$NLEVELS\nobreak\ {\footnotesize \NWlink{nuweb127a}{127a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$NROW\nobreak\ {\footnotesize \NWlink{nuweb126a}{126a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$OneTableSums Body\nobreak\ {\footnotesize \NWlink{nuweb110a}{110a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb108d}{108d}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb109c}{c}.
}
\item $\langle\,$P-Values\nobreak\ {\footnotesize \NWlink{nuweb62b}{62b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$Permutations\nobreak\ {\footnotesize \NWlink{nuweb123b}{123b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$PP12\nobreak\ {\footnotesize \NWlink{nuweb127b}{127b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$R block Input\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb119c}{c}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}.
}
\item $\langle\,$R blockTable Input\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb119c}{119c}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}.
}
\item $\langle\,$R Header\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}\NWlink{nuweb15b}{, 15b}\NWlink{nuweb147a}{, 147a}\NWlink{nuweb147b}{b}\NWlink{nuweb147c}{c}\NWlink{nuweb148a}{, 148a}\NWlink{nuweb158a}{, 158a}\NWlink{nuweb158b}{b}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb159c}{c}.
}
\item $\langle\,$R Includes\nobreak\ {\footnotesize \NWlink{nuweb20b}{20b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb20a}{20a}.}
\item $\langle\,$R LECV Input\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb49b}{49b}\NWlink{nuweb51b}{, 51b}\NWlink{nuweb137c}{, 137c}\NWlink{nuweb137d}{d}\NWlink{nuweb138a}{, 138a}\NWlink{nuweb138b}{b}\NWlink{nuweb138c}{c}\NWlink{nuweb138d}{d}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb139b}{b}\NWlink{nuweb139c}{c}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb140b}{b}\NWlink{nuweb140c}{c}\NWlink{nuweb140d}{d}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb141b}{b}\NWlink{nuweb141c}{c}\NWlink{nuweb141d}{d}\NWlink{nuweb142a}{, 142a}\NWlink{nuweb142b}{b}\NWlink{nuweb142c}{c}.
}
\item $\langle\,$R N Input\nobreak\ {\footnotesize \NWlink{nuweb23a}{23a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb87a}{87a}.}
\item $\langle\,$R subset Input\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb78b}{, 78b}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb80}{, 80}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb84a}{, 84a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87c}{c}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb91c}{c}\NWlink{nuweb99a}{, 99a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb103c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107c}{c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb115b}{, 115b}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb119c}{c}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb122b}{b}.
}
\item $\langle\,$R weights Input\nobreak\ {\footnotesize \NWlink{nuweb24e}{24e}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb78b}{, 78b}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb80}{, 80}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb84a}{, 84a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87c}{c}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb91c}{c}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb103c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107c}{c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb115b}{, 115b}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}.
}
\item $\langle\,$R x Input\nobreak\ {\footnotesize \NWlink{nuweb23c}{23c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb75c}{, 75c}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83a}{, 83a}\NWlink{nuweb84a}{, 84a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb99a}{, 99a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb114b}{, 114b}.
}
\item $\langle\,$R y Input\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29b}{29b}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb78b}{, 78b}\NWlink{nuweb79b}{, 79b}\NWlink{nuweb80}{, 80}\NWlink{nuweb81b}{, 81b}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb99a}{, 99a}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb119a}{, 119a}.
}
\item $\langle\,$RC KronSums Input\nobreak\ {\footnotesize \NWlink{nuweb92b}{92b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb91c}{91c}.}
\item $\langle\,$RC_colSums\nobreak\ {\footnotesize \NWlink{nuweb104a}{104a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb102d}{102d}.}
\item $\langle\,$RC_colSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb103c}{103c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb104a}{104a}.}
\item $\langle\,$RC_CovarianceInfluence\nobreak\ {\footnotesize \NWlink{nuweb82a}{82a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$RC_CovarianceInfluence Prototype\nobreak\ {\footnotesize \NWlink{nuweb81b}{81b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$RC_CovarianceX\nobreak\ {\footnotesize \NWlink{nuweb85b}{85b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$RC_CovarianceX Prototype\nobreak\ {\footnotesize \NWlink{nuweb85a}{85a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb85b}{85b}.}
\item $\langle\,$RC_ExpectationCovarianceStatistic\nobreak\ {\footnotesize \NWlink{nuweb31}{31}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29a}{29a}.}
\item $\langle\,$RC_ExpectationCovarianceStatistic_2d\nobreak\ {\footnotesize \NWlink{nuweb44}{44}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb38b}{38b}.}
\item $\langle\,$RC_ExpectationInfluence\nobreak\ {\footnotesize \NWlink{nuweb79c}{79c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$RC_ExpectationInfluence Prototype\nobreak\ {\footnotesize \NWlink{nuweb79b}{79b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb79c}{79c}.}
\item $\langle\,$RC_ExpectationX\nobreak\ {\footnotesize \NWlink{nuweb83b}{83b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$RC_ExpectationX Prototype\nobreak\ {\footnotesize \NWlink{nuweb83a}{83a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb83b}{83b}.}
\item $\langle\,$RC_init_LECV_1d\nobreak\ {\footnotesize \NWlink{nuweb145b}{145b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$RC_init_LECV_2d\nobreak\ {\footnotesize \NWlink{nuweb146}{146}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb137a}{137a}.}
\item $\langle\,$RC_KronSums\nobreak\ {\footnotesize \NWlink{nuweb92a}{92a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$RC_KronSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb91c}{91c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb92a}{92a}.}
\item $\langle\,$RC_KronSums_Permutation\nobreak\ {\footnotesize \NWlink{nuweb100b}{100b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$RC_KronSums_Permutation Prototype\nobreak\ {\footnotesize \NWlink{nuweb100a}{100a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb100b}{100b}.}
\item $\langle\,$RC_LinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb75d}{75d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb75b}{75b}.}
\item $\langle\,$RC_LinearStatistic Prototype\nobreak\ {\footnotesize \NWlink{nuweb75c}{75c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb75d}{75d}.}
\item $\langle\,$RC_OneTableSums\nobreak\ {\footnotesize \NWlink{nuweb108a}{108a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$RC_OneTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb107c}{107c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb108a}{108a}.}
\item $\langle\,$RC_order_subset_wrt_block\nobreak\ {\footnotesize \NWlink{nuweb120a}{120a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb118b}{118b}.}
\item $\langle\,$RC_order_subset_wrt_block Prototype\nobreak\ {\footnotesize \NWlink{nuweb119c}{119c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb120a}{120a}.}
\item $\langle\,$RC_setup_subset\nobreak\ {\footnotesize \NWlink{nuweb123a}{123a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123b}{123b}.}
\item $\langle\,$RC_setup_subset Prototype\nobreak\ {\footnotesize \NWlink{nuweb122b}{122b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123a}{123a}.}
\item $\langle\,$RC_Sums\nobreak\ {\footnotesize \NWlink{nuweb88a}{88a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb86d}{86d}.}
\item $\langle\,$RC_Sums Prototype\nobreak\ {\footnotesize \NWlink{nuweb87c}{87c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb88a}{88a}.}
\item $\langle\,$RC_ThreeTableSums\nobreak\ {\footnotesize \NWlink{nuweb116a}{116a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$RC_ThreeTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb115b}{115b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb116a}{116a}.}
\item $\langle\,$RC_TwoTableSums\nobreak\ {\footnotesize \NWlink{nuweb112a}{112a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$RC_TwoTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb111b}{111b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb112a}{112a}.}
\item $\langle\,$Rd Header\nobreak\ {\footnotesize \NWlink{nuweb151b}{151b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb17}{17}\NWlink{nuweb18}{, 18}\NWlink{nuweb19}{, 19}\NWlink{nuweb152c}{, 152c}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb159a}{, 159a}.
}
\item $\langle\,$R_colSums\nobreak\ {\footnotesize \NWlink{nuweb103b}{103b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb102d}{102d}.}
\item $\langle\,$R_colSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb103a}{103a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb103b}{, 103b}.
}
\item $\langle\,$R_CovarianceInfluence\nobreak\ {\footnotesize \NWlink{nuweb81a}{81a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$R_CovarianceInfluence Prototype\nobreak\ {\footnotesize \NWlink{nuweb80}{80}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb81a}{, 81a}.
}
\item $\langle\,$R_CovarianceX\nobreak\ {\footnotesize \NWlink{nuweb84b}{84b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$R_CovarianceX Prototype\nobreak\ {\footnotesize \NWlink{nuweb84a}{84a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb84b}{, 84b}.
}
\item $\langle\,$R_ExpectationCovarianceStatistic\nobreak\ {\footnotesize \NWlink{nuweb30b}{30b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29a}{29a}.}
\item $\langle\,$R_ExpectationCovarianceStatistic Prototype\nobreak\ {\footnotesize \NWlink{nuweb29c}{29c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb30b}{, 30b}.
}
\item $\langle\,$R_ExpectationCovarianceStatistic_2d\nobreak\ {\footnotesize \NWlink{nuweb40a}{40a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb38b}{38b}.}
\item $\langle\,$R_ExpectationCovarianceStatistic_2d Prototype\nobreak\ {\footnotesize \NWlink{nuweb39a}{39a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb40a}{, 40a}.
}
\item $\langle\,$R_ExpectationInfluence\nobreak\ {\footnotesize \NWlink{nuweb79a}{79a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$R_ExpectationInfluence Prototype\nobreak\ {\footnotesize \NWlink{nuweb78b}{78b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb79a}{, 79a}.
}
\item $\langle\,$R_ExpectationX\nobreak\ {\footnotesize \NWlink{nuweb82c}{82c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb76a}{76a}.}
\item $\langle\,$R_ExpectationX Prototype\nobreak\ {\footnotesize \NWlink{nuweb82b}{82b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb82c}{, 82c}.
}
\item $\langle\,$R_init_LECV\nobreak\ {\footnotesize \NWlink{nuweb144}{144}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb145b}{145b}\NWlink{nuweb146}{, 146}.
}
\item $\langle\,$R_kronecker\nobreak\ {\footnotesize \NWlink{nuweb129a}{129a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$R_kronecker Prototype\nobreak\ {\footnotesize \NWlink{nuweb128b}{128b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb129a}{, 129a}.
}
\item $\langle\,$R_KronSums\nobreak\ {\footnotesize \NWlink{nuweb91b}{91b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$R_KronSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb91a}{91a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb91b}{, 91b}.
}
\item $\langle\,$R_KronSums_Permutation\nobreak\ {\footnotesize \NWlink{nuweb99b}{99b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90b}{90b}.}
\item $\langle\,$R_KronSums_Permutation Prototype\nobreak\ {\footnotesize \NWlink{nuweb99a}{99a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb99b}{, 99b}.
}
\item $\langle\,$R_MaximallySelectedTest\nobreak\ {\footnotesize \NWlink{nuweb55}{55}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb49a}{49a}.}
\item $\langle\,$R_MaximallySelectedTest Prototype\nobreak\ {\footnotesize \NWlink{nuweb54a}{54a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb55}{, 55}.
}
\item $\langle\,$R_MaximumTest\nobreak\ {\footnotesize \NWlink{nuweb53}{53}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb49a}{49a}.}
\item $\langle\,$R_MaximumTest Prototype\nobreak\ {\footnotesize \NWlink{nuweb51b}{51b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb53}{, 53}.
}
\item $\langle\,$R_MPinv_sym\nobreak\ {\footnotesize \NWlink{nuweb132}{132}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$R_MPinv_sym Prototype\nobreak\ {\footnotesize \NWlink{nuweb131a}{131a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb132}{, 132}.
}
\item $\langle\,$R_OneTableSums\nobreak\ {\footnotesize \NWlink{nuweb107b}{107b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$R_OneTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb107a}{107a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb107b}{, 107b}.
}
\item $\langle\,$R_order_subset_wrt_block\nobreak\ {\footnotesize \NWlink{nuweb119b}{119b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb118b}{118b}.}
\item $\langle\,$R_order_subset_wrt_block Prototype\nobreak\ {\footnotesize \NWlink{nuweb119a}{119a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb119b}{, 119b}.
}
\item $\langle\,$R_pack_sym\nobreak\ {\footnotesize \NWlink{nuweb136c}{136c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$R_pack_sym Prototype\nobreak\ {\footnotesize \NWlink{nuweb136a}{136a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb136c}{, 136c}.
}
\item $\langle\,$R_PermutedLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb36}{36}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29a}{29a}.}
\item $\langle\,$R_PermutedLinearStatistic Prototype\nobreak\ {\footnotesize \NWlink{nuweb35b}{35b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb36}{, 36}.
}
\item $\langle\,$R_PermutedLinearStatistic_2d\nobreak\ {\footnotesize \NWlink{nuweb47}{47}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb38b}{38b}.}
\item $\langle\,$R_PermutedLinearStatistic_2d Prototype\nobreak\ {\footnotesize \NWlink{nuweb46a}{46a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb47}{, 47}.
}
\item $\langle\,$R_quadform\nobreak\ {\footnotesize \NWlink{nuweb60b}{60b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb56a}{56a}.}
\item $\langle\,$R_quadform Prototype\nobreak\ {\footnotesize \NWlink{nuweb59b}{59b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb60b}{, 60b}.
}
\item $\langle\,$R_QuadraticTest\nobreak\ {\footnotesize \NWlink{nuweb50}{50}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb49a}{49a}.}
\item $\langle\,$R_QuadraticTest Prototype\nobreak\ {\footnotesize \NWlink{nuweb49b}{49b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb50}{, 50}.
}
\item $\langle\,$R_StandardisePermutedLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb38a}{38a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29a}{29a}.}
\item $\langle\,$R_StandardisePermutedLinearStatistic Prototype\nobreak\ {\footnotesize \NWlink{nuweb37b}{37b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb38a}{, 38a}.
}
\item $\langle\,$R_Sums\nobreak\ {\footnotesize \NWlink{nuweb87b}{87b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb86d}{86d}.}
\item $\langle\,$R_Sums Prototype\nobreak\ {\footnotesize \NWlink{nuweb87a}{87a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb87b}{, 87b}.
}
\item $\langle\,$R_ThreeTableSums\nobreak\ {\footnotesize \NWlink{nuweb115a}{115a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$R_ThreeTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb114b}{114b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb115a}{, 115a}.
}
\item $\langle\,$R_TwoTableSums\nobreak\ {\footnotesize \NWlink{nuweb111a}{111a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}.}
\item $\langle\,$R_TwoTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb110b}{110b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb111a}{, 111a}.
}
\item $\langle\,$R_unpack_sym\nobreak\ {\footnotesize \NWlink{nuweb135}{135}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb125b}{125b}.}
\item $\langle\,$R_unpack_sym Prototype\nobreak\ {\footnotesize \NWlink{nuweb134a}{134a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22a}{22a}\NWlink{nuweb135}{, 135}.
}
\item $\langle\,$Setup Dimensions\nobreak\ {\footnotesize \NWlink{nuweb30c}{30c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb30b}{30b}\NWlink{nuweb36}{, 36}.
}
\item $\langle\,$Setup Dimensions 2d\nobreak\ {\footnotesize \NWlink{nuweb40b}{40b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb40a}{40a}\NWlink{nuweb47}{, 47}.
}
\item $\langle\,$Setup Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb37a}{37a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb36}{36}\NWlink{nuweb47}{, 47}.
}
\item $\langle\,$Setup Log-Factorials\nobreak\ {\footnotesize \NWlink{nuweb48c}{48c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb47}{47}.}
\item $\langle\,$Setup maxstat Memory\nobreak\ {\footnotesize \NWlink{nuweb70a}{70a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
}
\item $\langle\,$Setup maxstat Variables\nobreak\ {\footnotesize \NWlink{nuweb69}{69}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb68}{68}\NWlink{nuweb72}{, 72}.
}
\item $\langle\,$Setup Memory and Subsets in Blocks\nobreak\ {\footnotesize \NWlink{nuweb33a}{33a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31}{31}.}
\item $\langle\,$Setup mvtnorm Correlation\nobreak\ {\footnotesize \NWlink{nuweb67a}{67a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb65}{65}.}
\item $\langle\,$Setup mvtnorm Memory\nobreak\ {\footnotesize \NWlink{nuweb66}{66}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb65}{65}.}
\item $\langle\,$Setup Test Memory\nobreak\ {\footnotesize \NWlink{nuweb51a}{51a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb50}{50}\NWlink{nuweb53}{, 53}.
}
\item $\langle\,$Setup unordered maxstat Contrasts\nobreak\ {\footnotesize \NWlink{nuweb73b}{73b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb72}{72}.}
\item $\langle\,$Setup Working Memory\nobreak\ {\footnotesize \NWlink{nuweb48b}{48b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb47}{47}.}
\item $\langle\,$SimpleSums\nobreak\ {\footnotesize \NWlink{nuweb86d}{86d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$start subset loop\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90a}{90a}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}.
}
\item $\langle\,$Sums Body\nobreak\ {\footnotesize \NWlink{nuweb90a}{90a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb88b}{88b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb89b}{b}\NWlink{nuweb89c}{c}.
}
\item $\langle\,$Tables\nobreak\ {\footnotesize \NWlink{nuweb106b}{106b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$Test Statistics\nobreak\ {\footnotesize \NWlink{nuweb56a}{56a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$Tests\nobreak\ {\footnotesize \NWlink{nuweb49a}{49a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$ThreeTableSums Body\nobreak\ {\footnotesize \NWlink{nuweb118a}{118a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb116d}{116d}\NWlink{nuweb117a}{, 117a}\NWlink{nuweb117b}{b}\NWlink{nuweb117c}{c}.
}
\item $\langle\,$TwoTableSums Body\nobreak\ {\footnotesize \NWlink{nuweb114a}{114a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb112d}{112d}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113b}{b}\NWlink{nuweb113c}{c}.
}
\item $\langle\,$User Interface\nobreak\ {\footnotesize \NWlink{nuweb29a}{29a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$User Interface Input\nobreak\ {\footnotesize \NWlink{nuweb29b}{29b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb29c}{29c}\NWlink{nuweb31}{, 31}\NWlink{nuweb35b}{, 35b}.
}
\item $\langle\,$Utils\nobreak\ {\footnotesize \NWlink{nuweb118b}{118b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb22c}{22c}.}
\item $\langle\,$vcov LinStatExpCov\nobreak\ {\footnotesize \NWlink{nuweb10}{10}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}.}
\item $\langle\,$XfactorKronSums Body\nobreak\ {\footnotesize \NWlink{nuweb98b}{98b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb97b}{97b}\NWlink{nuweb97c}{c}\NWlink{nuweb97d}{d}\NWlink{nuweb98a}{, 98a}.
}
\item $\langle\,$XfactorKronSums Permutation Body\nobreak\ {\footnotesize \NWlink{nuweb102c}{102c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb102a}{102a}\NWlink{nuweb102b}{b}.
}
\end{list}}

\section*{Identifiers}


{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \verb@ALTERNATIVE_greater@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb61b}{, 61b}\NWlink{nuweb64}{, 64}\NWlink{nuweb67a}{, 67a}.
\item \verb@ALTERNATIVE_less@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb53}{, 53}\NWlink{nuweb61b}{, 61b}\NWlink{nuweb64}{, 64}\NWlink{nuweb67a}{, 67a}.
\item \verb@ALTERNATIVE_twosided@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb61b}{, 61b}\NWlink{nuweb64}{, 64}\NWlink{nuweb67a}{, 67a}\NWlink{nuweb71b}{, 71b}.
\item \verb@B@: \underline{\NWlink{nuweb26c}{26c}}\NWlink{nuweb30b}{, 30b}\NWlink{nuweb30c}{c}\NWlink{nuweb31}{, 31}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45}{, 45}\NWlink{nuweb47}{, 47}\NWlink{nuweb48b}{, 48b}\NWlink{nuweb68}{, 68}\NWlink{nuweb69}{, 69}\NWlink{nuweb72}{, 72}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb128b}{b}\NWlink{nuweb128c}{c}\NWlink{nuweb129a}{, 129a}\NWlink{nuweb129b}{b}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb142d}{, 142d}\NWlink{nuweb144}{, 144}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb146}{, 146}.
\item \verb@block@: \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}, \underline{\NWlink{nuweb26b}{26b}}, \underline{\NWlink{nuweb26d}{26d}}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb140d}{, 140d}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item \verb@blockTable@: \underline{\NWlink{nuweb26e}{26e}}\NWlink{nuweb36}{, 36}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}.
\item \verb@CovarianceInfluence_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb140b}{, 140b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@Covariance_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb139b}{b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@C_chisq_pvalue@: \NWlink{nuweb50}{50}, \underline{\NWlink{nuweb62c}{62c}}.
\item \verb@C_colSums_dweights_dsubset@: \NWlink{nuweb104a}{104a}, \underline{\NWlink{nuweb104d}{104d}}.
\item \verb@C_colSums_dweights_isubset@: \NWlink{nuweb104a}{104a}, \underline{\NWlink{nuweb105c}{105c}}.
\item \verb@C_colSums_iweights_dsubset@: \NWlink{nuweb104a}{104a}, \underline{\NWlink{nuweb105a}{105a}}.
\item \verb@C_colSums_iweights_isubset@: \NWlink{nuweb104a}{104a}, \underline{\NWlink{nuweb105b}{105b}}.
\item \verb@C_CovarianceLinearStatistic@: \NWlink{nuweb34d}{34d}\NWlink{nuweb43}{, 43}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb75a}{, 75a}, \underline{\NWlink{nuweb77}{77}}\NWlink{nuweb78a}{, 78a}.
\item \verb@C_doPermute@: \NWlink{nuweb36}{36}, \underline{\NWlink{nuweb124b}{124b}}.
\item \verb@C_doPermuteBlock@: \NWlink{nuweb36}{36}, \underline{\NWlink{nuweb125a}{125a}}.
\item \verb@C_ExpectationLinearStatistic@: \NWlink{nuweb34a}{34a}\NWlink{nuweb42b}{, 42b}, \underline{\NWlink{nuweb76b}{76b}}.
\item \verb@C_get_B@: \NWlink{nuweb32a}{32a}\NWlink{nuweb45}{, 45}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb141d}{141d}}.
\item \verb@C_get_Covariance@: \NWlink{nuweb34d}{34d}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb139b}{139b}}\NWlink{nuweb145a}{, 145a}.
\item \verb@C_get_CovarianceInfluence@: \NWlink{nuweb33a}{33a}\NWlink{nuweb43}{, 43}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb140b}{140b}}\NWlink{nuweb145a}{, 145a}.
\item \verb@C_get_dimTable@: \NWlink{nuweb45}{45}, \underline{\NWlink{nuweb141c}{141c}}\NWlink{nuweb141d}{, 141d}.
\item \verb@C_get_Expectation@: \NWlink{nuweb34a}{34a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb138d}{138d}}\NWlink{nuweb145a}{, 145a}.
\item \verb@C_get_ExpectationInfluence@: \NWlink{nuweb33a}{33a}\NWlink{nuweb45}{, 45}, \underline{\NWlink{nuweb140a}{140a}}\NWlink{nuweb145a}{, 145a}.
\item \verb@C_get_ExpectationX@: \NWlink{nuweb33a}{33a}\NWlink{nuweb45}{, 45}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb139c}{139c}}.
\item \verb@C_get_LinearStatistic@: \NWlink{nuweb32b}{32b}\NWlink{nuweb44}{, 44}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb138c}{138c}}\NWlink{nuweb145a}{, 145a}.
\item \verb@C_get_nresample@: \NWlink{nuweb38a}{38a}\NWlink{nuweb50}{, 50}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb53}{, 53}\NWlink{nuweb55}{, 55}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb142a}{142a}}.
\item \verb@C_get_P@: \NWlink{nuweb32a}{32a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb45}{, 45}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb55}{, 55}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb137c}{137c}}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb139b}{b}\NWlink{nuweb142a}{, 142a}.
\item \verb@C_get_PermutedLinearStatistic@: \NWlink{nuweb38a}{38a}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb142b}{142b}}.
\item \verb@C_get_Q@: \NWlink{nuweb32a}{32a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb45}{, 45}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb137d}{137d}}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb139b}{b}\NWlink{nuweb142a}{, 142a}.
\item \verb@C_get_Sumweights@: \NWlink{nuweb33a}{33a}\NWlink{nuweb45}{, 45}, \underline{\NWlink{nuweb141a}{141a}}.
\item \verb@C_get_Table@: \NWlink{nuweb40a}{40a}\NWlink{nuweb45}{, 45}, \underline{\NWlink{nuweb141b}{141b}}.
\item \verb@C_get_TableBlock@: \NWlink{nuweb33a}{33a}, \underline{\NWlink{nuweb140d}{140d}}.
\item \verb@C_get_tol@: \NWlink{nuweb38a}{38a}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb142c}{142c}}.
\item \verb@C_get_Variance@: \NWlink{nuweb34c}{34c}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb139a}{139a}}\NWlink{nuweb139b}{, 139b}\NWlink{nuweb145a}{, 145a}.
\item \verb@C_get_VarianceInfluence@: \NWlink{nuweb33a}{33a}\NWlink{nuweb43}{, 43}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb140c}{140c}}\NWlink{nuweb145a}{, 145a}.
\item \verb@C_get_varonly@: \NWlink{nuweb31}{31}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb45}{, 45}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb53}{, 53}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb138a}{138a}}\NWlink{nuweb139b}{, 139b}.
\item \verb@C_get_Xfactor@: \NWlink{nuweb45}{45}, \underline{\NWlink{nuweb138b}{138b}}.
\item \verb@C_kronecker@: \NWlink{nuweb78a}{78a}\NWlink{nuweb129a}{, 129a}, \underline{\NWlink{nuweb129b}{129b}}.
\item \verb@C_kronecker_sym@: \NWlink{nuweb77}{77}, \underline{\NWlink{nuweb130a}{130a}}.
\item \verb@C_KronSums_dweights_dsubset@: \NWlink{nuweb93b}{93b}, \underline{\NWlink{nuweb94a}{94a}}.
\item \verb@C_KronSums_dweights_isubset@: \NWlink{nuweb93b}{93b}, \underline{\NWlink{nuweb95}{95}}.
\item \verb@C_KronSums_iweights_dsubset@: \NWlink{nuweb93b}{93b}, \underline{\NWlink{nuweb94b}{94b}}.
\item \verb@C_KronSums_iweights_isubset@: \NWlink{nuweb93b}{93b}, \underline{\NWlink{nuweb94c}{94c}}.
\item \verb@C_KronSums_Permutation_dsubset@: \NWlink{nuweb100b}{100b}, \underline{\NWlink{nuweb101a}{101a}}.
\item \verb@C_KronSums_Permutation_isubset@: \NWlink{nuweb100b}{100b}, \underline{\NWlink{nuweb101b}{101b}}.
\item \verb@C_maxabsstand_Covariance@: \underline{\NWlink{nuweb58b}{58b}}\NWlink{nuweb61b}{, 61b}.
\item \verb@C_maxabsstand_Variance@: \underline{\NWlink{nuweb59a}{59a}}\NWlink{nuweb61b}{, 61b}.
\item \verb@C_maxstand_Covariance@: \underline{\NWlink{nuweb56b}{56b}}\NWlink{nuweb61b}{, 61b}.
\item \verb@C_maxstand_Variance@: \underline{\NWlink{nuweb57a}{57a}}\NWlink{nuweb61b}{, 61b}.
\item \verb@C_maxtype@: \NWlink{nuweb53}{53}, \underline{\NWlink{nuweb61b}{61b}}\NWlink{nuweb71b}{, 71b}.
\item \verb@C_maxtype_pvalue@: \NWlink{nuweb53}{53}, \underline{\NWlink{nuweb65}{65}}.
\item \verb@C_minstand_Covariance@: \underline{\NWlink{nuweb57b}{57b}}\NWlink{nuweb61b}{, 61b}.
\item \verb@C_minstand_Variance@: \underline{\NWlink{nuweb58a}{58a}}\NWlink{nuweb61b}{, 61b}.
\item \verb@C_norm_pvalue@: \underline{\NWlink{nuweb64}{64}}\NWlink{nuweb65}{, 65}.
\item \verb@C_OneTableSums_dweights_dsubset@: \NWlink{nuweb108a}{108a}, \underline{\NWlink{nuweb108d}{108d}}.
\item \verb@C_OneTableSums_dweights_isubset@: \NWlink{nuweb108a}{108a}, \underline{\NWlink{nuweb109c}{109c}}.
\item \verb@C_OneTableSums_iweights_dsubset@: \NWlink{nuweb108a}{108a}, \underline{\NWlink{nuweb109a}{109a}}.
\item \verb@C_OneTableSums_iweights_isubset@: \NWlink{nuweb108a}{108a}, \underline{\NWlink{nuweb109b}{109b}}.
\item \verb@C_ordered_Xfactor@: \NWlink{nuweb34b}{34b}\NWlink{nuweb43}{, 43}\NWlink{nuweb55}{, 55}, \underline{\NWlink{nuweb68}{68}}.
\item \verb@C_order_subset_wrt_block@: \NWlink{nuweb120a}{120a}, \underline{\NWlink{nuweb122a}{122a}}.
\item \verb@C_Permute@: \underline{\NWlink{nuweb124a}{124a}}\NWlink{nuweb124b}{, 124b}\NWlink{nuweb124c}{c}.
\item \verb@C_PermuteBlock@: \underline{\NWlink{nuweb124c}{124c}}\NWlink{nuweb125a}{, 125a}.
\item \verb@C_perm_pvalue@: \NWlink{nuweb50}{50}\NWlink{nuweb53}{, 53}, \underline{\NWlink{nuweb63}{63}}\NWlink{nuweb71c}{, 71c}.
\item \verb@C_quadform@: \NWlink{nuweb50}{50}\NWlink{nuweb60b}{, 60b}, \underline{\NWlink{nuweb61a}{61a}}\NWlink{nuweb71b}{, 71b}\NWlink{nuweb155a}{, 155a}.
\item \verb@C_setup_subset@: \NWlink{nuweb120a}{120a}, \underline{\NWlink{nuweb120b}{120b}}\NWlink{nuweb123a}{, 123a}.
\item \verb@C_setup_subset_block@: \NWlink{nuweb120a}{120a}, \underline{\NWlink{nuweb121}{121}}.
\item \verb@C_standardise@: \NWlink{nuweb38a}{38a}, \underline{\NWlink{nuweb62a}{62a}}.
\item \verb@C_Sums_dweights_dsubset@: \NWlink{nuweb88a}{88a}, \underline{\NWlink{nuweb88b}{88b}}.
\item \verb@C_Sums_dweights_isubset@: \NWlink{nuweb88a}{88a}, \underline{\NWlink{nuweb89c}{89c}}.
\item \verb@C_Sums_iweights_dsubset@: \NWlink{nuweb88a}{88a}, \underline{\NWlink{nuweb89a}{89a}}.
\item \verb@C_Sums_iweights_isubset@: \NWlink{nuweb88a}{88a}, \underline{\NWlink{nuweb89b}{89b}}.
\item \verb@C_ThreeTableSums_dweights_dsubset@: \NWlink{nuweb116a}{116a}, \underline{\NWlink{nuweb116d}{116d}}.
\item \verb@C_ThreeTableSums_dweights_isubset@: \NWlink{nuweb116a}{116a}, \underline{\NWlink{nuweb117c}{117c}}.
\item \verb@C_ThreeTableSums_iweights_dsubset@: \NWlink{nuweb116a}{116a}, \underline{\NWlink{nuweb117a}{117a}}.
\item \verb@C_ThreeTableSums_iweights_isubset@: \NWlink{nuweb116a}{116a}, \underline{\NWlink{nuweb117b}{117b}}.
\item \verb@C_TwoTableSums_dweights_dsubset@: \NWlink{nuweb112a}{112a}, \underline{\NWlink{nuweb112d}{112d}}.
\item \verb@C_TwoTableSums_dweights_isubset@: \NWlink{nuweb112a}{112a}, \underline{\NWlink{nuweb113c}{113c}}.
\item \verb@C_TwoTableSums_iweights_dsubset@: \NWlink{nuweb112a}{112a}, \underline{\NWlink{nuweb113a}{113a}}.
\item \verb@C_TwoTableSums_iweights_isubset@: \NWlink{nuweb112a}{112a}, \underline{\NWlink{nuweb113b}{113b}}.
\item \verb@C_unordered_Xfactor@: \NWlink{nuweb34b}{34b}\NWlink{nuweb55}{, 55}, \underline{\NWlink{nuweb72}{72}}.
\item \verb@C_VarianceLinearStatistic@: \NWlink{nuweb34c}{34c}\NWlink{nuweb43}{, 43}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb75a}{, 75a}, \underline{\NWlink{nuweb78a}{78a}}.
\item \verb@C_XfactorKronSums_dweights_dsubset@: \NWlink{nuweb93a}{93a}, \underline{\NWlink{nuweb97b}{97b}}.
\item \verb@C_XfactorKronSums_dweights_isubset@: \NWlink{nuweb93a}{93a}, \underline{\NWlink{nuweb98a}{98a}}.
\item \verb@C_XfactorKronSums_iweights_dsubset@: \NWlink{nuweb93a}{93a}, \underline{\NWlink{nuweb97c}{97c}}.
\item \verb@C_XfactorKronSums_iweights_isubset@: \NWlink{nuweb93a}{93a}, \underline{\NWlink{nuweb97d}{97d}}.
\item \verb@C_XfactorKronSums_Permutation_dsubset@: \NWlink{nuweb100b}{100b}, \underline{\NWlink{nuweb102a}{102a}}.
\item \verb@C_XfactorKronSums_Permutation_isubset@: \NWlink{nuweb100b}{100b}, \underline{\NWlink{nuweb102b}{102b}}.
\item \verb@dim_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb137c}{, 137c}\NWlink{nuweb137d}{d}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@DoCenter@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79c}{, 79c}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb103b}{, 103b}.
\item \verb@DoSymmetric@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb85b}{, 85b}.
\item \verb@DoVarOnly@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb34b}{, 34b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb43}{, 43}.
\item \verb@ExpectationInfluence_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@ExpectationX_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb139c}{, 139c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@Expectation_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb138d}{, 138d}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@GE@: \underline{\NWlink{nuweb20c}{20c}}\NWlink{nuweb50}{, 50}\NWlink{nuweb53}{, 53}.
\item \verb@HAS_WEIGHTS@: \underline{\NWlink{nuweb24f}{24f}}, \underline{\NWlink{nuweb25a}{25a}}\NWlink{nuweb90a}{, 90a}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}.
\item \verb@LE@: \underline{\NWlink{nuweb20c}{20c}}\NWlink{nuweb53}{, 53}.
\item \verb@LECV@: \NWlink{nuweb37b}{37b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb49c}{, 49c}\NWlink{nuweb50}{, 50}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb52}{, 52}\NWlink{nuweb53}{, 53}\NWlink{nuweb54a}{, 54a}\NWlink{nuweb54b}{b}\NWlink{nuweb55}{, 55}\NWlink{nuweb67b}{, 67b}\NWlink{nuweb69}{, 69}, \underline{\NWlink{nuweb137b}{137b}}\NWlink{nuweb137c}{, 137c}\NWlink{nuweb137d}{d}\NWlink{nuweb138a}{, 138a}\NWlink{nuweb138b}{b}\NWlink{nuweb138c}{c}\NWlink{nuweb138d}{d}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb139b}{b}\NWlink{nuweb139c}{c}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb140b}{b}\NWlink{nuweb140c}{c}\NWlink{nuweb140d}{d}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb141b}{b}\NWlink{nuweb141c}{c}\NWlink{nuweb141d}{d}\NWlink{nuweb142a}{, 142a}\NWlink{nuweb142b}{b}\NWlink{nuweb142c}{c}.
\item \verb@LinearStatistic_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb138c}{, 138c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@mPQB@: \NWlink{nuweb35a}{35a}\NWlink{nuweb36}{, 36}\NWlink{nuweb44}{, 44}\NWlink{nuweb47}{, 47}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb69}{, 69}\NWlink{nuweb70b}{, 70b}\NWlink{nuweb74b}{, 74b}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb118a}{, 118a}, \underline{\NWlink{nuweb128a}{128a}}\NWlink{nuweb144}{, 144}.
\item \verb@N@: \NWlink{nuweb5a}{5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15b}{, 15b}, \underline{\NWlink{nuweb23a}{23a}}, \underline{\NWlink{nuweb23b}{23b}}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb65}{, 65}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb86b}{b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90a}{, 90a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb120b}{b}\NWlink{nuweb121}{, 121}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb130b}{, 130b}.
\item \verb@NCOL@: \NWlink{nuweb12}{12}\NWlink{nuweb30c}{, 30c}\NWlink{nuweb40b}{, 40b}\NWlink{nuweb60b}{, 60b}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb119b}{, 119b}, \underline{\NWlink{nuweb126b}{126b}}\NWlink{nuweb129a}{, 129a}.
\item \verb@NLEVELS@: \NWlink{nuweb30c}{30c}\NWlink{nuweb40b}{, 40b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb119b}{, 119b}, \underline{\NWlink{nuweb127a}{127a}}.
\item \verb@NROW@: \NWlink{nuweb6}{6}\NWlink{nuweb8}{, 8}\NWlink{nuweb9a}{, 9a}\NWlink{nuweb9b}{b}\NWlink{nuweb14}{, 14}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb36}{, 36}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb60b}{, 60b}, \underline{\NWlink{nuweb126a}{126a}}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb129a}{, 129a}\NWlink{nuweb136c}{, 136c}.
\item \verb@Nsubset@: \underline{\NWlink{nuweb25d}{25d}}\NWlink{nuweb33b}{, 33b}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb86b}{b}\NWlink{nuweb86c}{c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90a}{, 90a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb124a}{, 124a}\NWlink{nuweb124b}{b}\NWlink{nuweb125a}{, 125a}.
\item \verb@offset@: \underline{\NWlink{nuweb25e}{25e}}\NWlink{nuweb31}{, 31}\NWlink{nuweb33b}{, 33b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79c}{, 79c}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb116a}{, 116a}.
\item \verb@Offset0@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123a}{, 123a}.
\item \verb@P@: \NWlink{nuweb14}{14}, \underline{\NWlink{nuweb23d}{23d}}\NWlink{nuweb30b}{, 30b}\NWlink{nuweb30c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb45}{, 45}\NWlink{nuweb47}{, 47}\NWlink{nuweb50}{, 50}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb53}{, 53}\NWlink{nuweb55}{, 55}\NWlink{nuweb68}{, 68}\NWlink{nuweb69}{, 69}\NWlink{nuweb70a}{, 70a}\NWlink{nuweb70b}{b}\NWlink{nuweb72}{, 72}\NWlink{nuweb73a}{, 73a}\NWlink{nuweb73b}{b}\NWlink{nuweb74a}{, 74a}\NWlink{nuweb74b}{b}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84a}{, 84a}\NWlink{nuweb84b}{b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91a}{, 91a}\NWlink{nuweb91b}{b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99a}{, 99a}\NWlink{nuweb99b}{b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb130b}{, 130b}\NWlink{nuweb142d}{, 142d}\NWlink{nuweb144}{, 144}.
\item \verb@PermutedLinearStatistic_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb142a}{, 142a}\NWlink{nuweb142b}{b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@Power1@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb79c}{, 79c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb103b}{, 103b}.
\item \verb@Power2@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb85b}{, 85b}.
\item \verb@PP12@: \NWlink{nuweb33a}{33a}\NWlink{nuweb43}{, 43}\NWlink{nuweb45}{, 45}\NWlink{nuweb50}{, 50}\NWlink{nuweb77}{, 77}\NWlink{nuweb85b}{, 85b}, \underline{\NWlink{nuweb127b}{127b}}\NWlink{nuweb144}{, 144}\NWlink{nuweb145a}{, 145a}.
\item \verb@Q@: \NWlink{nuweb14}{14}, \underline{\NWlink{nuweb24b}{24b}}\NWlink{nuweb30b}{, 30b}\NWlink{nuweb30c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb36}{, 36}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb45}{, 45}\NWlink{nuweb47}{, 47}\NWlink{nuweb50}{, 50}\NWlink{nuweb51a}{, 51a}\NWlink{nuweb53}{, 53}\NWlink{nuweb68}{, 68}\NWlink{nuweb69}{, 69}\NWlink{nuweb70a}{, 70a}\NWlink{nuweb70b}{b}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb71b}{b}\NWlink{nuweb72}{, 72}\NWlink{nuweb74a}{, 74a}\NWlink{nuweb74b}{b}\NWlink{nuweb75a}{, 75a}\NWlink{nuweb75d}{d}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb142d}{, 142d}\NWlink{nuweb144}{, 144}\NWlink{nuweb145a}{, 145a}.
\item \verb@RC_colSums@: \NWlink{nuweb79c}{79c}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb103c}{c}, \underline{\NWlink{nuweb104a}{104a}}.
\item \verb@RC_CovarianceInfluence@: \NWlink{nuweb34b}{34b}\NWlink{nuweb43}{, 43}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb81b}{b}, \underline{\NWlink{nuweb82a}{82a}}.
\item \verb@RC_CovarianceX@: \NWlink{nuweb34c}{34c}\NWlink{nuweb34d}{d}\NWlink{nuweb43}{, 43}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85a}{, 85a}, \underline{\NWlink{nuweb85b}{85b}}.
\item \verb@RC_ExpectationCovarianceStatistic@: \NWlink{nuweb30b}{30b}, \underline{\NWlink{nuweb31}{31}}, \underline{\NWlink{nuweb44}{44}}.
\item \verb@RC_ExpectationInfluence@: \NWlink{nuweb34a}{34a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79b}{b}, \underline{\NWlink{nuweb79c}{79c}}.
\item \verb@RC_ExpectationX@: \NWlink{nuweb34a}{34a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb83a}{, 83a}, \underline{\NWlink{nuweb83b}{83b}}.
\item \verb@RC_init_LECV_1d@: \NWlink{nuweb30b}{30b}, \underline{\NWlink{nuweb145b}{145b}}.
\item \verb@RC_init_LECV_2d@: \NWlink{nuweb40a}{40a}, \underline{\NWlink{nuweb146}{146}}.
\item \verb@RC_KronSums@: \NWlink{nuweb75d}{75d}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb91c}{c}, \underline{\NWlink{nuweb92a}{92a}}.
\item \verb@RC_KronSums_Permutation@: \NWlink{nuweb36}{36}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100a}{, 100a}, \underline{\NWlink{nuweb100b}{100b}}.
\item \verb@RC_LinearStatistic@: \NWlink{nuweb32b}{32b}\NWlink{nuweb75c}{, 75c}, \underline{\NWlink{nuweb75d}{75d}}.
\item \verb@RC_OneTableSums@: \NWlink{nuweb33a}{33a}\NWlink{nuweb36}{, 36}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb107c}{c}, \underline{\NWlink{nuweb108a}{108a}}.
\item \verb@RC_order_subset_wrt_block@: \NWlink{nuweb33a}{33a}\NWlink{nuweb36}{, 36}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb119c}{c}, \underline{\NWlink{nuweb120a}{120a}}.
\item \verb@RC_setup_subset@: \NWlink{nuweb36}{36}\NWlink{nuweb122b}{, 122b}, \underline{\NWlink{nuweb123a}{123a}}.
\item \verb@RC_Sums@: \NWlink{nuweb33a}{33a}\NWlink{nuweb33b}{b}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb87c}{c}, \underline{\NWlink{nuweb88a}{88a}}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123a}{, 123a}.
\item \verb@RC_ThreeTableSums@: \NWlink{nuweb40a}{40a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb115b}{b}, \underline{\NWlink{nuweb116a}{116a}}.
\item \verb@RC_TwoTableSums@: \NWlink{nuweb40a}{40a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb111b}{b}, \underline{\NWlink{nuweb112a}{112a}}.
\item \verb@R_colSums@: \NWlink{nuweb103a}{103a}, \underline{\NWlink{nuweb103b}{103b}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_CovarianceInfluence@: \NWlink{nuweb80}{80}, \underline{\NWlink{nuweb81a}{81a}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_CovarianceX@: \NWlink{nuweb84a}{84a}, \underline{\NWlink{nuweb84b}{84b}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_ExpectationCovarianceStatistic@: \NWlink{nuweb6}{6}\NWlink{nuweb29c}{, 29c}\NWlink{nuweb30a}{, 30a}, \underline{\NWlink{nuweb30b}{30b}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160c}{c}\NWlink{nuweb160d}{d}.
\item \verb@R_ExpectationCovarianceStatistic_2d@: \NWlink{nuweb8}{8}\NWlink{nuweb39a}{, 39a}\NWlink{nuweb39b}{b}, \underline{\NWlink{nuweb40a}{40a}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_ExpectationInfluence@: \NWlink{nuweb78b}{78b}, \underline{\NWlink{nuweb79a}{79a}}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_ExpectationX@: \NWlink{nuweb82b}{82b}, \underline{\NWlink{nuweb82c}{82c}}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_KronSums@: \NWlink{nuweb91a}{91a}, \underline{\NWlink{nuweb91b}{91b}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_KronSums_Permutation@: \NWlink{nuweb99a}{99a}, \underline{\NWlink{nuweb99b}{99b}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_MPinv_sym@: \NWlink{nuweb131a}{131a}\NWlink{nuweb131b}{b}, \underline{\NWlink{nuweb132}{132}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb155a}{, 155a}.
\item \verb@R_OneTableSums@: \NWlink{nuweb15b}{15b}\NWlink{nuweb107a}{, 107a}, \underline{\NWlink{nuweb107b}{107b}}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_order_subset_wrt_block@: \NWlink{nuweb119a}{119a}, \underline{\NWlink{nuweb119b}{119b}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_pack_sym@: \NWlink{nuweb136a}{136a}\NWlink{nuweb136b}{b}, \underline{\NWlink{nuweb136c}{136c}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb154d}{, 154d}.
\item \verb@R_PermutedLinearStatistic@: \NWlink{nuweb6}{6}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb35c}{c}, \underline{\NWlink{nuweb36}{36}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_PermutedLinearStatistic_2d@: \NWlink{nuweb8}{8}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb46b}{b}, \underline{\NWlink{nuweb47}{47}}\NWlink{nuweb48a}{, 48a}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_quadform@: \NWlink{nuweb59b}{59b}\NWlink{nuweb60a}{, 60a}, \underline{\NWlink{nuweb60b}{60b}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb155a}{, 155a}.
\item \verb@R_Sums@: \NWlink{nuweb87a}{87a}, \underline{\NWlink{nuweb87b}{87b}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_ThreeTableSums@: \NWlink{nuweb15b}{15b}\NWlink{nuweb114b}{, 114b}, \underline{\NWlink{nuweb115a}{115a}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_TwoTableSums@: \NWlink{nuweb15b}{15b}\NWlink{nuweb110b}{, 110b}, \underline{\NWlink{nuweb111a}{111a}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}.
\item \verb@R_unpack_sym@: \NWlink{nuweb10}{10}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}, \underline{\NWlink{nuweb135}{135}}\NWlink{nuweb149}{, 149}\NWlink{nuweb150}{, 150}\NWlink{nuweb155a}{, 155a}.
\item \verb@S@: \underline{\NWlink{nuweb20c}{20c}}\NWlink{nuweb34b}{, 34b}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb43}{, 43}\NWlink{nuweb44}{, 44}\NWlink{nuweb56b}{, 56b}\NWlink{nuweb57b}{, 57b}\NWlink{nuweb58b}{, 58b}\NWlink{nuweb61a}{, 61a}\NWlink{nuweb62a}{, 62a}\NWlink{nuweb66}{, 66}\NWlink{nuweb67a}{, 67a}\NWlink{nuweb70b}{, 70b}\NWlink{nuweb74b}{, 74b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb96}{, 96}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{b}\NWlink{nuweb133}{, 133}\NWlink{nuweb139a}{, 139a}.
\item \verb@StandardisedPermutedLinearStatistic_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@subset@: \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}, \underline{\NWlink{nuweb25c}{25c}}, \underline{\NWlink{nuweb25f}{25f}}, \underline{\NWlink{nuweb26a}{26a}}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb31}{, 31}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb86c}{c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb124a}{, 124a}\NWlink{nuweb124b}{b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item \verb@sumweights@: \underline{\NWlink{nuweb25b}{25b}}\NWlink{nuweb31}{, 31}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb33b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb42b}{b}\NWlink{nuweb43}{, 43}\NWlink{nuweb45}{, 45}\NWlink{nuweb47}{, 47}\NWlink{nuweb48b}{, 48b}\NWlink{nuweb48d}{d}\NWlink{nuweb69}{, 69}\NWlink{nuweb70a}{, 70a}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb75a}{, 75a}\NWlink{nuweb77}{, 77}\NWlink{nuweb78a}{, 78a}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb141a}{, 141a}.
\item \verb@Sumweights_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb141d}{d}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}\NWlink{nuweb145b}{, 145b}.
\item \verb@TableBlock_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb33a}{, 33a}\NWlink{nuweb140d}{, 140d}\NWlink{nuweb141d}{, 141d}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}\NWlink{nuweb145b}{, 145b}.
\item \verb@Table_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb141c}{c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}\NWlink{nuweb146}{, 146}.
\item \verb@TESTSTAT_maximum@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb68}{, 68}\NWlink{nuweb70a}{, 70a}\NWlink{nuweb70b}{b}\NWlink{nuweb71a}{, 71a}\NWlink{nuweb71b}{b}\NWlink{nuweb72}{, 72}\NWlink{nuweb74b}{, 74b}\NWlink{nuweb75a}{, 75a}.
\item \verb@TESTSTAT_quadratic@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb70a}{, 70a}.
\item \verb@tol_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb142c}{, 142c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@VarianceInfluence_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb140c}{, 140c}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@Variance_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb139a}{, 139a}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@varonly_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb138a}{, 138a}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@weights@: \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15a}{, 15a}\NWlink{nuweb15b}{b}\NWlink{nuweb17}{, 17}\NWlink{nuweb19}{, 19}, \underline{\NWlink{nuweb24e}{24e}}, \underline{\NWlink{nuweb24f}{24f}}, \underline{\NWlink{nuweb25a}{25a}}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb33b}{, 33b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb48a}{, 48a}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb82c}{c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item \verb@x@: \NWlink{nuweb8}{8}\NWlink{nuweb14}{, 14}\NWlink{nuweb17}{, 17}\NWlink{nuweb20c}{, 20c}, \underline{\NWlink{nuweb23c}{23c}}, \underline{\NWlink{nuweb23e}{23e}}, \underline{\NWlink{nuweb23f}{23f}}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34c}{c}\NWlink{nuweb34d}{d}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb47}{, 47}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb82c}{, 82c}\NWlink{nuweb83b}{, 83b}\NWlink{nuweb84b}{, 84b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb108a}{, 108a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb126a}{, 126a}\NWlink{nuweb126b}{b}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb130b}{, 130b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb131b}{b}\NWlink{nuweb132}{, 132}\NWlink{nuweb133}{, 133}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb135}{, 135}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb136b}{b}\NWlink{nuweb136c}{c}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\item \verb@Xfactor_SLOT@: \underline{\NWlink{nuweb21a}{21a}}\NWlink{nuweb138b}{, 138b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item \verb@y@: \NWlink{nuweb14}{14}\NWlink{nuweb20c}{, 20c}, \underline{\NWlink{nuweb24a}{24a}}, \underline{\NWlink{nuweb24c}{24c}}, \underline{\NWlink{nuweb24d}{24d}}\NWlink{nuweb30a}{, 30a}\NWlink{nuweb30b}{b}\NWlink{nuweb30c}{c}\NWlink{nuweb32b}{, 32b}\NWlink{nuweb34a}{, 34a}\NWlink{nuweb34b}{b}\NWlink{nuweb35c}{, 35c}\NWlink{nuweb36}{, 36}\NWlink{nuweb39b}{, 39b}\NWlink{nuweb40a}{, 40a}\NWlink{nuweb40b}{b}\NWlink{nuweb41a}{, 41a}\NWlink{nuweb42b}{, 42b}\NWlink{nuweb43}{, 43}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb75d}{, 75d}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79c}{c}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb82a}{, 82a}\NWlink{nuweb91b}{, 91b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96}{, 96}\NWlink{nuweb98b}{, 98b}\NWlink{nuweb99b}{, 99b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb101c}{, 101c}\NWlink{nuweb102c}{, 102c}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb159a}{, 159a}\NWlink{nuweb159b}{b}\NWlink{nuweb160b}{, 160b}\NWlink{nuweb160d}{d}.
\end{list}}

\bibliographystyle{plainnat}

<<bib, echo = FALSE>>=
thisdir <- getwd()
bibfile <- system.file("REFERENCES.bib", package = "libcoin")
### bibfile may contain spaces LaTeX is unable to deal with on MacOS it seems
if (file.copy(bibfile, to = thisdir, overwrite = TRUE)) {
    bibfile <- "REFERENCES.bib"
} else {
    ### hope for the best
    bibfile <- file.path("..", "inst", "REFERENCES.bib")
}
@
\bibliography{\Sexpr{bibfile}}


\end{document}
