# SCM Repository

[matrix] Diff of /pkg/R/AllClass.R
 [matrix] / pkg / R / AllClass.R

# Diff of /pkg/R/AllClass.R

revision 1108, Mon Jan 2 23:02:07 2006 UTC revision 1109, Tue Jan 3 16:42:31 2006 UTC
# Line 48  Line 48
48  setClass("zMatrix", # letter 'z' is as in the names of Lapack subroutines  setClass("zMatrix", # letter 'z' is as in the names of Lapack subroutines
49           representation(x = "complex", "VIRTUAL"), contains = "Matrix")           representation(x = "complex", "VIRTUAL"), contains = "Matrix")
50
51  ## Virtual class of dense matrices  ## Virtual class of dense matrices (including "packed")
52  setClass("denseMatrix", representation("VIRTUAL"),  setClass("denseMatrix", representation("VIRTUAL"),
53           contains = "Matrix")           contains = "Matrix")
54
# Line 60  Line 60
60  setClass("ldenseMatrix", representation(x = "logical", "VIRTUAL"),  setClass("ldenseMatrix", representation(x = "logical", "VIRTUAL"),
61           contains = c("lMatrix", "denseMatrix"))           contains = c("lMatrix", "denseMatrix"))
62
63    ## diagonal: has 'diag' slot;  diag = "U"  <--> have identity matrix
64    setClass("diagonalMatrix", representation(diag = "character", "VIRTUAL"),
65             contains = "denseMatrix",
66             validity = function(object) {
67                 d <- object@Dim
68                 if(d[1] != (n <- d[2])) return("matrix is not square")
69                 lx <- length(object@x)
70                 if(object@diag == "U" && lx != 0)
71                     return("diag = \"U\" (identity matrix) requires empty 'x' slot")
72                 if(object@diag == "N" && lx != n)
73                     return("diagonal matrix has 'x' slot of length != 'n'")
74                 TRUE
75             },
76             prototype = prototype(diag = "N")
77             )
78
79  ## virtual SPARSE ------------  ## virtual SPARSE ------------
80
81  setClass("sparseMatrix", representation("VIRTUAL"), contains = "Matrix")  setClass("sparseMatrix", representation("VIRTUAL"), contains = "Matrix")
# Line 183  Line 199
199           ## "dsp" and "lsp" have the same validate           ## "dsp" and "lsp" have the same validate
200           )           )
201
202    ## 'diagonalMatrix' already has validity checking
203    ## diagonal, numeric matrices;      "d*" has 'x' slot :
204    setClass("ddiMatrix", contains = c("diagonalMatrix", "dMatrix"))
205    ## diagonal, logical matrices; "ldense*" has 'x' slot :
206    setClass("ldiMatrix", contains = c("diagonalMatrix", "ldenseMatrix"))
207
208
209  ##-------------------- S P A R S E (non-virtual) --------------------------  ##-------------------- S P A R S E (non-virtual) --------------------------
210
211  ##---------- numeric sparse matrix classes --------------------------------  ##---------- numeric sparse matrix classes --------------------------------
# Line 279  Line 302
302  ## logical, sparse, triplet triangular matrices  ## logical, sparse, triplet triangular matrices
303  setClass("ltTMatrix",  setClass("ltTMatrix",
304           contains = c("TsparseMatrix", "lsparseMatrix", "triangularMatrix"),           contains = c("TsparseMatrix", "lsparseMatrix", "triangularMatrix"),
305             prototype = prototype(uplo = "U", diag = "N"),
306           validity =           validity =
307           function(object) .Call("ltTMatrix_validate", object, PACKAGE = "Matrix")           function(object) .Call("ltTMatrix_validate", object, PACKAGE = "Matrix")
308           )           )

Legend:
 Removed from v.1108 changed lines Added in v.1109

 root@r-forge.r-project.org ViewVC Help Powered by ViewVC 1.0.0
Thanks to: