strucMatrix-class: A structured sparse matrix class

Description Usage Arguments Details Examples

Description

An S3 class for structured sparse matrices, which are lists with a Dim attribute and with the following elements:

rowInds

0-based row indices

colInds

0-based column indices

valInds

1-based indices for associating each rowInds and colInds pair with the elements in vals

trans

A function for transforming a parameter vector into vals. This function is used by update.strucMatrix

Objects in this class can be constructed with strucMatrix (and, for example, strucMatrixDiag), and has several methods including the following.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## S3 method for class 'strucMatrix'
print(x, n = 6L, ...)

## S3 method for class 'strucMatrix'
update(object, newPars, newTrans, ...)

## S3 method for class 'strucMatrix'
image(x, plain = FALSE, ...)

## S3 method for class 'strucMatrix'
plot(x, y, plain = FALSE, ...)

## S3 method for class 'strucMatrix'
t(x)

## S4 method for signature 'strucMatrix'
diag(x)

## S4 replacement method for signature 'strucMatrix'
diag(x) <- value

## S3 method for class 'strucMatrix'
dim(x)

Arguments

x

strucMatrix object

n

how many indices and repeated values to print?

...

passed to subsequent functions

object

strucMatrix object

newPars

optional new parameter values

newTrans

optional new transformation function

plain

should a completely plain plot be used? (try and see)

y

not used

value

replacement value for diagonal

Details

The ... arguments for the update.strucMatrix method can be used to specify special parameter arguments, if object$mkNewPars exits (which is often the case for special matrices such as strucMatrixTri. This is a more explicit approach and can therefore be more convenient than having to figure out what order the parameters should appear in newPars. For example, update(., diagVals = c(1, 1), offDiagVals = -0.2) is more explicit than update(., c(1, -0.2, 1)).

Examples

1
2
3
4
5
6
7
8
9
(X <- strucMatrix(rowInds = 1:6,
                colInds = rep(1:2, 3),
                valInds = rep(1:2, each = 3),
                vals    = c(-pi, pi)))
(Y <- update(X, c(0.2, 0.8)))
as.matrix(X, sparse = TRUE)
as.matrix(Y, sparse = TRUE)
image(kron(t(X), Y))
image(bind(X, Y, type = "diag"))

stevencarlislewalker/lme4ord documentation built on May 30, 2019, 4:43 p.m.