Re: [Rd] Re: [R] Problem going back to a viewport with gridBase

2005-06-03 Thread Gabor Grothendieck
On 6/2/05, Paul Murrell [EMAIL PROTECTED] wrote:
 Hi

Thanks.  I have mucked around in vpTree structures and discovered its
actually quite easy to specify children so I have changed my example
so that instead of naming the children of 'layout' and then remembering 
coordinates linked to the names of the children of 'layout' in 
the 'coords' structure (which really just duplicates state information
already available in grid) it simply follows the order
of the children of 'layout' directly.  This permits elimination of 'coords' 
and the two naming functions.  Using the depth approach you advocate,
'with' also becomes shorter and I think I have it to the point where it works 
with both vpPath and viewport classes.  Once Deepayan implements 
the use.viewport= argument to print, 'with' can be eliminated too.  No 
questions this time but I thought I would post the latest version for
completeness. Regards.

[pushLayout is same as before except there are no names on the
children of 'layout' and the rest is new]

library(grid)
library(lattice)

pushLayout - function(nr, nc, name=layout) {
  pushViewport(viewport(layout=grid.layout(nr, nc), name=name))
  for (i in 1:nr) {
for (j in 1:nc) {
  pushViewport(viewport(layout.pos.row=i, layout.pos.col=j))
  upViewport()
}
  }
  upViewport()
}

with.vpPath - with.viewport - function(data, expr, ...) {
  # if data is a vpPath it cannot be ROOT since NULL will never
dispatch here
  depth - if (data$name == ROOT) 0 else downViewport(data$name)
  result - eval.parent(substitute(expr))
  upViewport(depth)
  invisible(result)
}

grid.newpage()

# specify number of cells to fill and number of rows
n - 5; nr - 3

nc - ceiling(n/nr)
downViewport(pushLayout(nr, nc))

vpt - current.vpTree(all = FALSE)
for(k in 1:n) with(vpt$children[[k]],
  print( xyplot(v ~ v, list(v = 1:k)), newpage = FALSE )
)

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] using so-library involving Taucs

2005-06-03 Thread Susanne Heim

Dear R developers,

The trace of the hat matrix H~(n,n) is computed as follows:

tr(H) = tr(BS^-1B')  = tr(S^-1B'B) := tr(X) = sum(diag(X))

with B~(n,p), S~(p,p).
Since p is of the order 10^3 but S is sparse I would like to employ 
Taucs linear solver ( http://www.tau.ac.il/~stoledo/taucs/ ) on


SX = B'B.

(Further improvement by implying a looping over i=1,...,p, calling 
taucs_linsolve(S, X[,i], (B'B)[,i]) and saving X[i,i] only is pending.)


For this purpose I compiled the C code hattrace.c to a shared object 
using:
gcc -g -Wall -I/usr/local/taucs/src -I/usr/local/taucs/build/linux  -c 
hattrace.c -o hattrace.o
gcc -g  -L/usr/local/taucs/external/lib/linux 
-L/usr/local/taucs/lib/linux -L/usr/local/lib -L/opt/gnome/lib 
-L/usr/lib/R/lib -shared -fpic -o hattrace.so hattrace.o -ltaucs 
-llapack -lf77blas -lcblas -latlas  -lmetis -lm -lg2c -lR


I tried the following test commands:
library(splines)
library(SparseM)
B - splineDesign(knots = 1:10, x = 4:7)
D - diff(diag(dim(B)[2]), differences = 1)
BB - t(B) %*% B
S - as.matrix.ssc(BB + t(D) %*% D)
if (!is.loaded(symbol.C(hattrace))) { dyn.load(paste(hattrace, 
.Platform$dynlib.ext, sep = )) }

out - 0
spur - (.C(hattrace, as.double(as.vector(slot(S, ra))),
   as.integer(as.vector(slot(S, ja) - 1)),
   as.integer(as.vector(slot(S, ia) - 1)),
   as.integer(dim(S)[1]), as.double(as.vector(BB)),
   as.double(out), PACKAGE = hattrace))[[6]]

Unfortunately, I get an R process segmentation fault although the C Code 
outputs the correct trace value to /tmp/hattrace.log which I checked by 
a equivalent R routine. Since this segmentation fault does not occur 
every time, I assume a pointer problem. Any help on how to solve it is 
greatly appreciated.


I am running R 2.0.0 on SuSE Linux.

Susanne Heim

--
Susanne Heim
Institute of Statistics, Ludwig-Maximilians-University
Ludwigstr.33/II, D-80539 Munich, Germany.
Phone: +49-89-2180-2226

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] using so-library involving Taucs

2005-06-03 Thread Susanne Heim

Dear R developers,

The trace of the hat matrix H~(n,n) is computed as follows:

tr(H) = tr(BS^-1B')  = tr(S^-1B'B) := tr(X) = sum(diag(X))

with B~(n,p), S~(p,p).
Since p is of the order 103 but S is sparse I would like to employ Taucs 
linear solver ( http://www.tau.ac.il/~stoledo/taucs/ ) on


SX = B'B.

(Further improvement by implying a looping over i=1,...,p, calling 
taucs_linsolve(S, X[,i], (B'B)[,i]) and saving X[i,i] only is pending.)


For this purpose I compiled the C code hattrace.c to a shared object 
using:
gcc -g -Wall -I/usr/local/taucs/src -I/usr/local/taucs/build/linux  -c 
hattrace.c -o hattrace.o
gcc -g  -L/usr/local/taucs/external/lib/linux 
-L/usr/local/taucs/lib/linux -L/usr/local/lib -L/opt/gnome/lib 
-L/usr/lib/R/lib -shared -fpic -o hattrace.so hattrace.o -ltaucs 
-llapack -lf77blas -lcblas -latlas  -lmetis -lm -lg2c -lR


I tried the following test commands:
library(splines)
library(SparseM)
B - splineDesign(knots = 1:10, x = 4:7)
D - diff(diag(dim(B)[2]), differences = 1)
BB - t(B) %*% B
S - as.matrix.ssc(BB + t(D) %*% D)
if (!is.loaded(symbol.C(hattrace))) { dyn.load(paste(hattrace, 
.Platform$dynlib.ext, sep = )) }

out - 0
spur - (.C(hattrace, as.double(as.vector(slot(S, ra))),
   as.integer(as.vector(slot(S, ja) - 1)),
   as.integer(as.vector(slot(S, ia) - 1)),
   as.integer(dim(S)[1]), as.double(as.vector(BB)),
   as.double(out), PACKAGE = hattrace))[[6]]

Unfortunately, I get an R process segmentation fault although the C Code 
outputs the correct trace value to /tmp/hattrace.log which I checked by 
a equivalent R routine. Since this segmentation fault does not occur 
every time, I assume a pointer problem. Any help on how to solve it is 
greatly appreciated.


I am running R 2.0.0 on SuSE Linux.

Susanne Heim

--
Susanne Heim
Institute of Statistics, Ludwig-Maximilians-University
Ludwigstr.33/II, D-80539 Munich, Germany.
Phone: +49-89-2180-2226
__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] R-bugs will be offline starting June 7

2005-06-03 Thread Peter Dalgaard

Due to our IT unit moving on Wednesday and Biostat's move the day
after, the web interface to r-bugs will be offline from the afternoon
of June 7 at least until the afternoon of June 9, possibly going into
the 10th. The email interface may come up somewhat earlier.

-pd

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] dotcode typo? (PR#7917)

2005-06-03 Thread murdoch
On 6/2/2005 1:27 PM, [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:

 
 Whoops, spoke too soon.  This definitely breaks the logic, so I won't 
 commit.  With this change the check of demo(lm.glm) in package utils 
 fails with this error message:
 
   dead - cbind(x, n - x)
 
   summary(glm(dead ~ dose, family = binomial(link = logit)))
 Error in .Call(logit_link, mu) : cannot resolve native routine
 Execution halted
 
 I'm cc'ing this to R-bugs so we don't forget it, but I'm not going to be 
 able to fix it down myself.
 
 Duncan Murdoch
 
 __
 R-devel@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 That occurs in code that I recently added so I better check that.

I think it was that .Call() didn't include PACKAGE=stats in 
stats/R/family.R.  I've fixed that; I'll look for other similar cases.

Duncan Murdoch

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] documentation source diff...

2005-06-03 Thread Dan Bolser

Hi, I forgot the name of the function 'colSums', and expected to be able
to find it through the 'see also' section of the documentation for the
'sum' function.

Here is the diff I made of the altered documentation to facilitate this
action... (p.s. I made the diff on the R-2.1.0 source).


diff sum.Rd src/library/base/man/sum.Rd --context=2
*** sum.Rd  2005-06-03 20:24:22.468224056 +0100
--- src/library/base/man/sum.Rd 2005-04-18 22:30:27.0 +0100
***
*** 33,38 
Wadsworth \ Brooks/Cole.
  }
- \seealso{
-   \code{\code{\link{colSums}}.
- }
  \keyword{arith}
--- 33,35 

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] using so-library involving Taucs

2005-06-03 Thread Douglas Bates
On 6/3/05, Susanne Heim [EMAIL PROTECTED] wrote:
 Dear R developers,
 
 The trace of the hat matrix H~(n,n) is computed as follows:
 
 tr(H) = tr(BS^-1B')  = tr(S^-1B'B) := tr(X) = sum(diag(X))
 
 with B~(n,p), S~(p,p).
 Since p is of the order 10^3 but S is sparse I would like to employ
 Taucs linear solver ( http://www.tau.ac.il/~stoledo/taucs/ ) on
 
 SX = B'B.
 
 (Further improvement by implying a looping over i=1,...,p, calling
 taucs_linsolve(S, X[,i], (B'B)[,i]) and saving X[i,i] only is pending.)
 
 For this purpose I compiled the C code hattrace.c to a shared object
 using:
 gcc -g -Wall -I/usr/local/taucs/src -I/usr/local/taucs/build/linux  -c
 hattrace.c -o hattrace.o
 gcc -g  -L/usr/local/taucs/external/lib/linux
 -L/usr/local/taucs/lib/linux -L/usr/local/lib -L/opt/gnome/lib
 -L/usr/lib/R/lib -shared -fpic -o hattrace.so hattrace.o -ltaucs
 -llapack -lf77blas -lcblas -latlas  -lmetis -lm -lg2c -lR
 
 I tried the following test commands:
 library(splines)
 library(SparseM)
 B - splineDesign(knots = 1:10, x = 4:7)
 D - diff(diag(dim(B)[2]), differences = 1)
 BB - t(B) %*% B
 S - as.matrix.ssc(BB + t(D) %*% D)
 if (!is.loaded(symbol.C(hattrace))) { dyn.load(paste(hattrace,
 .Platform$dynlib.ext, sep = )) }
 out - 0
 spur - (.C(hattrace, as.double(as.vector(slot(S, ra))),
 as.integer(as.vector(slot(S, ja) - 1)),
 as.integer(as.vector(slot(S, ia) - 1)),
 as.integer(dim(S)[1]), as.double(as.vector(BB)),
 as.double(out), PACKAGE = hattrace))[[6]]
 
 Unfortunately, I get an R process segmentation fault although the C Code
 outputs the correct trace value to /tmp/hattrace.log which I checked by
 a equivalent R routine. Since this segmentation fault does not occur
 every time, I assume a pointer problem. Any help on how to solve it is
 greatly appreciated.

Is S positive definite?  If so, it may be more effective to take the
Cholesky decomposition of S and solve the system S^(1/2)X = B then
take the sum of the squares of the elements of X.

If you wish to provide me off-list with examples of the matrices S and
B, I can check how best to do this with the Matrix package.

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel