Commit e69e4317 authored by Roman Flury's avatar Roman Flury

spam2.2-1

parent b8a86ac9
Pipeline #1209 passed with stage
in 3 seconds
## General and platform dependent
SHELL := /bin/bash
LIBPATH = #export R_LIBS_USER=$(shell pwd)/lib:/usr/sepp1.5.1/drwho/pack-a/r-3.2.1-ro/amd64-linux-ubuntu14.04/lib/R/library:/home/furrer/R/x86_64-pc-linux-gnu-library/3.5 &&
#R := $(LIBPATH) R
#RSCRIPT := $(LIBPATH) Rscript
#LIBPATH = export R_LIBS_USER=$(shell pwd)/lib:/usr/sepp1.5.1/drwho/pack-a/r-devel-99-ro/amd64-linux-ubuntu14.04/lib/R/library:/home/furrer/R/x86_64-pc-linux-gnu-library/3.5:/usr/lib/R-devel/lib/R/library &&
R := $(LIBPATH) R ## On I-MATH servers: daily built devel version
RSCRIPT := $(LIBPATH) Rscript ## On I-MATH servers: daily built devel version
.SUFFIXES: .Rnw .R .Rout .tex .pdf .c .o .so .f
......@@ -81,7 +81,7 @@
<h1>Illustrations and Examples</h1>
<h4 class="author">Reinhard Furrer, Roman Flury</h4>
<h4 class="date">2018-10-11</h4>
<h4 class="date">2018-12-20</h4>
<div class="hidden name"><code>spam.Rmd</code></div>
......
......@@ -114,7 +114,7 @@
<div id="spam-2-2-1" class="section level1">
<h1 class="page-header">
<a href="#spam-2-2-1" class="anchor"></a>spam 2.2-1<small> Unreleased </small>
<a href="#spam-2-2-1" class="anchor"></a>spam 2.2-1<small> 2018-12-20 </small>
</h1>
<p>SIGNIFICANT USER-VISIBLE CHANGES</p>
<ul>
......@@ -128,7 +128,8 @@
</ul>
<p>INTERNAL CHANGES</p>
<ul>
<li>spam fit for pkgdown website.</li>
<li>Spam fit for pkgdown website.</li>
<li>Replacing some internal functions by their primitive equivalent.</li>
</ul>
</div>
<div id="spam-2-2-0" class="section level1">
......@@ -443,8 +444,7 @@
<p>INTERNAL CHANGES</p>
<ul>
<li>New much faster approach to extract rows. For not too sparse large matrices improvements over two orders of magnitudes are achieved.</li>
<li>Elininated ‘.Internal()’ calls that induce a ‘Note’ on CRAN checks. This also implied a minor rewrite of ‘image.spam’.<br>
</li>
<li>Elininated ‘.Internal()’ calls that induce a ‘Note’ on CRAN checks. This also implied a minor rewrite of ‘image.spam’.</li>
<li>Minor code improvements.</li>
<li>Eliminated non-API calls (29.1).</li>
<li>Rewritten .C(“bincode”,…) call as suggested by Brian Ripley (29.2).</li>
......@@ -469,8 +469,7 @@
<p>INTERNAL CHANGES</p>
<ul>
<li>Proper storage of data files.</li>
<li>Cleaning up argument names within spam functions.<br>
</li>
<li>Cleaning up argument names within spam functions.</li>
<li>Cleaning up old Fortran code, i.e., eliminating unnecessary subroutines and write calls.</li>
</ul>
<p>BUG FIXES</p>
......
......@@ -143,8 +143,7 @@ adjacency graph.<br /></p>
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>
<p>The data is available from the package <span class="pkg">INLA</span>
distributed from <a href='www.r-inla.org'>www.r-inla.org</a> or from<br />
<a href='http://www.math.ntnu.no/~hrue/GMRF-book/oral.txt'>http://www.math.ntnu.no/~hrue/GMRF-book/oral.txt</a></p>
distributed from <a href='www.r-inla.org'>www.r-inla.org</a>.</p>
<h2 class="hasAnchor" id="references"><a class="anchor" href="#references"></a>References</h2>
......
......@@ -261,7 +261,7 @@ tested for validity (defaults to <code>TRUE</code>).</p>
<span class='no'>R</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='spam.creation.html'>as.spam</a></span>(<span class='no'>cholS</span>)
<span class='no'>mvsample</span> <span class='kw'>&lt;-</span> ( <span class='fu'>array</span>(<span class='fu'>rnorm</span>(<span class='no'>N</span>*<span class='no'>n</span>),<span class='fu'>c</span>(<span class='no'>N</span>,<span class='no'>n</span>)) <span class='kw'>%*%</span> <span class='no'>R</span>)[,<span class='no'>iord</span>]
<span class='co'># It is often better to order the sample than the matrix</span>
<span class='co'># R itself. </span>
<span class='co'># R itself.</span>
<span class='co'># 'mvsample' is of class 'spam'. We need to transform it to a</span>
<span class='co'># regular matrix, as there is no method 'var' for 'spam' (should there?).</span>
......
......@@ -124,12 +124,12 @@
</div>
<pre class="usage"><span class='fu'>rmvnorm.const</span>(<span class='no'>n</span>, <span class='kw'>mu</span> <span class='kw'>=</span> <span class='fu'>rep</span>(<span class='fl'>0</span>, <span class='fu'>nrow</span>(<span class='no'>Sigma</span>)), <span class='no'>Sigma</span>, <span class='kw'>Rstruct</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>A</span> <span class='kw'>=</span> <span class='fu'>array</span>(<span class='fl'>1</span>, <span class='fu'>c</span>(<span class='fl'>1</span>,<span class='fu'>nrow</span>(<span class='no'>Sigma</span>))), <span class='kw'>a</span><span class='kw'>=</span><span class='fl'>0</span>, <span class='kw'>U</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)
<span class='fu'>rmvnorm.prec.const</span>(<span class='no'>n</span>, <span class='kw'>mu</span> <span class='kw'>=</span> <span class='fu'>rep</span>(<span class='fl'>0</span>, <span class='fu'>nrow</span>(<span class='no'>Q</span>)), <span class='no'>Q</span>, <span class='kw'>Rstruct</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>A</span> <span class='kw'>=</span> <span class='fu'>array</span>(<span class='fl'>1</span>, <span class='fu'>c</span>(<span class='fl'>1</span>,<span class='fu'>nrow</span>(<span class='no'>Q</span>))), <span class='kw'>a</span><span class='kw'>=</span><span class='fl'>0</span>, <span class='kw'>U</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)
<pre class="usage"><span class='fu'>rmvnorm.const</span>(<span class='no'>n</span>, <span class='kw'>mu</span> <span class='kw'>=</span> <span class='fu'>rep.int</span>(<span class='fl'>0</span>, <span class='fu'>dim</span>(<span class='no'>Sigma</span>)[<span class='fl'>1</span>]), <span class='no'>Sigma</span>, <span class='kw'>Rstruct</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>A</span> <span class='kw'>=</span> <span class='fu'>array</span>(<span class='fl'>1</span>, <span class='fu'>c</span>(<span class='fl'>1</span>,<span class='fu'>dim</span>(<span class='no'>Sigma</span>)[<span class='fl'>1</span>])), <span class='kw'>a</span><span class='kw'>=</span><span class='fl'>0</span>, <span class='kw'>U</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)
<span class='fu'>rmvnorm.prec.const</span>(<span class='no'>n</span>, <span class='kw'>mu</span> <span class='kw'>=</span> <span class='fu'>rep.int</span>(<span class='fl'>0</span>, <span class='fu'>dim</span>(<span class='no'>Q</span>)[<span class='fl'>1</span>]), <span class='no'>Q</span>, <span class='kw'>Rstruct</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>A</span> <span class='kw'>=</span> <span class='fu'>array</span>(<span class='fl'>1</span>, <span class='fu'>c</span>(<span class='fl'>1</span>,<span class='fu'>dim</span>(<span class='no'>Q</span>)[<span class='fl'>1</span>])), <span class='kw'>a</span><span class='kw'>=</span><span class='fl'>0</span>, <span class='kw'>U</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)
<span class='fu'>rmvnorm.canonical.const</span>(<span class='no'>n</span>, <span class='no'>b</span>, <span class='no'>Q</span>, <span class='kw'>Rstruct</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>A</span> <span class='kw'>=</span> <span class='fu'>array</span>(<span class='fl'>1</span>, <span class='fu'>c</span>(<span class='fl'>1</span>,<span class='fu'>nrow</span>(<span class='no'>Q</span>))), <span class='kw'>a</span><span class='kw'>=</span><span class='fl'>0</span>, <span class='kw'>U</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)</pre>
<span class='kw'>A</span> <span class='kw'>=</span> <span class='fu'>array</span>(<span class='fl'>1</span>, <span class='fu'>c</span>(<span class='fl'>1</span>,<span class='fu'>dim</span>(<span class='no'>Q</span>)[<span class='fl'>1</span>])), <span class='kw'>a</span><span class='kw'>=</span><span class='fl'>0</span>, <span class='kw'>U</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
......
......@@ -124,8 +124,8 @@
</div>
<pre class="usage"><span class='fu'>rmvnorm.spam</span>(<span class='no'>n</span>,<span class='kw'>mu</span><span class='kw'>=</span><span class='fu'>rep</span>(<span class='fl'>0</span>, <span class='fu'>nrow</span>(<span class='no'>Sigma</span>)), <span class='no'>Sigma</span>, <span class='kw'>Rstruct</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)
<span class='fu'>rmvnorm.prec</span>(<span class='no'>n</span>,<span class='kw'>mu</span><span class='kw'>=</span><span class='fu'>rep</span>(<span class='fl'>0</span>, <span class='fu'>nrow</span>(<span class='no'>Q</span>)), <span class='no'>Q</span>, <span class='kw'>Rstruct</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)
<pre class="usage"><span class='fu'>rmvnorm.spam</span>(<span class='no'>n</span>,<span class='kw'>mu</span><span class='kw'>=</span><span class='fu'>rep.int</span>(<span class='fl'>0</span>, <span class='fu'>dim</span>(<span class='no'>Sigma</span>)[<span class='fl'>1</span>]), <span class='no'>Sigma</span>, <span class='kw'>Rstruct</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)
<span class='fu'>rmvnorm.prec</span>(<span class='no'>n</span>,<span class='kw'>mu</span><span class='kw'>=</span><span class='fu'>rep.int</span>(<span class='fl'>0</span>, <span class='fu'>dim</span>(<span class='no'>Q</span>)[<span class='fl'>1</span>]), <span class='no'>Q</span>, <span class='kw'>Rstruct</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)
<span class='fu'>rmvnorm.canonical</span>(<span class='no'>n</span>, <span class='no'>b</span>, <span class='no'>Q</span>, <span class='kw'>Rstruct</span><span class='kw'>=</span><span class='kw'>NULL</span>, <span class='no'>...</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
......@@ -192,14 +192,14 @@
<span class='no'>Sigmainv</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='spam.creation.html'>as.spam</a></span>( <span class='no'>Sigmainv</span>, <span class='kw'>eps</span><span class='kw'>=</span><span class='fl'>1e-4</span>)
<span class='no'>Sigma</span> <span class='kw'>&lt;-</span> <span class='fu'>solve</span>( <span class='no'>Sigmainv</span>) <span class='co'># for verification </span>
<span class='no'>Sigma</span> <span class='kw'>&lt;-</span> <span class='fu'>solve</span>( <span class='no'>Sigmainv</span>) <span class='co'># for verification</span>
<span class='no'>iidsample</span> <span class='kw'>&lt;-</span> <span class='fu'>array</span>(<span class='fu'>rnorm</span>(<span class='no'>N</span>*<span class='no'>n</span>),<span class='fu'>c</span>(<span class='no'>n</span>,<span class='no'>N</span>))
<span class='no'>mvsample</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='solve.html'>backsolve</a></span>( <span class='fu'>chol</span>(<span class='no'>Sigmainv</span>), <span class='no'>iidsample</span>)
<span class='fu'><a href='operations.html'>norm</a></span>( <span class='fu'>var</span>(<span class='fu'>t</span>(<span class='no'>mvsample</span>)) - <span class='no'>Sigma</span>, <span class='kw'>type</span><span class='kw'>=</span><span class='st'>"m"</span>)</div><div class='output co'>#&gt; [1] 0.1326448</div><div class='input'>
<span class='co'># compare with:</span>
<span class='no'>mvsample</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='solve.html'>backsolve</a></span>( <span class='fu'>chol</span>(<span class='fu'>as.matrix</span>( <span class='no'>Sigmainv</span>)), <span class='no'>iidsample</span>, <span class='no'>n</span>)
<span class='co'>#### ,n as patch </span>
<span class='co'>#### ,n as patch</span>
<span class='fu'><a href='operations.html'>norm</a></span>( <span class='fu'>var</span>(<span class='fu'>t</span>(<span class='no'>mvsample</span>)) - <span class='no'>Sigma</span>, <span class='kw'>type</span><span class='kw'>=</span><span class='st'>"m"</span>)</div><div class='output co'>#&gt; [1] 0.1326447</div><div class='input'>
......
......@@ -212,7 +212,7 @@ is.spam(x)</pre>
<span class='no'>is</span> <span class='kw'>&lt;-</span> <span class='fu'>sample</span>(<span class='no'>ln</span>,<span class='no'>nz</span>)
<span class='no'>js</span> <span class='kw'>&lt;-</span> <span class='fu'>sample</span>(<span class='no'>ln</span>,<span class='no'>nz</span>)
<span class='fu'>system.time</span>(<span class='kw'>for</span> (<span class='no'>i</span> <span class='kw'>in</span> <span class='fl'>1</span>:<span class='no'>nz</span>) <span class='no'>smat</span>[<span class='no'>is</span>[<span class='no'>i</span>], <span class='no'>js</span>[<span class='no'>i</span>]] <span class='kw'>&lt;-</span> <span class='no'>i</span>)</div><div class='output co'>#&gt; user system elapsed
#&gt; 0.088 0.000 0.089 </div><div class='input'><span class='fu'>system.time</span>(<span class='no'>smat</span>[<span class='fu'><a href='xybind.html'>cbind</a></span>(<span class='no'>is</span>,<span class='no'>js</span>)] <span class='kw'>&lt;-</span> <span class='fl'>1</span>:<span class='no'>nz</span>)</div><div class='output co'>#&gt; user system elapsed
#&gt; 0.108 0.000 0.121 </div><div class='input'><span class='fu'>system.time</span>(<span class='no'>smat</span>[<span class='fu'><a href='xybind.html'>cbind</a></span>(<span class='no'>is</span>,<span class='no'>js</span>)] <span class='kw'>&lt;-</span> <span class='fl'>1</span>:<span class='no'>nz</span>)</div><div class='output co'>#&gt; user system elapsed
#&gt; 0.004 0.000 0.001 </div><div class='input'>
<span class='fu'>getClass</span>(<span class='st'>"spam"</span>)</div><div class='output co'>#&gt; Class "spam" [package "spam"]
#&gt;
......
......@@ -160,7 +160,7 @@ spam.Version() provides detailed information about the version of spam
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='no'>spam.version</span>$<span class='no'>version.string</span></div><div class='output co'>#&gt; [1] "Spam version 2.2-1 (2018-10-11)"</div></pre>
<pre class="examples"><div class='input'><span class='no'>spam.version</span>$<span class='no'>version.string</span></div><div class='output co'>#&gt; [1] "Spam version 2.2-1 (2018-12-20)"</div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
......
No preview for this file type
......@@ -2,7 +2,7 @@ Package: spam
Type: Package
Title: SPArse Matrix
Version: 2.2-1
Date: 2018-10-11
Date: 2018-12-20
Authors@R: c(person("Reinhard", "Furrer", role = c("aut", "cre"),
email = "reinhard.furrer@math.uzh.ch"),
person("Florian", "Gerber", role = c("ctb"),
......
......@@ -2,12 +2,10 @@
# can be used for spam-devel and spam
include ../Makefile.defs
all: pkgdown
pkgdown:
$(RSCRIPT) -e "pkgdown::build_site()"
Rscript -e "pkgdown::build_site()"
clean:
......
......@@ -11,7 +11,8 @@ BUG FIXES
INTERNAL CHANGES
* spam fit for pkgdown website.
* Spam fit for pkgdown website.
* Replacing some internal functions by their primitive equivalent.
# spam 2.2-0
......
......@@ -168,8 +168,8 @@ setMethod("pad<-", "matrix",
function(x, value) {
if (!identical( length(value), 2L)) stop("dims should be of length 2.")
tmp <- matrix(0, value)
mr <- 1:min(value[1], nrow(x))
mc <- 1:min(value[2], ncol(x))
mr <- 1:min(value[1], dim(x)[1])
mc <- 1:min(value[2], dim(x)[2])
tmp[mr,mc] <- x[mr,mc]
return(tmp)
})
......@@ -40,7 +40,7 @@ setMethod("!",signature(x="spam"), function(x){
x
} else {
inefficiencywarning( gettextf("This %s operation may be inefficient",sQuote(.Generic)), prod(dim(x)))
spam(as.double( callGeneric(as.matrix(x))), nrow=nrow(x))
spam(as.double( callGeneric(as.matrix(x))), nrow=dim(x)[1])
}
})
......
......@@ -41,7 +41,7 @@ function (x = seq(0, 1, len = nrow(z)), y = seq(0, 1, len = ncol(z)),
if (is.null(dim(x)))
stop("argument must be matrix-like")
z <- x
x <- seq(0, 1, len = nrow(z))
x <- seq(0, 1, len = dim(z)[1])
}
if (missing(xlab))
xlab <- ""
......@@ -81,12 +81,12 @@ function (x = seq(0, 1, len = nrow(z)), y = seq(0, 1, len = ncol(z)),
if (!is.spam(z)) stop("'z' must be a matrix")
xx <- x
yy <- y
if (length(x) > 1 && length(x) == nrow(z)) {
if (length(x) > 1 && length(x) == dim(z)[1]) {
dx <- 0.5 * diff(x)
x <- c(x[1] - dx[1], x[-length(x)] + dx, x[length(x)] +
dx[length(x) - 1])
}
if (length(y) > 1 && length(y) == ncol(z)) {
if (length(y) > 1 && length(y) == dim(z)[2]) {
dy <- 0.5 * diff(y)
y <- c(y[1] - dy[1], y[-length(y)] + dy, y[length(y)] +
dy[length(y) - 1])
......@@ -118,13 +118,13 @@ function (x = seq(0, 1, len = nrow(z)), y = seq(0, 1, len = ncol(z)),
if (!add)
plot(NA, NA, xlim = xlim, ylim = ylim, type = "n", xaxs = xaxs,
yaxs = yaxs, xlab = xlab, ylab = ylab, ...)
if (length(xx) != nrow(z) || length(yy) != ncol(z))
if (length(xx) != dim(z)[1] || length(yy) != dim(z)[2])
stop("dimensions of z are not length(x) times length(y)")
if (missing(cex)) {
warning("default value for 'cex' in 'image' might be a bad choice", call.=FALSE)
cex <- 1
}
points( xx[rep.int((1:nrow(z)),diff(z@rowpointers))], yy[z@colindices],
points( xx[rep.int((1:dim(z)[1]),diff(z@rowpointers))], yy[z@colindices],
pch=".", cex=cex*getOption("spam.cex")/sum(z@dimension),
col=col[zi+1])
}
......@@ -168,7 +168,7 @@ plot.spam <- function(x,y,xlab=NULL,ylab=NULL,...)
lab <- deparse(substitute(x))
#only a few cases are considered
# 1st case, a colum vector only
if (ncol(x)==1) {
if (dim(x)[2]==1) {
x <- c(x)
return( plot(x,...))
}
......
......@@ -13,7 +13,7 @@
# Draw from a multivariate normal:
# (Algorithm 2.3 from Rue and Held, 2005)
rmvnorm.spam <- function(n,mu=rep(0, nrow(Sigma)), Sigma, Rstruct=NULL, ...) {
rmvnorm.spam <- function(n, mu = rep.int(0, dim(Sigma)[1]), Sigma, Rstruct = NULL, ...) {
# taken from ?chol.spam
if (is(Rstruct,"spam.chol.NgPeyton"))
......@@ -34,17 +34,17 @@ rmvnorm.spam <- function(n,mu=rep(0, nrow(Sigma)), Sigma, Rstruct=NULL, ...) {
# Draw from a multivariate normal given a precision matrix:
# (Algorithm 2.4 from Rue and Held, 2005)
rmvnorm.prec <- function(n,mu=rep(0, nrow(Q)), Q, Rstruct=NULL, ...) {
rmvnorm.prec <- function(n, mu = rep.int(0, dim(Q)[1]), Q, Rstruct = NULL, ...) {
if (is(Rstruct,"spam.chol.NgPeyton"))
R <- update.spam.chol.NgPeyton( Rstruct, Q, ...)
else
R <- chol(Q,...)
R <- chol(Q, ...)
# R is the upper triangular part of the permutated matrix Sigma
N <- dim(Q)[1]
nu <- backsolve(R, array(rnorm(n*N),c(N,n)), k=N)
return(t(nu+mu))
nu <- backsolve(R, array(rnorm(n*N), c(N, n)), k = N)
return(t(nu + mu))
}
......@@ -68,12 +68,12 @@ rmvnorm.canonical <- function(n, b, Q, Rstruct=NULL, ...) {
rmvnorm.const <- function (n, mu = rep(0, nrow(Sigma)), Sigma,
rmvnorm.const <- function (n, mu = rep.int(0, dim(Sigma)[1]), Sigma,
Rstruct = NULL,
A = array(1, c(1,nrow(Sigma))), a=0, U=NULL, ...)
A = array(1, c(1,dim(Sigma)[1])), a=0, U=NULL, ...)
{
N <- dim(Sigma)[1]
if (!identical(ncol(A), N)) stop("Incorrect constraint specification")
if (!identical(dim(A)[2], N)) stop("Incorrect constraint specification")
if (is(Rstruct, "spam.chol.NgPeyton"))
cholS <- update.spam.chol.NgPeyton(Rstruct, Sigma, ...)
......@@ -93,12 +93,12 @@ rmvnorm.const <- function (n, mu = rep(0, nrow(Sigma)), Sigma,
}
rmvnorm.prec.const <- function (n, mu = rep(0, nrow(Q)), Q,
rmvnorm.prec.const <- function (n, mu = rep.int(0, dim(Q)[1]), Q,
Rstruct = NULL,
A = array(1, c(1,nrow(Q))), a=0, U=NULL, ...)
A = array(1, c(1,dim(Q)[1])), a=0, U=NULL, ...)
{
N = dim(Q)[1]
if (!identical(ncol(A), N)) stop("Incorrect constraint specification")
if (!identical(dim(A)[2], N)) stop("Incorrect constraint specification")
if (is(Rstruct, "spam.chol.NgPeyton"))
R <- update.spam.chol.NgPeyton(Rstruct, Q, ...)
......@@ -118,10 +118,10 @@ rmvnorm.prec.const <- function (n, mu = rep(0, nrow(Q)), Q,
rmvnorm.canonical.const <- function (n, b, Q, Rstruct = NULL,
A = array(1, c(1,nrow(Q))), a=0, U=NULL, ...)
A = array(1, c(1,dim(Q)[1])), a=0, U=NULL, ...)
{
N = dim(Q)[1]
if (!identical(ncol(A), N)) stop("Incorrect constraint specification")
if (!identical(dim(A)[2], N)) stop("Incorrect constraint specification")
if (is(Rstruct, "spam.chol.NgPeyton"))
R <- update.spam.chol.NgPeyton(Rstruct, Q, ...)
......
......@@ -668,8 +668,8 @@ backsolve.spam <- function(r, x,...){#, k = NULL, upper.tri = NULL, transpose =
p <- 1
} else {
x <- as.matrix(x)
n <- nrow(x)
p <- ncol(x)
n <- dim(x)[1]
p <- dim(x)[2]
}
# we separate between "spam.chol.NgPeyton" and "spam"
......@@ -776,8 +776,8 @@ forwardsolve.spam <- function(l, x,...){#, k = NULL, upper.tri = NULL, transpose
p <- 1L
} else {
if(!is.matrix(x)) x <- as.matrix(x)
n <- nrow(x)
p <- ncol(x)
n <- dim(x)[1]
p <- dim(x)[2]
}
# we separate between "spam.chol.NgPeyton" and "spam"
......
......@@ -14,19 +14,19 @@
head.spam <- function(x, n = 6L, m = n, ...) {
stopifnot(length(n) == 1L, length(m) == 1L)
n <- if (n < 0L)
max(nrow(x) + n, 0L)
else min(n, nrow(x))
max(dim(x)[1] + n, 0L)
else min(n, dim(x)[1])
m <- if (m < 0L)
max(ncol(x) + m, 0L)
else min(m, ncol(x))
max(dim(x)[2] + m, 0L)
else min(m, dim(x)[2])
as.matrix(x[seq_len(n), seq_len(m), drop = FALSE])
}
tail.spam <- function (x, n = 6L, m = n, addrownums = TRUE, ...)
{
stopifnot(length(n) == 1L, length(m) == 1L)
nrx <- nrow(x)
ncx <- ncol(x)
nrx <- dim(x)[1]
ncx <- dim(x)[2]
n <- if (n < 0L)
max(nrx + n, 0L)
else min(n, nrx)
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/Oral.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/Oral.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -34,8 +37,7 @@ There is a similar dataset \code{data(Germany)} with larynx cancer cases from t
\pkg{INLA} as well, with an additional smoking covariate.
}
\source{The data is available from the package \pkg{INLA}
distributed from \url{www.r-inla.org} or from\cr
\url{http://www.math.ntnu.no/~hrue/GMRF-book/oral.txt}
distributed from \url{www.r-inla.org}.
}
\references{
Knorr-Held, L. and Rasser, G. (2000) Bayesian Detection of Clusters and Discontinuities in Disease Maps,
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/UScounties.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/UScounties.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/USprecip.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/USprecip.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/adjacency.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/adjacency.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/allequal.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/allequal.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/apply.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/apply.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/bandwidth.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/bandwidth.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/bdiag.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/bdiag.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/chol.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/chol.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/circulant.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/circulant.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/cleanup.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/cleanup.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/coerce.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/coerce.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/coercion.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/coercion.Rd. %
% It is part of the R package spam, %
% --> https://CRAN.R-project.org/package=spam %
% --> https://CRAN.R-project.org/package=spam64 %
% --> https://git.math.uzh.ch/reinhard.furrer/spam %
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb], %
% Roman Flury [ctb], Daniel Gerber [ctb], %
% Kaspar Moesinger [ctb] %
% HEADER END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
% HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is file ../spam/man/complexity.Rd
% This file is part of the spam package,
% http://www.math.uzh.ch/furrer/software/spam/
% by Reinhard Furrer [aut, cre], Florian Gerber [ctb]
% Daniel Gerber [ctb], Kaspar Moesinger [ctb]
% This is file spam/man/complexity.Rd. %
% It is part of the R package spam, %