Coord.to.Pointers: Convert a matrix defined by row and column indices to one...

View source: R/matrices.R

Coord.to.PointersR Documentation

Convert a matrix defined by row and column indices to one defined by a row- or column-oriented compression scheme.

Description

Returns indices and pointers that define a sparse Hessian in compressed format. Inputs are the row and column indices.

Usage

Coord.to.Pointers(
  rows,
  cols,
  dims,
  triangle = TRUE,
  lower = TRUE,
  symmetric = FALSE,
  order = c("column", "row", "triplet"),
  index1 = TRUE
)

Arguments

rows, cols

row and column indices of non-zero elements

dims

2-element vector for number of rows and columns.

triangle

Is input intended to be a triangular (TRUE) or full (FALSE) matrix. See details for how this argument is interpreted for different values of order.

lower

If triangular is true, this argument identifies the input matrix as lower- or upper-triangular. This argument is ignored if triangle is FALSE.

symmetric

If TRUE, and matrix is triangular, then the matrix will be treated as symmetric, with only the triangular elements provided. If matrix is neither triangular nor symmetric, then symmetric=TRUE will probably trigger an error.

order

Determines the indexing/compression scheme for the output matrix. Use "triplet" to get row and column indices. Defaults to the same class as M.

index1

TRUE if using 1-based indexing. FALSE for 0-based indexing.

Details

triangle and order have the following interpretation:

triangle=TRUE

Input rows and cols represent lower or upper triangle of a matrix. If order="symmetric", then the output list will be for a full, symmetric matrix. Otherwise, the output list will be for only the lower or upper triangle. Any elements outside of the specified triangle will trigger an error.

triangle=FALSE

Input rows and cols represent a full matrix. If that matrix is not symmetric, then order=="symmetric" will trigger an error.

If symmetric=FALSE and order='triplet', the output list should contain the same row and column indices as the input list.

Value

A list. See Matrix.to.Pointers (no values are included in return list).

See Also

Matrix.to.Pointers


sparseHessianFD documentation built on Oct. 20, 2022, 1:08 a.m.