SCM

SCM Repository

[matrix] Annotation of /pkg/Matrix/R/AllGeneric.R
ViewVC logotype

Annotation of /pkg/Matrix/R/AllGeneric.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3098 - (view) (download)

1 : maechler 925 #### Define those generics that we need, if they don't exist;
2 :     #### not all will be exported
3 : bates 10
4 :     setGeneric("expand", function(x, ...) standardGeneric("expand"))
5 : bates 325
6 : maechler 2110
7 : mmaechler 2904 setGeneric("isDiagonal", function(object) standardGeneric("isDiagonal"))
8 : maechler 925
9 : mmaechler 3015 setGeneric("isTriangular", function(object, upper = NA, ...)
10 : mmaechler 2904 standardGeneric("isTriangular"))
11 : maechler 925
12 : mmaechler 3069 ## Boolean Arithmetic Matrix multiplication
13 :     setGeneric("%&%", function (x, y) standardGeneric("%&%"))
14 :    
15 :    
16 : maechler 2110 ## isSymmetric is "S3 generic" in R's base/R/eigen.R
17 :    
18 : bates 10 setGeneric("facmul",
19 :     function(x, factor, y, transpose, left, ...)
20 :     standardGeneric("facmul"))
21 :    
22 : maechler 2157 setGeneric("BunchKaufman", function(x, ...) standardGeneric("BunchKaufman"))
23 :     setGeneric("lu", function(x, ...) standardGeneric("lu"))
24 : bates 10
25 : maechler 2154 ##NB ## do not redefine the "base signature"
26 : maechler 1389
27 : maechler 2154 ##NB setGeneric("chol", def = function(x, pivot= FALSE,...) standardGeneric("chol"),
28 :     ##NB useAsDefault= function(x, pivot= FALSE,...) base::chol(x, pivot, ...))
29 : bates 1427
30 : maechler 2154 ##NB setGeneric("qr", def = function(x, tol=1e-7,...) standardGeneric("qr"),
31 :     ##NB useAsDefault= function(x, tol=1e-7,...) base::qr(x, tol, ...))
32 : maechler 1389
33 : mmaechler 3069 if(is.na(match("...", names(formals(implicitGeneric("crossprod")))))) {
34 :     ## base:crossprod() has no '...', but since 2015-03, there's an implicit generic
35 :     setGeneric("crossprod", function(x, y=NULL, ...) standardGeneric("crossprod"),
36 :     useAsDefault= function(x, y=NULL, ...) base::crossprod(x, y))
37 :     setGeneric("tcrossprod", function(x, y=NULL, ...) standardGeneric("tcrossprod"),
38 :     useAsDefault= function(x, y=NULL, ...) base::tcrossprod(x, y))
39 :     }
40 :    
41 : bates 10 setGeneric("Schur", function(x, vectors, ...) standardGeneric("Schur"))
42 :    
43 : mmaechler 2807 setGeneric("unpack", function(x, ...) standardGeneric("unpack"))
44 :     setGeneric("pack", function(x, ...) standardGeneric("pack"))
45 : bates 10
46 :    
47 : bates 769 setGeneric("expm", function(x) standardGeneric("expm"))
48 : bates 10
49 : bates 835 setGeneric("writeMM", function(obj, file, ...)
50 :     standardGeneric("writeMM"))
51 :    
52 : bates 1268 setGeneric("tril", function(x, k = 0, ...)
53 :     standardGeneric("tril"))
54 : bates 1265
55 : bates 1268 setGeneric("triu", function(x, k = 0, ...)
56 :     standardGeneric("triu"))
57 : bates 1265
58 : bates 1268 setGeneric("band", function(x, k1, k2, ...)
59 :     standardGeneric("band"))
60 :    
61 : bates 1427 setGeneric("Cholesky",
62 : maechler 2154 function(A, perm = TRUE, LDL = !super, super = FALSE,
63 :     Imult = 0, ...)
64 : bates 1427 standardGeneric("Cholesky"))
65 : bates 1268
66 : maechler 2112 setGeneric("symmpart", function(x) standardGeneric("symmpart"))
67 :     setGeneric("skewpart", function(x) standardGeneric("skewpart"))
68 : bates 1427
69 : maechler 2115 ## A version of coercion to "symmetric" which does *NOT* check,
70 :     ## but just takes the ## upper (or lower) values and
71 :     ## ``declares'' the symmetric:
72 :     setGeneric("forceSymmetric",
73 :     function(x, uplo) standardGeneric("forceSymmetric"))
74 : mmaechler 2514
75 :     setGeneric("nnzero", function(x, na.counted = NA) standardGeneric("nnzero"),
76 :     signature = "x")
77 : dmbates 2558
78 : mmaechler 2780 setGeneric("updown", function(update, C, L) standardGeneric("updown"))
79 : mmaechler 2837
80 : mmaechler 2862 if(FALSE)
81 :     ## only "need this", as 'Dvec' should not get its default from base::qr.Q :
82 :     ## unfortunately, this masks base::qr.Q with a warning
83 :     setGeneric("qr.Q", function(qr, complete = FALSE, Dvec)
84 :     standardGeneric("qr.Q"),
85 :     useAsDefault = function(qr, complete = FALSE, Dvec) {
86 :     if(missing(Dvec))
87 :     base::qr.Q(qr, complete=complete)
88 :     else base::qr.Q(qr, complete=complete, Dvec=Dvec)
89 :     })

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