Description Usage Arguments Value Author(s) See Also Examples
This function creates the sparseness structure of a logical matrix in the format that is required by ipoptr.
1 | make.sparse( A )
|
A |
Matrix with logicals. TRUE denotes a non-zero element in the matrix. |
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.
Jelmer Ypma
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 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.