SCM

SCM Repository

[matrix] Diff of /pkg/R/zzz.R
ViewVC logotype

Diff of /pkg/R/zzz.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 908, Thu Sep 8 15:30:08 2005 UTC revision 1056, Tue Nov 22 16:40:49 2005 UTC
# Line 1  Line 1 
1    ### Note that "in theory" even base::as.vector() should be overloaded.
2    ### In practice that could be too much of a performance penalty in some cases.
3    
4  .onLoad <- function(libname, pkgname)  .onLoad <- function(libname, pkgname)
5  {  {
6        require(methods)
7    
8      ## The following works around namespace-protection on purpose:      ## The following works around namespace-protection on purpose:
9      assignInNamespace("..Old..as.matrix", base::as.matrix, ns = "base")      assignInNamespace("..Old..as.matrix", base::as.matrix, ns = "base")
10        assignInNamespace("..Old..as.array", base::as.array, ns = "base")
11      assignInNamespace("as.matrix", as.matrix, ns = "base")      assignInNamespace("as.matrix", as.matrix, ns = "base")
12        assignInNamespace("as.array", as.array, ns = "base")
13      ## Now all the functions in 'base' that start with something like      ## Now all the functions in 'base' that start with something like
14      ##  "x <- as.matrix(x)"      ##  "x <- as.matrix(x)" or  "X <- as.array(X)"
15      ## will work for 'Matrix'-matrices      ## will work for 'Matrix'-matrices
16    
17        ## kronecker() / %x% -- in principle should re-assigne base::kronecker
18        ## -----------> ?? performance hit ?? in mantelhaen.test() ??
19        ##
20        ## This is formally identical to the base definition, but should use the
21        ## generic kronecker
22        assignInNamespace("%x%", function (X, Y) kronecker(X, Y), ns = "base")
23    
24      if(paste(R.version$major, R.version$minor, sep=".") >= "2.2")      if(paste(R.version$major, R.version$minor, sep=".") >= "2.2")
25          methods:::bind_activation(TRUE)          methods:::bind_activation(TRUE)
26  }  }
# Line 14  Line 28 
28  .onUnload <- function(libpath)  .onUnload <- function(libpath)
29  {  {
30      assignInNamespace("as.matrix", base::..Old..as.matrix, ns = "base")      assignInNamespace("as.matrix", base::..Old..as.matrix, ns = "base")
31        assignInNamespace("as.array",  base::..Old..as.array,  ns = "base")
32      library.dynam.unload("Matrix", libpath)      library.dynam.unload("Matrix", libpath)
33    
34      if(paste(R.version$major, R.version$minor, sep=".") >= "2.2")      if(paste(R.version$major, R.version$minor, sep=".") >= "2.2")

Legend:
Removed from v.908  
changed lines
  Added in v.1056

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge