strucMatrix: Structured sparse matrices

Description Usage Arguments Details Value Examples

Description

A sparse matrix class for matrices whose elements come from a set of a relatively small number of values or computable from a relatively small parameter vector.

Usage

1
2
strucMatrix(rowInds, colInds, valInds, vals, trans, Dim,
  sortFun = standardSort)

Arguments

rowInds

1-based row indices (converted to 0-based in output)

colInds

1-based column indices (converted to 0-based in output)

valInds

indices for the nonzero values

vals

nonzero values

trans

function for transforming some parameters into vals. the environment of this function should contain a vector of these parameters (called init), which could be taken as the arguments to trans. these initial values can be obtained by getInit and set by setInit. an update.strucMatrix method will update these parameters.

Dim

matrix dimensions

sortFun

a function with which to sort the indices of the resulting matrix. please note that by default the standardSort function is used, which provides a convenient ordering for computing Khatri-Rao products (with kr). see details.

Details

These structured matrix objects are useful for updating matrices at each iteration of a general nonlinear optimizer. This strucMatrix-class is designed to work well with the Matrix package, in that they can be quickly coerced to sparseMatrix objects. The mkSparseTrans function can be used to automatically generate a function for updating the values of the sparseMatrix object from a relatively small number of parameters or repeated values.

Such matrices are best constructed by binding, kroning, and kring together a series of simpler strucMatrix matrices, which can be constructed with the strucMatrix function or a function for constructing special strucMatrix objects (e.g. strucMatrixDiag).

Note that the ordering of the indices supplied to rowInds, colInds, and valInds may not appear in the same order in the output. This is because sortFun is used to process the order, which by default is standardSort. To suppress this behaviour a different sortFun may be supplied, but this is generally not recommended because certain functions assume certain orderings (e.g. kr).

Value

A member of the strucMatrix-class.

Examples

1
strucMatrix(1:4, 4:1, rep(1:2, 2), c(-pi, pi))

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