make.sparse: Create sparseness structure from logical matrix

Description Usage Arguments Value Author(s) See Also Examples

Description

This function creates the sparseness structure of a logical matrix in the format that is required by ipoptr.

Usage

1

Arguments

A

Matrix with logicals. TRUE denotes a non-zero element in the matrix.

Value

List of vectors with indices. Each element of the list corresponds to a row in the matrix. Each index corresponds to a non-zero element in the matrix.

Author(s)

Jelmer Ypma

See Also

ipoptr print.sparseness

Examples

1
2
3
4
5
6
7
8
library('ipoptr')
# print lower-diagonal 5x5 matrix generated with make.sparse
A_lower <- make.sparse( lower.tri( matrix(1, nrow=5, ncol=5), diag=TRUE ) )
print.sparseness( A_lower )

# prnit a diagonal 5x5 matrix without indices counts
A_diag  <- make.sparse( diag(5) > 0 )
print.sparseness( A_diag )

jyypma/ipoptr documentation built on May 20, 2019, 6:28 a.m.