Description Usage Arguments Details Value Examples
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.
1 2 | strucMatrix(rowInds, colInds, valInds, vals, trans, Dim,
sortFun = standardSort)
|
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
|
Dim |
matrix dimensions |
sortFun |
a function with which to sort the indices of the
resulting matrix. please note that by default the
|
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 bind
ing,
kron
ing, and kr
ing 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
).
A member of the strucMatrix-class
.
1 | strucMatrix(1:4, 4:1, rep(1:2, 2), c(-pi, pi))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.