\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}

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

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


\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=None,%
pdfstartview=FitBH,%
linkcolor={linkcolor},%
anchorcolor={linkcolor},%
citecolor={linkcolor},%
filecolor={linkcolor},%
menucolor={linkcolor},%
pagecolor={linkcolor},%
urlcolor={linkcolor}%
]{hyperref}

\usepackage[round]{natbib}

\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\topmargin}{0in}
\addtolength{\topmargin}{-\headheight}
\addtolength{\topmargin}{-\headsep}
\setlength{\textheight}{8.9in}
\setlength{\textwidth}{6.5in}
\setlength{\marginparwidth}{0.5in}

\newcommand{\pkg}[1]{\textbf{#1}}
\newcommand{\proglang}[1]{\textsf{#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{\ws}{\mathbf{w}_\cdot}
\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)}}


\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) 2017-2019 Torsten Hothorn \\

This file is part of the \pkg{libcoin} 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{strasserweber1999} 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 $\mu(\A) \in \R^{PQ}$ and covariance
$\Sigma(\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{strasserweber1999}:
\begin{eqnarray}
\mu(\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 \\
\Sigma(\A) & = & \V(\T(\A) \mid S(\A)) \nonumber \\
& = &
    \frac{\ws}{\ws(\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}{\ws(\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 $\ws(\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)) = \ws(\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)) = \ws(\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)$,
$\mu = \sum_{b = 1}^B \mu(\A_b)$ and $\Sigma = \sum_{b = 1}^B \Sigma(\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 $\mathbf{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}(\mathbf{t}, \mu, \Sigma)  = \max \left| \frac{\mathbf{t} -
\mu}{\text{diag}(\Sigma)^{1/2}} \right|
\end{eqnarray*}
utilizing the conditional expectation $\mu$ and covariance matrix
$\Sigma$. The application of a quadratic form $c_\text{quad}(\mathbf{t}, \mu,
\Sigma)  =
(\mathbf{t} - \mu) \Sigma^+ (\mathbf{t} - \mu)^\top$ is one alternative, although
computationally more expensive because the Moore-Penrose
inverse $\Sigma^+$ of $\Sigma$ 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, \mu, \Sigma) &\le& c(\mathbf{t}, \mu, \Sigma)) \quad \text{(less)} \\
P(c(\T, \mu, \Sigma) &\ge& c(\mathbf{t}, \mu, \Sigma)) \quad \text{(greater)}\\
P(|c(\T, \mu, \Sigma)| &\le& |c(\mathbf{t}, \mu, \Sigma)|) \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{\mathbf{t} - \mu}{\text{diag}(\Sigma)^{1/2}} \right)
    \quad \text{(less) and }
\max \left( \frac{\mathbf{t} - \mu}{\text{diag}(\Sigma)^{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{R Code}

\section{R User Interface}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
\NWtarget{nuweb3a}{} \verb@"libcoin.R"@\nobreak\ {\footnotesize {3a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb165a}{165a}}$\,\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 functions, \verb|LinStatExpCov| and
\verb|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 \verb|X| and \verb|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{nuweb18}{, 18}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}.
\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@@\\
\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@        return(.LinStatExpCov1d(X = X, Y = Y, weights = weights,@\\
\mbox{}\verb@                                subset = subset, block = block,@\\
\mbox{}\verb@                                checkNAs = checkNAs,@\\
\mbox{}\verb@                                varonly = varonly, nresample = nresample,@\\
\mbox{}\verb@                                standardise = standardise, tol = tol))@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (!is.null(ix) & !is.null(iy))@\\
\mbox{}\verb@        return(.LinStatExpCov2d(X = X, Y = Y, ix = ix, iy = iy,@\\
\mbox{}\verb@                                weights = weights, subset = subset,@\\
\mbox{}\verb@                                block = block, varonly = varonly,@\\
\mbox{}\verb@                                checkNAs = checkNAs, nresample = nresample,@\\
\mbox{}\verb@                                standardise = standardise, tol = tol))@\\
\mbox{}\verb@@\\
\mbox{}\verb@    stop("incorrect call to 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{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}.
\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 \verb|X| and \verb|Y| with $N$ rows as well as $P$ and $Q$
columns, respectively. The special case of a dummy matrix
\verb|X| with $P$ columns can also be represented by a factor at $P$ levels.
The vector of case weights \verb|weights| can be stored as \verb|integer|
or \verb|double| (possibly resulting from an aggregation of $N > $
\verb|INT_MAX| observations). The subset vector \verb|subset| may contain
the elements $1, \dots, N$ as \verb|integer| or \verb|double| (for $N > $
\verb|INT_MAX|) and can be longer than $N$. The \verb|subset| vector MUST be
sorted. \verb|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@@\\
\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{nuweb16}{, 16}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Missing values are only allowed in \verb|X| and
\verb|Y|, all other vectors must not contain \verb|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@@\\
\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 <- (1: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{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The logical argument \verb|varonly| triggers the computation of the diagonal
elements of the covariance matrix $\Sigma$ only. \verb|nresample| permuted linear statistics
under the null hypothesis $H_0$ are returned on the original and
standardised scale (the latter only when \verb|standardise| is \verb|TRUE|).
Variances smaller than \verb|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@@\\
\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") <- 1: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{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb32c}{32c}, \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb40}{40}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}.
\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 \verb|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 \verb|ix| denote an integer vector with elements $0, \dots, L_x$ of
length $N$ and
\verb|iy| an integer vector with elements $0, \dots, L_y$, also of length
$N$. The matrix
\verb|X| is now of dimension $(L_x + 1) \times P$ and the matrix \verb|Y|
of dimension $(L_y + 1) \times Q$. The combination of \verb|X| and \verb|ix|
means that the $i$th observation corresponds to the row \verb|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 \verb|ix| being zero denote a missing value (\verb|NA|s are not
allowed in \verb|ix| and \verb|iy|). Thus, the first row of \verb|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 abbrevation ``2d'')
over the $N$ elements of \verb|ix| and \verb|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@@\\
\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{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb44}{44}, \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb51}{51}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\verb|ix| can be a factor 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@@\\
\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") <- 1: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 <- 1: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{nuweb16}{, 16}.
\item \NWtxtIdentsUsed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}.
\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@@\\
\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") <- 1: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 <- 1: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{nuweb16}{, 16}.
\item \NWtxtIdentsUsed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}.
\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 \verb|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 \verb|LinStatExpCov| returned by \verb|LinStatExpCov()|
contain the symmetric covariance matrix as a vector of the lower triangular
elements. The \verb|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@@\\
\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{nuweb149}{149}.
\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. \verb|doTest()| allows to compute the statistics $c_\text{max}$
(taking \verb|alternative| into account) and $c_\text{quad}$ along with the
corresponding $p$-values. If \verb|nresample = 0| was used in the call to
\verb|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 \verb|PermutedStatistics| is \verb|TRUE|). The
$p$-values (\verb|lower = FALSE|) or $(1 - p)$-values (\verb|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{nuweb19}{, 19}.

\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@@\\
\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{nuweb139c}{139c}.
\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 \verb|lmult| so that we can then left-multiply a
matrix to an object of class \verb|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@@\\
\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(1: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{nuweb139b}{139b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\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(c(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(c(1:5), ls1d)
stopifnot(isequal(ls1c, ls1s))
@

\subsection{Tabulations}

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

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap14}\raggedright\small
\NWtarget{nuweb15}{} $\langle\,${\itshape ctabs Prototype}\nobreak\ {\footnotesize {15}}$\,\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{nuweb16}{16}\NWlink{nuweb20}{, 20}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap15}\raggedright\small
\NWtarget{nuweb16}{} \verb@"ctabs.R"@\nobreak\ {\footnotesize {16}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb165a}{165a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@ctabs <-@\\
\mbox{}\verb@function@\hbox{$\langle\,${\itshape ctabs Prototype}\nobreak\ {\footnotesize \NWlink{nuweb15}{15}}$\,\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 && length(block) == 0)@\\
\mbox{}\verb@        return(.Call(R_OneTableSums, ix, weights, subset))@\\
\mbox{}\verb@    if (length(block) == 0)@\\
\mbox{}\verb@        return(.Call(R_TwoTableSums, ix, iy, weights, subset))@\\
\mbox{}\verb@    if (length(iy) == 0)@\\
\mbox{}\verb@        return(.Call(R_TwoTableSums, ix, block, weights, subset)[,-1,drop = FALSE])@\\
\mbox{}\verb@    return(.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{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb118a}{118a}, \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb122b}{122b}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}.
\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{nuweb18}{} \verb@"LinStatExpCov.Rd"@\nobreak\ {\footnotesize {18}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\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@  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, ie 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{@\\
\mbox{}\verb@  Strasser, H. and Weber, C.  (1999).  On the asymptotic theory of permutation@\\
\mbox{}\verb@  statistics.  \emph{Mathematical Methods of Statistics} \bold{8}(2), 220--250.@\\
\mbox{}\verb@}@\\
\mbox{}\verb@\examples{@\\
\mbox{}\verb@wilcox.test(Ozone ~ Month, data = airquality, subset = Month \%in\% c(5, 8))@\\
\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))@\\
\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{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap17}\raggedright\small
\NWtarget{nuweb19}{} \verb@"doTest.Rd"@\nobreak\ {\footnotesize {19}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\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{nuweb20}{} \verb@"ctabs.Rd"@\nobreak\ {\footnotesize {20}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\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{nuweb15}{15}}$\,\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 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{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\chapter{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 \verb|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{nuweb21a}{} \verb@"libcoin_internal.h"@\nobreak\ {\footnotesize {21a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb165b}{165b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Includes}\nobreak\ {\footnotesize \NWlink{nuweb21b}{21b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Macros}\nobreak\ {\footnotesize \NWlink{nuweb22a}{22a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Global Variables}\nobreak\ {\footnotesize \NWlink{nuweb22b}{22b}}$\,\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{nuweb21b}{} $\langle\,${\itshape R Includes}\nobreak\ {\footnotesize {21b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@#include <R.h>@\\
\mbox{}\verb@#include <Rinternals.h>@\\
\mbox{}\verb@#include <Rmath.h>@\\
\mbox{}\verb@#include <Rdefines.h>@\\
\mbox{}\verb@#include <R_ext/stats_package.h> /* for S_rcont2 */@\\
\mbox{}\verb@#include <R_ext/Applic.h> /* for dgemm */@\\
\mbox{}\verb@#include <R_ext/Lapack.h> /* for dgesdd */@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb21a}{21a}.

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

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap21}\raggedright\small
\NWtarget{nuweb22a}{} $\langle\,${\itshape C Macros}\nobreak\ {\footnotesize {22a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb21a}{21a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@GE@\nobreak\ \NWlink{nuweb55}{55}\NWlink{nuweb57}{, 57}, \verb@LE@\nobreak\ \NWlink{nuweb57}{57}, \verb@S@\nobreak\ \NWlink{nuweb37b}{37b}\NWlink{nuweb38b}{, 38b}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb60b}{, 60b}\NWlink{nuweb61b}{, 61b}\NWlink{nuweb62b}{, 62b}\NWlink{nuweb65}{, 65}\NWlink{nuweb67a}{, 67a}\NWlink{nuweb71}{, 71}\NWlink{nuweb72a}{, 72a}\NWlink{nuweb76a}{, 76a}\NWlink{nuweb80b}{, 80b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb105}{, 105}\NWlink{nuweb144}{, 144}\NWlink{nuweb145a}{, 145a}\NWlink{nuweb147}{, 147}\NWlink{nuweb152b}{, 152b}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap22}\raggedright\small
\NWtarget{nuweb22b}{} $\langle\,${\itshape C Global Variables}\nobreak\ {\footnotesize {22b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb21a}{21a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@CovarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb154a}{154a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb152b}{152b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@dim_SLOT@\nobreak\ \NWlink{nuweb150c}{150c}\NWlink{nuweb151a}{, 151a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@DoCenter@\nobreak\ \NWlink{nuweb81d}{81d}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90}{, 90}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb113b}{, 113b}, \verb@DoSymmetric@\nobreak\ \NWlink{nuweb81d}{81d}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb93a}{, 93a}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb37b}{37b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb47}{, 47}, \verb@ExpectationInfluence_SLOT@\nobreak\ \NWlink{nuweb153c}{153c}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@ExpectationX_SLOT@\nobreak\ \NWlink{nuweb153b}{153b}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@Expectation_SLOT@\nobreak\ \NWlink{nuweb152a}{152a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@LinearStatistic_SLOT@\nobreak\ \NWlink{nuweb151d}{151d}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@Offset0@\nobreak\ \NWlink{nuweb35b}{35b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb136a}{, 136a}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb156b}{156b}\NWlink{nuweb156c}{c}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@Power1@\nobreak\ \NWlink{nuweb86a}{86a}\NWlink{nuweb90}{, 90}\NWlink{nuweb113b}{, 113b}, \verb@Power2@\nobreak\ \NWlink{nuweb88a}{88a}\NWlink{nuweb93a}{, 93a}, \verb@StandardisedPermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb157b}{157b}\NWlink{nuweb158}{, 158}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb155a}{155a}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}\NWlink{nuweb159b}{, 159b}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb154c}{, 154c}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}\NWlink{nuweb159b}{, 159b}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb155b}{155b}\NWlink{nuweb155c}{c}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}\NWlink{nuweb160}{, 160}, \verb@tol_SLOT@\nobreak\ \NWlink{nuweb156d}{156d}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@VarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb154b}{154b}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@Variance_SLOT@\nobreak\ \NWlink{nuweb152b}{152b}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@varonly_SLOT@\nobreak\ \NWlink{nuweb151b}{151b}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}, \verb@Xfactor_SLOT@\nobreak\ \NWlink{nuweb151c}{151c}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The corresponding header file contains definitions of
functions that can be called via \verb|.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{nuweb23a}{} \verb@"libcoin.h"@\nobreak\ {\footnotesize {23a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb165b}{165b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@#include "libcoin_internal.h"@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Function Prototypes}\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\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{nuweb23b}{} $\langle\,${\itshape Function Prototypes}\nobreak\ {\footnotesize {23b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_ExpectationCovarianceStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb32b}{32b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_PermutedLinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb38c}{38c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_StandardisePermutedLinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb41c}{41c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_ExpectationCovarianceStatistic\_2d Prototype}\nobreak\ {\footnotesize \NWlink{nuweb43a}{43a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_PermutedLinearStatistic\_2d Prototype}\nobreak\ {\footnotesize \NWlink{nuweb50a}{50a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_QuadraticTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb54}{54}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_MaximumTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb56b}{56b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_MaximallySelectedTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb58}{58}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_ExpectationInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb85a}{85a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_CovarianceInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_ExpectationX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb88b}{88b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_CovarianceX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb91}{91}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_Sums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb95a}{95a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_KronSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb99}{99}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_KronSums\_Permutation Prototype}\nobreak\ {\footnotesize \NWlink{nuweb109a}{109a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_colSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb113a}{113a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_OneTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb117b}{117b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_TwoTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb122a}{122a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_ThreeTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb127a}{127a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_order\_subset\_wrt\_block Prototype}\nobreak\ {\footnotesize \NWlink{nuweb132a}{132a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_quadform Prototype}\nobreak\ {\footnotesize \NWlink{nuweb64b}{64b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_kronecker Prototype}\nobreak\ {\footnotesize \NWlink{nuweb141c}{141c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_MPinv\_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb146a}{146a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@extern @\hbox{$\langle\,${\itshape R\_unpack\_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb148b}{148b}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23a}{23a}.

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

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap25}\raggedright\small
\NWtarget{nuweb23c}{} \verb@"libcoin.c"@\nobreak\ {\footnotesize {23c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb165b}{165b}}$\,\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{nuweb24a}{24a}}$\,\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{nuweb24a}{} $\langle\,${\itshape Function Definitions}\nobreak\ {\footnotesize {24a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape MoreUtils}\nobreak\ {\footnotesize \NWlink{nuweb139a}{139a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Memory}\nobreak\ {\footnotesize \NWlink{nuweb150a}{150a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape P-Values}\nobreak\ {\footnotesize \NWlink{nuweb67b}{67b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape KronSums}\nobreak\ {\footnotesize \NWlink{nuweb98b}{98b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape colSums}\nobreak\ {\footnotesize \NWlink{nuweb112c}{112c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape SimpleSums}\nobreak\ {\footnotesize \NWlink{nuweb94c}{94c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Tables}\nobreak\ {\footnotesize \NWlink{nuweb117a}{117a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Utils}\nobreak\ {\footnotesize \NWlink{nuweb131b}{131b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape LinearStatistics}\nobreak\ {\footnotesize \NWlink{nuweb81b}{81b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Permutations}\nobreak\ {\footnotesize \NWlink{nuweb136b}{136b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape ExpectationCovariances}\nobreak\ {\footnotesize \NWlink{nuweb82a}{82a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Test Statistics}\nobreak\ {\footnotesize \NWlink{nuweb60a}{60a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape User Interface}\nobreak\ {\footnotesize \NWlink{nuweb31a}{31a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape 2d User Interface}\nobreak\ {\footnotesize \NWlink{nuweb42b}{42b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Tests}\nobreak\ {\footnotesize \NWlink{nuweb53a}{53a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23c}{23c}.

\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{nuweb24b}{} $\langle\,${\itshape R N Input}\nobreak\ {\footnotesize {24b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP N,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb95a}{95a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb5a}{5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb16}{, 16}\NWlink{nuweb24c}{, 24c}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb70}{, 70}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb145a}{, 145a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
which at \proglang{C} level is represented as \verb|R_xlen_t| to allow for
$N > $ \verb|INT_MAX|

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap28}\raggedright\small
\NWtarget{nuweb24c}{} $\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize {24c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb25b}{25b}\NWlink{nuweb25c}{c}\NWlink{nuweb34}{, 34}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb85c}{c}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87b}{b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb89b}{b}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb92b}{b}\NWlink{nuweb95c}{, 95c}\NWlink{nuweb96b}{, 96b}\NWlink{nuweb97a}{, 97a}\NWlink{nuweb97b}{b}\NWlink{nuweb97c}{c}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb109c}{c}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133a}{, 133a}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb135b}{, 135b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb5a}{5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb16}{, 16}\NWlink{nuweb24b}{, 24b}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb70}{, 70}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb145a}{, 145a}.
\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{nuweb24d}{} $\langle\,${\itshape R x Input}\nobreak\ {\footnotesize {24d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP x,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb50a}{, 50a}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb91}{, 91}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb99}{, 99}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109c}{c}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb117b}{, 117b}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb127a}{, 127a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb14}{, 14}\NWlink{nuweb18}{, 18}\NWlink{nuweb22a}{, 22a}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38d}{d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb51}{, 51}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb139b}{, 139b}\NWlink{nuweb139c}{c}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb145a}{, 145a}\NWlink{nuweb145b}{b}\NWlink{nuweb146a}{, 146a}\NWlink{nuweb146b}{b}\NWlink{nuweb147}{, 147}\NWlink{nuweb148a}{, 148a}\NWlink{nuweb148b}{b}\NWlink{nuweb149}{, 149}.
\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{nuweb25a}{} $\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize {25a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int P@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb25b}{25b}\NWlink{nuweb25c}{c}\NWlink{nuweb34}{, 34}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb160}{, 160}.
\item \NWtxtIdentsDefed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb32c}{, 32c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38b}{b}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb49}{, 49}\NWlink{nuweb51}{, 51}\NWlink{nuweb55}{, 55}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb59}{, 59}\NWlink{nuweb73}{, 73}\NWlink{nuweb74}{, 74}\NWlink{nuweb75}{, 75}\NWlink{nuweb76a}{, 76a}\NWlink{nuweb78}{, 78}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79b}{b}\NWlink{nuweb80a}{, 80a}\NWlink{nuweb80b}{b}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb91}{, 91}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb99}{, 99}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb140b}{, 140b}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb145a}{, 145a}\NWlink{nuweb157a}{, 157a}\NWlink{nuweb158}{, 158}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap31}\raggedright\small
\NWtarget{nuweb25b}{} $\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize {25b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double *x,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb101c}{101c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb145a}{, 145a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb14}{, 14}\NWlink{nuweb18}{, 18}\NWlink{nuweb22a}{, 22a}\NWlink{nuweb24d}{, 24d}\NWlink{nuweb25c}{, 25c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38d}{d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb51}{, 51}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb139b}{, 139b}\NWlink{nuweb139c}{c}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb145a}{, 145a}\NWlink{nuweb145b}{b}\NWlink{nuweb146a}{, 146a}\NWlink{nuweb146b}{b}\NWlink{nuweb147}{, 147}\NWlink{nuweb148a}{, 148a}\NWlink{nuweb148b}{b}\NWlink{nuweb149}{, 149}.
\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{nuweb25c}{} $\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize {25c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int *x,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106a}{106a}\NWlink{nuweb111c}{, 111c}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123c}{, 123c}\NWlink{nuweb128c}{, 128c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb14}{, 14}\NWlink{nuweb18}{, 18}\NWlink{nuweb22a}{, 22a}\NWlink{nuweb24d}{, 24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38d}{d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb51}{, 51}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb139b}{, 139b}\NWlink{nuweb139c}{c}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb145a}{, 145a}\NWlink{nuweb145b}{b}\NWlink{nuweb146a}{, 146a}\NWlink{nuweb146b}{b}\NWlink{nuweb147}{, 147}\NWlink{nuweb148a}{, 148a}\NWlink{nuweb148b}{b}\NWlink{nuweb149}{, 149}.
\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{nuweb25d}{} $\langle\,${\itshape R y Input}\nobreak\ {\footnotesize {25d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP y,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb50a}{, 50a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb85c}{c}\NWlink{nuweb86b}{, 86b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb99}{, 99}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb132a}{, 132a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@y@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb22a}{, 22a}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap34}\raggedright\small
\NWtarget{nuweb25e}{} $\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize {25e}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int Q@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb26a}{26a}\NWlink{nuweb26b}{b}\NWlink{nuweb34}{, 34}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb85c}{c}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87b}{b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb160}{, 160}.
\item \NWtxtIdentsDefed\nobreak\  \verb@Q@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb32c}{, 32c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38b}{b}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb49}{, 49}\NWlink{nuweb51}{, 51}\NWlink{nuweb55}{, 55}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb73}{, 73}\NWlink{nuweb74}{, 74}\NWlink{nuweb75}{, 75}\NWlink{nuweb76a}{, 76a}\NWlink{nuweb76b}{b}\NWlink{nuweb76c}{c}\NWlink{nuweb78}{, 78}\NWlink{nuweb80a}{, 80a}\NWlink{nuweb80b}{b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb81d}{d}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb157a}{, 157a}\NWlink{nuweb158}{, 158}\NWlink{nuweb159a}{, 159a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap35}\raggedright\small
\NWtarget{nuweb26a}{} $\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize {26a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double *y,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer Q 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{nuweb81c}{81c}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb101c}{c}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb111c}{c}\NWlink{nuweb112a}{, 112a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@y@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb22a}{, 22a}\NWlink{nuweb25d}{, 25d}\NWlink{nuweb26b}{, 26b}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\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{nuweb26b}{} $\langle\,${\itshape C integer y Input}\nobreak\ {\footnotesize {26b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int *y,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer Q 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{nuweb123c}{123c}\NWlink{nuweb128c}{, 128c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@y@\nobreak\ \NWlink{nuweb14}{14}\NWlink{nuweb22a}{, 22a}\NWlink{nuweb25d}{, 25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The weights $w_i, i = 1, \dots, N$

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap37}\raggedright\small
\NWtarget{nuweb26c}{} $\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize {26c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP weights@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb85c}{c}\NWlink{nuweb86b}{, 86b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb91}{, 91}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb95a}{, 95a}\NWlink{nuweb95c}{c}\NWlink{nuweb99}{, 99}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113c}{c}\NWlink{nuweb117b}{, 117b}\NWlink{nuweb118b}{, 118b}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb132a}{, 132a}\NWlink{nuweb135b}{, 135b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@weights@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15}{, 15}\NWlink{nuweb16}{, 16}\NWlink{nuweb18}{, 18}\NWlink{nuweb20}{, 20}\NWlink{nuweb26d}{, 26d}\NWlink{nuweb26e}{e}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36b}{, 36b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38d}{d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb52a}{, 52a}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb136a}{, 136a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
can be constant one (\verb|XLENGTH(weights) == 0| or \verb|weights = integer(0)|)
or integer-valued, with \verb|HAS_WEIGHTS == 0| in the former case

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap38}\raggedright\small
\NWtarget{nuweb26d}{} $\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize {26d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb97a}{97a}\NWlink{nuweb97b}{b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb104b}{b}\NWlink{nuweb106c}{, 106c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb115b}{, 115b}\NWlink{nuweb115c}{c}\NWlink{nuweb120b}{, 120b}\NWlink{nuweb120c}{c}\NWlink{nuweb124c}{, 124c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb129c}{, 129c}\NWlink{nuweb130a}{, 130a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb26e}{26e}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb126}{, 126}\NWlink{nuweb131a}{, 131a}, \verb@weights,@\nobreak\ \NWlink{nuweb4}{4}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb16}{, 16}\NWlink{nuweb20}{, 20}\NWlink{nuweb26e}{, 26e}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36b}{, 36b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38d}{d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb136a}{, 136a}.\item \NWtxtIdentsUsed\nobreak\  \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Weights larger than \verb|INT_MAX| are stored as double

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap39}\raggedright\small
\NWtarget{nuweb26e}{} $\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize {26e}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb96b}{96b}\NWlink{nuweb97c}{, 97c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104c}{, 104c}\NWlink{nuweb106b}{, 106b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb121a}{, 121a}\NWlink{nuweb124b}{, 124b}\NWlink{nuweb125b}{, 125b}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb130b}{, 130b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb126}{, 126}\NWlink{nuweb131a}{, 131a}, \verb@weights,@\nobreak\ \NWlink{nuweb4}{4}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb16}{, 16}\NWlink{nuweb20}{, 20}\NWlink{nuweb26d}{, 26d}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36b}{, 36b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38d}{d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb136a}{, 136a}.\item \NWtxtIdentsUsed\nobreak\  \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
The sum of all weights is a double

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap40}\raggedright\small
\NWtarget{nuweb27a}{} $\langle\,${\itshape C sumweights Input}\nobreak\ {\footnotesize {27a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double sumweights@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb83}{83}\NWlink{nuweb84}{, 84}\NWlink{nuweb85c}{, 85c}\NWlink{nuweb87b}{, 87b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@sumweights@\nobreak\ \NWlink{nuweb34}{34}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb46c}{c}\NWlink{nuweb47}{, 47}\NWlink{nuweb49}{, 49}\NWlink{nuweb51}{, 51}\NWlink{nuweb52b}{, 52b}\NWlink{nuweb52d}{d}\NWlink{nuweb74}{, 74}\NWlink{nuweb75}{, 75}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb155a}{, 155a}.
\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{nuweb27b}{} $\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize {27b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP subset@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb85c}{c}\NWlink{nuweb86b}{, 86b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb91}{, 91}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb95a}{, 95a}\NWlink{nuweb95c}{c}\NWlink{nuweb99}{, 99}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109c}{c}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113c}{c}\NWlink{nuweb117b}{, 117b}\NWlink{nuweb118b}{, 118b}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb132a}{, 132a}\NWlink{nuweb133a}{, 133a}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb135b}{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{nuweb15}{, 15}\NWlink{nuweb16}{, 16}\NWlink{nuweb18}{, 18}\NWlink{nuweb20}{, 20}\NWlink{nuweb27e}{, 27e}\NWlink{nuweb28a}{, 28a}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb34}{, 34}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb94b}{, 94b}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb137a}{, 137a}\NWlink{nuweb137b}{b}\NWlink{nuweb138a}{, 138a}\NWlink{nuweb138b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
are either not existent (\verb|XLENGTH(subset) == 0|) or of length

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap42}\raggedright\small
\NWtarget{nuweb27c}{} $\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize {27c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb27d}{27d}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb137a}{, 137a}\NWlink{nuweb137b}{b}\NWlink{nuweb138b}{, 138b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@Nsubset@\nobreak\ \NWlink{nuweb36b}{36b}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb94b}{b}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb137a}{, 137a}\NWlink{nuweb137b}{b}\NWlink{nuweb138b}{, 138b}.
\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{nuweb27d}{} $\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize {27d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@R_xlen_t offset,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb27e}{27e}\NWlink{nuweb28a}{, 28a}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb85c}{, 85c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb95c}{, 95c}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb113c}{, 113c}\NWlink{nuweb118b}{, 118b}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb128a}{, 128a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@offset@\nobreak\ \NWlink{nuweb34}{34}\NWlink{nuweb36b}{, 36b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90}{, 90}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb128b}{, 128b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
where \verb|offset| is a \proglang{C} style index for \verb|subset|.

Subsets are stored either as integer

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap44}\raggedright\small
\NWtarget{nuweb27e}{} $\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize {27e}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int *subset,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\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{nuweb104b}{, 104b}\NWlink{nuweb104c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107b}{b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115c}{, 115c}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb120c}{, 120c}\NWlink{nuweb121a}{, 121a}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb125b}{b}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{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{nuweb15}{, 15}\NWlink{nuweb16}{, 16}\NWlink{nuweb18}{, 18}\NWlink{nuweb20}{, 20}\NWlink{nuweb27b}{, 27b}\NWlink{nuweb28a}{, 28a}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb34}{, 34}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb94b}{, 94b}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb137a}{, 137a}\NWlink{nuweb137b}{b}\NWlink{nuweb138a}{, 138a}\NWlink{nuweb138b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
or double (to allow for indices larger than \verb|INT_MAX|)

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap45}\raggedright\small
\NWtarget{nuweb28a}{} $\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize {28a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double *subset,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb96b}{96b}\NWlink{nuweb97a}{, 97a}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106b}{, 106b}\NWlink{nuweb106c}{c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111c}{, 111c}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb115b}{b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb120b}{b}\NWlink{nuweb124b}{, 124b}\NWlink{nuweb124c}{c}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb129c}{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{nuweb15}{, 15}\NWlink{nuweb16}{, 16}\NWlink{nuweb18}{, 18}\NWlink{nuweb20}{, 20}\NWlink{nuweb27b}{, 27b}\NWlink{nuweb27e}{e}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb34}{, 34}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb94b}{, 94b}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb137a}{, 137a}\NWlink{nuweb137b}{b}\NWlink{nuweb138a}{, 138a}\NWlink{nuweb138b}{b}.
\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{nuweb28b}{} $\langle\,${\itshape R block Input}\nobreak\ {\footnotesize {28b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP block@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb50a}{, 50a}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb132a}{, 132a}\NWlink{nuweb133a}{, 133a}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb135a}{, 135a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15}{, 15}\NWlink{nuweb16}{, 16}\NWlink{nuweb18}{, 18}\NWlink{nuweb20}{, 20}\NWlink{nuweb28d}{, 28d}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb154c}{, 154c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
at $B$ levels

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap47}\raggedright\small
\NWtarget{nuweb28c}{} $\langle\,${\itshape C integer B Input}\nobreak\ {\footnotesize {28c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int B@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb28d}{28d}\NWlink{nuweb34}{, 34}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb160}{, 160}.
\item \NWtxtIdentsDefed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb32c}{32c}\NWlink{nuweb33}{, 33}\NWlink{nuweb34}{, 34}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb48}{, 48}\NWlink{nuweb49}{, 49}\NWlink{nuweb51}{, 51}\NWlink{nuweb52b}{, 52b}\NWlink{nuweb73}{, 73}\NWlink{nuweb74}{, 74}\NWlink{nuweb78}{, 78}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb141b}{b}\NWlink{nuweb141c}{c}\NWlink{nuweb142}{, 142}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}\NWlink{nuweb157a}{, 157a}\NWlink{nuweb158}{, 158}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb160}{, 160}.
\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{nuweb28d}{} $\langle\,${\itshape C integer block Input}\nobreak\ {\footnotesize {28d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int *block,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer B Input}\nobreak\ {\footnotesize \NWlink{nuweb28c}{28c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb128c}{128c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15}{, 15}\NWlink{nuweb16}{, 16}\NWlink{nuweb18}{, 18}\NWlink{nuweb20}{, 20}\NWlink{nuweb28b}{, 28b}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb154c}{, 154c}.
\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{nuweb28e}{} $\langle\,${\itshape R blockTable Input}\nobreak\ {\footnotesize {28e}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP blockTable@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb133a}{133a}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb135a}{, 135a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@blockTable@\nobreak\ \NWlink{nuweb40}{40}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb135a}{, 135a}.
\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 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 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>>=
LECV <- function(X, Y, weights = integer(0), subset = integer(0), block = integer(0)) {

    if (length(weights) == 0) weights <- rep(1, NROW(X))
    if (length(subset) == 0) subset <- 1:NROW(X)
    idx <- rep(subset, weights[subset])
    X <- X[idx,,drop = FALSE]
    Y <- Y[idx,,drop = FALSE]
    sumweights <- length(idx)

    if (length(block) == 0) {
        ExpX <- colSums(X)
        ExpY <- colSums(Y) / sumweights
        yc <- t(t(Y) - ExpY)
        CovY <- crossprod(yc) / sumweights
        CovX <- crossprod(X)
        Exp <- kronecker(ExpY, ExpX)
        Cov <- sumweights / (sumweights - 1) * kronecker(CovY, CovX) -
               1 / (sumweights - 1) * kronecker(CovY, tcrossprod(ExpX))

        ret <- list(LinearStatistic = as.vector(crossprod(X, Y)),
                    Expectation = as.vector(Exp),
                    Covariance = Cov,
                    Variance = diag(Cov))
   } else {
        block <- block[idx]
        ret <- list(LinearStatistic = 0, Expectation = 0, Covariance = 0, Variance = 0)
        for (b in levels(block)) {
            tmp <- LECV(X = X, Y = Y, subset = which(block == b))
            for (l in names(ret)) ret[[l]] <- ret[[l]] + tmp[[l]]
        }
   }
   return(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 \verb|LECV()|) with the 1d and 2d \proglang{C} level
implementations in the two sitations with and without specification of
\verb|X| (ie, the dummy matrix in the latter case).

<<tests>>=
### with X given
testit <- function(...) {
    a <- LinStatExpCov(x, y, ...)
    b <- LECV(x, y, ...)
    d <- LinStatExpCov(X = iX2d, ix = ix, Y = iY2d, iy = iy, ...)
    return(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 <- LECV(Xfactor, y, ...)
    d <- LinStatExpCov(X = integer(0), ix = ix, Y = iY2d, iy = iy, ...)
    return(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 \verb|R_| are \proglang{C} functions callable via
\verb|.Call()| from \proglang{R}. That means they all return \verb|SEXP|.
These functions allocate memory handled by \proglang{R}.

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

Functions starting with \verb|C_| only take pointer arguments and return a
scalar nor nothing.

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

\section{C User Interface}

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

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap50}\raggedright\small
\NWtarget{nuweb31a}{} $\langle\,${\itshape User Interface}\nobreak\ {\footnotesize {31a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_ExpectationCovarianceStatistic}\nobreak\ {\footnotesize \NWlink{nuweb34}{34}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ExpectationCovarianceStatistic}\nobreak\ {\footnotesize \NWlink{nuweb32c}{32c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_PermutedLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb40}{40}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_StandardisePermutedLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb42a}{42a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\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 weights, subset and blocks. The latter three variables are ignored when
specified as \verb|integer(0)|.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap51}\raggedright\small
\NWtarget{nuweb31b}{} $\langle\,${\itshape User Interface Input}\nobreak\ {\footnotesize {31b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb28b}{28b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb32b}{32b}\NWlink{nuweb34}{, 34}\NWlink{nuweb38c}{, 38c}.

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

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap52}\raggedright\small
\NWtarget{nuweb32a}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {32a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb165b}{165b}}$\,\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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb32c}{32c}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap53}\raggedright\small
\NWtarget{nuweb32b}{} $\langle\,${\itshape R\_ExpectationCovarianceStatistic Prototype}\nobreak\ {\footnotesize {32b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_ExpectationCovarianceStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb31b}{31b}}$\,\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{nuweb23b}{23b}\NWlink{nuweb32c}{, 32c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb32c}{32c}.
\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{nuweb32c}{} $\langle\,${\itshape R\_ExpectationCovarianceStatistic}\nobreak\ {\footnotesize {32c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ExpectationCovarianceStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb32b}{32b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Dimensions}\nobreak\ {\footnotesize \NWlink{nuweb33}{33}}$\,\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{nuweb31a}{31a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb6}{6}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb34}{34}\NWlink{nuweb48}{, 48}, \verb@RC_init_LECV_1d@\nobreak\ \NWlink{nuweb159b}{159b}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
$P$, $Q$ and $B$ are first extracted from the data. The case where \verb|X|
is an implicitly specified dummy matrix, the dimension $P$ is the number of
levels of \verb|x|.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap55}\raggedright\small
\NWtarget{nuweb33}{} $\langle\,${\itshape Setup Dimensions}\nobreak\ {\footnotesize {33}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb32c}{32c}\NWlink{nuweb40}{, 40}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb140a}{140a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\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:  \verb|x| being an integer (Xfactor) with some 0 elements is not handled
        correctly (as \verb|sumweights| doesnt't take this information into
        account; use subset to exclude these missings (as done in
        libcoin::LinStatExpCov)

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap56}\raggedright\small
\NWtarget{nuweb34}{} $\langle\,${\itshape RC\_ExpectationCovarianceStatistic}\nobreak\ {\footnotesize {34}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_ExpectationCovarianceStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb31b}{31b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer B Input}\nobreak\ {\footnotesize \NWlink{nuweb28c}{28c}}$\,\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{nuweb35a}{35a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Compute Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb35b}{35b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Memory and Subsets in Blocks}\nobreak\ {\footnotesize \NWlink{nuweb36a}{36a}}$\,\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{nuweb36b}{36b}}$\,\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{nuweb37a}{37a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute Covariance Influence}\nobreak\ {\footnotesize \NWlink{nuweb37b}{37b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@            if (C_get_varonly(ans)) {@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape Compute Variance Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb37c}{37c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            } else {@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape Compute Covariance Linear Statistic}\nobreak\ {\footnotesize \NWlink{nuweb38a}{38a}}$\,\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{nuweb38b}{38b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    Free(ExpX); Free(VarX); 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{nuweb31a}{31a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb32c}{32c}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\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{nuweb35a}{} $\langle\,${\itshape Extract Dimensions}\nobreak\ {\footnotesize {35a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb34}{34}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@C_get_B@\nobreak\ \NWlink{nuweb156a}{156a}, \verb@C_get_P@\nobreak\ \NWlink{nuweb150c}{150c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb151a}{151a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\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{nuweb35b}{} $\langle\,${\itshape Compute Linear Statistic}\nobreak\ {\footnotesize {35b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb34}{34}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb151d}{151d}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_LinearStatistic@\nobreak\ \NWlink{nuweb81d}{81d}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\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 absense of block, this just returns
subset.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap59}\raggedright\small
\NWtarget{nuweb36a}{} $\langle\,${\itshape Setup Memory and Subsets in Blocks}\nobreak\ {\footnotesize {36a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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 = 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@*/@\\
\mbox{}\verb@if (C_get_varonly(ans)) {@\\
\mbox{}\verb@    VarX = Calloc(P, double);@\\
\mbox{}\verb@    CovX = Calloc(1, double);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    VarX = Calloc(1, double);@\\
\mbox{}\verb@    CovX = 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{nuweb34}{34}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb154a}{154a}, \verb@C_get_ExpectationInfluence@\nobreak\ \NWlink{nuweb153c}{153c}, \verb@C_get_ExpectationX@\nobreak\ \NWlink{nuweb153b}{153b}, \verb@C_get_Sumweights@\nobreak\ \NWlink{nuweb155a}{155a}, \verb@C_get_TableBlock@\nobreak\ \NWlink{nuweb154c}{154c}, \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb154b}{154b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@PP12@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb119a}{119a}, \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb133b}{133b}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb96a}{96a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
We compute $\mu(\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{nuweb36b}{} $\langle\,${\itshape Compute Sum of Weights in Block}\nobreak\ {\footnotesize {36b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@/* compute sum of 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{nuweb34}{34}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb96a}{96a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap61}\raggedright\small
\NWtarget{nuweb37a}{} $\langle\,${\itshape Compute Expectation Linear Statistic}\nobreak\ {\footnotesize {37a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb34}{34}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_ExpectationLinearStatistic@\nobreak\ \NWlink{nuweb82b}{82b}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb152a}{152a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb86a}{86a}, \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb90}{90}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\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 \verb|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{nuweb37b}{} $\langle\,${\itshape Compute Covariance Influence}\nobreak\ {\footnotesize {37b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb34}{34}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_ordered_Xfactor@\nobreak\ \NWlink{nuweb73}{73}, \verb@C_unordered_Xfactor@\nobreak\ \NWlink{nuweb78}{78}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_CovarianceInfluence@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
We can now compute the variance or covariance of the linear statistic
$\Sigma(\A)$:

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap63}\raggedright\small
\NWtarget{nuweb37c}{} $\langle\,${\itshape Compute Variance Linear Statistic}\nobreak\ {\footnotesize {37c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb34}{34}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_Variance@\nobreak\ \NWlink{nuweb152b}{152b}, \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb84}{84}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb93a}{93a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap64}\raggedright\small
\NWtarget{nuweb38a}{} $\langle\,${\itshape Compute Covariance Linear Statistic}\nobreak\ {\footnotesize {38a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb34}{34}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb83}{83}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb153a}{153a}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb93a}{93a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap65}\raggedright\small
\NWtarget{nuweb38b}{} $\langle\,${\itshape Compute Variance from Covariance}\nobreak\ {\footnotesize {38b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\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@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb34}{34}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb153a}{153a}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb152b}{152b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\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{nuweb38c}{} $\langle\,${\itshape R\_PermutedLinearStatistic Prototype}\nobreak\ {\footnotesize {38c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_PermutedLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb31b}{31b}}$\,\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{nuweb23b}{23b}\NWlink{nuweb40}{, 40}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb40}{40}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap67}\raggedright\small
\NWtarget{nuweb38d}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {38d}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb40}{40}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\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 absense and presense of blocks.
Weights are removed by expanding subset accordingly. Once within-block
permutations were set-up the Kronecker product of \verb|X| and \verb|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 \verb|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{nuweb40}{} $\langle\,${\itshape R\_PermutedLinearStatistic}\nobreak\ {\footnotesize {40}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_PermutedLinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb38c}{38c}}$\,\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{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    R_xlen_t inresample;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup Dimensions}\nobreak\ {\footnotesize \NWlink{nuweb33}{33}}$\,\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{nuweb41a}{41a}}$\,\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{nuweb41a}{41a}}$\,\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{nuweb31a}{31a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb6}{6}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb38d}{d}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb28e}{28e}, \verb@C_doPermute@\nobreak\ \NWlink{nuweb137b}{137b}, \verb@C_doPermuteBlock@\nobreak\ \NWlink{nuweb138b}{138b}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_KronSums_Permutation@\nobreak\ \NWlink{nuweb110a}{110a}, \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb119a}{119a}, \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb133b}{133b}, \verb@RC_setup_subset@\nobreak\ \NWlink{nuweb136a}{136a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap69}\raggedright\small
\NWtarget{nuweb41a}{} $\langle\,${\itshape Setup Linear Statistic}\nobreak\ {\footnotesize {41a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb40}{40}\NWlink{nuweb51}{, 51}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap70}\raggedright\small
\NWtarget{nuweb41b}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {41b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\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{scrap71}\raggedright\small
\NWtarget{nuweb41c}{} $\langle\,${\itshape R\_StandardisePermutedLinearStatistic Prototype}\nobreak\ {\footnotesize {41c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb23b}{23b}\NWlink{nuweb42a}{, 42a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap72}\raggedright\small
\NWtarget{nuweb42a}{} $\langle\,${\itshape R\_StandardisePermutedLinearStatistic}\nobreak\ {\footnotesize {42a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_StandardisePermutedLinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb41c}{41c}}$\,\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{nuweb31a}{31a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb153a}{153a}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb152a}{152a}, \verb@C_get_nresample@\nobreak\ \NWlink{nuweb156b}{156b}, \verb@C_get_P@\nobreak\ \NWlink{nuweb150c}{150c}, \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb156c}{156c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb151a}{151a}, \verb@C_get_tol@\nobreak\ \NWlink{nuweb156d}{156d}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb152b}{152b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@C_standardise@\nobreak\ \NWlink{nuweb67a}{67a}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\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{nuweb42b}{} $\langle\,${\itshape 2d User Interface}\nobreak\ {\footnotesize {42b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_ExpectationCovarianceStatistic\_2d}\nobreak\ {\footnotesize \NWlink{nuweb48}{48}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ExpectationCovarianceStatistic\_2d}\nobreak\ {\footnotesize \NWlink{nuweb44}{44}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_PermutedLinearStatistic\_2d}\nobreak\ {\footnotesize \NWlink{nuweb51}{51}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap74}\raggedright\small
\NWtarget{nuweb42c}{} $\langle\,${\itshape 2d User Interface Input}\nobreak\ {\footnotesize {42c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@SEXP ix,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@SEXP iy,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb28b}{28b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb43a}{43a}\NWlink{nuweb48}{, 48}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap75}\raggedright\small
\NWtarget{nuweb43a}{} $\langle\,${\itshape R\_ExpectationCovarianceStatistic\_2d Prototype}\nobreak\ {\footnotesize {43a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_ExpectationCovarianceStatistic_2d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape 2d User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb42c}{42c}}$\,\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{nuweb23b}{23b}\NWlink{nuweb44}{, 44}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb44}{44}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap76}\raggedright\small
\NWtarget{nuweb43b}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {43b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb44}{44}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap77}\raggedright\small
\NWtarget{nuweb44}{} $\langle\,${\itshape R\_ExpectationCovarianceStatistic\_2d}\nobreak\ {\footnotesize {44}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ExpectationCovarianceStatistic\_2d Prototype}\nobreak\ {\footnotesize \NWlink{nuweb43a}{43a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb45a}{45a}}$\,\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{nuweb42b}{42b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb43a}{, 43a}\NWlink{nuweb43b}{b}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@C_get_Table@\nobreak\ \NWlink{nuweb155b}{155b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_init_LECV_2d@\nobreak\ \NWlink{nuweb160}{160}, \verb@RC_ThreeTableSums@\nobreak\ \NWlink{nuweb128b}{128b}, \verb@RC_TwoTableSums@\nobreak\ \NWlink{nuweb123b}{123b}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap78}\raggedright\small
\NWtarget{nuweb45a}{} $\langle\,${\itshape Setup Dimensions 2d}\nobreak\ {\footnotesize {45a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb44}{44}\NWlink{nuweb51}{, 51}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb140a}{140a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap79}\raggedright\small
\NWtarget{nuweb45b}{} $\langle\,${\itshape Linear Statistic 2d}\nobreak\ {\footnotesize {45b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb48}{48}\NWlink{nuweb52d}{, 52d}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap80}\raggedright\small
\NWtarget{nuweb46a}{} $\langle\,${\itshape 2d Total Table}\nobreak\ {\footnotesize {46a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb48}{48}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap81}\raggedright\small
\NWtarget{nuweb46b}{} $\langle\,${\itshape Col Row Total Sums}\nobreak\ {\footnotesize {46b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb48}{48}\NWlink{nuweb51}{, 51}.
\item \NWtxtIdentsUsed\nobreak\  \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap82}\raggedright\small
\NWtarget{nuweb46c}{} $\langle\,${\itshape 2d Expectation}\nobreak\ {\footnotesize {46c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb48}{48}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_ExpectationLinearStatistic@\nobreak\ \NWlink{nuweb82b}{82b}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb152a}{152a}, \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb86a}{86a}, \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb90}{90}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap83}\raggedright\small
\NWtarget{nuweb47}{} $\langle\,${\itshape 2d Covariance}\nobreak\ {\footnotesize {47}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb48}{48}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb83}{83}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb153a}{153a}, \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb154a}{154a}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb152b}{152b}, \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb154b}{154b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@C_ordered_Xfactor@\nobreak\ \NWlink{nuweb73}{73}, \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb84}{84}, \verb@DoVarOnly@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@PP12@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_CovarianceInfluence@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb93a}{93a}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap84}\raggedright\small
\NWtarget{nuweb48}{} $\langle\,${\itshape RC\_ExpectationCovarianceStatistic\_2d}\nobreak\ {\footnotesize {48}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_ExpectationCovarianceStatistic_2d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape 2d User Interface Input}\nobreak\ {\footnotesize \NWlink{nuweb42c}{42c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape 2d Memory}\nobreak\ {\footnotesize \NWlink{nuweb49}{49}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape 2d Total Table}\nobreak\ {\footnotesize \NWlink{nuweb46a}{46a}}$\,\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{nuweb45b}{45b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Col Row Total Sums}\nobreak\ {\footnotesize \NWlink{nuweb46b}{46b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape 2d Expectation}\nobreak\ {\footnotesize \NWlink{nuweb46c}{46c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape 2d Covariance}\nobreak\ {\footnotesize \NWlink{nuweb47}{47}}$\,\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@    Free(CovX);@\\
\mbox{}\verb@    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{nuweb42b}{42b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb32c}{32c}\NWlink{nuweb34}{, 34}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb153a}{153a}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb151d}{151d}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb152b}{152b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap85}\raggedright\small
\NWtarget{nuweb49}{} $\langle\,${\itshape 2d Memory}\nobreak\ {\footnotesize {49}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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 = Calloc(P, double);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@    CovX = Calloc(PP12(P), double);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@table2d = 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{nuweb48}{48}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@C_get_B@\nobreak\ \NWlink{nuweb156a}{156a}, \verb@C_get_dimTable@\nobreak\ \NWlink{nuweb155c}{155c}, \verb@C_get_ExpectationInfluence@\nobreak\ \NWlink{nuweb153c}{153c}, \verb@C_get_ExpectationX@\nobreak\ \NWlink{nuweb153b}{153b}, \verb@C_get_P@\nobreak\ \NWlink{nuweb150c}{150c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb151a}{151a}, \verb@C_get_Sumweights@\nobreak\ \NWlink{nuweb155a}{155a}, \verb@C_get_Table@\nobreak\ \NWlink{nuweb155b}{155b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@C_get_Xfactor@\nobreak\ \NWlink{nuweb151c}{151c}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@PP12@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\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{nuweb50a}{} $\langle\,${\itshape R\_PermutedLinearStatistic\_2d Prototype}\nobreak\ {\footnotesize {50a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_PermutedLinearStatistic_2d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP ix,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP iy,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb28b}{28b}}$\,\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{nuweb23b}{23b}\NWlink{nuweb51}{, 51}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb51}{51}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap87}\raggedright\small
\NWtarget{nuweb50b}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {50b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb51}{51}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap88}\raggedright\small
\NWtarget{nuweb51}{} $\langle\,${\itshape R\_PermutedLinearStatistic\_2d}\nobreak\ {\footnotesize {51}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_PermutedLinearStatistic\_2d Prototype}\nobreak\ {\footnotesize \NWlink{nuweb50a}{50a}}$\,\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{nuweb45a}{45a}}$\,\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{nuweb52b}{52b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Convert Table to Integer}\nobreak\ {\footnotesize \NWlink{nuweb52a}{52a}}$\,\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{nuweb46b}{46b}}$\,\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{nuweb52c}{52c}}$\,\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{nuweb41a}{41a}}$\,\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{nuweb52d}{52d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@        }@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    PutRNGstate();@\\
\mbox{}\verb@@\\
\mbox{}\verb@    Free(csum); Free(rsum); Free(sumweights); Free(rtable2);@\\
\mbox{}\verb@    Free(jwork); Free(fact); 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{nuweb42b}{42b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb8}{8}\NWlink{nuweb50a}{, 50a}\NWlink{nuweb50b}{b}\NWlink{nuweb52a}{, 52a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap89}\raggedright\small
\NWtarget{nuweb52a}{} $\langle\,${\itshape Convert Table to Integer}\nobreak\ {\footnotesize {52a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb51}{51}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb51}{51}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap90}\raggedright\small
\NWtarget{nuweb52b}{} $\langle\,${\itshape Setup Working Memory}\nobreak\ {\footnotesize {52b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@csum = Calloc(Lyp1 * B, int);@\\
\mbox{}\verb@rsum = Calloc(Lxp1 * B, int);@\\
\mbox{}\verb@sumweights = Calloc(B, int);@\\
\mbox{}\verb@table = Calloc(Lxp1 * Lyp1, int);@\\
\mbox{}\verb@rtable2 = Calloc(Lx * Ly , int);@\\
\mbox{}\verb@jwork = Calloc(Lyp1, int);@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb51}{51}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap91}\raggedright\small
\NWtarget{nuweb52c}{} $\langle\,${\itshape Setup Log-Factorials}\nobreak\ {\footnotesize {52c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@fact = 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{nuweb51}{51}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap92}\raggedright\small
\NWtarget{nuweb52d}{} $\langle\,${\itshape Compute Permuted Linear Statistic 2d}\nobreak\ {\footnotesize {52d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@S_rcont2(&Lx, &Ly, rsum + Lxp1 * b + 1,@\\
\mbox{}\verb@         csum + Lyp1 *b + 1, sumweights + b, fact, jwork, rtable2);@\\
\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{nuweb45b}{45b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb51}{51}.
\item \NWtxtIdentsUsed\nobreak\  \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Tests}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap93}\raggedright\small
\NWtarget{nuweb53a}{} $\langle\,${\itshape Tests}\nobreak\ {\footnotesize {53a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_QuadraticTest}\nobreak\ {\footnotesize \NWlink{nuweb55}{55}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_MaximumTest}\nobreak\ {\footnotesize \NWlink{nuweb57}{57}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_MaximallySelectedTest}\nobreak\ {\footnotesize \NWlink{nuweb59}{59}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap94}\raggedright\small
\NWtarget{nuweb53b}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {53b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@extern SEXP libcoin_R_QuadraticTest(@\\
\mbox{}\verb@    SEXP LEV, 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(LEV, pvalue, lower, give_log, PermutedStatistics);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@extern SEXP libcoin_R_MaximumTest(@\\
\mbox{}\verb@    SEXP LEV, 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(LEV, alternative, pvalue, lower, give_log, PermutedStatistics, maxpts, releps,@\\
\mbox{}\verb@               abseps);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@\\
\mbox{}\verb@extern SEXP libcoin_R_MaximallySelectedTest(@\\
\mbox{}\verb@    SEXP LEV, 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(LEV, 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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap95}\raggedright\small
\NWtarget{nuweb54}{} $\langle\,${\itshape R\_QuadraticTest Prototype}\nobreak\ {\footnotesize {54}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_QuadraticTest@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb23b}{23b}\NWlink{nuweb55}{, 55}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap96}\raggedright\small
\NWtarget{nuweb55}{} $\langle\,${\itshape R\_QuadraticTest}\nobreak\ {\footnotesize {55}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_QuadraticTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb54}{54}}$\,\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{nuweb56a}{56a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    MPinv = 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@        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@    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{nuweb53a}{53a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_chisq_pvalue@\nobreak\ \NWlink{nuweb67c}{67c}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb153a}{153a}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb152a}{152a}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb151d}{151d}, \verb@C_get_nresample@\nobreak\ \NWlink{nuweb156b}{156b}, \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb156c}{156c}, \verb@C_get_tol@\nobreak\ \NWlink{nuweb156d}{156d}, \verb@C_perm_pvalue@\nobreak\ \NWlink{nuweb68}{68}, \verb@C_quadform@\nobreak\ \NWlink{nuweb65}{65}, \verb@GE@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@PP12@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap97}\raggedright\small
\NWtarget{nuweb56a}{} $\langle\,${\itshape Setup Test Memory}\nobreak\ {\footnotesize {56a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb55}{55}\NWlink{nuweb57}{, 57}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_nresample@\nobreak\ \NWlink{nuweb156b}{156b}, \verb@C_get_P@\nobreak\ \NWlink{nuweb150c}{150c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb151a}{151a}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap98}\raggedright\small
\NWtarget{nuweb56b}{} $\langle\,${\itshape R\_MaximumTest Prototype}\nobreak\ {\footnotesize {56b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_MaximumTest@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb23b}{23b}\NWlink{nuweb57}{, 57}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap99}\raggedright\small
\NWtarget{nuweb57}{} $\langle\,${\itshape R\_MaximumTest}\nobreak\ {\footnotesize {57}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_MaximumTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb56b}{56b}}$\,\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{nuweb56a}{56a}}$\,\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{nuweb53a}{53a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb153a}{153a}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb152a}{152a}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb151d}{151d}, \verb@C_get_nresample@\nobreak\ \NWlink{nuweb156b}{156b}, \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb156c}{156c}, \verb@C_get_tol@\nobreak\ \NWlink{nuweb156d}{156d}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb152b}{152b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@C_maxtype@\nobreak\ \NWlink{nuweb66}{66}, \verb@C_maxtype_pvalue@\nobreak\ \NWlink{nuweb70}{70}, \verb@C_perm_pvalue@\nobreak\ \NWlink{nuweb68}{68}, \verb@GE@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@LE@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap100}\raggedright\small
\NWtarget{nuweb58}{} $\langle\,${\itshape R\_MaximallySelectedTest Prototype}\nobreak\ {\footnotesize {58}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb23b}{23b}\NWlink{nuweb59}{, 59}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap101}\raggedright\small
\NWtarget{nuweb59}{} $\langle\,${\itshape R\_MaximallySelectedTest}\nobreak\ {\footnotesize {59}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_MaximallySelectedTest Prototype}\nobreak\ {\footnotesize \NWlink{nuweb58}{58}}$\,\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{nuweb53a}{53a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_nresample@\nobreak\ \NWlink{nuweb156b}{156b}, \verb@C_get_P@\nobreak\ \NWlink{nuweb150c}{150c}, \verb@C_ordered_Xfactor@\nobreak\ \NWlink{nuweb73}{73}, \verb@C_unordered_Xfactor@\nobreak\ \NWlink{nuweb78}{78}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Test Statistics}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap102}\raggedright\small
\NWtarget{nuweb60a}{} $\langle\,${\itshape Test Statistics}\nobreak\ {\footnotesize {60a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_maxstand\_Covariance}\nobreak\ {\footnotesize \NWlink{nuweb60b}{60b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_maxstand\_Variance}\nobreak\ {\footnotesize \NWlink{nuweb61a}{61a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_minstand\_Covariance}\nobreak\ {\footnotesize \NWlink{nuweb61b}{61b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_minstand\_Variance}\nobreak\ {\footnotesize \NWlink{nuweb62a}{62a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_maxabsstand\_Covariance}\nobreak\ {\footnotesize \NWlink{nuweb62b}{62b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_maxabsstand\_Variance}\nobreak\ {\footnotesize \NWlink{nuweb63}{63}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_quadform}\nobreak\ {\footnotesize \NWlink{nuweb65}{65}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_quadform}\nobreak\ {\footnotesize \NWlink{nuweb64c}{64c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_maxtype}\nobreak\ {\footnotesize \NWlink{nuweb66}{66}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_standardise}\nobreak\ {\footnotesize \NWlink{nuweb67a}{67a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_ordered\_Xfactor}\nobreak\ {\footnotesize \NWlink{nuweb73}{73}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_unordered\_Xfactor}\nobreak\ {\footnotesize \NWlink{nuweb78}{78}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap103}\raggedright\small
\NWtarget{nuweb60b}{} $\langle\,${\itshape C\_maxstand\_Covariance}\nobreak\ {\footnotesize {60b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxstand_Covariance@\nobreak\ \NWlink{nuweb66}{66}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap104}\raggedright\small
\NWtarget{nuweb61a}{} $\langle\,${\itshape C\_maxstand\_Variance}\nobreak\ {\footnotesize {61a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxstand_Variance@\nobreak\ \NWlink{nuweb66}{66}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap105}\raggedright\small
\NWtarget{nuweb61b}{} $\langle\,${\itshape C\_minstand\_Covariance}\nobreak\ {\footnotesize {61b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_minstand_Covariance@\nobreak\ \NWlink{nuweb66}{66}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap106}\raggedright\small
\NWtarget{nuweb62a}{} $\langle\,${\itshape C\_minstand\_Variance}\nobreak\ {\footnotesize {62a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_minstand_Variance@\nobreak\ \NWlink{nuweb66}{66}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap107}\raggedright\small
\NWtarget{nuweb62b}{} $\langle\,${\itshape C\_maxabsstand\_Covariance}\nobreak\ {\footnotesize {62b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxabsstand_Covariance@\nobreak\ \NWlink{nuweb66}{66}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap108}\raggedright\small
\NWtarget{nuweb63}{} $\langle\,${\itshape C\_maxabsstand\_Variance}\nobreak\ {\footnotesize {63}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxabsstand_Variance@\nobreak\ \NWlink{nuweb66}{66}.
\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{scrap109}\raggedright\small
\NWtarget{nuweb64a}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {64a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_quadform@\nobreak\ \NWlink{nuweb64c}{64c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap110}\raggedright\small
\NWtarget{nuweb64b}{} $\langle\,${\itshape R\_quadform Prototype}\nobreak\ {\footnotesize {64b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb23b}{23b}\NWlink{nuweb64c}{, 64c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_quadform@\nobreak\ \NWlink{nuweb64c}{64c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap111}\raggedright\small
\NWtarget{nuweb64c}{} $\langle\,${\itshape R\_quadform}\nobreak\ {\footnotesize {64c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_quadform Prototype}\nobreak\ {\footnotesize \NWlink{nuweb64b}{64b}}$\,\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_quadform@\nobreak\ \NWlink{nuweb64a}{64a}\NWlink{nuweb64b}{b}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_quadform@\nobreak\ \NWlink{nuweb65}{65}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap112}\raggedright\small
\NWtarget{nuweb65}{} $\langle\,${\itshape C\_quadform}\nobreak\ {\footnotesize {65}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_quadform@\nobreak\ \NWlink{nuweb55}{55}\NWlink{nuweb64c}{, 64c}\NWlink{nuweb76c}{, 76c}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap113}\raggedright\small
\NWtarget{nuweb66}{} $\langle\,${\itshape C\_maxtype}\nobreak\ {\footnotesize {66}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxtype@\nobreak\ \NWlink{nuweb57}{57}\NWlink{nuweb76c}{, 76c}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_maxabsstand_Covariance@\nobreak\ \NWlink{nuweb62b}{62b}, \verb@C_maxabsstand_Variance@\nobreak\ \NWlink{nuweb63}{63}, \verb@C_maxstand_Covariance@\nobreak\ \NWlink{nuweb60b}{60b}, \verb@C_maxstand_Variance@\nobreak\ \NWlink{nuweb61a}{61a}, \verb@C_minstand_Covariance@\nobreak\ \NWlink{nuweb61b}{61b}, \verb@C_minstand_Variance@\nobreak\ \NWlink{nuweb62a}{62a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap114}\raggedright\small
\NWtarget{nuweb67a}{} $\langle\,${\itshape C\_standardise}\nobreak\ {\footnotesize {67a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_standardise@\nobreak\ \NWlink{nuweb42a}{42a}.\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap115}\raggedright\small
\NWtarget{nuweb67b}{} $\langle\,${\itshape P-Values}\nobreak\ {\footnotesize {67b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_chisq\_pvalue}\nobreak\ {\footnotesize \NWlink{nuweb67c}{67c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_perm\_pvalue}\nobreak\ {\footnotesize \NWlink{nuweb68}{68}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_norm\_pvalue}\nobreak\ {\footnotesize \NWlink{nuweb69}{69}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_maxtype\_pvalue}\nobreak\ {\footnotesize \NWlink{nuweb70}{70}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap116}\raggedright\small
\NWtarget{nuweb67c}{} $\langle\,${\itshape C\_chisq\_pvalue}\nobreak\ {\footnotesize {67c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb67b}{67b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_chisq_pvalue@\nobreak\ \NWlink{nuweb55}{55}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap117}\raggedright\small
\NWtarget{nuweb68}{} $\langle\,${\itshape C\_perm\_pvalue}\nobreak\ {\footnotesize {68}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb67b}{67b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_perm_pvalue@\nobreak\ \NWlink{nuweb55}{55}\NWlink{nuweb57}{, 57}\NWlink{nuweb77}{, 77}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap118}\raggedright\small
\NWtarget{nuweb69}{} $\langle\,${\itshape C\_norm\_pvalue}\nobreak\ {\footnotesize {69}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb67b}{67b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap119}\raggedright\small
\NWtarget{nuweb70}{} $\langle\,${\itshape C\_maxtype\_pvalue}\nobreak\ {\footnotesize {70}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb71}{71}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup mvtnorm Correlation}\nobreak\ {\footnotesize \NWlink{nuweb72a}{72a}}$\,\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@    Free(corr); Free(sd); Free(lowerbnd); Free(upperbnd);@\\
\mbox{}\verb@    Free(infin); Free(delta); 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{nuweb67b}{67b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_maxtype_pvalue@\nobreak\ \NWlink{nuweb57}{57}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap120}\raggedright\small
\NWtarget{nuweb71}{} $\langle\,${\itshape Setup mvtnorm Memory}\nobreak\ {\footnotesize {71}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@if (n == 2)@\\
\mbox{}\verb@    corr = Calloc(1, double);@\\
\mbox{}\verb@else@\\
\mbox{}\verb@    corr = Calloc(n + ((n - 2) * (n - 1))/2, double);@\\
\mbox{}\verb@@\\
\mbox{}\verb@sd = Calloc(n, double);@\\
\mbox{}\verb@lowerbnd = Calloc(n, double);@\\
\mbox{}\verb@upperbnd = Calloc(n, double);@\\
\mbox{}\verb@infin = Calloc(n, int);@\\
\mbox{}\verb@delta = Calloc(n, double);@\\
\mbox{}\verb@index = 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{nuweb70}{70}.
\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\verb|mvtdst| assumes the unique elements of the triangular
covariance matrix to be passed as argument \verb|CORREL|

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap121}\raggedright\small
\NWtarget{nuweb72a}{} $\langle\,${\itshape Setup mvtnorm Correlation}\nobreak\ {\footnotesize {72a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb70}{70}.
\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap122}\raggedright\small
\NWtarget{nuweb72b}{} $\langle\,${\itshape maxstat Xfactor Variables}\nobreak\ {\footnotesize {72b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb73}{73}\NWlink{nuweb78}{, 78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap123}\raggedright\small
\NWtarget{nuweb73}{} $\langle\,${\itshape C\_ordered\_Xfactor}\nobreak\ {\footnotesize {73}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_ordered_Xfactor@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape maxstat Xfactor Variables}\nobreak\ {\footnotesize \NWlink{nuweb72b}{72b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup maxstat Variables}\nobreak\ {\footnotesize \NWlink{nuweb74}{74}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup maxstat Memory}\nobreak\ {\footnotesize \NWlink{nuweb75}{75}}$\,\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{nuweb76b}{76b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            } else {@\\
\mbox{}\verb@                @\hbox{$\langle\,${\itshape Compute maxstat Variance / Covariance from Total Covariance}\nobreak\ {\footnotesize \NWlink{nuweb76a}{76a}}$\,\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{nuweb76c}{76c}}$\,\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{nuweb76c}{76c}}$\,\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{nuweb77}{77}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    Free(mlinstat); Free(mexpect); Free(mblinstat);@\\
\mbox{}\verb@    Free(mvar); Free(mcovar); Free(mMPinv);@\\
\mbox{}\verb@    if (nresample == 0) Free(blinstat);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ordered_Xfactor@\nobreak\ \NWlink{nuweb37b}{37b}\NWlink{nuweb47}{, 47}\NWlink{nuweb59}{, 59}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap124}\raggedright\small
\NWtarget{nuweb74}{} $\langle\,${\itshape Setup maxstat Variables}\nobreak\ {\footnotesize {74}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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 covarinance 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{nuweb73}{73}\NWlink{nuweb78}{, 78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@C_get_B@\nobreak\ \NWlink{nuweb156a}{156a}, \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb153a}{153a}, \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb154a}{154a}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb152a}{152a}, \verb@C_get_ExpectationX@\nobreak\ \NWlink{nuweb153b}{153b}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb151d}{151d}, \verb@C_get_nresample@\nobreak\ \NWlink{nuweb156b}{156b}, \verb@C_get_P@\nobreak\ \NWlink{nuweb150c}{150c}, \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb156c}{156c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb151a}{151a}, \verb@C_get_tol@\nobreak\ \NWlink{nuweb156d}{156d}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb152b}{152b}, \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb154b}{154b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap125}\raggedright\small
\NWtarget{nuweb75}{} $\langle\,${\itshape Setup maxstat Memory}\nobreak\ {\footnotesize {75}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@mlinstat = Calloc(Q, double);@\\
\mbox{}\verb@mexpect = Calloc(Q, double);@\\
\mbox{}\verb@if (teststat == TESTSTAT_maximum) {@\\
\mbox{}\verb@   mvar = Calloc(Q, double);@\\
\mbox{}\verb@   /* not needed, but allocate anyway to make -Wmaybe-uninitialized happy */@\\
\mbox{}\verb@   mcovar = Calloc(1, double);@\\
\mbox{}\verb@   mMPinv = Calloc(1, double);@\\
\mbox{}\verb@} else {@\\
\mbox{}\verb@   mcovar = Calloc(Q * (Q + 1) / 2, double);@\\
\mbox{}\verb@   mMPinv = Calloc(Q * (Q + 1) / 2, double);@\\
\mbox{}\verb@   /* not needed, but allocate anyway to make -Wmaybe-uninitialized happy */@\\
\mbox{}\verb@   mvar = Calloc(1, double);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@if (nresample > 0) {@\\
\mbox{}\verb@    mblinstat = Calloc(Q * nresample, double);@\\
\mbox{}\verb@} else { /* not needed, but allocate anyway to make -Wmaybe-uninitialized happy */@\\
\mbox{}\verb@    mblinstat = Calloc(1, double);@\\
\mbox{}\verb@    blinstat = 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{nuweb73}{73}\NWlink{nuweb78}{, 78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap126}\raggedright\small
\NWtarget{nuweb76a}{} $\langle\,${\itshape Compute maxstat Variance / Covariance from Total Covariance}\nobreak\ {\footnotesize {76a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb73}{73}.
\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap127}\raggedright\small
\NWtarget{nuweb76b}{} $\langle\,${\itshape Compute maxstat Variance / Covariance Directly}\nobreak\ {\footnotesize {76b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb73}{73}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb83}{83}, \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb84}{84}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap128}\raggedright\small
\NWtarget{nuweb76c}{} $\langle\,${\itshape Compute maxstat Test Statistic}\nobreak\ {\footnotesize {76c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb73}{73}\NWlink{nuweb78}{, 78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_maxtype@\nobreak\ \NWlink{nuweb66}{66}, \verb@C_quadform@\nobreak\ \NWlink{nuweb65}{65}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap129}\raggedright\small
\NWtarget{nuweb77}{} $\langle\,${\itshape Compute maxstat Permutation P-Value}\nobreak\ {\footnotesize {77}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb73}{73}\NWlink{nuweb78}{, 78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_perm_pvalue@\nobreak\ \NWlink{nuweb68}{68}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap130}\raggedright\small
\NWtarget{nuweb78}{} $\langle\,${\itshape C\_unordered\_Xfactor}\nobreak\ {\footnotesize {78}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_unordered_Xfactor@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape maxstat Xfactor Variables}\nobreak\ {\footnotesize \NWlink{nuweb72b}{72b}}$\,\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{nuweb74}{74}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Setup maxstat Memory}\nobreak\ {\footnotesize \NWlink{nuweb75}{75}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    mtmp = 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{nuweb79a}{79a}}$\,\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{nuweb79b}{79b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape Compute unordered maxstat Linear Statistic and Expectation}\nobreak\ {\footnotesize \NWlink{nuweb80a}{80a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@        if (B == 1) {@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute unordered maxstat Variance / Covariance Directly}\nobreak\ {\footnotesize \NWlink{nuweb81a}{81a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@        } else {@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape Compute unordered maxstat Variance / Covariance from Total Covariance}\nobreak\ {\footnotesize \NWlink{nuweb80b}{80b}}$\,\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{nuweb76c}{76c}}$\,\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{nuweb76c}{76c}}$\,\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{nuweb77}{77}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@    Free(mlinstat); Free(mexpect); Free(levels); Free(contrast); Free(indl); Free(mtmp);@\\
\mbox{}\verb@    Free(mblinstat); Free(mvar); Free(mcovar); Free(mMPinv);@\\
\mbox{}\verb@    if (nresample == 0) Free(blinstat);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb60a}{60a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_unordered_Xfactor@\nobreak\ \NWlink{nuweb37b}{37b}\NWlink{nuweb59}{, 59}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap131}\raggedright\small
\NWtarget{nuweb79a}{} $\langle\,${\itshape Count Levels}\nobreak\ {\footnotesize {79a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@contrast = 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 = 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 = 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{nuweb78}{78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap132}\raggedright\small
\NWtarget{nuweb79b}{} $\langle\,${\itshape Setup unordered maxstat Contrasts}\nobreak\ {\footnotesize {79b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb78}{78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap133}\raggedright\small
\NWtarget{nuweb80a}{} $\langle\,${\itshape Compute unordered maxstat Linear Statistic and Expectation}\nobreak\ {\footnotesize {80a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\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@    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{nuweb78}{78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap134}\raggedright\small
\NWtarget{nuweb80b}{} $\langle\,${\itshape Compute unordered maxstat Variance / Covariance from Total Covariance}\nobreak\ {\footnotesize {80b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb78}{78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap135}\raggedright\small
\NWtarget{nuweb81a}{} $\langle\,${\itshape Compute unordered maxstat Variance / Covariance Directly}\nobreak\ {\footnotesize {81a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb78}{78}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb83}{83}, \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb84}{84}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Linear Statistics}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap136}\raggedright\small
\NWtarget{nuweb81b}{} $\langle\,${\itshape LinearStatistics}\nobreak\ {\footnotesize {81b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_LinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb81d}{81d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap137}\raggedright\small
\NWtarget{nuweb81c}{} $\langle\,${\itshape RC\_LinearStatistic Prototype}\nobreak\ {\footnotesize {81c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_LinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb81d}{81d}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_LinearStatistic@\nobreak\ \NWlink{nuweb81d}{81d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap138}\raggedright\small
\NWtarget{nuweb81d}{} $\langle\,${\itshape RC\_LinearStatistic}\nobreak\ {\footnotesize {81d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_LinearStatistic Prototype}\nobreak\ {\footnotesize \NWlink{nuweb81c}{81c}}$\,\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{nuweb81b}{81b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_LinearStatistic@\nobreak\ \NWlink{nuweb35b}{35b}\NWlink{nuweb81c}{, 81c}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@DoSymmetric@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_KronSums@\nobreak\ \NWlink{nuweb101a}{101a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Expectation and Covariance}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap139}\raggedright\small
\NWtarget{nuweb82a}{} $\langle\,${\itshape ExpectationCovariances}\nobreak\ {\footnotesize {82a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_ExpectationInfluence}\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ExpectationInfluence}\nobreak\ {\footnotesize \NWlink{nuweb85b}{85b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_CovarianceInfluence}\nobreak\ {\footnotesize \NWlink{nuweb88a}{88a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_CovarianceInfluence}\nobreak\ {\footnotesize \NWlink{nuweb87a}{87a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_ExpectationX}\nobreak\ {\footnotesize \NWlink{nuweb90}{90}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ExpectationX}\nobreak\ {\footnotesize \NWlink{nuweb89a}{89a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_CovarianceX}\nobreak\ {\footnotesize \NWlink{nuweb93a}{93a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_CovarianceX}\nobreak\ {\footnotesize \NWlink{nuweb92a}{92a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_ExpectationLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb82b}{82b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_CovarianceLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb83}{83}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_VarianceLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb84}{84}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

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

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap140}\raggedright\small
\NWtarget{nuweb82b}{} $\langle\,${\itshape C\_ExpectationLinearStatistic}\nobreak\ {\footnotesize {82b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_ExpectationLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ExpectationLinearStatistic@\nobreak\ \NWlink{nuweb37a}{37a}\NWlink{nuweb46c}{, 46c}.\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap141}\raggedright\small
\NWtarget{nuweb83}{} $\langle\,${\itshape C\_CovarianceLinearStatistic}\nobreak\ {\footnotesize {83}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_CovarianceLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\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{nuweb27a}{27a}}$\,\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 = 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@        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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb38a}{38a}\NWlink{nuweb47}{, 47}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb84}{, 84}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_kronecker_sym@\nobreak\ \NWlink{nuweb144}{144}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@PP12@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap142}\raggedright\small
\NWtarget{nuweb84}{} $\langle\,${\itshape C\_VarianceLinearStatistic}\nobreak\ {\footnotesize {84}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_VarianceLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\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{nuweb27a}{27a}}$\,\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 = 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@        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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_VarianceLinearStatistic@\nobreak\ \NWlink{nuweb37c}{37c}\NWlink{nuweb47}{, 47}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb81a}{, 81a}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_CovarianceLinearStatistic@\nobreak\ \NWlink{nuweb83}{83}, \verb@C_kronecker@\nobreak\ \NWlink{nuweb143}{143}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Influence}

<<ExpectationInfluence>>=
sumweights <- sum(weights[subset])
expecty <- a0 <- colSums(y[subset, ] * weights[subset]) / sumweights
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{scrap143}\raggedright\small
\NWtarget{nuweb85a}{} $\langle\,${\itshape R\_ExpectationInfluence Prototype}\nobreak\ {\footnotesize {85a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_ExpectationInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23b}{23b}\NWlink{nuweb85b}{, 85b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb85b}{85b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap144}\raggedright\small
\NWtarget{nuweb85b}{} $\langle\,${\itshape R\_ExpectationInfluence}\nobreak\ {\footnotesize {85b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ExpectationInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb85a}{85a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb85a}{85a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb86a}{86a}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb96a}{96a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap145}\raggedright\small
\NWtarget{nuweb85c}{} $\langle\,${\itshape RC\_ExpectationInfluence Prototype}\nobreak\ {\footnotesize {85c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_ExpectationInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C sumweights Input}\nobreak\ {\footnotesize \NWlink{nuweb27a}{27a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb114c}{114c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb86a}{86a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb86a}{86a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap146}\raggedright\small
\NWtarget{nuweb86a}{} $\langle\,${\itshape RC\_ExpectationInfluence}\nobreak\ {\footnotesize {86a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_ExpectationInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb85c}{85c}}$\,\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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ExpectationInfluence@\nobreak\ \NWlink{nuweb37a}{37a}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb85c}{c}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@Power1@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb114a}{114a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\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))

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
a0 <- vary

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

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap147}\raggedright\small
\NWtarget{nuweb86b}{} $\langle\,${\itshape R\_CovarianceInfluence Prototype}\nobreak\ {\footnotesize {86b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_CovarianceInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\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{nuweb23b}{23b}\NWlink{nuweb87a}{, 87a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_CovarianceInfluence@\nobreak\ \NWlink{nuweb87a}{87a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap148}\raggedright\small
\NWtarget{nuweb87a}{} $\langle\,${\itshape R\_CovarianceInfluence}\nobreak\ {\footnotesize {87a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_CovarianceInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    SEXP ExpInf;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_CovarianceInfluence@\nobreak\ \NWlink{nuweb86b}{86b}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_CovarianceInfluence@\nobreak\ \NWlink{nuweb88a}{88a}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb96a}{96a}, \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb85b}{85b}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap149}\raggedright\small
\NWtarget{nuweb87b}{} $\langle\,${\itshape RC\_CovarianceInfluence Prototype}\nobreak\ {\footnotesize {87b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_CovarianceInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *ExpInf,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C sumweights Input}\nobreak\ {\footnotesize \NWlink{nuweb27a}{27a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int VARONLY,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\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_CovarianceInfluence@\nobreak\ \NWlink{nuweb88a}{88a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap150}\raggedright\small
\NWtarget{nuweb88a}{} $\langle\,${\itshape RC\_CovarianceInfluence}\nobreak\ {\footnotesize {88a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_CovarianceInfluence Prototype}\nobreak\ {\footnotesize \NWlink{nuweb87b}{87b}}$\,\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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_CovarianceInfluence@\nobreak\ \NWlink{nuweb37b}{37b}\NWlink{nuweb47}{, 47}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87b}{b}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@DoSymmetric@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@Power2@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb114a}{114a}, \verb@RC_KronSums@\nobreak\ \NWlink{nuweb101a}{101a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{X}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap151}\raggedright\small
\NWtarget{nuweb88b}{} $\langle\,${\itshape R\_ExpectationX Prototype}\nobreak\ {\footnotesize {88b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_ExpectationX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP P,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23b}{23b}\NWlink{nuweb89a}{, 89a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb89a}{89a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap152}\raggedright\small
\NWtarget{nuweb89a}{} $\langle\,${\itshape R\_ExpectationX}\nobreak\ {\footnotesize {89a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ExpectationX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb88b}{88b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb88b}{88b}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb90}{90}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap153}\raggedright\small
\NWtarget{nuweb89b}{} $\langle\,${\itshape RC\_ExpectationX Prototype}\nobreak\ {\footnotesize {89b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_ExpectationX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb119c}{119c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb90}{90}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb90}{90}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap154}\raggedright\small
\NWtarget{nuweb90}{} $\langle\,${\itshape RC\_ExpectationX}\nobreak\ {\footnotesize {90}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_ExpectationX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb89b}{89b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    double center;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (TYPEOF(x) == INTSXP) {@\\
\mbox{}\verb@        double* Pp1tmp = 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@        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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ExpectationX@\nobreak\ \NWlink{nuweb37a}{37a}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb89b}{b}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Power1@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb114a}{114a}, \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb119a}{119a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<ExpectationCovarianceX>>=
a0 <- colSums(x[subset, ] * weights[subset])
a0
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]))
a0
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{scrap155}\raggedright\small
\NWtarget{nuweb91}{} $\langle\,${\itshape R\_CovarianceX Prototype}\nobreak\ {\footnotesize {91}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_CovarianceX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP P,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\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{nuweb23b}{23b}\NWlink{nuweb92a}{, 92a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@R_CovarianceX@\nobreak\ \NWlink{nuweb92a}{92a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap156}\raggedright\small
\NWtarget{nuweb92a}{} $\langle\,${\itshape R\_CovarianceX}\nobreak\ {\footnotesize {92a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_CovarianceX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb91}{91}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    SEXP ExpX;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_CovarianceX@\nobreak\ \NWlink{nuweb91}{91}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb93a}{93a}, \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb89a}{89a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap157}\raggedright\small
\NWtarget{nuweb92b}{} $\langle\,${\itshape RC\_CovarianceX Prototype}\nobreak\ {\footnotesize {92b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_CovarianceX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *ExpX,@\\
\mbox{}\verb@    int VARONLY,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb93a}{93a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb93a}{93a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap158}\raggedright\small
\NWtarget{nuweb93a}{} $\langle\,${\itshape RC\_CovarianceX}\nobreak\ {\footnotesize {93a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_CovarianceX Prototype}\nobreak\ {\footnotesize \NWlink{nuweb92b}{92b}}$\,\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{nuweb82a}{82a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_CovarianceX@\nobreak\ \NWlink{nuweb37c}{37c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb47}{, 47}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb92b}{b}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@DoSymmetric@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Power2@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@PP12@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb114a}{114a}, \verb@RC_KronSums@\nobreak\ \NWlink{nuweb101a}{101a}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\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, weights, or blocks. We start with an
initialisation of the loop over all observations

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap159}\raggedright\small
\NWtarget{nuweb93b}{} $\langle\,${\itshape init subset loop}\nobreak\ {\footnotesize {93b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb98a}{98a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb126}{, 126}\NWlink{nuweb131a}{, 131a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}.
\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 \verb|offset| and \verb|Nsubset|,
allowing for number of observations larger than \verb|INT_MAX|

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap160}\raggedright\small
\NWtarget{nuweb94a}{} $\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize {94a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb98a}{98a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb126}{, 126}\NWlink{nuweb131a}{, 131a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
After computions in the loop, we compute the next element

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap161}\raggedright\small
\NWtarget{nuweb94b}{} $\langle\,${\itshape continue subset loop}\nobreak\ {\footnotesize {94b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb98a}{98a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb126}{, 126}\NWlink{nuweb131a}{, 131a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Simple Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap162}\raggedright\small
\NWtarget{nuweb94c}{} $\langle\,${\itshape SimpleSums}\nobreak\ {\footnotesize {94c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_Sums\_dweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb96b}{96b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_Sums\_iweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb97a}{97a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_Sums\_iweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb97b}{97b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_Sums\_dweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb97c}{97c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_Sums}\nobreak\ {\footnotesize \NWlink{nuweb96a}{96a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_Sums}\nobreak\ {\footnotesize \NWlink{nuweb95b}{95b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\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{scrap163}\raggedright\small
\NWtarget{nuweb95a}{} $\langle\,${\itshape R\_Sums Prototype}\nobreak\ {\footnotesize {95a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_Sums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R N Input}\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23b}{23b}\NWlink{nuweb95b}{, 95b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_Sums@\nobreak\ \NWlink{nuweb95b}{95b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap164}\raggedright\small
\NWtarget{nuweb95b}{} $\langle\,${\itshape R\_Sums}\nobreak\ {\footnotesize {95b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_Sums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb95a}{95a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb94c}{94c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_Sums@\nobreak\ \NWlink{nuweb95a}{95a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb96a}{96a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap165}\raggedright\small
\NWtarget{nuweb95c}{} $\langle\,${\itshape RC\_Sums Prototype}\nobreak\ {\footnotesize {95c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double RC_Sums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb96a}{96a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_Sums@\nobreak\ \NWlink{nuweb96a}{96a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap166}\raggedright\small
\NWtarget{nuweb96a}{} $\langle\,${\itshape RC\_Sums}\nobreak\ {\footnotesize {96a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_Sums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb95c}{95c}}$\,\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{nuweb94c}{94c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_Sums@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb36b}{b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb95c}{c}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb136a}{, 136a}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_Sums_dweights_dsubset@\nobreak\ \NWlink{nuweb96b}{96b}, \verb@C_Sums_dweights_isubset@\nobreak\ \NWlink{nuweb97c}{97c}, \verb@C_Sums_iweights_dsubset@\nobreak\ \NWlink{nuweb97a}{97a}, \verb@C_Sums_iweights_isubset@\nobreak\ \NWlink{nuweb97b}{97b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap167}\raggedright\small
\NWtarget{nuweb96b}{} $\langle\,${\itshape C\_Sums\_dweights\_dsubset}\nobreak\ {\footnotesize {96b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double C_Sums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize \NWlink{nuweb98a}{98a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb94c}{94c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Sums_dweights_dsubset@\nobreak\ \NWlink{nuweb96a}{96a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap168}\raggedright\small
\NWtarget{nuweb97a}{} $\langle\,${\itshape C\_Sums\_iweights\_dsubset}\nobreak\ {\footnotesize {97a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double C_Sums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize \NWlink{nuweb98a}{98a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb94c}{94c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Sums_iweights_dsubset@\nobreak\ \NWlink{nuweb96a}{96a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap169}\raggedright\small
\NWtarget{nuweb97b}{} $\langle\,${\itshape C\_Sums\_iweights\_isubset}\nobreak\ {\footnotesize {97b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double C_Sums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize \NWlink{nuweb98a}{98a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb94c}{94c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Sums_iweights_isubset@\nobreak\ \NWlink{nuweb96a}{96a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap170}\raggedright\small
\NWtarget{nuweb97c}{} $\langle\,${\itshape C\_Sums\_dweights\_isubset}\nobreak\ {\footnotesize {97c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double C_Sums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize \NWlink{nuweb98a}{98a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb94c}{94c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Sums_dweights_isubset@\nobreak\ \NWlink{nuweb96a}{96a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap171}\raggedright\small
\NWtarget{nuweb98a}{} $\langle\,${\itshape Sums Body}\nobreak\ {\footnotesize {98a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb93b}{93b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\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{nuweb94b}{94b}}$\,\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{nuweb96b}{96b}\NWlink{nuweb97a}{, 97a}\NWlink{nuweb97b}{b}\NWlink{nuweb97c}{c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Kronecker Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap172}\raggedright\small
\NWtarget{nuweb98b}{} $\langle\,${\itshape KronSums}\nobreak\ {\footnotesize {98b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_KronSums\_dweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb103b}{103b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_KronSums\_iweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb104a}{104a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_KronSums\_iweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb104b}{104b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_KronSums\_dweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb104c}{104c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_XfactorKronSums\_dweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb106b}{106b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_XfactorKronSums\_iweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb106c}{106c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_XfactorKronSums\_iweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb107a}{107a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_XfactorKronSums\_dweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb107b}{107b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_KronSums}\nobreak\ {\footnotesize \NWlink{nuweb101a}{101a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_KronSums}\nobreak\ {\footnotesize \NWlink{nuweb100a}{100a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_KronSums\_Permutation\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb111a}{111a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_KronSums\_Permutation\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb110b}{110b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_XfactorKronSums\_Permutation\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb112a}{112a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_XfactorKronSums\_Permutation\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb111c}{111c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_KronSums\_Permutation}\nobreak\ {\footnotesize \NWlink{nuweb110a}{110a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_KronSums\_Permutation}\nobreak\ {\footnotesize \NWlink{nuweb109b}{109b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
<<KronSums>>=
r1 <- rep(1:ncol(x), ncol(y))
r2 <- rep(1:ncol(y), each = ncol(x))

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{scrap173}\raggedright\small
\NWtarget{nuweb99}{} $\langle\,${\itshape R\_KronSums Prototype}\nobreak\ {\footnotesize {99}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_KronSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP P,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\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{nuweb23b}{23b}\NWlink{nuweb100a}{, 100a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@R_KronSums@\nobreak\ \NWlink{nuweb100a}{100a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap174}\raggedright\small
\NWtarget{nuweb100a}{} $\langle\,${\itshape R\_KronSums}\nobreak\ {\footnotesize {100a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_KronSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb99}{99}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_KronSums@\nobreak\ \NWlink{nuweb99}{99}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_KronSums@\nobreak\ \NWlink{nuweb101a}{101a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap175}\raggedright\small
\NWtarget{nuweb100b}{} $\langle\,${\itshape RC\_KronSums Prototype}\nobreak\ {\footnotesize {100b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_KronSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape RC KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb101b}{101b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\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}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_KronSums@\nobreak\ \NWlink{nuweb101a}{101a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap176}\raggedright\small
\NWtarget{nuweb101a}{} $\langle\,${\itshape RC\_KronSums}\nobreak\ {\footnotesize {101a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_KronSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb100b}{100b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    if (TYPEOF(x) == INTSXP) {@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape KronSums Integer x}\nobreak\ {\footnotesize \NWlink{nuweb102}{102}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    } else {@\\
\mbox{}\verb@        @\hbox{$\langle\,${\itshape KronSums Double x}\nobreak\ {\footnotesize \NWlink{nuweb103a}{103a}}$\,\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{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_KronSums@\nobreak\ \NWlink{nuweb81d}{81d}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb100b}{b}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap177}\raggedright\small
\NWtarget{nuweb101b}{} $\langle\,${\itshape RC KronSums Input}\nobreak\ {\footnotesize {101b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\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{nuweb100b}{100b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap178}\raggedright\small
\NWtarget{nuweb101c}{} $\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize {101c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\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{nuweb103b}{103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb104b}{b}\NWlink{nuweb104c}{c}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap179}\raggedright\small
\NWtarget{nuweb101d}{} $\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize {101d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb81c}{81c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb104b}{b}\NWlink{nuweb104c}{c}\NWlink{nuweb106b}{, 106b}\NWlink{nuweb106c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107b}{b}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb111c}{c}\NWlink{nuweb112a}{, 112a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap180}\raggedright\small
\NWtarget{nuweb102}{} $\langle\,${\itshape KronSums Integer x}\nobreak\ {\footnotesize {102}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb101a}{101a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_XfactorKronSums_dweights_dsubset@\nobreak\ \NWlink{nuweb106b}{106b}, \verb@C_XfactorKronSums_dweights_isubset@\nobreak\ \NWlink{nuweb107b}{107b}, \verb@C_XfactorKronSums_iweights_dsubset@\nobreak\ \NWlink{nuweb106c}{106c}, \verb@C_XfactorKronSums_iweights_isubset@\nobreak\ \NWlink{nuweb107a}{107a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap181}\raggedright\small
\NWtarget{nuweb103a}{} $\langle\,${\itshape KronSums Double x}\nobreak\ {\footnotesize {103a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb101a}{101a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_KronSums_dweights_dsubset@\nobreak\ \NWlink{nuweb103b}{103b}, \verb@C_KronSums_dweights_isubset@\nobreak\ \NWlink{nuweb104c}{104c}, \verb@C_KronSums_iweights_dsubset@\nobreak\ \NWlink{nuweb104a}{104a}, \verb@C_KronSums_iweights_isubset@\nobreak\ \NWlink{nuweb104b}{104b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap182}\raggedright\small
\NWtarget{nuweb103b}{} $\langle\,${\itshape C\_KronSums\_dweights\_dsubset}\nobreak\ {\footnotesize {103b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_KronSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb101c}{101c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb105}{105}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_dweights_dsubset@\nobreak\ \NWlink{nuweb103a}{103a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap183}\raggedright\small
\NWtarget{nuweb104a}{} $\langle\,${\itshape C\_KronSums\_iweights\_dsubset}\nobreak\ {\footnotesize {104a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_KronSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb101c}{101c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb105}{105}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_iweights_dsubset@\nobreak\ \NWlink{nuweb103a}{103a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap184}\raggedright\small
\NWtarget{nuweb104b}{} $\langle\,${\itshape C\_KronSums\_iweights\_isubset}\nobreak\ {\footnotesize {104b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_KronSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb101c}{101c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb105}{105}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_iweights_isubset@\nobreak\ \NWlink{nuweb103a}{103a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap185}\raggedright\small
\NWtarget{nuweb104c}{} $\langle\,${\itshape C\_KronSums\_dweights\_isubset}\nobreak\ {\footnotesize {104c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_KronSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb101c}{101c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb105}{105}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_dweights_isubset@\nobreak\ \NWlink{nuweb103a}{103a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap186}\raggedright\small
\NWtarget{nuweb105}{} $\langle\,${\itshape KronSums Body}\nobreak\ {\footnotesize {105}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb93b}{93b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@            @\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\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{nuweb94b}{94b}}$\,\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{nuweb103b}{103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb104b}{b}\NWlink{nuweb104c}{c}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsubsection{Xfactor Kronecker Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap187}\raggedright\small
\NWtarget{nuweb106a}{} $\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize {106a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb106b}{106b}\NWlink{nuweb106c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107b}{b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap188}\raggedright\small
\NWtarget{nuweb106b}{} $\langle\,${\itshape C\_XfactorKronSums\_dweights\_dsubset}\nobreak\ {\footnotesize {106b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_XfactorKronSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb108}{108}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_dweights_dsubset@\nobreak\ \NWlink{nuweb102}{102}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap189}\raggedright\small
\NWtarget{nuweb106c}{} $\langle\,${\itshape C\_XfactorKronSums\_iweights\_dsubset}\nobreak\ {\footnotesize {106c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_XfactorKronSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb108}{108}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_iweights_dsubset@\nobreak\ \NWlink{nuweb102}{102}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap190}\raggedright\small
\NWtarget{nuweb107a}{} $\langle\,${\itshape C\_XfactorKronSums\_iweights\_isubset}\nobreak\ {\footnotesize {107a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_XfactorKronSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb108}{108}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_iweights_isubset@\nobreak\ \NWlink{nuweb102}{102}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap191}\raggedright\small
\NWtarget{nuweb107b}{} $\langle\,${\itshape C\_XfactorKronSums\_dweights\_isubset}\nobreak\ {\footnotesize {107b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_XfactorKronSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C XfactorKronSums Input}\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize \NWlink{nuweb108}{108}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_dweights_isubset@\nobreak\ \NWlink{nuweb102}{102}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap192}\raggedright\small
\NWtarget{nuweb108}{} $\langle\,${\itshape XfactorKronSums Body}\nobreak\ {\footnotesize {108}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb93b}{93b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\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{nuweb94b}{94b}}$\,\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{nuweb106b}{106b}\NWlink{nuweb106c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107b}{b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\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{scrap193}\raggedright\small
\NWtarget{nuweb109a}{} $\langle\,${\itshape R\_KronSums\_Permutation Prototype}\nobreak\ {\footnotesize {109a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_KronSums_Permutation@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    SEXP P,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\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{nuweb23b}{23b}\NWlink{nuweb109b}{, 109b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@R_KronSums_Permutation@\nobreak\ \NWlink{nuweb109b}{109b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap194}\raggedright\small
\NWtarget{nuweb109b}{} $\langle\,${\itshape R\_KronSums\_Permutation}\nobreak\ {\footnotesize {109b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_KronSums\_Permutation Prototype}\nobreak\ {\footnotesize \NWlink{nuweb109a}{109a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_KronSums_Permutation@\nobreak\ \NWlink{nuweb109a}{109a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_KronSums_Permutation@\nobreak\ \NWlink{nuweb110a}{110a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap195}\raggedright\small
\NWtarget{nuweb109c}{} $\langle\,${\itshape RC\_KronSums\_Permutation Prototype}\nobreak\ {\footnotesize {109c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_KronSums_Permutation@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb110a}{110a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_KronSums_Permutation@\nobreak\ \NWlink{nuweb110a}{110a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap196}\raggedright\small
\NWtarget{nuweb110a}{} $\langle\,${\itshape RC\_KronSums\_Permutation}\nobreak\ {\footnotesize {110a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_KronSums\_Permutation Prototype}\nobreak\ {\footnotesize \NWlink{nuweb109c}{109c}}$\,\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{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_KronSums_Permutation@\nobreak\ \NWlink{nuweb40}{40}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb109c}{c}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_KronSums_Permutation_dsubset@\nobreak\ \NWlink{nuweb110b}{110b}, \verb@C_KronSums_Permutation_isubset@\nobreak\ \NWlink{nuweb111a}{111a}, \verb@C_XfactorKronSums_Permutation_dsubset@\nobreak\ \NWlink{nuweb111c}{111c}, \verb@C_XfactorKronSums_Permutation_isubset@\nobreak\ \NWlink{nuweb112a}{112a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap197}\raggedright\small
\NWtarget{nuweb110b}{} $\langle\,${\itshape C\_KronSums\_Permutation\_dsubset}\nobreak\ {\footnotesize {110b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_KronSums_Permutation_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Permutation Body}\nobreak\ {\footnotesize \NWlink{nuweb111b}{111b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_Permutation_dsubset@\nobreak\ \NWlink{nuweb110a}{110a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap198}\raggedright\small
\NWtarget{nuweb111a}{} $\langle\,${\itshape C\_KronSums\_Permutation\_isubset}\nobreak\ {\footnotesize {111a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_KronSums_Permutation_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int *subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape KronSums Permutation Body}\nobreak\ {\footnotesize \NWlink{nuweb111b}{111b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_Permutation_isubset@\nobreak\ \NWlink{nuweb110a}{110a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
Because \verb|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{scrap199}\raggedright\small
\NWtarget{nuweb111b}{} $\langle\,${\itshape KronSums Permutation Body}\nobreak\ {\footnotesize {111b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb110b}{110b}\NWlink{nuweb111a}{, 111a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsubsection{Xfactor Permuted Kronecker Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap200}\raggedright\small
\NWtarget{nuweb111c}{} $\langle\,${\itshape C\_XfactorKronSums\_Permutation\_dsubset}\nobreak\ {\footnotesize {111c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_XfactorKronSums_Permutation_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    double *subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Permutation Body}\nobreak\ {\footnotesize \NWlink{nuweb112b}{112b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_Permutation_dsubset@\nobreak\ \NWlink{nuweb110a}{110a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap201}\raggedright\small
\NWtarget{nuweb112a}{} $\langle\,${\itshape C\_XfactorKronSums\_Permutation\_isubset}\nobreak\ {\footnotesize {112a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_XfactorKronSums_Permutation_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real y Input}\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int *subsety,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C KronSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape XfactorKronSums Permutation Body}\nobreak\ {\footnotesize \NWlink{nuweb112b}{112b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb98b}{98b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_XfactorKronSums_Permutation_isubset@\nobreak\ \NWlink{nuweb110a}{110a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap202}\raggedright\small
\NWtarget{nuweb112b}{} $\langle\,${\itshape XfactorKronSums Permutation Body}\nobreak\ {\footnotesize {112b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb111c}{111c}\NWlink{nuweb112a}{, 112a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Column Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap203}\raggedright\small
\NWtarget{nuweb112c}{} $\langle\,${\itshape colSums}\nobreak\ {\footnotesize {112c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_colSums\_dweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb115a}{115a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_colSums\_iweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb115b}{115b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_colSums\_iweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb115c}{115c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_colSums\_dweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb116a}{116a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_colSums}\nobreak\ {\footnotesize \NWlink{nuweb114a}{114a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_colSums}\nobreak\ {\footnotesize \NWlink{nuweb113b}{113b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\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{scrap204}\raggedright\small
\NWtarget{nuweb113a}{} $\langle\,${\itshape R\_colSums Prototype}\nobreak\ {\footnotesize {113a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_colSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23b}{23b}\NWlink{nuweb113b}{, 113b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_colSums@\nobreak\ \NWlink{nuweb113b}{113b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap205}\raggedright\small
\NWtarget{nuweb113b}{} $\langle\,${\itshape R\_colSums}\nobreak\ {\footnotesize {113b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_colSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb113a}{113a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    int P;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb112c}{112c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_colSums@\nobreak\ \NWlink{nuweb113a}{113a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@DoCenter@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Power1@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@RC_colSums@\nobreak\ \NWlink{nuweb114a}{114a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap206}\raggedright\small
\NWtarget{nuweb113c}{} $\langle\,${\itshape RC\_colSums Prototype}\nobreak\ {\footnotesize {113c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_colSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb114b}{114b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb114c}{114c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb114a}{114a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_colSums@\nobreak\ \NWlink{nuweb114a}{114a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap207}\raggedright\small
\NWtarget{nuweb114a}{} $\langle\,${\itshape RC\_colSums}\nobreak\ {\footnotesize {114a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_colSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb113c}{113c}}$\,\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{nuweb112c}{112c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_colSums@\nobreak\ \NWlink{nuweb86a}{86a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90}{, 90}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb113c}{c}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_colSums_dweights_dsubset@\nobreak\ \NWlink{nuweb115a}{115a}, \verb@C_colSums_dweights_isubset@\nobreak\ \NWlink{nuweb116a}{116a}, \verb@C_colSums_iweights_dsubset@\nobreak\ \NWlink{nuweb115b}{115b}, \verb@C_colSums_iweights_isubset@\nobreak\ \NWlink{nuweb115c}{115c}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap208}\raggedright\small
\NWtarget{nuweb114b}{} $\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize {114b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C real x Input}\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\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{nuweb113c}{113c}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb115b}{b}\NWlink{nuweb115c}{c}\NWlink{nuweb116a}{, 116a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap209}\raggedright\small
\NWtarget{nuweb114c}{} $\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize {114c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb85c}{85c}\NWlink{nuweb113c}{, 113c}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb115b}{b}\NWlink{nuweb115c}{c}\NWlink{nuweb116a}{, 116a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap210}\raggedright\small
\NWtarget{nuweb115a}{} $\langle\,${\itshape C\_colSums\_dweights\_dsubset}\nobreak\ {\footnotesize {115a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_colSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb114b}{114b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb114c}{114c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb112c}{112c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_colSums_dweights_dsubset@\nobreak\ \NWlink{nuweb114a}{114a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap211}\raggedright\small
\NWtarget{nuweb115b}{} $\langle\,${\itshape C\_colSums\_iweights\_dsubset}\nobreak\ {\footnotesize {115b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_colSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb114b}{114b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb114c}{114c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb112c}{112c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_colSums_iweights_dsubset@\nobreak\ \NWlink{nuweb114a}{114a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap212}\raggedright\small
\NWtarget{nuweb115c}{} $\langle\,${\itshape C\_colSums\_iweights\_isubset}\nobreak\ {\footnotesize {115c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_colSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb114b}{114b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb114c}{114c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb112c}{112c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_colSums_iweights_isubset@\nobreak\ \NWlink{nuweb114a}{114a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap213}\raggedright\small
\NWtarget{nuweb116a}{} $\langle\,${\itshape C\_colSums\_dweights\_isubset}\nobreak\ {\footnotesize {116a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_colSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Input}\nobreak\ {\footnotesize \NWlink{nuweb114b}{114b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C colSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb114c}{114c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb112c}{112c}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_colSums_dweights_isubset@\nobreak\ \NWlink{nuweb114a}{114a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap214}\raggedright\small
\NWtarget{nuweb116b}{} $\langle\,${\itshape colSums Body}\nobreak\ {\footnotesize {116b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb93b}{93b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\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{nuweb94b}{94b}}$\,\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{nuweb115a}{115a}\NWlink{nuweb115b}{b}\NWlink{nuweb115c}{c}\NWlink{nuweb116a}{, 116a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Tables}

\subsubsection{OneTable Sums}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap215}\raggedright\small
\NWtarget{nuweb117a}{} $\langle\,${\itshape Tables}\nobreak\ {\footnotesize {117a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_OneTableSums\_dweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb120a}{120a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_OneTableSums\_iweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb120b}{120b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_OneTableSums\_iweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb120c}{120c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_OneTableSums\_dweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb121a}{121a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_OneTableSums}\nobreak\ {\footnotesize \NWlink{nuweb119a}{119a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_OneTableSums}\nobreak\ {\footnotesize \NWlink{nuweb118a}{118a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_TwoTableSums\_dweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb124b}{124b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_TwoTableSums\_iweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb124c}{124c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_TwoTableSums\_iweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb125a}{125a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_TwoTableSums\_dweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb125b}{125b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_TwoTableSums}\nobreak\ {\footnotesize \NWlink{nuweb123b}{123b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_TwoTableSums}\nobreak\ {\footnotesize \NWlink{nuweb122b}{122b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_ThreeTableSums\_dweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb129b}{129b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_ThreeTableSums\_iweights\_dsubset}\nobreak\ {\footnotesize \NWlink{nuweb129c}{129c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_ThreeTableSums\_iweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb130a}{130a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_ThreeTableSums\_dweights\_isubset}\nobreak\ {\footnotesize \NWlink{nuweb130b}{130b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_ThreeTableSums}\nobreak\ {\footnotesize \NWlink{nuweb128b}{128b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ThreeTableSums}\nobreak\ {\footnotesize \NWlink{nuweb127b}{127b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\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{scrap216}\raggedright\small
\NWtarget{nuweb117b}{} $\langle\,${\itshape R\_OneTableSums Prototype}\nobreak\ {\footnotesize {117b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_OneTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23b}{23b}\NWlink{nuweb118a}{, 118a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb118a}{118a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap217}\raggedright\small
\NWtarget{nuweb118a}{} $\langle\,${\itshape R\_OneTableSums}\nobreak\ {\footnotesize {118a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_OneTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb117b}{117b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb16}{16}\NWlink{nuweb117b}{, 117b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb140a}{140a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb119a}{119a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap218}\raggedright\small
\NWtarget{nuweb118b}{} $\langle\,${\itshape RC\_OneTableSums Prototype}\nobreak\ {\footnotesize {118b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_OneTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb119b}{119b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb119c}{119c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb119a}{119a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb119a}{119a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap219}\raggedright\small
\NWtarget{nuweb119a}{} $\langle\,${\itshape RC\_OneTableSums}\nobreak\ {\footnotesize {119a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_OneTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb118b}{118b}}$\,\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{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_OneTableSums@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb40}{, 40}\NWlink{nuweb90}{, 90}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb118b}{b}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_OneTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb120a}{120a}, \verb@C_OneTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb121a}{121a}, \verb@C_OneTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb120b}{120b}, \verb@C_OneTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb120c}{120c}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap220}\raggedright\small
\NWtarget{nuweb119b}{} $\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize {119b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb118b}{118b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb120b}{b}\NWlink{nuweb120c}{c}\NWlink{nuweb121a}{, 121a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap221}\raggedright\small
\NWtarget{nuweb119c}{} $\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize {119c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb89b}{89b}\NWlink{nuweb118b}{, 118b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb120b}{b}\NWlink{nuweb120c}{c}\NWlink{nuweb121a}{, 121a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap222}\raggedright\small
\NWtarget{nuweb120a}{} $\langle\,${\itshape C\_OneTableSums\_dweights\_dsubset}\nobreak\ {\footnotesize {120a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_OneTableSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb119b}{119b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb119c}{119c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb121b}{121b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_OneTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb119a}{119a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap223}\raggedright\small
\NWtarget{nuweb120b}{} $\langle\,${\itshape C\_OneTableSums\_iweights\_dsubset}\nobreak\ {\footnotesize {120b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_OneTableSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb119b}{119b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb119c}{119c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb121b}{121b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_OneTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb119a}{119a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap224}\raggedright\small
\NWtarget{nuweb120c}{} $\langle\,${\itshape C\_OneTableSums\_iweights\_isubset}\nobreak\ {\footnotesize {120c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_OneTableSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb119b}{119b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb119c}{119c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb121b}{121b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_OneTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb119a}{119a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap225}\raggedright\small
\NWtarget{nuweb121a}{} $\langle\,${\itshape C\_OneTableSums\_dweights\_isubset}\nobreak\ {\footnotesize {121a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_OneTableSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb119b}{119b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C OneTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb119c}{119c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb121b}{121b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_OneTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb119a}{119a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap226}\raggedright\small
\NWtarget{nuweb121b}{} $\langle\,${\itshape OneTableSums Body}\nobreak\ {\footnotesize {121b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb93b}{93b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\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{nuweb94b}{94b}}$\,\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{nuweb120a}{120a}\NWlink{nuweb120b}{b}\NWlink{nuweb120c}{c}\NWlink{nuweb121a}{, 121a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\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{scrap227}\raggedright\small
\NWtarget{nuweb122a}{} $\langle\,${\itshape R\_TwoTableSums Prototype}\nobreak\ {\footnotesize {122a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_TwoTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23b}{23b}\NWlink{nuweb122b}{, 122b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb122b}{122b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap228}\raggedright\small
\NWtarget{nuweb122b}{} $\langle\,${\itshape R\_TwoTableSums}\nobreak\ {\footnotesize {122b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_TwoTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb122a}{122a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, dim;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb16}{16}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb140a}{140a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_TwoTableSums@\nobreak\ \NWlink{nuweb123b}{123b}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap229}\raggedright\small
\NWtarget{nuweb123a}{} $\langle\,${\itshape RC\_TwoTableSums Prototype}\nobreak\ {\footnotesize {123a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_TwoTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb123c}{123c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb124a}{124a}}$\,\rangle$}\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 \NWtxtIdentsUsed\nobreak\  \verb@RC_TwoTableSums@\nobreak\ \NWlink{nuweb123b}{123b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap230}\raggedright\small
\NWtarget{nuweb123b}{} $\langle\,${\itshape RC\_TwoTableSums}\nobreak\ {\footnotesize {123b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_TwoTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb123a}{123a}}$\,\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{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_TwoTableSums@\nobreak\ \NWlink{nuweb44}{44}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123a}{, 123a}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_TwoTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb124b}{124b}, \verb@C_TwoTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb125b}{125b}, \verb@C_TwoTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb124c}{124c}, \verb@C_TwoTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb125a}{125a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap231}\raggedright\small
\NWtarget{nuweb123c}{} $\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize {123c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer y 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{nuweb123a}{123a}\NWlink{nuweb124b}{, 124b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb125b}{b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap232}\raggedright\small
\NWtarget{nuweb124a}{} $\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize {124a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb123a}{123a}\NWlink{nuweb124b}{, 124b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb125b}{b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap233}\raggedright\small
\NWtarget{nuweb124b}{} $\langle\,${\itshape C\_TwoTableSums\_dweights\_dsubset}\nobreak\ {\footnotesize {124b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_TwoTableSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb123c}{123c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb124a}{124a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb126}{126}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_TwoTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb123b}{123b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap234}\raggedright\small
\NWtarget{nuweb124c}{} $\langle\,${\itshape C\_TwoTableSums\_iweights\_dsubset}\nobreak\ {\footnotesize {124c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_TwoTableSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb123c}{123c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb124a}{124a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb126}{126}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_TwoTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb123b}{123b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap235}\raggedright\small
\NWtarget{nuweb125a}{} $\langle\,${\itshape C\_TwoTableSums\_iweights\_isubset}\nobreak\ {\footnotesize {125a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_TwoTableSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb123c}{123c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb124a}{124a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb126}{126}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_TwoTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb123b}{123b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap236}\raggedright\small
\NWtarget{nuweb125b}{} $\langle\,${\itshape C\_TwoTableSums\_dweights\_isubset}\nobreak\ {\footnotesize {125b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_TwoTableSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb123c}{123c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C TwoTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb124a}{124a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb126}{126}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_TwoTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb123b}{123b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap237}\raggedright\small
\NWtarget{nuweb126}{} $\langle\,${\itshape TwoTableSums Body}\nobreak\ {\footnotesize {126}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb93b}{93b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\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{nuweb94b}{94b}}$\,\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{nuweb124b}{124b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb125b}{b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\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{scrap238}\raggedright\small
\NWtarget{nuweb127a}{} $\langle\,${\itshape R\_ThreeTableSums Prototype}\nobreak\ {\footnotesize {127a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_ThreeTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R x Input}\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb28b}{28b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23b}{23b}\NWlink{nuweb127b}{, 127b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb127b}{127b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap239}\raggedright\small
\NWtarget{nuweb127b}{} $\langle\,${\itshape R\_ThreeTableSums}\nobreak\ {\footnotesize {127b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_ThreeTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb127a}{127a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, dim;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb16}{16}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb140a}{140a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@RC_ThreeTableSums@\nobreak\ \NWlink{nuweb128b}{128b}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap240}\raggedright\small
\NWtarget{nuweb128a}{} $\langle\,${\itshape RC\_ThreeTableSums Prototype}\nobreak\ {\footnotesize {128a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void RC_ThreeTableSums@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb128c}{128c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C subset range Input}\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb129a}{129a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb128b}{128b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_ThreeTableSums@\nobreak\ \NWlink{nuweb128b}{128b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap241}\raggedright\small
\NWtarget{nuweb128b}{} $\langle\,${\itshape RC\_ThreeTableSums}\nobreak\ {\footnotesize {128b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_ThreeTableSums Prototype}\nobreak\ {\footnotesize \NWlink{nuweb128a}{128a}}$\,\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{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_ThreeTableSums@\nobreak\ \NWlink{nuweb44}{44}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128a}{, 128a}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@C_ThreeTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb129b}{129b}, \verb@C_ThreeTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb130b}{130b}, \verb@C_ThreeTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb129c}{129c}, \verb@C_ThreeTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb130a}{130a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@offset@\nobreak\ \NWlink{nuweb27d}{27d}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap242}\raggedright\small
\NWtarget{nuweb128c}{} $\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize {128c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer x Input}\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer y Input}\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C integer block Input}\nobreak\ {\footnotesize \NWlink{nuweb28d}{28d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb128a}{128a}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb129c}{c}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap243}\raggedright\small
\NWtarget{nuweb129a}{} $\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize {129a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb128a}{128a}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb129c}{c}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{b}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap244}\raggedright\small
\NWtarget{nuweb129b}{} $\langle\,${\itshape C\_ThreeTableSums\_dweights\_dsubset}\nobreak\ {\footnotesize {129b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_ThreeTableSums_dweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb128c}{128c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb129a}{129a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb131a}{131a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ThreeTableSums_dweights_dsubset@\nobreak\ \NWlink{nuweb128b}{128b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap245}\raggedright\small
\NWtarget{nuweb129c}{} $\langle\,${\itshape C\_ThreeTableSums\_iweights\_dsubset}\nobreak\ {\footnotesize {129c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_ThreeTableSums_iweights_dsubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb128c}{128c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real subset Input}\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb129a}{129a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *s;@\\
\mbox{}\verb@    int *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb131a}{131a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ThreeTableSums_iweights_dsubset@\nobreak\ \NWlink{nuweb128b}{128b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap246}\raggedright\small
\NWtarget{nuweb130a}{} $\langle\,${\itshape C\_ThreeTableSums\_iweights\_isubset}\nobreak\ {\footnotesize {130a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_ThreeTableSums_iweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb128c}{128c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb129a}{129a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s, *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb131a}{131a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ThreeTableSums_iweights_isubset@\nobreak\ \NWlink{nuweb128b}{128b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap247}\raggedright\small
\NWtarget{nuweb130b}{} $\langle\,${\itshape C\_ThreeTableSums\_dweights\_isubset}\nobreak\ {\footnotesize {130b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_ThreeTableSums_dweights_isubset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Input}\nobreak\ {\footnotesize \NWlink{nuweb128c}{128c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C real weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C ThreeTableSums Answer}\nobreak\ {\footnotesize \NWlink{nuweb129a}{129a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    int *s;@\\
\mbox{}\verb@    double *w;@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize \NWlink{nuweb131a}{131a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb117a}{117a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_ThreeTableSums_dweights_isubset@\nobreak\ \NWlink{nuweb128b}{128b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap248}\raggedright\small
\NWtarget{nuweb131a}{} $\langle\,${\itshape ThreeTableSums Body}\nobreak\ {\footnotesize {131a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb93b}{93b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape start subset loop}\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\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{nuweb94b}{94b}}$\,\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{nuweb129b}{129b}\NWlink{nuweb129c}{c}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@HAS_WEIGHTS@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\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{scrap249}\raggedright\small
\NWtarget{nuweb131b}{} $\langle\,${\itshape Utils}\nobreak\ {\footnotesize {131b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_setup\_subset}\nobreak\ {\footnotesize \NWlink{nuweb134a}{134a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_setup\_subset\_block}\nobreak\ {\footnotesize \NWlink{nuweb134b}{134b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_order\_subset\_wrt\_block}\nobreak\ {\footnotesize \NWlink{nuweb135a}{135a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_order\_subset\_wrt\_block}\nobreak\ {\footnotesize \NWlink{nuweb133b}{133b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_order\_subset\_wrt\_block}\nobreak\ {\footnotesize \NWlink{nuweb132b}{132b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap250}\raggedright\small
\NWtarget{nuweb132a}{} $\langle\,${\itshape R\_order\_subset\_wrt\_block Prototype}\nobreak\ {\footnotesize {132a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP R_order_subset_wrt_block@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R y Input}\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb28b}{28b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb23b}{23b}\NWlink{nuweb132b}{, 132b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_order_subset_wrt_block@\nobreak\ \NWlink{nuweb132b}{132b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap251}\raggedright\small
\NWtarget{nuweb132b}{} $\langle\,${\itshape R\_order\_subset\_wrt\_block}\nobreak\ {\footnotesize {132b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_order\_subset\_wrt\_block Prototype}\nobreak\ {\footnotesize \NWlink{nuweb132a}{132a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\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{nuweb131b}{131b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_order_subset_wrt_block@\nobreak\ \NWlink{nuweb132a}{132a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb28e}{28e}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@NLEVELS@\nobreak\ \NWlink{nuweb140a}{140a}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb133b}{133b}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb96a}{96a}, \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb118a}{118a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap252}\raggedright\small
\NWtarget{nuweb133a}{} $\langle\,${\itshape RC\_order\_subset\_wrt\_block Prototype}\nobreak\ {\footnotesize {133a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP RC_order_subset_wrt_block@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb28b}{28b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R blockTable Input}\nobreak\ {\footnotesize \NWlink{nuweb28e}{28e}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb133b}{133b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb133b}{133b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap253}\raggedright\small
\NWtarget{nuweb133b}{} $\langle\,${\itshape RC\_order\_subset\_wrt\_block}\nobreak\ {\footnotesize {133b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_order\_subset\_wrt\_block Prototype}\nobreak\ {\footnotesize \NWlink{nuweb133a}{133a}}$\,\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{nuweb131b}{131b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_order_subset_wrt_block@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb40}{, 40}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133a}{, 133a}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb28e}{28e}, \verb@C_order_subset_wrt_block@\nobreak\ \NWlink{nuweb135a}{135a}, \verb@C_setup_subset@\nobreak\ \NWlink{nuweb134a}{134a}, \verb@C_setup_subset_block@\nobreak\ \NWlink{nuweb134b}{134b}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap254}\raggedright\small
\NWtarget{nuweb134a}{} $\langle\,${\itshape C\_setup\_subset}\nobreak\ {\footnotesize {134a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_setup_subset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\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{nuweb131b}{131b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_setup_subset@\nobreak\ \NWlink{nuweb133b}{133b}\NWlink{nuweb136a}{, 136a}.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap255}\raggedright\small
\NWtarget{nuweb134b}{} $\langle\,${\itshape C\_setup\_subset\_block}\nobreak\ {\footnotesize {134b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_setup_subset_block@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb28b}{28b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R blockTable Input}\nobreak\ {\footnotesize \NWlink{nuweb28e}{28e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *cumtable;@\\
\mbox{}\verb@    int Nlevels = LENGTH(blockTable);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    cumtable = 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@    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@    Free(cumtable);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb131b}{131b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_setup_subset_block@\nobreak\ \NWlink{nuweb133b}{133b}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb28e}{28e}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap256}\raggedright\small
\NWtarget{nuweb135a}{} $\langle\,${\itshape C\_order\_subset\_wrt\_block}\nobreak\ {\footnotesize {135a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_order_subset_wrt_block@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R block Input}\nobreak\ {\footnotesize \NWlink{nuweb28b}{28b}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R blockTable Input}\nobreak\ {\footnotesize \NWlink{nuweb28e}{28e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    SEXP ans@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    double *cumtable;@\\
\mbox{}\verb@    int Nlevels = LENGTH(blockTable);@\\
\mbox{}\verb@@\\
\mbox{}\verb@    cumtable = 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@    Free(cumtable);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb131b}{131b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_order_subset_wrt_block@\nobreak\ \NWlink{nuweb133b}{133b}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@blockTable@\nobreak\ \NWlink{nuweb28e}{28e}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap257}\raggedright\small
\NWtarget{nuweb135b}{} $\langle\,${\itshape RC\_setup\_subset Prototype}\nobreak\ {\footnotesize {135b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP RC_setup_subset@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer N Input}\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R weights Input}\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R subset Input}\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@)@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb136a}{136a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@RC_setup_subset@\nobreak\ \NWlink{nuweb136a}{136a}.
\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
\verb|REALSXP|.

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap258}\raggedright\small
\NWtarget{nuweb136a}{} $\langle\,${\itshape RC\_setup\_subset}\nobreak\ {\footnotesize {136a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_setup\_subset Prototype}\nobreak\ {\footnotesize \NWlink{nuweb135b}{135b}}$\,\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{nuweb136b}{136b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_setup_subset@\nobreak\ \NWlink{nuweb40}{40}\NWlink{nuweb135b}{, 135b}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_setup_subset@\nobreak\ \NWlink{nuweb134a}{134a}, \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@Offset0@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@RC_Sums@\nobreak\ \NWlink{nuweb96a}{96a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@weights@\nobreak\ \NWlink{nuweb26c}{26c}, \verb@weights,@\nobreak\ \NWlink{nuweb26d}{26d}\NWlink{nuweb26e}{e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Permutation Helpers}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap259}\raggedright\small
\NWtarget{nuweb136b}{} $\langle\,${\itshape Permutations}\nobreak\ {\footnotesize {136b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_setup\_subset}\nobreak\ {\footnotesize \NWlink{nuweb136a}{136a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_Permute}\nobreak\ {\footnotesize \NWlink{nuweb137a}{137a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_doPermute}\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_PermuteBlock}\nobreak\ {\footnotesize \NWlink{nuweb138a}{138a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_doPermuteBlock}\nobreak\ {\footnotesize \NWlink{nuweb138b}{138b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap260}\raggedright\small
\NWtarget{nuweb137a}{} $\langle\,${\itshape C\_Permute}\nobreak\ {\footnotesize {137a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_Permute@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    double *subset,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb136b}{136b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_Permute@\nobreak\ \NWlink{nuweb137b}{137b}\NWlink{nuweb138a}{, 138a}.\item \NWtxtIdentsUsed\nobreak\  \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap261}\raggedright\small
\NWtarget{nuweb137b}{} $\langle\,${\itshape C\_doPermute}\nobreak\ {\footnotesize {137b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_doPermute@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    double *subset,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb136b}{136b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_doPermute@\nobreak\ \NWlink{nuweb40}{40}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_Permute@\nobreak\ \NWlink{nuweb137a}{137a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap262}\raggedright\small
\NWtarget{nuweb138a}{} $\langle\,${\itshape C\_PermuteBlock}\nobreak\ {\footnotesize {138a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb136b}{136b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_PermuteBlock@\nobreak\ \NWlink{nuweb138b}{138b}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_Permute@\nobreak\ \NWlink{nuweb137a}{137a}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap263}\raggedright\small
\NWtarget{nuweb138b}{} $\langle\,${\itshape C\_doPermuteBlock}\nobreak\ {\footnotesize {138b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@void C_doPermuteBlock@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    double *subset,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Nsubset Input}\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\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{nuweb136b}{136b}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_doPermuteBlock@\nobreak\ \NWlink{nuweb40}{40}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_PermuteBlock@\nobreak\ \NWlink{nuweb138a}{138a}, \verb@Nsubset@\nobreak\ \NWlink{nuweb27c}{27c}, \verb@subset@\nobreak\ \NWlink{nuweb27b}{27b}\NWlink{nuweb27e}{e}\NWlink{nuweb28a}{, 28a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\subsection{Other Utils}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap264}\raggedright\small
\NWtarget{nuweb139a}{} $\langle\,${\itshape MoreUtils}\nobreak\ {\footnotesize {139a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape NROW}\nobreak\ {\footnotesize \NWlink{nuweb139b}{139b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape NCOL}\nobreak\ {\footnotesize \NWlink{nuweb139c}{139c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape NLEVELS}\nobreak\ {\footnotesize \NWlink{nuweb140a}{140a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_kronecker}\nobreak\ {\footnotesize \NWlink{nuweb143}{143}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_kronecker}\nobreak\ {\footnotesize \NWlink{nuweb142}{142}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_kronecker\_sym}\nobreak\ {\footnotesize \NWlink{nuweb144}{144}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_KronSums\_sym}\nobreak\ {\footnotesize \NWlink{nuweb145a}{145a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_MPinv\_sym}\nobreak\ {\footnotesize \NWlink{nuweb147}{147}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_MPinv\_sym}\nobreak\ {\footnotesize \NWlink{nuweb146b}{146b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_unpack\_sym}\nobreak\ {\footnotesize \NWlink{nuweb149}{149}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap265}\raggedright\small
\NWtarget{nuweb139b}{} $\langle\,${\itshape NROW}\nobreak\ {\footnotesize {139b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int NROW@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP x@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    SEXP a;@\\
\mbox{}\verb@    a = getAttrib(x, R_DimSymbol);@\\
\mbox{}\verb@    if (a == R_NilValue) return(XLENGTH(x));@\\
\mbox{}\verb@    if (TYPEOF(a) == REALSXP)@\\
\mbox{}\verb@        return(REAL(a)[0]);@\\
\mbox{}\verb@    return(INTEGER(a)[0]);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb139a}{139a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb6}{6}\NWlink{nuweb8}{, 8}\NWlink{nuweb9a}{, 9a}\NWlink{nuweb9b}{b}\NWlink{nuweb14}{, 14}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb40}{, 40}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb64c}{, 64c}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb142}{, 142}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap266}\raggedright\small
\NWtarget{nuweb139c}{} $\langle\,${\itshape NCOL}\nobreak\ {\footnotesize {139c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int NCOL@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    SEXP x@\\
\mbox{}\verb@) {@\\
\mbox{}\verb@    SEXP a;@\\
\mbox{}\verb@    a = getAttrib(x, R_DimSymbol);@\\
\mbox{}\verb@    if (a == R_NilValue) return(1);@\\
\mbox{}\verb@    if (TYPEOF(a) == REALSXP)@\\
\mbox{}\verb@        return(REAL(a)[1]);@\\
\mbox{}\verb@    return(INTEGER(a)[1]);@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb139a}{139a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@NCOL@\nobreak\ \NWlink{nuweb12}{12}\NWlink{nuweb33}{, 33}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb64c}{, 64c}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb142}{, 142}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap267}\raggedright\small
\NWtarget{nuweb140a}{} $\langle\,${\itshape NLEVELS}\nobreak\ {\footnotesize {140a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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@    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@        return(maxlev);@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@    return(NROW(a));@\\
\mbox{}\verb@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb139a}{139a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@NLEVELS@\nobreak\ \NWlink{nuweb33}{33}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb132b}{, 132b}.\item \NWtxtIdentsUsed\nobreak\  \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\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{scrap268}\raggedright\small
\NWtarget{nuweb140b}{} $\langle\,${\itshape PP12}\nobreak\ {\footnotesize {140b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@PP12@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb47}{, 47}\NWlink{nuweb49}{, 49}\NWlink{nuweb55}{, 55}\NWlink{nuweb83}{, 83}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb158}{, 158}\NWlink{nuweb159a}{, 159a}.\item \NWtxtIdentsUsed\nobreak\  \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap269}\raggedright\small
\NWtarget{nuweb141a}{} $\langle\,${\itshape mPQB}\nobreak\ {\footnotesize {141a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@mPQB@\nobreak\ \NWlink{nuweb38b}{38b}\NWlink{nuweb40}{, 40}\NWlink{nuweb48}{, 48}\NWlink{nuweb51}{, 51}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb74}{, 74}\NWlink{nuweb76a}{, 76a}\NWlink{nuweb80b}{, 80b}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb108}{, 108}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb158}{, 158}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\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{scrap270}\raggedright\small
\NWtarget{nuweb141b}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {141b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap271}\raggedright\small
\NWtarget{nuweb141c}{} $\langle\,${\itshape R\_kronecker Prototype}\nobreak\ {\footnotesize {141c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb23b}{23b}\NWlink{nuweb142}{, 142}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap272}\raggedright\small
\NWtarget{nuweb142}{} $\langle\,${\itshape R\_kronecker}\nobreak\ {\footnotesize {142}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_kronecker Prototype}\nobreak\ {\footnotesize \NWlink{nuweb141c}{141c}}$\,\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{nuweb139a}{139a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@C_kronecker@\nobreak\ \NWlink{nuweb143}{143}, \verb@NCOL@\nobreak\ \NWlink{nuweb139c}{139c}, \verb@NROW@\nobreak\ \NWlink{nuweb139b}{139b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap273}\raggedright\small
\NWtarget{nuweb143}{} $\langle\,${\itshape C\_kronecker}\nobreak\ {\footnotesize {143}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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 i, j, k, l, mr, js, ir;@\\
\mbox{}\verb@    double y;@\\
\mbox{}\verb@@\\
\mbox{}\verb@    if (overwrite) {@\\
\mbox{}\verb@        for (i = 0; i < m * r * n * s; i++) ans[i] = 0.0;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    mr = m * r;@\\
\mbox{}\verb@    for (i = 0; i < m; i++) {@\\
\mbox{}\verb@        ir = i * r;@\\
\mbox{}\verb@        for (j = 0; j < n; j++) {@\\
\mbox{}\verb@            js = j * s;@\\
\mbox{}\verb@            y = A[j*m + i];@\\
\mbox{}\verb@            for (k = 0; k < r; k++) {@\\
\mbox{}\verb@                for (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{nuweb139a}{139a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_kronecker@\nobreak\ \NWlink{nuweb84}{84}\NWlink{nuweb142}{, 142}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap274}\raggedright\small
\NWtarget{nuweb144}{} $\langle\,${\itshape C\_kronecker\_sym}\nobreak\ {\footnotesize {144}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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 i, j, k, l, 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 (i = 0; i < mr * (mr + 1) / 2; i++) ans[i] = 0.0;@\\
\mbox{}\verb@    }@\\
\mbox{}\verb@@\\
\mbox{}\verb@    for (i = 0; i < m; i++) {@\\
\mbox{}\verb@        ir = i * r;@\\
\mbox{}\verb@        for (j = 0; j <= i; j++) {@\\
\mbox{}\verb@            js = j * s;@\\
\mbox{}\verb@            y = A[S(i, j, m)];@\\
\mbox{}\verb@            for (k = 0; k < r; k++) {@\\
\mbox{}\verb@                for (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{nuweb139a}{139a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_kronecker_sym@\nobreak\ \NWlink{nuweb83}{83}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@y@\nobreak\ \NWlink{nuweb25d}{25d}\NWlink{nuweb26a}{, 26a}\NWlink{nuweb26b}{b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap275}\raggedright\small
\NWtarget{nuweb145a}{} $\langle\,${\itshape C\_KronSums\_sym}\nobreak\ {\footnotesize {145a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb25b}{25b}}$\,\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{nuweb139a}{139a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_KronSums_sym@\nobreak\ \NWtxtIdentsNotUsed.\item \NWtxtIdentsUsed\nobreak\  \verb@N@\nobreak\ \NWlink{nuweb24b}{24b}\NWlink{nuweb24c}{c}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\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{scrap276}\raggedright\small
\NWtarget{nuweb145b}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {145b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb146b}{146b}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap277}\raggedright\small
\NWtarget{nuweb146a}{} $\langle\,${\itshape R\_MPinv\_sym Prototype}\nobreak\ {\footnotesize {146a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb23b}{23b}\NWlink{nuweb146b}{, 146b}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb146b}{146b}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap278}\raggedright\small
\NWtarget{nuweb146b}{} $\langle\,${\itshape R\_MPinv\_sym}\nobreak\ {\footnotesize {146b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_MPinv\_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb146a}{146a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@{@\\
\mbox{}\verb@    SEXP ans, names, MPinv, rank;@\\
\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), INTEGER(n)[0], 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{nuweb139a}{139a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb145b}{145b}\NWlink{nuweb146a}{, 146a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap279}\raggedright\small
\NWtarget{nuweb147}{} $\langle\,${\itshape C\_MPinv\_sym}\nobreak\ {\footnotesize {147}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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 = Calloc(n * (n + 1) / 2, double);@\\
\mbox{}\verb@        Memcpy(rx, x, n * (n + 1) / 2);@\\
\mbox{}\verb@        work = Calloc(3 * n, double);@\\
\mbox{}\verb@        val = Calloc(n, double);@\\
\mbox{}\verb@        vec = Calloc(n * n, double);@\\
\mbox{}\verb@@\\
\mbox{}\verb@        F77_CALL(dspev)("V", "L", &n, rx, val, vec, &n, work,@\\
\mbox{}\verb@                        &info);@\\
\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@        Free(rx); Free(work); Free(val); 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{nuweb139a}{139a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\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{scrap280}\raggedright\small
\NWtarget{nuweb148a}{} \verb@"libcoinAPI.h"@\nobreak\ {\footnotesize {148a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb149}{149}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap281}\raggedright\small
\NWtarget{nuweb148b}{} $\langle\,${\itshape R\_unpack\_sym Prototype}\nobreak\ {\footnotesize {148b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb23b}{23b}\NWlink{nuweb149}{, 149}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb149}{149}, \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap282}\raggedright\small
\NWtarget{nuweb149}{} $\langle\,${\itshape R\_unpack\_sym}\nobreak\ {\footnotesize {149}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R\_unpack\_sym Prototype}\nobreak\ {\footnotesize \NWlink{nuweb148b}{148b}}$\,\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{nuweb139a}{139a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb10}{10}\NWlink{nuweb148a}{, 148a}\NWlink{nuweb148b}{b}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.\item \NWtxtIdentsUsed\nobreak\  \verb@x@\nobreak\ \NWlink{nuweb24d}{24d}\NWlink{nuweb25b}{, 25b}\NWlink{nuweb25c}{c}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\section{Memory}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap283}\raggedright\small
\NWtarget{nuweb150a}{} $\langle\,${\itshape Memory}\nobreak\ {\footnotesize {150a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_P}\nobreak\ {\footnotesize \NWlink{nuweb150c}{150c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_Q}\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape PP12}\nobreak\ {\footnotesize \NWlink{nuweb140b}{140b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape mPQB}\nobreak\ {\footnotesize \NWlink{nuweb141a}{141a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_varonly}\nobreak\ {\footnotesize \NWlink{nuweb151b}{151b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_Xfactor}\nobreak\ {\footnotesize \NWlink{nuweb151c}{151c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_LinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb151d}{151d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_Expectation}\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_Variance}\nobreak\ {\footnotesize \NWlink{nuweb152b}{152b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_Covariance}\nobreak\ {\footnotesize \NWlink{nuweb153a}{153a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_ExpectationX}\nobreak\ {\footnotesize \NWlink{nuweb153b}{153b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_ExpectationInfluence}\nobreak\ {\footnotesize \NWlink{nuweb153c}{153c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_CovarianceInfluence}\nobreak\ {\footnotesize \NWlink{nuweb154a}{154a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_VarianceInfluence}\nobreak\ {\footnotesize \NWlink{nuweb154b}{154b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_TableBlock}\nobreak\ {\footnotesize \NWlink{nuweb154c}{154c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_Sumweights}\nobreak\ {\footnotesize \NWlink{nuweb155a}{155a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_Table}\nobreak\ {\footnotesize \NWlink{nuweb155b}{155b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_dimTable}\nobreak\ {\footnotesize \NWlink{nuweb155c}{155c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_B}\nobreak\ {\footnotesize \NWlink{nuweb156a}{156a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_nresample}\nobreak\ {\footnotesize \NWlink{nuweb156b}{156b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_PermutedLinearStatistic}\nobreak\ {\footnotesize \NWlink{nuweb156c}{156c}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C\_get\_tol}\nobreak\ {\footnotesize \NWlink{nuweb156d}{156d}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_init\_LECV\_1d}\nobreak\ {\footnotesize \NWlink{nuweb159b}{159b}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape RC\_init\_LECV\_2d}\nobreak\ {\footnotesize \NWlink{nuweb160}{160}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb24a}{24a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap284}\raggedright\small
\NWtarget{nuweb150b}{} $\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize {150b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP LECV@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb54}{54}\NWlink{nuweb56b}{, 56b}\NWlink{nuweb150c}{, 150c}\NWlink{nuweb151a}{, 151a}\NWlink{nuweb151b}{b}\NWlink{nuweb151c}{c}\NWlink{nuweb151d}{d}\NWlink{nuweb152a}{, 152a}\NWlink{nuweb152b}{b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}.
\item \NWtxtIdentsDefed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb41b}{41b}\NWlink{nuweb41c}{c}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb55}{, 55}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb58}{, 58}\NWlink{nuweb59}{, 59}\NWlink{nuweb72b}{, 72b}\NWlink{nuweb74}{, 74}\NWlink{nuweb150c}{, 150c}\NWlink{nuweb151a}{, 151a}\NWlink{nuweb151b}{b}\NWlink{nuweb151c}{c}\NWlink{nuweb151d}{d}\NWlink{nuweb152a}{, 152a}\NWlink{nuweb152b}{b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap285}\raggedright\small
\NWtarget{nuweb150c}{} $\langle\,${\itshape C\_get\_P}\nobreak\ {\footnotesize {150c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int C_get_P@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_P@\nobreak\ \NWlink{nuweb35a}{35a}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb49}{, 49}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb59}{, 59}\NWlink{nuweb74}{, 74}\NWlink{nuweb152b}{, 152b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb156b}{, 156b}.\item \NWtxtIdentsUsed\nobreak\  \verb@dim_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap286}\raggedright\small
\NWtarget{nuweb151a}{} $\langle\,${\itshape C\_get\_Q}\nobreak\ {\footnotesize {151a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int C_get_Q@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Q@\nobreak\ \NWlink{nuweb35a}{35a}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb49}{, 49}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb74}{, 74}\NWlink{nuweb152b}{, 152b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb156b}{, 156b}.\item \NWtxtIdentsUsed\nobreak\  \verb@dim_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap287}\raggedright\small
\NWtarget{nuweb151b}{} $\langle\,${\itshape C\_get\_varonly}\nobreak\ {\footnotesize {151b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int C_get_varonly@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_varonly@\nobreak\ \NWlink{nuweb34}{34}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb38b}{, 38b}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb49}{, 49}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}\NWlink{nuweb153a}{, 153a}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@varonly_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap288}\raggedright\small
\NWtarget{nuweb151c}{} $\langle\,${\itshape C\_get\_Xfactor}\nobreak\ {\footnotesize {151c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int C_get_Xfactor@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Xfactor@\nobreak\ \NWlink{nuweb49}{49}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@Xfactor_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap289}\raggedright\small
\NWtarget{nuweb151d}{} $\langle\,${\itshape C\_get\_LinearStatistic}\nobreak\ {\footnotesize {151d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_LinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb35b}{35b}\NWlink{nuweb48}{, 48}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}\NWlink{nuweb159a}{, 159a}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@LinearStatistic_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap290}\raggedright\small
\NWtarget{nuweb152a}{} $\langle\,${\itshape C\_get\_Expectation}\nobreak\ {\footnotesize {152a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_Expectation@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb37a}{37a}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}\NWlink{nuweb159a}{, 159a}.\item \NWtxtIdentsUsed\nobreak\  \verb@Expectation_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap291}\raggedright\small
\NWtarget{nuweb152b}{} $\langle\,${\itshape C\_get\_Variance}\nobreak\ {\footnotesize {152b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_Variance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Variance@\nobreak\ \NWlink{nuweb37c}{37c}\NWlink{nuweb38b}{, 38b}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb159a}{, 159a}.\item \NWtxtIdentsUsed\nobreak\  \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@C_get_P@\nobreak\ \NWlink{nuweb150c}{150c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb151a}{151a}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@S@\nobreak\ \NWlink{nuweb22a}{22a}, \verb@Variance_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap292}\raggedright\small
\NWtarget{nuweb153a}{} $\langle\,${\itshape C\_get\_Covariance}\nobreak\ {\footnotesize {153a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_Covariance@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb38a}{38a}\NWlink{nuweb38b}{b}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}\NWlink{nuweb159a}{, 159a}.\item \NWtxtIdentsUsed\nobreak\  \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@C_get_P@\nobreak\ \NWlink{nuweb150c}{150c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb151a}{151a}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb152b}{152b}, \verb@C_get_varonly@\nobreak\ \NWlink{nuweb151b}{151b}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap293}\raggedright\small
\NWtarget{nuweb153b}{} $\langle\,${\itshape C\_get\_ExpectationX}\nobreak\ {\footnotesize {153b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_ExpectationX@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_ExpectationX@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb49}{, 49}\NWlink{nuweb74}{, 74}.\item \NWtxtIdentsUsed\nobreak\  \verb@ExpectationX_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap294}\raggedright\small
\NWtarget{nuweb153c}{} $\langle\,${\itshape C\_get\_ExpectationInfluence}\nobreak\ {\footnotesize {153c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_ExpectationInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_ExpectationInfluence@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb49}{, 49}\NWlink{nuweb159a}{, 159a}.\item \NWtxtIdentsUsed\nobreak\  \verb@ExpectationInfluence_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap295}\raggedright\small
\NWtarget{nuweb154a}{} $\langle\,${\itshape C\_get\_CovarianceInfluence}\nobreak\ {\footnotesize {154a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_CovarianceInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb47}{, 47}\NWlink{nuweb74}{, 74}\NWlink{nuweb159a}{, 159a}.\item \NWtxtIdentsUsed\nobreak\  \verb@CovarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap296}\raggedright\small
\NWtarget{nuweb154b}{} $\langle\,${\itshape C\_get\_VarianceInfluence}\nobreak\ {\footnotesize {154b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_VarianceInfluence@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb47}{, 47}\NWlink{nuweb74}{, 74}\NWlink{nuweb159a}{, 159a}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@VarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap297}\raggedright\small
\NWtarget{nuweb154c}{} $\langle\,${\itshape C\_get\_TableBlock}\nobreak\ {\footnotesize {154c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_TableBlock@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_TableBlock@\nobreak\ \NWlink{nuweb36a}{36a}.\item \NWtxtIdentsUsed\nobreak\  \verb@block@\nobreak\ \NWlink{nuweb28b}{28b}\NWlink{nuweb28d}{d}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap298}\raggedright\small
\NWtarget{nuweb155a}{} $\langle\,${\itshape C\_get\_Sumweights}\nobreak\ {\footnotesize {155a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_Sumweights@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Sumweights@\nobreak\ \NWlink{nuweb36a}{36a}\NWlink{nuweb49}{, 49}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@sumweights@\nobreak\ \NWlink{nuweb27a}{27a}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap299}\raggedright\small
\NWtarget{nuweb155b}{} $\langle\,${\itshape C\_get\_Table}\nobreak\ {\footnotesize {155b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_Table@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_Table@\nobreak\ \NWlink{nuweb44}{44}\NWlink{nuweb49}{, 49}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap300}\raggedright\small
\NWtarget{nuweb155c}{} $\langle\,${\itshape C\_get\_dimTable}\nobreak\ {\footnotesize {155c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int* C_get_dimTable@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_dimTable@\nobreak\ \NWlink{nuweb49}{49}\NWlink{nuweb156a}{, 156a}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap301}\raggedright\small
\NWtarget{nuweb156a}{} $\langle\,${\itshape C\_get\_B}\nobreak\ {\footnotesize {156a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int C_get_B@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_B@\nobreak\ \NWlink{nuweb35a}{35a}\NWlink{nuweb49}{, 49}\NWlink{nuweb74}{, 74}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_dimTable@\nobreak\ \NWlink{nuweb155c}{155c}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap302}\raggedright\small
\NWtarget{nuweb156b}{} $\langle\,${\itshape C\_get\_nresample}\nobreak\ {\footnotesize {156b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@R_xlen_t C_get_nresample@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_nresample@\nobreak\ \NWlink{nuweb42a}{42a}\NWlink{nuweb55}{, 55}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb59}{, 59}\NWlink{nuweb74}{, 74}.\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_P@\nobreak\ \NWlink{nuweb150c}{150c}, \verb@C_get_Q@\nobreak\ \NWlink{nuweb151a}{151a}, \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap303}\raggedright\small
\NWtarget{nuweb156c}{} $\langle\,${\itshape C\_get\_PermutedLinearStatistic}\nobreak\ {\footnotesize {156c}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double* C_get_PermutedLinearStatistic@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb42a}{42a}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap304}\raggedright\small
\NWtarget{nuweb156d}{} $\langle\,${\itshape C\_get\_tol}\nobreak\ {\footnotesize {156d}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@double C_get_tol@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape R LECV Input}\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@C_get_tol@\nobreak\ \NWlink{nuweb42a}{42a}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}.\item \NWtxtIdentsUsed\nobreak\  \verb@LECV@\nobreak\ \NWlink{nuweb150b}{150b}, \verb@tol_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap305}\raggedright\small
\NWtarget{nuweb157a}{} $\langle\,${\itshape Memory Input Checks}\nobreak\ {\footnotesize {157a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb158}{158}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap306}\raggedright\small
\NWtarget{nuweb157b}{} $\langle\,${\itshape Memory Names}\nobreak\ {\footnotesize {157b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb158}{158}.
\item \NWtxtIdentsUsed\nobreak\  \verb@CovarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@dim_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@ExpectationInfluence_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@ExpectationX_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Expectation_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@LinearStatistic_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@StandardisedPermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@tol_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@VarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Variance_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@varonly_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Xfactor_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap307}\raggedright\small
\NWtarget{nuweb158}{} $\langle\,${\itshape R\_init\_LECV}\nobreak\ {\footnotesize {158}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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{nuweb157a}{157a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@PQ = mPQB(P, Q, 1);@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape Memory Names}\nobreak\ {\footnotesize \NWlink{nuweb157b}{157b}}$\,\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{nuweb159a}{159a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtMacroRefIn\ \NWlink{nuweb159b}{159b}\NWlink{nuweb160}{, 160}.
\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@CovarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Covariance_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@dim_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@ExpectationInfluence_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@ExpectationX_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Expectation_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@LinearStatistic_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@mPQB@\nobreak\ \NWlink{nuweb141a}{141a}, \verb@P@\nobreak\ \NWlink{nuweb25a}{25a}, \verb@PermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@PP12@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}, \verb@StandardisedPermutedLinearStatistic_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@tol_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@VarianceInfluence_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Variance_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@varonly_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@Xfactor_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap308}\raggedright\small
\NWtarget{nuweb159a}{} $\langle\,${\itshape Initialise Zero}\nobreak\ {\footnotesize {159a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@/* set inital 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{nuweb158}{158}.
\item \NWtxtIdentsUsed\nobreak\  \verb@C_get_Covariance@\nobreak\ \NWlink{nuweb153a}{153a}, \verb@C_get_CovarianceInfluence@\nobreak\ \NWlink{nuweb154a}{154a}, \verb@C_get_Expectation@\nobreak\ \NWlink{nuweb152a}{152a}, \verb@C_get_ExpectationInfluence@\nobreak\ \NWlink{nuweb153c}{153c}, \verb@C_get_LinearStatistic@\nobreak\ \NWlink{nuweb151d}{151d}, \verb@C_get_Variance@\nobreak\ \NWlink{nuweb152b}{152b}, \verb@C_get_VarianceInfluence@\nobreak\ \NWlink{nuweb154b}{154b}, \verb@PP12@\nobreak\ \NWlink{nuweb140b}{140b}, \verb@Q@\nobreak\ \NWlink{nuweb25e}{25e}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap309}\raggedright\small
\NWtarget{nuweb159b}{} $\langle\,${\itshape RC\_init\_LECV\_1d}\nobreak\ {\footnotesize {159b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP RC_init_LECV_1d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    int varonly,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer B Input}\nobreak\ {\footnotesize \NWlink{nuweb28c}{28c}}$\,\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{nuweb158}{158}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_init_LECV_1d@\nobreak\ \NWlink{nuweb32c}{32c}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@Sumweights_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}, \verb@TableBlock_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap310}\raggedright\small
\NWtarget{nuweb160}{} $\langle\,${\itshape RC\_init\_LECV\_2d}\nobreak\ {\footnotesize {160}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@SEXP RC_init_LECV_2d@\\
\mbox{}\verb@(@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer P Input}\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$}\verb@,@\\
\mbox{}\verb@    @\hbox{$\langle\,${\itshape C integer Q Input}\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\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{nuweb28c}{28c}}$\,\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{nuweb158}{158}}$\,\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{nuweb150a}{150a}.
\item \NWtxtIdentsDefed\nobreak\  \verb@RC_init_LECV_2d@\nobreak\ \NWlink{nuweb44}{44}.\item \NWtxtIdentsUsed\nobreak\  \verb@B@\nobreak\ \NWlink{nuweb28c}{28c}, \verb@Table_SLOT@\nobreak\ \NWlink{nuweb22b}{22b}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\chapter{Package Infrastructure}

\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap311}\raggedright\small
\NWtarget{nuweb161a}{} \verb@"AAA.R"@\nobreak\ {\footnotesize {161a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape R Header}\nobreak\ {\footnotesize \NWlink{nuweb165a}{165a}}$\,\rangle$}\verb@@\\
\mbox{}\verb@.onUnload <- 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{scrap312}\raggedright\small
\NWtarget{nuweb161b}{} \verb@"DESCRIPTION"@\nobreak\ {\footnotesize {161b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@Package: libcoin@\\
\mbox{}\verb@Title: Linear Test Statistics for Permutation Inference@\\
\mbox{}\verb@Date: 2019-08-22@\\
\mbox{}\verb@Version: 1.0-5@\\
\mbox{}\verb@Authors@{\tt @}\verb@R: person("Torsten", "Hothorn", role = c("aut", "cre"),@\\
\mbox{}\verb@                  email = "Torsten.Hothorn@{\tt @}\verb@R-project.org")@\\
\mbox{}\verb@Description: Basic infrastructure for linear test statistics and permutation@\\
\mbox{}\verb@  inference in the framework of Strasser and Weber (1999) <http://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@\\
\mbox{}\verb@Imports: stats, mvtnorm@\\
\mbox{}\verb@LinkingTo: mvtnorm@\\
\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{scrap313}\raggedright\small
\NWtarget{nuweb161c}{} \verb@"NAMESPACE"@\nobreak\ {\footnotesize {161c}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\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@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 \verb|-g| to \verb|PKG\_CFLAGS| for \verb|operf| profiling (this is
not portable).
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap314}\raggedright\small
\NWtarget{nuweb162a}{} \verb@"Makevars"@\nobreak\ {\footnotesize {162a}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\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{scrap315}\raggedright\small
\NWtarget{nuweb162b}{} \verb@"libcoin-win.def"@\nobreak\ {\footnotesize {162b}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\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{scrap316}\raggedright\small
\NWtarget{nuweb163}{} \verb@"libcoin-init.c"@\nobreak\ {\footnotesize {163}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@@\hbox{$\langle\,${\itshape C Header}\nobreak\ {\footnotesize \NWlink{nuweb165b}{165b}}$\,\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@    {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{nuweb163}{163}\NWlink{nuweb164}{, 164}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_colSums@\nobreak\ \NWlink{nuweb113b}{113b}, \verb@R_CovarianceInfluence@\nobreak\ \NWlink{nuweb87a}{87a}, \verb@R_CovarianceX@\nobreak\ \NWlink{nuweb92a}{92a}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb32c}{32c}, \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb44}{44}, \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb85b}{85b}, \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb89a}{89a}, \verb@R_KronSums@\nobreak\ \NWlink{nuweb100a}{100a}, \verb@R_KronSums_Permutation@\nobreak\ \NWlink{nuweb109b}{109b}, \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb146b}{146b}, \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb118a}{118a}, \verb@R_order_subset_wrt_block@\nobreak\ \NWlink{nuweb132b}{132b}, \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb40}{40}, \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb51}{51}, \verb@R_quadform@\nobreak\ \NWlink{nuweb64c}{64c}, \verb@R_Sums@\nobreak\ \NWlink{nuweb95b}{95b}, \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb122b}{122b}, \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb149}{149}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap317}\raggedright\small
\NWtarget{nuweb164}{} \verb@"libcoin-init.c"@\nobreak\ {\footnotesize {164}}$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\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@}@\\
\mbox{}\verb@@{\NWsep}
\end{list}
\vspace{-1.5ex}
\footnotesize
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \NWtxtFileDefBy\ \NWlink{nuweb163}{163}\NWlink{nuweb164}{, 164}.
\item \NWtxtIdentsUsed\nobreak\  \verb@R_colSums@\nobreak\ \NWlink{nuweb113b}{113b}, \verb@R_CovarianceInfluence@\nobreak\ \NWlink{nuweb87a}{87a}, \verb@R_CovarianceX@\nobreak\ \NWlink{nuweb92a}{92a}, \verb@R_ExpectationCovarianceStatistic@\nobreak\ \NWlink{nuweb32c}{32c}, \verb@R_ExpectationCovarianceStatistic_2d@\nobreak\ \NWlink{nuweb44}{44}, \verb@R_ExpectationInfluence@\nobreak\ \NWlink{nuweb85b}{85b}, \verb@R_ExpectationX@\nobreak\ \NWlink{nuweb89a}{89a}, \verb@R_KronSums@\nobreak\ \NWlink{nuweb100a}{100a}, \verb@R_KronSums_Permutation@\nobreak\ \NWlink{nuweb109b}{109b}, \verb@R_MPinv_sym@\nobreak\ \NWlink{nuweb146b}{146b}, \verb@R_OneTableSums@\nobreak\ \NWlink{nuweb118a}{118a}, \verb@R_order_subset_wrt_block@\nobreak\ \NWlink{nuweb132b}{132b}, \verb@R_PermutedLinearStatistic@\nobreak\ \NWlink{nuweb40}{40}, \verb@R_PermutedLinearStatistic_2d@\nobreak\ \NWlink{nuweb51}{51}, \verb@R_quadform@\nobreak\ \NWlink{nuweb64c}{64c}, \verb@R_Sums@\nobreak\ \NWlink{nuweb95b}{95b}, \verb@R_ThreeTableSums@\nobreak\ \NWlink{nuweb127b}{127b}, \verb@R_TwoTableSums@\nobreak\ \NWlink{nuweb122b}{122b}, \verb@R_unpack_sym@\nobreak\ \NWlink{nuweb149}{149}.
\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap318}\raggedright\small
\NWtarget{nuweb165a}{} $\langle\,${\itshape R Header}\nobreak\ {\footnotesize {165a}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@###    Copyright (C) 2017-2019 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{nuweb16}{, 16}\NWlink{nuweb161a}{, 161a}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth}\label{scrap319}\raggedright\small
\NWtarget{nuweb165b}{} $\langle\,${\itshape C Header}\nobreak\ {\footnotesize {165b}}$\,\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@/*@\\
\mbox{}\verb@    Copyright (C) 2017-2019 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{nuweb21a}{21a}\NWlink{nuweb23a}{, 23a}\NWlink{nuweb23c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb163}{, 163}.

\item{}
\end{list}
\end{minipage}\vspace{4ex}
\end{flushleft}
\chapter*{Index}

\section*{Files}


{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \verb@"AAA.R"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb161a}{161a}.}
\item \verb@"ctabs.R"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb16}{16}.}
\item \verb@"ctabs.Rd"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb20}{20}.}
\item \verb@"DESCRIPTION"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb161b}{161b}.}
\item \verb@"doTest.Rd"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb19}{19}.}
\item \verb@"libcoin-init.c"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb163}{163}\NWlink{nuweb164}{, 164}.
}
\item \verb@"libcoin-win.def"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb162b}{162b}.}
\item \verb@"libcoin.c"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb23c}{23c}.}
\item \verb@"libcoin.h"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb23a}{23a}.}
\item \verb@"libcoin.R"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb3a}{3a}.}
\item \verb@"libcoinAPI.h"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb32a}{32a}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb41b}{, 41b}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb53b}{, 53b}\NWlink{nuweb64a}{, 64a}\NWlink{nuweb141b}{, 141b}\NWlink{nuweb145b}{, 145b}\NWlink{nuweb148a}{, 148a}.
}
\item \verb@"libcoin_internal.h"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb21a}{21a}.}
\item \verb@"LinStatExpCov.Rd"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb18}{18}.}
\item \verb@"Makevars"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb162a}{162a}.}
\item \verb@"NAMESPACE"@ {\footnotesize {\NWtxtDefBy} \NWlink{nuweb161c}{161c}.}
\end{list}}

\section*{Fragments}


{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item $\langle\,$2d Covariance\nobreak\ {\footnotesize \NWlink{nuweb47}{47}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb48}{48}.}
\item $\langle\,$2d Expectation\nobreak\ {\footnotesize \NWlink{nuweb46c}{46c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb48}{48}.}
\item $\langle\,$2d Memory\nobreak\ {\footnotesize \NWlink{nuweb49}{49}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb48}{48}.}
\item $\langle\,$2d Total Table\nobreak\ {\footnotesize \NWlink{nuweb46a}{46a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb48}{48}.}
\item $\langle\,$2d User Interface\nobreak\ {\footnotesize \NWlink{nuweb42b}{42b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$2d User Interface Input\nobreak\ {\footnotesize \NWlink{nuweb42c}{42c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb43a}{43a}\NWlink{nuweb48}{, 48}.
}
\item $\langle\,$C colSums Answer\nobreak\ {\footnotesize \NWlink{nuweb114c}{114c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb85c}{85c}\NWlink{nuweb113c}{, 113c}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb115b}{b}\NWlink{nuweb115c}{c}\NWlink{nuweb116a}{, 116a}.
}
\item $\langle\,$C colSums Input\nobreak\ {\footnotesize \NWlink{nuweb114b}{114b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb113c}{113c}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb115b}{b}\NWlink{nuweb115c}{c}\NWlink{nuweb116a}{, 116a}.
}
\item $\langle\,$C Global Variables\nobreak\ {\footnotesize \NWlink{nuweb22b}{22b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb21a}{21a}.}
\item $\langle\,$C Header\nobreak\ {\footnotesize \NWlink{nuweb165b}{165b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb21a}{21a}\NWlink{nuweb23a}{, 23a}\NWlink{nuweb23c}{c}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb163}{, 163}.
}
\item $\langle\,$C integer B Input\nobreak\ {\footnotesize \NWlink{nuweb28c}{28c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb28d}{28d}\NWlink{nuweb34}{, 34}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb160}{, 160}.
}
\item $\langle\,$C integer block Input\nobreak\ {\footnotesize \NWlink{nuweb28d}{28d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb128c}{128c}.}
\item $\langle\,$C integer N Input\nobreak\ {\footnotesize \NWlink{nuweb24c}{24c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb25b}{25b}\NWlink{nuweb25c}{c}\NWlink{nuweb34}{, 34}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb85c}{c}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87b}{b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb89b}{b}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb92b}{b}\NWlink{nuweb95c}{, 95c}\NWlink{nuweb96b}{, 96b}\NWlink{nuweb97a}{, 97a}\NWlink{nuweb97b}{b}\NWlink{nuweb97c}{c}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb109c}{c}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133a}{, 133a}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb135b}{, 135b}.
}
\item $\langle\,$C integer Nsubset Input\nobreak\ {\footnotesize \NWlink{nuweb27c}{27c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb27d}{27d}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb137a}{, 137a}\NWlink{nuweb137b}{b}\NWlink{nuweb138b}{, 138b}.
}
\item $\langle\,$C integer P Input\nobreak\ {\footnotesize \NWlink{nuweb25a}{25a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb25b}{25b}\NWlink{nuweb25c}{c}\NWlink{nuweb34}{, 34}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb160}{, 160}.
}
\item $\langle\,$C integer Q Input\nobreak\ {\footnotesize \NWlink{nuweb25e}{25e}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb26a}{26a}\NWlink{nuweb26b}{b}\NWlink{nuweb34}{, 34}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb85c}{c}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87b}{b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb160}{, 160}.
}
\item $\langle\,$C integer subset Input\nobreak\ {\footnotesize \NWlink{nuweb27e}{27e}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb97b}{97b}\NWlink{nuweb97c}{c}\NWlink{nuweb104b}{, 104b}\NWlink{nuweb104c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107b}{b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb115c}{, 115c}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb120c}{, 120c}\NWlink{nuweb121a}{, 121a}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb125b}{b}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{b}.
}
\item $\langle\,$C integer weights Input\nobreak\ {\footnotesize \NWlink{nuweb26d}{26d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb97a}{97a}\NWlink{nuweb97b}{b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb104b}{b}\NWlink{nuweb106c}{, 106c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb115b}{, 115b}\NWlink{nuweb115c}{c}\NWlink{nuweb120b}{, 120b}\NWlink{nuweb120c}{c}\NWlink{nuweb124c}{, 124c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb129c}{, 129c}\NWlink{nuweb130a}{, 130a}.
}
\item $\langle\,$C integer x Input\nobreak\ {\footnotesize \NWlink{nuweb25c}{25c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106a}{106a}\NWlink{nuweb111c}{, 111c}\NWlink{nuweb112a}{, 112a}\NWlink{nuweb119b}{, 119b}\NWlink{nuweb123c}{, 123c}\NWlink{nuweb128c}{, 128c}.
}
\item $\langle\,$C integer y Input\nobreak\ {\footnotesize \NWlink{nuweb26b}{26b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123c}{123c}\NWlink{nuweb128c}{, 128c}.
}
\item $\langle\,$C KronSums Answer\nobreak\ {\footnotesize \NWlink{nuweb101d}{101d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb81c}{81c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb104b}{b}\NWlink{nuweb104c}{c}\NWlink{nuweb106b}{, 106b}\NWlink{nuweb106c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107b}{b}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb111c}{c}\NWlink{nuweb112a}{, 112a}.
}
\item $\langle\,$C KronSums Input\nobreak\ {\footnotesize \NWlink{nuweb101c}{101c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb103b}{103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb104b}{b}\NWlink{nuweb104c}{c}.
}
\item $\langle\,$C Macros\nobreak\ {\footnotesize \NWlink{nuweb22a}{22a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb21a}{21a}.}
\item $\langle\,$C OneTableSums Answer\nobreak\ {\footnotesize \NWlink{nuweb119c}{119c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb89b}{89b}\NWlink{nuweb118b}{, 118b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb120b}{b}\NWlink{nuweb120c}{c}\NWlink{nuweb121a}{, 121a}.
}
\item $\langle\,$C OneTableSums Input\nobreak\ {\footnotesize \NWlink{nuweb119b}{119b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb118b}{118b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb120b}{b}\NWlink{nuweb120c}{c}\NWlink{nuweb121a}{, 121a}.
}
\item $\langle\,$C real subset Input\nobreak\ {\footnotesize \NWlink{nuweb28a}{28a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb96b}{96b}\NWlink{nuweb97a}{, 97a}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb106b}{, 106b}\NWlink{nuweb106c}{c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111c}{, 111c}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb115b}{b}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb120b}{b}\NWlink{nuweb124b}{, 124b}\NWlink{nuweb124c}{c}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb129c}{c}.
}
\item $\langle\,$C real weights Input\nobreak\ {\footnotesize \NWlink{nuweb26e}{26e}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb96b}{96b}\NWlink{nuweb97c}{, 97c}\NWlink{nuweb103b}{, 103b}\NWlink{nuweb104c}{, 104c}\NWlink{nuweb106b}{, 106b}\NWlink{nuweb107b}{, 107b}\NWlink{nuweb115a}{, 115a}\NWlink{nuweb116a}{, 116a}\NWlink{nuweb120a}{, 120a}\NWlink{nuweb121a}{, 121a}\NWlink{nuweb124b}{, 124b}\NWlink{nuweb125b}{, 125b}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb130b}{, 130b}.
}
\item $\langle\,$C real x Input\nobreak\ {\footnotesize \NWlink{nuweb25b}{25b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb101c}{101c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb114b}{, 114b}\NWlink{nuweb145a}{, 145a}.
}
\item $\langle\,$C real y Input\nobreak\ {\footnotesize \NWlink{nuweb26a}{26a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb81c}{81c}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb101c}{c}\NWlink{nuweb106a}{, 106a}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb110b}{, 110b}\NWlink{nuweb111a}{, 111a}\NWlink{nuweb111c}{c}\NWlink{nuweb112a}{, 112a}.
}
\item $\langle\,$C subset range Input\nobreak\ {\footnotesize \NWlink{nuweb27d}{27d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb27e}{27e}\NWlink{nuweb28a}{, 28a}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb85c}{, 85c}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb95c}{, 95c}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb109c}{, 109c}\NWlink{nuweb113c}{, 113c}\NWlink{nuweb118b}{, 118b}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb128a}{, 128a}.
}
\item $\langle\,$C sumweights Input\nobreak\ {\footnotesize \NWlink{nuweb27a}{27a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb83}{83}\NWlink{nuweb84}{, 84}\NWlink{nuweb85c}{, 85c}\NWlink{nuweb87b}{, 87b}.
}
\item $\langle\,$C ThreeTableSums Answer\nobreak\ {\footnotesize \NWlink{nuweb129a}{129a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb128a}{128a}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb129c}{c}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{b}.
}
\item $\langle\,$C ThreeTableSums Input\nobreak\ {\footnotesize \NWlink{nuweb128c}{128c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb128a}{128a}\NWlink{nuweb129b}{, 129b}\NWlink{nuweb129c}{c}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{b}.
}
\item $\langle\,$C TwoTableSums Answer\nobreak\ {\footnotesize \NWlink{nuweb124a}{124a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123a}{123a}\NWlink{nuweb124b}{, 124b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb125b}{b}.
}
\item $\langle\,$C TwoTableSums Input\nobreak\ {\footnotesize \NWlink{nuweb123c}{123c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123a}{123a}\NWlink{nuweb124b}{, 124b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb125b}{b}.
}
\item $\langle\,$C XfactorKronSums Input\nobreak\ {\footnotesize \NWlink{nuweb106a}{106a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}\NWlink{nuweb106c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107b}{b}.
}
\item $\langle\,$Check ix\nobreak\ {\footnotesize \NWlink{nuweb9a}{9a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb8}{8}\NWlink{nuweb16}{, 16}.
}
\item $\langle\,$Check iy\nobreak\ {\footnotesize \NWlink{nuweb9b}{9b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb8}{8}\NWlink{nuweb16}{, 16}.
}
\item $\langle\,$Check weights, subset, block\nobreak\ {\footnotesize \NWlink{nuweb5a}{5a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb6}{6}\NWlink{nuweb8}{, 8}\NWlink{nuweb16}{, 16}.
}
\item $\langle\,$Col Row Total Sums\nobreak\ {\footnotesize \NWlink{nuweb46b}{46b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb48}{48}\NWlink{nuweb51}{, 51}.
}
\item $\langle\,$colSums\nobreak\ {\footnotesize \NWlink{nuweb112c}{112c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$colSums Body\nobreak\ {\footnotesize \NWlink{nuweb116b}{116b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb115a}{115a}\NWlink{nuweb115b}{b}\NWlink{nuweb115c}{c}\NWlink{nuweb116a}{, 116a}.
}
\item $\langle\,$Compute Covariance Influence\nobreak\ {\footnotesize \NWlink{nuweb37b}{37b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb34}{34}.}
\item $\langle\,$Compute Covariance Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb38a}{38a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb34}{34}.}
\item $\langle\,$Compute Expectation Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb37a}{37a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb34}{34}.}
\item $\langle\,$Compute Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb35b}{35b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb34}{34}.}
\item $\langle\,$Compute maxstat Permutation P-Value\nobreak\ {\footnotesize \NWlink{nuweb77}{77}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb73}{73}\NWlink{nuweb78}{, 78}.
}
\item $\langle\,$Compute maxstat Test Statistic\nobreak\ {\footnotesize \NWlink{nuweb76c}{76c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb73}{73}\NWlink{nuweb78}{, 78}.
}
\item $\langle\,$Compute maxstat Variance / Covariance Directly\nobreak\ {\footnotesize \NWlink{nuweb76b}{76b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb73}{73}.}
\item $\langle\,$Compute maxstat Variance / Covariance from Total Covariance\nobreak\ {\footnotesize \NWlink{nuweb76a}{76a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb73}{73}.}
\item $\langle\,$Compute Permuted Linear Statistic 2d\nobreak\ {\footnotesize \NWlink{nuweb52d}{52d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb51}{51}.}
\item $\langle\,$Compute Sum of Weights in Block\nobreak\ {\footnotesize \NWlink{nuweb36b}{36b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb34}{34}.}
\item $\langle\,$Compute unordered maxstat Linear Statistic and Expectation\nobreak\ {\footnotesize \NWlink{nuweb80a}{80a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb78}{78}.}
\item $\langle\,$Compute unordered maxstat Variance / Covariance Directly\nobreak\ {\footnotesize \NWlink{nuweb81a}{81a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb78}{78}.}
\item $\langle\,$Compute unordered maxstat Variance / Covariance from Total Covariance\nobreak\ {\footnotesize \NWlink{nuweb80b}{80b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb78}{78}.}
\item $\langle\,$Compute Variance from Covariance\nobreak\ {\footnotesize \NWlink{nuweb38b}{38b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb34}{34}.}
\item $\langle\,$Compute Variance Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb37c}{37c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb34}{34}.}
\item $\langle\,$continue subset loop\nobreak\ {\footnotesize \NWlink{nuweb94b}{94b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98a}{98a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb126}{, 126}\NWlink{nuweb131a}{, 131a}.
}
\item $\langle\,$Contrasts\nobreak\ {\footnotesize \NWlink{nuweb14}{14}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}.}
\item $\langle\,$Convert Table to Integer\nobreak\ {\footnotesize \NWlink{nuweb52a}{52a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb51}{51}.}
\item $\langle\,$Count Levels\nobreak\ {\footnotesize \NWlink{nuweb79a}{79a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb78}{78}.}
\item $\langle\,$ctabs Prototype\nobreak\ {\footnotesize \NWlink{nuweb15}{15}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb16}{16}\NWlink{nuweb20}{, 20}.
}
\item $\langle\,$C\_chisq\_pvalue\nobreak\ {\footnotesize \NWlink{nuweb67c}{67c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb67b}{67b}.}
\item $\langle\,$C\_colSums\_dweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb115a}{115a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb112c}{112c}.}
\item $\langle\,$C\_colSums\_dweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb116a}{116a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb112c}{112c}.}
\item $\langle\,$C\_colSums\_iweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb115b}{115b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb112c}{112c}.}
\item $\langle\,$C\_colSums\_iweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb115c}{115c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb112c}{112c}.}
\item $\langle\,$C\_CovarianceLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb83}{83}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$C\_doPermute\nobreak\ {\footnotesize \NWlink{nuweb137b}{137b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb136b}{136b}.}
\item $\langle\,$C\_doPermuteBlock\nobreak\ {\footnotesize \NWlink{nuweb138b}{138b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb136b}{136b}.}
\item $\langle\,$C\_ExpectationLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb82b}{82b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$C\_get\_B\nobreak\ {\footnotesize \NWlink{nuweb156a}{156a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_Covariance\nobreak\ {\footnotesize \NWlink{nuweb153a}{153a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_CovarianceInfluence\nobreak\ {\footnotesize \NWlink{nuweb154a}{154a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_dimTable\nobreak\ {\footnotesize \NWlink{nuweb155c}{155c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_Expectation\nobreak\ {\footnotesize \NWlink{nuweb152a}{152a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_ExpectationInfluence\nobreak\ {\footnotesize \NWlink{nuweb153c}{153c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_ExpectationX\nobreak\ {\footnotesize \NWlink{nuweb153b}{153b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_LinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb151d}{151d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_nresample\nobreak\ {\footnotesize \NWlink{nuweb156b}{156b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_P\nobreak\ {\footnotesize \NWlink{nuweb150c}{150c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_PermutedLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb156c}{156c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_Q\nobreak\ {\footnotesize \NWlink{nuweb151a}{151a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_Sumweights\nobreak\ {\footnotesize \NWlink{nuweb155a}{155a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_Table\nobreak\ {\footnotesize \NWlink{nuweb155b}{155b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_TableBlock\nobreak\ {\footnotesize \NWlink{nuweb154c}{154c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_tol\nobreak\ {\footnotesize \NWlink{nuweb156d}{156d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_Variance\nobreak\ {\footnotesize \NWlink{nuweb152b}{152b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_VarianceInfluence\nobreak\ {\footnotesize \NWlink{nuweb154b}{154b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_varonly\nobreak\ {\footnotesize \NWlink{nuweb151b}{151b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_get\_Xfactor\nobreak\ {\footnotesize \NWlink{nuweb151c}{151c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$C\_kronecker\nobreak\ {\footnotesize \NWlink{nuweb143}{143}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$C\_kronecker\_sym\nobreak\ {\footnotesize \NWlink{nuweb144}{144}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$C\_KronSums\_dweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb103b}{103b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_KronSums\_dweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb104c}{104c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_KronSums\_iweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb104a}{104a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_KronSums\_iweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb104b}{104b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_KronSums\_Permutation\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb110b}{110b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_KronSums\_Permutation\_isubset\nobreak\ {\footnotesize \NWlink{nuweb111a}{111a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_KronSums\_sym\nobreak\ {\footnotesize \NWlink{nuweb145a}{145a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$C\_maxabsstand\_Covariance\nobreak\ {\footnotesize \NWlink{nuweb62b}{62b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_maxabsstand\_Variance\nobreak\ {\footnotesize \NWlink{nuweb63}{63}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_maxstand\_Covariance\nobreak\ {\footnotesize \NWlink{nuweb60b}{60b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_maxstand\_Variance\nobreak\ {\footnotesize \NWlink{nuweb61a}{61a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_maxtype\nobreak\ {\footnotesize \NWlink{nuweb66}{66}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_maxtype\_pvalue\nobreak\ {\footnotesize \NWlink{nuweb70}{70}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb67b}{67b}.}
\item $\langle\,$C\_minstand\_Covariance\nobreak\ {\footnotesize \NWlink{nuweb61b}{61b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_minstand\_Variance\nobreak\ {\footnotesize \NWlink{nuweb62a}{62a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_MPinv\_sym\nobreak\ {\footnotesize \NWlink{nuweb147}{147}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$C\_norm\_pvalue\nobreak\ {\footnotesize \NWlink{nuweb69}{69}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb67b}{67b}.}
\item $\langle\,$C\_OneTableSums\_dweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb120a}{120a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_OneTableSums\_dweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb121a}{121a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_OneTableSums\_iweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb120b}{120b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_OneTableSums\_iweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb120c}{120c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_ordered\_Xfactor\nobreak\ {\footnotesize \NWlink{nuweb73}{73}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_order\_subset\_wrt\_block\nobreak\ {\footnotesize \NWlink{nuweb135a}{135a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb131b}{131b}.}
\item $\langle\,$C\_Permute\nobreak\ {\footnotesize \NWlink{nuweb137a}{137a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb136b}{136b}.}
\item $\langle\,$C\_PermuteBlock\nobreak\ {\footnotesize \NWlink{nuweb138a}{138a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb136b}{136b}.}
\item $\langle\,$C\_perm\_pvalue\nobreak\ {\footnotesize \NWlink{nuweb68}{68}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb67b}{67b}.}
\item $\langle\,$C\_quadform\nobreak\ {\footnotesize \NWlink{nuweb65}{65}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_setup\_subset\nobreak\ {\footnotesize \NWlink{nuweb134a}{134a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb131b}{131b}.}
\item $\langle\,$C\_setup\_subset\_block\nobreak\ {\footnotesize \NWlink{nuweb134b}{134b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb131b}{131b}.}
\item $\langle\,$C\_standardise\nobreak\ {\footnotesize \NWlink{nuweb67a}{67a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_Sums\_dweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb96b}{96b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb94c}{94c}.}
\item $\langle\,$C\_Sums\_dweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb97c}{97c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb94c}{94c}.}
\item $\langle\,$C\_Sums\_iweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb97a}{97a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb94c}{94c}.}
\item $\langle\,$C\_Sums\_iweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb97b}{97b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb94c}{94c}.}
\item $\langle\,$C\_ThreeTableSums\_dweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb129b}{129b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_ThreeTableSums\_dweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb130b}{130b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_ThreeTableSums\_iweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb129c}{129c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_ThreeTableSums\_iweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb130a}{130a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_TwoTableSums\_dweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb124b}{124b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_TwoTableSums\_dweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb125b}{125b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_TwoTableSums\_iweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb124c}{124c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_TwoTableSums\_iweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb125a}{125a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$C\_unordered\_Xfactor\nobreak\ {\footnotesize \NWlink{nuweb78}{78}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$C\_VarianceLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb84}{84}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$C\_XfactorKronSums\_dweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb106b}{106b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_XfactorKronSums\_dweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb107b}{107b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_XfactorKronSums\_iweights\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb106c}{106c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_XfactorKronSums\_iweights\_isubset\nobreak\ {\footnotesize \NWlink{nuweb107a}{107a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_XfactorKronSums\_Permutation\_dsubset\nobreak\ {\footnotesize \NWlink{nuweb111c}{111c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$C\_XfactorKronSums\_Permutation\_isubset\nobreak\ {\footnotesize \NWlink{nuweb112a}{112a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\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{nuweb19}{, 19}.
}
\item $\langle\,$ExpectationCovariances\nobreak\ {\footnotesize \NWlink{nuweb82a}{82a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$Extract Dimensions\nobreak\ {\footnotesize \NWlink{nuweb35a}{35a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb34}{34}.}
\item $\langle\,$Function Definitions\nobreak\ {\footnotesize \NWlink{nuweb24a}{24a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23c}{23c}.}
\item $\langle\,$Function Prototypes\nobreak\ {\footnotesize \NWlink{nuweb23b}{23b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23a}{23a}.}
\item $\langle\,$Handle Missing Values\nobreak\ {\footnotesize \NWlink{nuweb5b}{5b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb6}{6}.}
\item $\langle\,$init subset loop\nobreak\ {\footnotesize \NWlink{nuweb93b}{93b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98a}{98a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb126}{, 126}\NWlink{nuweb131a}{, 131a}.
}
\item $\langle\,$Initialise Zero\nobreak\ {\footnotesize \NWlink{nuweb159a}{159a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb158}{158}.}
\item $\langle\,$KronSums\nobreak\ {\footnotesize \NWlink{nuweb98b}{98b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$KronSums Body\nobreak\ {\footnotesize \NWlink{nuweb105}{105}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb103b}{103b}\NWlink{nuweb104a}{, 104a}\NWlink{nuweb104b}{b}\NWlink{nuweb104c}{c}.
}
\item $\langle\,$KronSums Double x\nobreak\ {\footnotesize \NWlink{nuweb103a}{103a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb101a}{101a}.}
\item $\langle\,$KronSums Integer x\nobreak\ {\footnotesize \NWlink{nuweb102}{102}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb101a}{101a}.}
\item $\langle\,$KronSums Permutation Body\nobreak\ {\footnotesize \NWlink{nuweb111b}{111b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb110b}{110b}\NWlink{nuweb111a}{, 111a}.
}
\item $\langle\,$Linear Statistic 2d\nobreak\ {\footnotesize \NWlink{nuweb45b}{45b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb48}{48}\NWlink{nuweb52d}{, 52d}.
}
\item $\langle\,$LinearStatistics\nobreak\ {\footnotesize \NWlink{nuweb81b}{81b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\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{nuweb18}{, 18}.
}
\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{nuweb72b}{72b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb73}{73}\NWlink{nuweb78}{, 78}.
}
\item $\langle\,$Memory\nobreak\ {\footnotesize \NWlink{nuweb150a}{150a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$Memory Input Checks\nobreak\ {\footnotesize \NWlink{nuweb157a}{157a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb158}{158}.}
\item $\langle\,$Memory Names\nobreak\ {\footnotesize \NWlink{nuweb157b}{157b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb158}{158}.}
\item $\langle\,$MoreUtils\nobreak\ {\footnotesize \NWlink{nuweb139a}{139a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$mPQB\nobreak\ {\footnotesize \NWlink{nuweb141a}{141a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$NCOL\nobreak\ {\footnotesize \NWlink{nuweb139c}{139c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$NLEVELS\nobreak\ {\footnotesize \NWlink{nuweb140a}{140a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$NROW\nobreak\ {\footnotesize \NWlink{nuweb139b}{139b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$OneTableSums Body\nobreak\ {\footnotesize \NWlink{nuweb121b}{121b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb120a}{120a}\NWlink{nuweb120b}{b}\NWlink{nuweb120c}{c}\NWlink{nuweb121a}{, 121a}.
}
\item $\langle\,$P-Values\nobreak\ {\footnotesize \NWlink{nuweb67b}{67b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$Permutations\nobreak\ {\footnotesize \NWlink{nuweb136b}{136b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$PP12\nobreak\ {\footnotesize \NWlink{nuweb140b}{140b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$R block Input\nobreak\ {\footnotesize \NWlink{nuweb28b}{28b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb50a}{, 50a}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb132a}{, 132a}\NWlink{nuweb133a}{, 133a}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb135a}{, 135a}.
}
\item $\langle\,$R blockTable Input\nobreak\ {\footnotesize \NWlink{nuweb28e}{28e}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb133a}{133a}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb135a}{, 135a}.
}
\item $\langle\,$R Header\nobreak\ {\footnotesize \NWlink{nuweb165a}{165a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}\NWlink{nuweb16}{, 16}\NWlink{nuweb161a}{, 161a}.
}
\item $\langle\,$R Includes\nobreak\ {\footnotesize \NWlink{nuweb21b}{21b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb21a}{21a}.}
\item $\langle\,$R LECV Input\nobreak\ {\footnotesize \NWlink{nuweb150b}{150b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb54}{54}\NWlink{nuweb56b}{, 56b}\NWlink{nuweb150c}{, 150c}\NWlink{nuweb151a}{, 151a}\NWlink{nuweb151b}{b}\NWlink{nuweb151c}{c}\NWlink{nuweb151d}{d}\NWlink{nuweb152a}{, 152a}\NWlink{nuweb152b}{b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}.
}
\item $\langle\,$R N Input\nobreak\ {\footnotesize \NWlink{nuweb24b}{24b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb95a}{95a}.}
\item $\langle\,$R subset Input\nobreak\ {\footnotesize \NWlink{nuweb27b}{27b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb85c}{c}\NWlink{nuweb86b}{, 86b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb91}{, 91}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb95a}{, 95a}\NWlink{nuweb95c}{c}\NWlink{nuweb99}{, 99}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109c}{c}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113c}{c}\NWlink{nuweb117b}{, 117b}\NWlink{nuweb118b}{, 118b}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb132a}{, 132a}\NWlink{nuweb133a}{, 133a}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb135b}{b}.
}
\item $\langle\,$R weights Input\nobreak\ {\footnotesize \NWlink{nuweb26c}{26c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb85c}{c}\NWlink{nuweb86b}{, 86b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb91}{, 91}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb95a}{, 95a}\NWlink{nuweb95c}{c}\NWlink{nuweb99}{, 99}\NWlink{nuweb100b}{, 100b}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb113c}{c}\NWlink{nuweb117b}{, 117b}\NWlink{nuweb118b}{, 118b}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb123a}{, 123a}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb128a}{, 128a}\NWlink{nuweb132a}{, 132a}\NWlink{nuweb135b}{, 135b}.
}
\item $\langle\,$R x Input\nobreak\ {\footnotesize \NWlink{nuweb24d}{24d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb50a}{, 50a}\NWlink{nuweb81c}{, 81c}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89b}{, 89b}\NWlink{nuweb91}{, 91}\NWlink{nuweb92b}{, 92b}\NWlink{nuweb99}{, 99}\NWlink{nuweb101b}{, 101b}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109c}{c}\NWlink{nuweb113a}{, 113a}\NWlink{nuweb117b}{, 117b}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb127a}{, 127a}.
}
\item $\langle\,$R y Input\nobreak\ {\footnotesize \NWlink{nuweb25d}{25d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31b}{31b}\NWlink{nuweb42c}{, 42c}\NWlink{nuweb50a}{, 50a}\NWlink{nuweb85a}{, 85a}\NWlink{nuweb85c}{c}\NWlink{nuweb86b}{, 86b}\NWlink{nuweb87b}{, 87b}\NWlink{nuweb99}{, 99}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb122a}{, 122a}\NWlink{nuweb127a}{, 127a}\NWlink{nuweb132a}{, 132a}.
}
\item $\langle\,$RC KronSums Input\nobreak\ {\footnotesize \NWlink{nuweb101b}{101b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb100b}{100b}.}
\item $\langle\,$RC\_colSums\nobreak\ {\footnotesize \NWlink{nuweb114a}{114a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb112c}{112c}.}
\item $\langle\,$RC\_colSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb113c}{113c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb114a}{114a}.}
\item $\langle\,$RC\_CovarianceInfluence\nobreak\ {\footnotesize \NWlink{nuweb88a}{88a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$RC\_CovarianceInfluence Prototype\nobreak\ {\footnotesize \NWlink{nuweb87b}{87b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb88a}{88a}.}
\item $\langle\,$RC\_CovarianceX\nobreak\ {\footnotesize \NWlink{nuweb93a}{93a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$RC\_CovarianceX Prototype\nobreak\ {\footnotesize \NWlink{nuweb92b}{92b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb93a}{93a}.}
\item $\langle\,$RC\_ExpectationCovarianceStatistic\nobreak\ {\footnotesize \NWlink{nuweb34}{34}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31a}{31a}.}
\item $\langle\,$RC\_ExpectationCovarianceStatistic\_2d\nobreak\ {\footnotesize \NWlink{nuweb48}{48}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb42b}{42b}.}
\item $\langle\,$RC\_ExpectationInfluence\nobreak\ {\footnotesize \NWlink{nuweb86a}{86a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$RC\_ExpectationInfluence Prototype\nobreak\ {\footnotesize \NWlink{nuweb85c}{85c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb86a}{86a}.}
\item $\langle\,$RC\_ExpectationX\nobreak\ {\footnotesize \NWlink{nuweb90}{90}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$RC\_ExpectationX Prototype\nobreak\ {\footnotesize \NWlink{nuweb89b}{89b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb90}{90}.}
\item $\langle\,$RC\_init\_LECV\_1d\nobreak\ {\footnotesize \NWlink{nuweb159b}{159b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$RC\_init\_LECV\_2d\nobreak\ {\footnotesize \NWlink{nuweb160}{160}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb150a}{150a}.}
\item $\langle\,$RC\_KronSums\nobreak\ {\footnotesize \NWlink{nuweb101a}{101a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$RC\_KronSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb100b}{100b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb101a}{101a}.}
\item $\langle\,$RC\_KronSums\_Permutation\nobreak\ {\footnotesize \NWlink{nuweb110a}{110a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$RC\_KronSums\_Permutation Prototype\nobreak\ {\footnotesize \NWlink{nuweb109c}{109c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb110a}{110a}.}
\item $\langle\,$RC\_LinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb81d}{81d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb81b}{81b}.}
\item $\langle\,$RC\_LinearStatistic Prototype\nobreak\ {\footnotesize \NWlink{nuweb81c}{81c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb81d}{81d}.}
\item $\langle\,$RC\_OneTableSums\nobreak\ {\footnotesize \NWlink{nuweb119a}{119a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$RC\_OneTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb118b}{118b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb119a}{119a}.}
\item $\langle\,$RC\_order\_subset\_wrt\_block\nobreak\ {\footnotesize \NWlink{nuweb133b}{133b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb131b}{131b}.}
\item $\langle\,$RC\_order\_subset\_wrt\_block Prototype\nobreak\ {\footnotesize \NWlink{nuweb133a}{133a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb133b}{133b}.}
\item $\langle\,$RC\_setup\_subset\nobreak\ {\footnotesize \NWlink{nuweb136a}{136a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb136b}{136b}.}
\item $\langle\,$RC\_setup\_subset Prototype\nobreak\ {\footnotesize \NWlink{nuweb135b}{135b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb136a}{136a}.}
\item $\langle\,$RC\_Sums\nobreak\ {\footnotesize \NWlink{nuweb96a}{96a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb94c}{94c}.}
\item $\langle\,$RC\_Sums Prototype\nobreak\ {\footnotesize \NWlink{nuweb95c}{95c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb96a}{96a}.}
\item $\langle\,$RC\_ThreeTableSums\nobreak\ {\footnotesize \NWlink{nuweb128b}{128b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$RC\_ThreeTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb128a}{128a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb128b}{128b}.}
\item $\langle\,$RC\_TwoTableSums\nobreak\ {\footnotesize \NWlink{nuweb123b}{123b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$RC\_TwoTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb123a}{123a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb123b}{123b}.}
\item $\langle\,$R\_colSums\nobreak\ {\footnotesize \NWlink{nuweb113b}{113b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb112c}{112c}.}
\item $\langle\,$R\_colSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb113a}{113a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb113b}{, 113b}.
}
\item $\langle\,$R\_CovarianceInfluence\nobreak\ {\footnotesize \NWlink{nuweb87a}{87a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$R\_CovarianceInfluence Prototype\nobreak\ {\footnotesize \NWlink{nuweb86b}{86b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb87a}{, 87a}.
}
\item $\langle\,$R\_CovarianceX\nobreak\ {\footnotesize \NWlink{nuweb92a}{92a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$R\_CovarianceX Prototype\nobreak\ {\footnotesize \NWlink{nuweb91}{91}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb92a}{, 92a}.
}
\item $\langle\,$R\_ExpectationCovarianceStatistic\nobreak\ {\footnotesize \NWlink{nuweb32c}{32c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31a}{31a}.}
\item $\langle\,$R\_ExpectationCovarianceStatistic Prototype\nobreak\ {\footnotesize \NWlink{nuweb32b}{32b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb32c}{, 32c}.
}
\item $\langle\,$R\_ExpectationCovarianceStatistic\_2d\nobreak\ {\footnotesize \NWlink{nuweb44}{44}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb42b}{42b}.}
\item $\langle\,$R\_ExpectationCovarianceStatistic\_2d Prototype\nobreak\ {\footnotesize \NWlink{nuweb43a}{43a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb44}{, 44}.
}
\item $\langle\,$R\_ExpectationInfluence\nobreak\ {\footnotesize \NWlink{nuweb85b}{85b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$R\_ExpectationInfluence Prototype\nobreak\ {\footnotesize \NWlink{nuweb85a}{85a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb85b}{, 85b}.
}
\item $\langle\,$R\_ExpectationX\nobreak\ {\footnotesize \NWlink{nuweb89a}{89a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb82a}{82a}.}
\item $\langle\,$R\_ExpectationX Prototype\nobreak\ {\footnotesize \NWlink{nuweb88b}{88b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb89a}{, 89a}.
}
\item $\langle\,$R\_init\_LECV\nobreak\ {\footnotesize \NWlink{nuweb158}{158}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb159b}{159b}\NWlink{nuweb160}{, 160}.
}
\item $\langle\,$R\_kronecker\nobreak\ {\footnotesize \NWlink{nuweb142}{142}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$R\_kronecker Prototype\nobreak\ {\footnotesize \NWlink{nuweb141c}{141c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb142}{, 142}.
}
\item $\langle\,$R\_KronSums\nobreak\ {\footnotesize \NWlink{nuweb100a}{100a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$R\_KronSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb99}{99}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb100a}{, 100a}.
}
\item $\langle\,$R\_KronSums\_Permutation\nobreak\ {\footnotesize \NWlink{nuweb109b}{109b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98b}{98b}.}
\item $\langle\,$R\_KronSums\_Permutation Prototype\nobreak\ {\footnotesize \NWlink{nuweb109a}{109a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb109b}{, 109b}.
}
\item $\langle\,$R\_MaximallySelectedTest\nobreak\ {\footnotesize \NWlink{nuweb59}{59}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb53a}{53a}.}
\item $\langle\,$R\_MaximallySelectedTest Prototype\nobreak\ {\footnotesize \NWlink{nuweb58}{58}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb59}{, 59}.
}
\item $\langle\,$R\_MaximumTest\nobreak\ {\footnotesize \NWlink{nuweb57}{57}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb53a}{53a}.}
\item $\langle\,$R\_MaximumTest Prototype\nobreak\ {\footnotesize \NWlink{nuweb56b}{56b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb57}{, 57}.
}
\item $\langle\,$R\_MPinv\_sym\nobreak\ {\footnotesize \NWlink{nuweb146b}{146b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$R\_MPinv\_sym Prototype\nobreak\ {\footnotesize \NWlink{nuweb146a}{146a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb146b}{, 146b}.
}
\item $\langle\,$R\_OneTableSums\nobreak\ {\footnotesize \NWlink{nuweb118a}{118a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$R\_OneTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb117b}{117b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb118a}{, 118a}.
}
\item $\langle\,$R\_order\_subset\_wrt\_block\nobreak\ {\footnotesize \NWlink{nuweb132b}{132b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb131b}{131b}.}
\item $\langle\,$R\_order\_subset\_wrt\_block Prototype\nobreak\ {\footnotesize \NWlink{nuweb132a}{132a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb132b}{, 132b}.
}
\item $\langle\,$R\_PermutedLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb40}{40}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31a}{31a}.}
\item $\langle\,$R\_PermutedLinearStatistic Prototype\nobreak\ {\footnotesize \NWlink{nuweb38c}{38c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb40}{, 40}.
}
\item $\langle\,$R\_PermutedLinearStatistic\_2d\nobreak\ {\footnotesize \NWlink{nuweb51}{51}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb42b}{42b}.}
\item $\langle\,$R\_PermutedLinearStatistic\_2d Prototype\nobreak\ {\footnotesize \NWlink{nuweb50a}{50a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb51}{, 51}.
}
\item $\langle\,$R\_quadform\nobreak\ {\footnotesize \NWlink{nuweb64c}{64c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb60a}{60a}.}
\item $\langle\,$R\_quadform Prototype\nobreak\ {\footnotesize \NWlink{nuweb64b}{64b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb64c}{, 64c}.
}
\item $\langle\,$R\_QuadraticTest\nobreak\ {\footnotesize \NWlink{nuweb55}{55}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb53a}{53a}.}
\item $\langle\,$R\_QuadraticTest Prototype\nobreak\ {\footnotesize \NWlink{nuweb54}{54}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb55}{, 55}.
}
\item $\langle\,$R\_StandardisePermutedLinearStatistic\nobreak\ {\footnotesize \NWlink{nuweb42a}{42a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb31a}{31a}.}
\item $\langle\,$R\_StandardisePermutedLinearStatistic Prototype\nobreak\ {\footnotesize \NWlink{nuweb41c}{41c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb42a}{, 42a}.
}
\item $\langle\,$R\_Sums\nobreak\ {\footnotesize \NWlink{nuweb95b}{95b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb94c}{94c}.}
\item $\langle\,$R\_Sums Prototype\nobreak\ {\footnotesize \NWlink{nuweb95a}{95a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb95b}{, 95b}.
}
\item $\langle\,$R\_ThreeTableSums\nobreak\ {\footnotesize \NWlink{nuweb127b}{127b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$R\_ThreeTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb127a}{127a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb127b}{, 127b}.
}
\item $\langle\,$R\_TwoTableSums\nobreak\ {\footnotesize \NWlink{nuweb122b}{122b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb117a}{117a}.}
\item $\langle\,$R\_TwoTableSums Prototype\nobreak\ {\footnotesize \NWlink{nuweb122a}{122a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb122b}{, 122b}.
}
\item $\langle\,$R\_unpack\_sym\nobreak\ {\footnotesize \NWlink{nuweb149}{149}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb139a}{139a}.}
\item $\langle\,$R\_unpack\_sym Prototype\nobreak\ {\footnotesize \NWlink{nuweb148b}{148b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb23b}{23b}\NWlink{nuweb149}{, 149}.
}
\item $\langle\,$Setup Dimensions\nobreak\ {\footnotesize \NWlink{nuweb33}{33}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb32c}{32c}\NWlink{nuweb40}{, 40}.
}
\item $\langle\,$Setup Dimensions 2d\nobreak\ {\footnotesize \NWlink{nuweb45a}{45a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb44}{44}\NWlink{nuweb51}{, 51}.
}
\item $\langle\,$Setup Linear Statistic\nobreak\ {\footnotesize \NWlink{nuweb41a}{41a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb40}{40}\NWlink{nuweb51}{, 51}.
}
\item $\langle\,$Setup Log-Factorials\nobreak\ {\footnotesize \NWlink{nuweb52c}{52c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb51}{51}.}
\item $\langle\,$Setup maxstat Memory\nobreak\ {\footnotesize \NWlink{nuweb75}{75}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb73}{73}\NWlink{nuweb78}{, 78}.
}
\item $\langle\,$Setup maxstat Variables\nobreak\ {\footnotesize \NWlink{nuweb74}{74}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb73}{73}\NWlink{nuweb78}{, 78}.
}
\item $\langle\,$Setup Memory and Subsets in Blocks\nobreak\ {\footnotesize \NWlink{nuweb36a}{36a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb34}{34}.}
\item $\langle\,$Setup mvtnorm Correlation\nobreak\ {\footnotesize \NWlink{nuweb72a}{72a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb70}{70}.}
\item $\langle\,$Setup mvtnorm Memory\nobreak\ {\footnotesize \NWlink{nuweb71}{71}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb70}{70}.}
\item $\langle\,$Setup Test Memory\nobreak\ {\footnotesize \NWlink{nuweb56a}{56a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb55}{55}\NWlink{nuweb57}{, 57}.
}
\item $\langle\,$Setup unordered maxstat Contrasts\nobreak\ {\footnotesize \NWlink{nuweb79b}{79b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb78}{78}.}
\item $\langle\,$Setup Working Memory\nobreak\ {\footnotesize \NWlink{nuweb52b}{52b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb51}{51}.}
\item $\langle\,$SimpleSums\nobreak\ {\footnotesize \NWlink{nuweb94c}{94c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$start subset loop\nobreak\ {\footnotesize \NWlink{nuweb94a}{94a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb98a}{98a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb126}{, 126}\NWlink{nuweb131a}{, 131a}.
}
\item $\langle\,$Sums Body\nobreak\ {\footnotesize \NWlink{nuweb98a}{98a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb96b}{96b}\NWlink{nuweb97a}{, 97a}\NWlink{nuweb97b}{b}\NWlink{nuweb97c}{c}.
}
\item $\langle\,$Tables\nobreak\ {\footnotesize \NWlink{nuweb117a}{117a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$Test Statistics\nobreak\ {\footnotesize \NWlink{nuweb60a}{60a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$Tests\nobreak\ {\footnotesize \NWlink{nuweb53a}{53a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$ThreeTableSums Body\nobreak\ {\footnotesize \NWlink{nuweb131a}{131a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb129b}{129b}\NWlink{nuweb129c}{c}\NWlink{nuweb130a}{, 130a}\NWlink{nuweb130b}{b}.
}
\item $\langle\,$TwoTableSums Body\nobreak\ {\footnotesize \NWlink{nuweb126}{126}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb124b}{124b}\NWlink{nuweb124c}{c}\NWlink{nuweb125a}{, 125a}\NWlink{nuweb125b}{b}.
}
\item $\langle\,$User Interface\nobreak\ {\footnotesize \NWlink{nuweb31a}{31a}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$User Interface Input\nobreak\ {\footnotesize \NWlink{nuweb31b}{31b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb32b}{32b}\NWlink{nuweb34}{, 34}\NWlink{nuweb38c}{, 38c}.
}
\item $\langle\,$Utils\nobreak\ {\footnotesize \NWlink{nuweb131b}{131b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb24a}{24a}.}
\item $\langle\,$vcov LinStatExpCov\nobreak\ {\footnotesize \NWlink{nuweb10}{10}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb3a}{3a}.}
\item $\langle\,$XfactorKronSums Body\nobreak\ {\footnotesize \NWlink{nuweb108}{108}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb106b}{106b}\NWlink{nuweb106c}{c}\NWlink{nuweb107a}{, 107a}\NWlink{nuweb107b}{b}.
}
\item $\langle\,$XfactorKronSums Permutation Body\nobreak\ {\footnotesize \NWlink{nuweb112b}{112b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb111c}{111c}\NWlink{nuweb112a}{, 112a}.
}
\end{list}}

\section*{Identifiers}


{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item \verb@B@: \underline{\NWlink{nuweb28c}{28c}}\NWlink{nuweb32c}{, 32c}\NWlink{nuweb33}{, 33}\NWlink{nuweb34}{, 34}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb46a}{, 46a}\NWlink{nuweb48}{, 48}\NWlink{nuweb49}{, 49}\NWlink{nuweb51}{, 51}\NWlink{nuweb52b}{, 52b}\NWlink{nuweb73}{, 73}\NWlink{nuweb74}{, 74}\NWlink{nuweb78}{, 78}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb141b}{b}\NWlink{nuweb141c}{c}\NWlink{nuweb142}{, 142}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}\NWlink{nuweb157a}{, 157a}\NWlink{nuweb158}{, 158}\NWlink{nuweb159b}{, 159b}\NWlink{nuweb160}{, 160}.
\item \verb@block@: \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15}{, 15}\NWlink{nuweb16}{, 16}\NWlink{nuweb18}{, 18}\NWlink{nuweb20}{, 20}, \underline{\NWlink{nuweb28b}{28b}}, \underline{\NWlink{nuweb28d}{28d}}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb154c}{, 154c}.
\item \verb@blockTable@: \underline{\NWlink{nuweb28e}{28e}}\NWlink{nuweb40}{, 40}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb134b}{, 134b}\NWlink{nuweb135a}{, 135a}.
\item \verb@CovarianceInfluence_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@Covariance_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb152b}{, 152b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@C_chisq_pvalue@: \NWlink{nuweb55}{55}, \underline{\NWlink{nuweb67c}{67c}}.
\item \verb@C_colSums_dweights_dsubset@: \NWlink{nuweb114a}{114a}, \underline{\NWlink{nuweb115a}{115a}}.
\item \verb@C_colSums_dweights_isubset@: \NWlink{nuweb114a}{114a}, \underline{\NWlink{nuweb116a}{116a}}.
\item \verb@C_colSums_iweights_dsubset@: \NWlink{nuweb114a}{114a}, \underline{\NWlink{nuweb115b}{115b}}.
\item \verb@C_colSums_iweights_isubset@: \NWlink{nuweb114a}{114a}, \underline{\NWlink{nuweb115c}{115c}}.
\item \verb@C_CovarianceLinearStatistic@: \NWlink{nuweb38a}{38a}\NWlink{nuweb47}{, 47}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb81a}{, 81a}, \underline{\NWlink{nuweb83}{83}}\NWlink{nuweb84}{, 84}.
\item \verb@C_doPermute@: \NWlink{nuweb40}{40}, \underline{\NWlink{nuweb137b}{137b}}.
\item \verb@C_doPermuteBlock@: \NWlink{nuweb40}{40}, \underline{\NWlink{nuweb138b}{138b}}.
\item \verb@C_ExpectationLinearStatistic@: \NWlink{nuweb37a}{37a}\NWlink{nuweb46c}{, 46c}, \underline{\NWlink{nuweb82b}{82b}}.
\item \verb@C_get_B@: \NWlink{nuweb35a}{35a}\NWlink{nuweb49}{, 49}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb156a}{156a}}.
\item \verb@C_get_Covariance@: \NWlink{nuweb38a}{38a}\NWlink{nuweb38b}{b}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb153a}{153a}}\NWlink{nuweb159a}{, 159a}.
\item \verb@C_get_CovarianceInfluence@: \NWlink{nuweb36a}{36a}\NWlink{nuweb47}{, 47}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb154a}{154a}}\NWlink{nuweb159a}{, 159a}.
\item \verb@C_get_dimTable@: \NWlink{nuweb49}{49}, \underline{\NWlink{nuweb155c}{155c}}\NWlink{nuweb156a}{, 156a}.
\item \verb@C_get_Expectation@: \NWlink{nuweb37a}{37a}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb152a}{152a}}\NWlink{nuweb159a}{, 159a}.
\item \verb@C_get_ExpectationInfluence@: \NWlink{nuweb36a}{36a}\NWlink{nuweb49}{, 49}, \underline{\NWlink{nuweb153c}{153c}}\NWlink{nuweb159a}{, 159a}.
\item \verb@C_get_ExpectationX@: \NWlink{nuweb36a}{36a}\NWlink{nuweb49}{, 49}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb153b}{153b}}.
\item \verb@C_get_LinearStatistic@: \NWlink{nuweb35b}{35b}\NWlink{nuweb48}{, 48}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb151d}{151d}}\NWlink{nuweb159a}{, 159a}.
\item \verb@C_get_nresample@: \NWlink{nuweb42a}{42a}\NWlink{nuweb55}{, 55}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb59}{, 59}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb156b}{156b}}.
\item \verb@C_get_P@: \NWlink{nuweb35a}{35a}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb49}{, 49}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb59}{, 59}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb150c}{150c}}\NWlink{nuweb152b}{, 152b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb156b}{, 156b}.
\item \verb@C_get_PermutedLinearStatistic@: \NWlink{nuweb42a}{42a}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb156c}{156c}}.
\item \verb@C_get_Q@: \NWlink{nuweb35a}{35a}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb49}{, 49}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb151a}{151a}}\NWlink{nuweb152b}{, 152b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb156b}{, 156b}.
\item \verb@C_get_Sumweights@: \NWlink{nuweb36a}{36a}\NWlink{nuweb49}{, 49}, \underline{\NWlink{nuweb155a}{155a}}.
\item \verb@C_get_Table@: \NWlink{nuweb44}{44}\NWlink{nuweb49}{, 49}, \underline{\NWlink{nuweb155b}{155b}}.
\item \verb@C_get_TableBlock@: \NWlink{nuweb36a}{36a}, \underline{\NWlink{nuweb154c}{154c}}.
\item \verb@C_get_tol@: \NWlink{nuweb42a}{42a}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb156d}{156d}}.
\item \verb@C_get_Variance@: \NWlink{nuweb37c}{37c}\NWlink{nuweb38b}{, 38b}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb152b}{152b}}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb159a}{, 159a}.
\item \verb@C_get_VarianceInfluence@: \NWlink{nuweb36a}{36a}\NWlink{nuweb47}{, 47}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb154b}{154b}}\NWlink{nuweb159a}{, 159a}.
\item \verb@C_get_varonly@: \NWlink{nuweb34}{34}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb38b}{, 38b}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb49}{, 49}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb151b}{151b}}\NWlink{nuweb153a}{, 153a}.
\item \verb@C_get_Xfactor@: \NWlink{nuweb49}{49}, \underline{\NWlink{nuweb151c}{151c}}.
\item \verb@C_kronecker@: \NWlink{nuweb84}{84}\NWlink{nuweb142}{, 142}, \underline{\NWlink{nuweb143}{143}}.
\item \verb@C_kronecker_sym@: \NWlink{nuweb83}{83}, \underline{\NWlink{nuweb144}{144}}.
\item \verb@C_KronSums_dweights_dsubset@: \NWlink{nuweb103a}{103a}, \underline{\NWlink{nuweb103b}{103b}}.
\item \verb@C_KronSums_dweights_isubset@: \NWlink{nuweb103a}{103a}, \underline{\NWlink{nuweb104c}{104c}}.
\item \verb@C_KronSums_iweights_dsubset@: \NWlink{nuweb103a}{103a}, \underline{\NWlink{nuweb104a}{104a}}.
\item \verb@C_KronSums_iweights_isubset@: \NWlink{nuweb103a}{103a}, \underline{\NWlink{nuweb104b}{104b}}.
\item \verb@C_KronSums_Permutation_dsubset@: \NWlink{nuweb110a}{110a}, \underline{\NWlink{nuweb110b}{110b}}.
\item \verb@C_KronSums_Permutation_isubset@: \NWlink{nuweb110a}{110a}, \underline{\NWlink{nuweb111a}{111a}}.
\item \verb@C_maxabsstand_Covariance@: \underline{\NWlink{nuweb62b}{62b}}\NWlink{nuweb66}{, 66}.
\item \verb@C_maxabsstand_Variance@: \underline{\NWlink{nuweb63}{63}}\NWlink{nuweb66}{, 66}.
\item \verb@C_maxstand_Covariance@: \underline{\NWlink{nuweb60b}{60b}}\NWlink{nuweb66}{, 66}.
\item \verb@C_maxstand_Variance@: \underline{\NWlink{nuweb61a}{61a}}\NWlink{nuweb66}{, 66}.
\item \verb@C_maxtype@: \NWlink{nuweb57}{57}, \underline{\NWlink{nuweb66}{66}}\NWlink{nuweb76c}{, 76c}.
\item \verb@C_maxtype_pvalue@: \NWlink{nuweb57}{57}, \underline{\NWlink{nuweb70}{70}}.
\item \verb@C_minstand_Covariance@: \underline{\NWlink{nuweb61b}{61b}}\NWlink{nuweb66}{, 66}.
\item \verb@C_minstand_Variance@: \underline{\NWlink{nuweb62a}{62a}}\NWlink{nuweb66}{, 66}.
\item \verb@C_OneTableSums_dweights_dsubset@: \NWlink{nuweb119a}{119a}, \underline{\NWlink{nuweb120a}{120a}}.
\item \verb@C_OneTableSums_dweights_isubset@: \NWlink{nuweb119a}{119a}, \underline{\NWlink{nuweb121a}{121a}}.
\item \verb@C_OneTableSums_iweights_dsubset@: \NWlink{nuweb119a}{119a}, \underline{\NWlink{nuweb120b}{120b}}.
\item \verb@C_OneTableSums_iweights_isubset@: \NWlink{nuweb119a}{119a}, \underline{\NWlink{nuweb120c}{120c}}.
\item \verb@C_ordered_Xfactor@: \NWlink{nuweb37b}{37b}\NWlink{nuweb47}{, 47}\NWlink{nuweb59}{, 59}, \underline{\NWlink{nuweb73}{73}}.
\item \verb@C_order_subset_wrt_block@: \NWlink{nuweb133b}{133b}, \underline{\NWlink{nuweb135a}{135a}}.
\item \verb@C_Permute@: \underline{\NWlink{nuweb137a}{137a}}\NWlink{nuweb137b}{, 137b}\NWlink{nuweb138a}{, 138a}.
\item \verb@C_PermuteBlock@: \underline{\NWlink{nuweb138a}{138a}}\NWlink{nuweb138b}{, 138b}.
\item \verb@C_perm_pvalue@: \NWlink{nuweb55}{55}\NWlink{nuweb57}{, 57}, \underline{\NWlink{nuweb68}{68}}\NWlink{nuweb77}{, 77}.
\item \verb@C_quadform@: \NWlink{nuweb55}{55}\NWlink{nuweb64c}{, 64c}, \underline{\NWlink{nuweb65}{65}}\NWlink{nuweb76c}{, 76c}.
\item \verb@C_setup_subset@: \NWlink{nuweb133b}{133b}, \underline{\NWlink{nuweb134a}{134a}}\NWlink{nuweb136a}{, 136a}.
\item \verb@C_setup_subset_block@: \NWlink{nuweb133b}{133b}, \underline{\NWlink{nuweb134b}{134b}}.
\item \verb@C_standardise@: \NWlink{nuweb42a}{42a}, \underline{\NWlink{nuweb67a}{67a}}.
\item \verb@C_Sums_dweights_dsubset@: \NWlink{nuweb96a}{96a}, \underline{\NWlink{nuweb96b}{96b}}.
\item \verb@C_Sums_dweights_isubset@: \NWlink{nuweb96a}{96a}, \underline{\NWlink{nuweb97c}{97c}}.
\item \verb@C_Sums_iweights_dsubset@: \NWlink{nuweb96a}{96a}, \underline{\NWlink{nuweb97a}{97a}}.
\item \verb@C_Sums_iweights_isubset@: \NWlink{nuweb96a}{96a}, \underline{\NWlink{nuweb97b}{97b}}.
\item \verb@C_ThreeTableSums_dweights_dsubset@: \NWlink{nuweb128b}{128b}, \underline{\NWlink{nuweb129b}{129b}}.
\item \verb@C_ThreeTableSums_dweights_isubset@: \NWlink{nuweb128b}{128b}, \underline{\NWlink{nuweb130b}{130b}}.
\item \verb@C_ThreeTableSums_iweights_dsubset@: \NWlink{nuweb128b}{128b}, \underline{\NWlink{nuweb129c}{129c}}.
\item \verb@C_ThreeTableSums_iweights_isubset@: \NWlink{nuweb128b}{128b}, \underline{\NWlink{nuweb130a}{130a}}.
\item \verb@C_TwoTableSums_dweights_dsubset@: \NWlink{nuweb123b}{123b}, \underline{\NWlink{nuweb124b}{124b}}.
\item \verb@C_TwoTableSums_dweights_isubset@: \NWlink{nuweb123b}{123b}, \underline{\NWlink{nuweb125b}{125b}}.
\item \verb@C_TwoTableSums_iweights_dsubset@: \NWlink{nuweb123b}{123b}, \underline{\NWlink{nuweb124c}{124c}}.
\item \verb@C_TwoTableSums_iweights_isubset@: \NWlink{nuweb123b}{123b}, \underline{\NWlink{nuweb125a}{125a}}.
\item \verb@C_unordered_Xfactor@: \NWlink{nuweb37b}{37b}\NWlink{nuweb59}{, 59}, \underline{\NWlink{nuweb78}{78}}.
\item \verb@C_VarianceLinearStatistic@: \NWlink{nuweb37c}{37c}\NWlink{nuweb47}{, 47}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb81a}{, 81a}, \underline{\NWlink{nuweb84}{84}}.
\item \verb@C_XfactorKronSums_dweights_dsubset@: \NWlink{nuweb102}{102}, \underline{\NWlink{nuweb106b}{106b}}.
\item \verb@C_XfactorKronSums_dweights_isubset@: \NWlink{nuweb102}{102}, \underline{\NWlink{nuweb107b}{107b}}.
\item \verb@C_XfactorKronSums_iweights_dsubset@: \NWlink{nuweb102}{102}, \underline{\NWlink{nuweb106c}{106c}}.
\item \verb@C_XfactorKronSums_iweights_isubset@: \NWlink{nuweb102}{102}, \underline{\NWlink{nuweb107a}{107a}}.
\item \verb@C_XfactorKronSums_Permutation_dsubset@: \NWlink{nuweb110a}{110a}, \underline{\NWlink{nuweb111c}{111c}}.
\item \verb@C_XfactorKronSums_Permutation_isubset@: \NWlink{nuweb110a}{110a}, \underline{\NWlink{nuweb112a}{112a}}.
\item \verb@dim_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb150c}{, 150c}\NWlink{nuweb151a}{, 151a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@DoCenter@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90}{, 90}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb113b}{, 113b}.
\item \verb@DoSymmetric@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb93a}{, 93a}.
\item \verb@DoVarOnly@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb37b}{, 37b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb47}{, 47}.
\item \verb@ExpectationInfluence_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb153c}{, 153c}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@ExpectationX_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb153b}{, 153b}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@Expectation_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb152a}{, 152a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@GE@: \underline{\NWlink{nuweb22a}{22a}}\NWlink{nuweb55}{, 55}\NWlink{nuweb57}{, 57}.
\item \verb@HAS_WEIGHTS@: \underline{\NWlink{nuweb26d}{26d}}, \underline{\NWlink{nuweb26e}{26e}}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb126}{, 126}\NWlink{nuweb131a}{, 131a}.
\item \verb@LE@: \underline{\NWlink{nuweb22a}{22a}}\NWlink{nuweb57}{, 57}.
\item \verb@LECV@: \NWlink{nuweb41b}{41b}\NWlink{nuweb41c}{c}\NWlink{nuweb42a}{, 42a}\NWlink{nuweb55}{, 55}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb58}{, 58}\NWlink{nuweb59}{, 59}\NWlink{nuweb72b}{, 72b}\NWlink{nuweb74}{, 74}, \underline{\NWlink{nuweb150b}{150b}}\NWlink{nuweb150c}{, 150c}\NWlink{nuweb151a}{, 151a}\NWlink{nuweb151b}{b}\NWlink{nuweb151c}{c}\NWlink{nuweb151d}{d}\NWlink{nuweb152a}{, 152a}\NWlink{nuweb152b}{b}\NWlink{nuweb153a}{, 153a}\NWlink{nuweb153b}{b}\NWlink{nuweb153c}{c}\NWlink{nuweb154a}{, 154a}\NWlink{nuweb154b}{b}\NWlink{nuweb154c}{c}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb155b}{b}\NWlink{nuweb155c}{c}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb156b}{b}\NWlink{nuweb156c}{c}\NWlink{nuweb156d}{d}.
\item \verb@LinearStatistic_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb151d}{, 151d}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@mPQB@: \NWlink{nuweb38b}{38b}\NWlink{nuweb40}{, 40}\NWlink{nuweb48}{, 48}\NWlink{nuweb51}{, 51}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb74}{, 74}\NWlink{nuweb76a}{, 76a}\NWlink{nuweb80b}{, 80b}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb108}{, 108}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb131a}{, 131a}, \underline{\NWlink{nuweb141a}{141a}}\NWlink{nuweb158}{, 158}.
\item \verb@N@: \NWlink{nuweb5a}{5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb16}{, 16}, \underline{\NWlink{nuweb24b}{24b}}, \underline{\NWlink{nuweb24c}{24c}}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb70}{, 70}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb134a}{, 134a}\NWlink{nuweb134b}{b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb145a}{, 145a}.
\item \verb@NCOL@: \NWlink{nuweb12}{12}\NWlink{nuweb33}{, 33}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb64c}{, 64c}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb132b}{, 132b}, \underline{\NWlink{nuweb139c}{139c}}\NWlink{nuweb142}{, 142}.
\item \verb@NLEVELS@: \NWlink{nuweb33}{33}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb132b}{, 132b}, \underline{\NWlink{nuweb140a}{140a}}.
\item \verb@NROW@: \NWlink{nuweb6}{6}\NWlink{nuweb8}{, 8}\NWlink{nuweb9a}{, 9a}\NWlink{nuweb9b}{b}\NWlink{nuweb14}{, 14}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb40}{, 40}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb64c}{, 64c}, \underline{\NWlink{nuweb139b}{139b}}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb142}{, 142}.
\item \verb@Nsubset@: \underline{\NWlink{nuweb27c}{27c}}\NWlink{nuweb36b}{, 36b}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb94a}{, 94a}\NWlink{nuweb94b}{b}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb98a}{, 98a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb137a}{, 137a}\NWlink{nuweb137b}{b}\NWlink{nuweb138b}{, 138b}.
\item \verb@offset@: \underline{\NWlink{nuweb27d}{27d}}\NWlink{nuweb34}{, 34}\NWlink{nuweb36b}{, 36b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90}{, 90}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb128b}{, 128b}.
\item \verb@Offset0@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb136a}{, 136a}.
\item \verb@P@: \NWlink{nuweb14}{14}, \underline{\NWlink{nuweb25a}{25a}}\NWlink{nuweb32c}{, 32c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38b}{b}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb49}{, 49}\NWlink{nuweb51}{, 51}\NWlink{nuweb55}{, 55}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb59}{, 59}\NWlink{nuweb73}{, 73}\NWlink{nuweb74}{, 74}\NWlink{nuweb75}{, 75}\NWlink{nuweb76a}{, 76a}\NWlink{nuweb78}{, 78}\NWlink{nuweb79a}{, 79a}\NWlink{nuweb79b}{b}\NWlink{nuweb80a}{, 80a}\NWlink{nuweb80b}{b}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb88b}{, 88b}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb91}{, 91}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb99}{, 99}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109a}{, 109a}\NWlink{nuweb109b}{b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb140b}{, 140b}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb145a}{, 145a}\NWlink{nuweb157a}{, 157a}\NWlink{nuweb158}{, 158}.
\item \verb@PermutedLinearStatistic_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb156b}{, 156b}\NWlink{nuweb156c}{c}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@Power1@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb90}{, 90}\NWlink{nuweb113b}{, 113b}.
\item \verb@Power2@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb93a}{, 93a}.
\item \verb@PP12@: \NWlink{nuweb36a}{36a}\NWlink{nuweb47}{, 47}\NWlink{nuweb49}{, 49}\NWlink{nuweb55}{, 55}\NWlink{nuweb83}{, 83}\NWlink{nuweb93a}{, 93a}, \underline{\NWlink{nuweb140b}{140b}}\NWlink{nuweb158}{, 158}\NWlink{nuweb159a}{, 159a}.
\item \verb@Q@: \NWlink{nuweb14}{14}, \underline{\NWlink{nuweb25e}{25e}}\NWlink{nuweb32c}{, 32c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38b}{b}\NWlink{nuweb40}{, 40}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb49}{, 49}\NWlink{nuweb51}{, 51}\NWlink{nuweb55}{, 55}\NWlink{nuweb56a}{, 56a}\NWlink{nuweb57}{, 57}\NWlink{nuweb73}{, 73}\NWlink{nuweb74}{, 74}\NWlink{nuweb75}{, 75}\NWlink{nuweb76a}{, 76a}\NWlink{nuweb76b}{b}\NWlink{nuweb76c}{c}\NWlink{nuweb78}{, 78}\NWlink{nuweb80a}{, 80a}\NWlink{nuweb80b}{b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb81d}{d}\NWlink{nuweb82b}{, 82b}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb141a}{, 141a}\NWlink{nuweb157a}{, 157a}\NWlink{nuweb158}{, 158}\NWlink{nuweb159a}{, 159a}.
\item \verb@RC_colSums@: \NWlink{nuweb86a}{86a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb90}{, 90}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb113c}{c}, \underline{\NWlink{nuweb114a}{114a}}.
\item \verb@RC_CovarianceInfluence@: \NWlink{nuweb37b}{37b}\NWlink{nuweb47}{, 47}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb87b}{b}, \underline{\NWlink{nuweb88a}{88a}}.
\item \verb@RC_CovarianceX@: \NWlink{nuweb37c}{37c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb47}{, 47}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb92b}{b}, \underline{\NWlink{nuweb93a}{93a}}.
\item \verb@RC_ExpectationCovarianceStatistic@: \NWlink{nuweb32c}{32c}, \underline{\NWlink{nuweb34}{34}}, \underline{\NWlink{nuweb48}{48}}.
\item \verb@RC_ExpectationInfluence@: \NWlink{nuweb37a}{37a}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb85c}{c}, \underline{\NWlink{nuweb86a}{86a}}.
\item \verb@RC_ExpectationX@: \NWlink{nuweb37a}{37a}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb89b}{b}, \underline{\NWlink{nuweb90}{90}}.
\item \verb@RC_init_LECV_1d@: \NWlink{nuweb32c}{32c}, \underline{\NWlink{nuweb159b}{159b}}.
\item \verb@RC_init_LECV_2d@: \NWlink{nuweb44}{44}, \underline{\NWlink{nuweb160}{160}}.
\item \verb@RC_KronSums@: \NWlink{nuweb81d}{81d}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb100b}{b}, \underline{\NWlink{nuweb101a}{101a}}.
\item \verb@RC_KronSums_Permutation@: \NWlink{nuweb40}{40}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb109c}{c}, \underline{\NWlink{nuweb110a}{110a}}.
\item \verb@RC_LinearStatistic@: \NWlink{nuweb35b}{35b}\NWlink{nuweb81c}{, 81c}, \underline{\NWlink{nuweb81d}{81d}}.
\item \verb@RC_OneTableSums@: \NWlink{nuweb36a}{36a}\NWlink{nuweb40}{, 40}\NWlink{nuweb90}{, 90}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb118b}{b}, \underline{\NWlink{nuweb119a}{119a}}.
\item \verb@RC_order_subset_wrt_block@: \NWlink{nuweb36a}{36a}\NWlink{nuweb40}{, 40}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133a}{, 133a}, \underline{\NWlink{nuweb133b}{133b}}.
\item \verb@RC_setup_subset@: \NWlink{nuweb40}{40}\NWlink{nuweb135b}{, 135b}, \underline{\NWlink{nuweb136a}{136a}}.
\item \verb@RC_Sums@: \NWlink{nuweb36a}{36a}\NWlink{nuweb36b}{b}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb95c}{c}, \underline{\NWlink{nuweb96a}{96a}}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb136a}{, 136a}.
\item \verb@RC_ThreeTableSums@: \NWlink{nuweb44}{44}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128a}{, 128a}, \underline{\NWlink{nuweb128b}{128b}}.
\item \verb@RC_TwoTableSums@: \NWlink{nuweb44}{44}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123a}{, 123a}, \underline{\NWlink{nuweb123b}{123b}}.
\item \verb@R_colSums@: \NWlink{nuweb113a}{113a}, \underline{\NWlink{nuweb113b}{113b}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_CovarianceInfluence@: \NWlink{nuweb86b}{86b}, \underline{\NWlink{nuweb87a}{87a}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_CovarianceX@: \NWlink{nuweb91}{91}, \underline{\NWlink{nuweb92a}{92a}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_ExpectationCovarianceStatistic@: \NWlink{nuweb6}{6}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32b}{b}, \underline{\NWlink{nuweb32c}{32c}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_ExpectationCovarianceStatistic_2d@: \NWlink{nuweb8}{8}\NWlink{nuweb43a}{, 43a}\NWlink{nuweb43b}{b}, \underline{\NWlink{nuweb44}{44}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_ExpectationInfluence@: \NWlink{nuweb85a}{85a}, \underline{\NWlink{nuweb85b}{85b}}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_ExpectationX@: \NWlink{nuweb88b}{88b}, \underline{\NWlink{nuweb89a}{89a}}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_KronSums@: \NWlink{nuweb99}{99}, \underline{\NWlink{nuweb100a}{100a}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_KronSums_Permutation@: \NWlink{nuweb109a}{109a}, \underline{\NWlink{nuweb109b}{109b}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_MPinv_sym@: \NWlink{nuweb145b}{145b}\NWlink{nuweb146a}{, 146a}, \underline{\NWlink{nuweb146b}{146b}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_OneTableSums@: \NWlink{nuweb16}{16}\NWlink{nuweb117b}{, 117b}, \underline{\NWlink{nuweb118a}{118a}}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_order_subset_wrt_block@: \NWlink{nuweb132a}{132a}, \underline{\NWlink{nuweb132b}{132b}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_PermutedLinearStatistic@: \NWlink{nuweb6}{6}\NWlink{nuweb38c}{, 38c}\NWlink{nuweb38d}{d}, \underline{\NWlink{nuweb40}{40}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_PermutedLinearStatistic_2d@: \NWlink{nuweb8}{8}\NWlink{nuweb50a}{, 50a}\NWlink{nuweb50b}{b}, \underline{\NWlink{nuweb51}{51}}\NWlink{nuweb52a}{, 52a}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_quadform@: \NWlink{nuweb64a}{64a}\NWlink{nuweb64b}{b}, \underline{\NWlink{nuweb64c}{64c}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_Sums@: \NWlink{nuweb95a}{95a}, \underline{\NWlink{nuweb95b}{95b}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_ThreeTableSums@: \NWlink{nuweb16}{16}\NWlink{nuweb127a}{, 127a}, \underline{\NWlink{nuweb127b}{127b}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_TwoTableSums@: \NWlink{nuweb16}{16}\NWlink{nuweb122a}{, 122a}, \underline{\NWlink{nuweb122b}{122b}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@R_unpack_sym@: \NWlink{nuweb10}{10}\NWlink{nuweb148a}{, 148a}\NWlink{nuweb148b}{b}, \underline{\NWlink{nuweb149}{149}}\NWlink{nuweb163}{, 163}\NWlink{nuweb164}{, 164}.
\item \verb@S@: \underline{\NWlink{nuweb22a}{22a}}\NWlink{nuweb37b}{, 37b}\NWlink{nuweb38b}{, 38b}\NWlink{nuweb47}{, 47}\NWlink{nuweb48}{, 48}\NWlink{nuweb60b}{, 60b}\NWlink{nuweb61b}{, 61b}\NWlink{nuweb62b}{, 62b}\NWlink{nuweb65}{, 65}\NWlink{nuweb67a}{, 67a}\NWlink{nuweb71}{, 71}\NWlink{nuweb72a}{, 72a}\NWlink{nuweb76a}{, 76a}\NWlink{nuweb80b}{, 80b}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb105}{, 105}\NWlink{nuweb144}{, 144}\NWlink{nuweb145a}{, 145a}\NWlink{nuweb147}{, 147}\NWlink{nuweb152b}{, 152b}.
\item \verb@StandardisedPermutedLinearStatistic_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@subset@: \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb5b}{b}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15}{, 15}\NWlink{nuweb16}{, 16}\NWlink{nuweb18}{, 18}\NWlink{nuweb20}{, 20}, \underline{\NWlink{nuweb27b}{27b}}, \underline{\NWlink{nuweb27e}{27e}}, \underline{\NWlink{nuweb28a}{28a}}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb34}{, 34}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb94b}{, 94b}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb133b}{, 133b}\NWlink{nuweb135a}{, 135a}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb137a}{, 137a}\NWlink{nuweb137b}{b}\NWlink{nuweb138a}{, 138a}\NWlink{nuweb138b}{b}.
\item \verb@sumweights@: \underline{\NWlink{nuweb27a}{27a}}\NWlink{nuweb34}{, 34}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb36b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb46b}{, 46b}\NWlink{nuweb46c}{c}\NWlink{nuweb47}{, 47}\NWlink{nuweb49}{, 49}\NWlink{nuweb51}{, 51}\NWlink{nuweb52b}{, 52b}\NWlink{nuweb52d}{d}\NWlink{nuweb74}{, 74}\NWlink{nuweb75}{, 75}\NWlink{nuweb76b}{, 76b}\NWlink{nuweb81a}{, 81a}\NWlink{nuweb83}{, 83}\NWlink{nuweb84}{, 84}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb136a}{, 136a}\NWlink{nuweb155a}{, 155a}.
\item \verb@Sumweights_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb155a}{, 155a}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}\NWlink{nuweb159b}{, 159b}.
\item \verb@TableBlock_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb36a}{, 36a}\NWlink{nuweb154c}{, 154c}\NWlink{nuweb156a}{, 156a}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}\NWlink{nuweb159b}{, 159b}.
\item \verb@Table_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb155b}{, 155b}\NWlink{nuweb155c}{c}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}\NWlink{nuweb160}{, 160}.
\item \verb@tol_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb156d}{, 156d}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@VarianceInfluence_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb154b}{, 154b}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@Variance_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb152b}{, 152b}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@varonly_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb151b}{, 151b}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@weights@: \NWlink{nuweb3b}{3b}\NWlink{nuweb4}{, 4}\NWlink{nuweb5a}{, 5a}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb15}{, 15}\NWlink{nuweb16}{, 16}\NWlink{nuweb18}{, 18}\NWlink{nuweb20}{, 20}, \underline{\NWlink{nuweb26c}{26c}}\NWlink{nuweb26d}{, 26d}\NWlink{nuweb26e}{e}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36b}{, 36b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38d}{d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb52a}{, 52a}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb93b}{b}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb96a}{, 96a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb136a}{, 136a}.
\item \verb@weights,@: \NWlink{nuweb4}{4}\NWlink{nuweb6}{, 6}\NWlink{nuweb8}{, 8}\NWlink{nuweb16}{, 16}\NWlink{nuweb20}{, 20}, \underline{\NWlink{nuweb26d}{26d}}, \underline{\NWlink{nuweb26e}{26e}}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb36b}{, 36b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38d}{d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb95b}{, 95b}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb136a}{, 136a}.
\item \verb@x@: \NWlink{nuweb8}{8}\NWlink{nuweb14}{, 14}\NWlink{nuweb18}{, 18}\NWlink{nuweb22a}{, 22a}, \underline{\NWlink{nuweb24d}{24d}}, \underline{\NWlink{nuweb25b}{25b}}, \underline{\NWlink{nuweb25c}{25c}}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35a}{, 35a}\NWlink{nuweb35b}{b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37c}{c}\NWlink{nuweb38a}{, 38a}\NWlink{nuweb38d}{d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb51}{, 51}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb89a}{, 89a}\NWlink{nuweb90}{, 90}\NWlink{nuweb92a}{, 92a}\NWlink{nuweb93a}{, 93a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb101a}{, 101a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb113b}{, 113b}\NWlink{nuweb114a}{, 114a}\NWlink{nuweb116b}{, 116b}\NWlink{nuweb118a}{, 118a}\NWlink{nuweb119a}{, 119a}\NWlink{nuweb121b}{, 121b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb139b}{, 139b}\NWlink{nuweb139c}{c}\NWlink{nuweb140a}{, 140a}\NWlink{nuweb145a}{, 145a}\NWlink{nuweb145b}{b}\NWlink{nuweb146a}{, 146a}\NWlink{nuweb146b}{b}\NWlink{nuweb147}{, 147}\NWlink{nuweb148a}{, 148a}\NWlink{nuweb148b}{b}\NWlink{nuweb149}{, 149}.
\item \verb@Xfactor_SLOT@: \underline{\NWlink{nuweb22b}{22b}}\NWlink{nuweb151c}{, 151c}\NWlink{nuweb157b}{, 157b}\NWlink{nuweb158}{, 158}.
\item \verb@y@: \NWlink{nuweb14}{14}\NWlink{nuweb22a}{, 22a}, \underline{\NWlink{nuweb25d}{25d}}, \underline{\NWlink{nuweb26a}{26a}}, \underline{\NWlink{nuweb26b}{26b}}\NWlink{nuweb32a}{, 32a}\NWlink{nuweb32c}{c}\NWlink{nuweb33}{, 33}\NWlink{nuweb35b}{, 35b}\NWlink{nuweb37a}{, 37a}\NWlink{nuweb37b}{b}\NWlink{nuweb38d}{, 38d}\NWlink{nuweb40}{, 40}\NWlink{nuweb43b}{, 43b}\NWlink{nuweb44}{, 44}\NWlink{nuweb45a}{, 45a}\NWlink{nuweb45b}{b}\NWlink{nuweb46c}{, 46c}\NWlink{nuweb47}{, 47}\NWlink{nuweb50b}{, 50b}\NWlink{nuweb81d}{, 81d}\NWlink{nuweb85b}{, 85b}\NWlink{nuweb86a}{, 86a}\NWlink{nuweb87a}{, 87a}\NWlink{nuweb88a}{, 88a}\NWlink{nuweb100a}{, 100a}\NWlink{nuweb102}{, 102}\NWlink{nuweb103a}{, 103a}\NWlink{nuweb105}{, 105}\NWlink{nuweb108}{, 108}\NWlink{nuweb109b}{, 109b}\NWlink{nuweb110a}{, 110a}\NWlink{nuweb111b}{, 111b}\NWlink{nuweb112b}{, 112b}\NWlink{nuweb122b}{, 122b}\NWlink{nuweb123b}{, 123b}\NWlink{nuweb126}{, 126}\NWlink{nuweb127b}{, 127b}\NWlink{nuweb128b}{, 128b}\NWlink{nuweb131a}{, 131a}\NWlink{nuweb132b}{, 132b}\NWlink{nuweb143}{, 143}\NWlink{nuweb144}{, 144}.
\end{list}}

\bibliographystyle{plainnat}
\bibliography{\Sexpr{gsub("\\.bib", "", system.file("libcoin.bib", package = "libcoin"))}}

\end{document}
