Description Usage Arguments Value Author(s) See Also Examples
This function plots the sparseness structure of a matrix in the format that is required by ipoptr.
1 | plot.sparseness( x, pch='.', asp=1, xaxs='i', yaxs='i', ... )
|
x |
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. |
pch |
plotting ‘character’. See |
asp |
aspect ratio, default = 1. |
xaxs, yaxs |
style of axis interval calculation, default = 'i' (do not extend the axis). See |
... |
further graphical parameters that will be passed to |
A list with the non-zero x and y indices is returned.
Jelmer Ypma
ipoptr
print.sparseness
make.sparse
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library('ipoptr')
# use different plotting symbol for small matrices
plot.sparseness( make.sparse(diag(5)), pch='x' )
# plot large matrix example
s <- make.sparse( lower.tri( matrix( 1, 500, 500), diag=TRUE ) )
plot.sparseness( s )
# plot another large matrix
s <- do.call( "cbind", lapply( 1:5, function(i) { diag(5) %x% matrix(1, nrow=5, ncol=20) } ) )
s <- do.call( "rbind", lapply( 1:10, function(i) { s } ) )
s <- cbind( matrix( 1, nrow=nrow(s), ncol=40 ), s )
plot.sparseness( make.sparse( s ) )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.