Aliases: ltpMatrix-class ltrMatrix-class !,ltpMatrix-method coerce,ltpMatrix,dtpMatrix-method coerce,ltpMatrix,lgeMatrix-method coerce,ltpMatrix,ltCMatrix-method coerce,ltpMatrix,ltRMatrix-method coerce,ltpMatrix,ltTMatrix-method coerce,ltpMatrix,lspMatrix-method coerce,ltpMatrix,ltrMatrix-method coerce,ltpMatrix,ntpMatrix-method coerce,matrix,ltpMatrix-method !,ltrMatrix-method coerce,ltrMatrix,dtrMatrix-method coerce,ltrMatrix,lgeMatrix-method coerce,ltrMatrix,ltCMatrix-method coerce,ltrMatrix,ltRMatrix-method coerce,ltrMatrix,ltTMatrix-method coerce,ltrMatrix,lsyMatrix-method coerce,ltrMatrix,ltpMatrix-method coerce,ltrMatrix,ntrMatrix-method coerce,matrix,ltrMatrix-method
Keywords: classes
### ** Examples showClass("ltrMatrix")
Class "ltrMatrix" [package "Matrix"] Slots: Name: Dim Dimnames x uplo diag Class: integer list logical character character Extends: Class "unpackedMatrix", directly Class "ldenseMatrix", directly Class "triangularMatrix", directly Class "lMatrix", by class "ldenseMatrix", distance 2 Class "denseMatrix", by class "ldenseMatrix", distance 2 Class "Matrix", by class "triangularMatrix", distance 2 Class "xMatrix", by class "lMatrix", distance 3 Class "mMatrix", by class "Matrix", distance 4 Class "replValueSp", by class "Matrix", distance 4
str(new("ltpMatrix"))
Formal class 'ltpMatrix' [package "Matrix"] with 5 slots ..@ uplo : chr "U" ..@ Dim : int [1:2] 0 0 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ..@ x : logi(0) ..@ diag : chr "N"
(lutr <- as(upper.tri(matrix(, 4, 4)), "ldenseMatrix"))
4 x 4 Matrix of class "ltrMatrix" [,1] [,2] [,3] [,4] [1,] FALSE TRUE TRUE TRUE [2,] . FALSE TRUE TRUE [3,] . . FALSE TRUE [4,] . . . FALSE
str(lutp <- pack(lutr)) # packed matrix: only 10 = 4*(4+1)/2 entries
Formal class 'ltpMatrix' [package "Matrix"] with 5 slots ..@ uplo : chr "U" ..@ Dim : int [1:2] 4 4 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ..@ x : logi [1:10] FALSE TRUE FALSE TRUE TRUE FALSE ... ..@ diag : chr "N"
!lutp # the logical negation (is *not* logical triangular !)
4 x 4 Matrix of class "lgeMatrix" [,1] [,2] [,3] [,4] [1,] TRUE FALSE FALSE FALSE [2,] TRUE TRUE FALSE FALSE [3,] TRUE TRUE TRUE FALSE [4,] TRUE TRUE TRUE TRUE
## but this one is: stopifnot(all.equal(lutp, pack(!!lutp)))