These functions were in earlier versions, but will no longer be maintained, and are not even guaranteed to work now.

Build sparse matrix from data in CSC (column compressed) format.

Converts row and column indices to a pattern Matrix object of Matrix class

This function is deprecated. Use sparseHessianFD instead.

Sym.CSC.to.Matrix(H, nvars)

Coord.to.Sym.Pattern.Matrix(H, nvars)

Coord.to.Pattern.Matrix(
  rows,
  cols,
  dims,
  compressed = TRUE,
  symmetric = FALSE,
  index1 = TRUE
)

new.sparse.hessian.obj(
  x,
  fn,
  gr,
  hs,
  fd.method = 0L,
  eps = sqrt(.Machine$double.eps),
  ...
)

sparseHessianFD.new(
  x,
  fn,
  gr,
  rows,
  cols,
  direct = NULL,
  eps = sqrt(.Machine$double.eps),
  ...
)

Arguments

H

a list containing Hessian data. See details.

nvars

the number of rows (and columns) in the matrix.

rows, cols

row and column indices of non-zero elements

dims

2-element vector for number of rows and columns in matrix

compressed

If TRUE, returns a matrix is compressed column (default=TRUE)

symmetric

If TRUE, matrix will be symmetric, and only the lower triangular elements need to be provided (default=FALSE)

index1

TRUE if input row and col use 1-based indexing, and FALSE for 0-based indexing.

x

variable vector for initialization

fn

R function that returns function value

gr

R function that returns the gradient of the function

hs

list of two vectors: row and column indices of non-zero elements of lower triangle of Hessian. See details.

fd.method

If TRUE, use direct method for computatation. Otherwise, use indirect/substitution method. See references.

eps

The perturbation amount for finite differencing of the gradient to compute the Hessian. Defaults to sqrt(.Machine$double.eps).

...

Other parameters to be passed to fn and gr.

direct

If TRUE, use direct method for computatation. Otherwise, use indirect/substitution method. See references.

Value

An object of Matrix class.

A sparse pattern matrix

An object of class sparseHessianFD

Details

Use Matrix::sparseMatrix instead of Sym.CSC.to.Matrix.

Use Coord.to.Pattern.Matrix with symmetric=TRUE instead of Coord.to.Sym.Pattern.Matrix.

This function is useful to prototype a sparsity pattern. No assumptions are made about symmetry.

hs is a list of two elements:

iRow

Integer vector of row indices of non-zero elements in lower triangle of Hessian.

jCol

Integer vector of column indices of non-zero elements in lower triangle of Hessian.

This function is deprecated. Use sparseHessianFD instead.