|
D.2.10.8 sparsetriag
Procedure from library random.lib (see random_lib).
- Usage:
- sparsetriag(n,m[,p,b]); n,m,p,b integers
- Return:
- nxm lower triagonal integer matrix, diagonal entries equal to 1, about
p percent of lower diagonal entries are 0, the remaining are random
integers >=1 and <= b; [defaults: (p,b) = (75,1)]
Example:
| LIB "random.lib";
sparsetriag(5,7);"";
==> 1,0,0,0,0,0,0,
==> 0,1,0,0,0,0,0,
==> 0,1,1,0,0,0,0,
==> 0,0,0,1,0,0,0,
==> 1,1,0,0,1,0,0
==>
sparsetriag(7,5,90);"";
==> 1,0,0,0,0,
==> 0,1,0,0,0,
==> 0,1,1,0,0,
==> 0,0,0,1,0,
==> 0,0,0,0,1,
==> 0,0,0,1,0,
==> 0,1,0,0,0
==>
sparsetriag(5,5,0);"";
==> 1,0,0,0,0,
==> 1,1,0,0,0,
==> 1,1,1,0,0,
==> 1,1,1,1,0,
==> 1,1,1,1,1
==>
sparsetriag(5,5,50,100);
==> 1,0,0,0,0,
==> 73,1,0,0,0,
==> 0,79,1,0,0,
==> 14,0,0,1,0,
==> 0,48,23,0,1
|
|