Top
Back: D.2.5.5 sparsematrix
Forward: D.2.5.7 sparsepoly
FastBack: D. SINGULAR libraries
FastForward: E. Release Notes
Up: D.2.5 random_lib
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

D.2.5.6 sparsemat

Procedure from library random.lib (see random_lib).

Usage:

sparsemat(n,m[,p,b]); n,m,p,b integers

Return:

nxm integer matrix, p percent of the entries are 0, the remaining are random coefficients >=1 and <= b; [defaults: (p,b) = (75,1)]

Example:

 
LIB "random.lib";
sparsemat(5,5);"";
→ 0,0,0,0,0,
→ 0,1,0,0,1,
→ 0,0,0,1,0,
→ 0,1,0,0,0,
→ 0,1,0,1,1 
→ 
sparsemat(5,5,95);"";
→ 1,0,0,0,0,
→ 0,0,0,0,0,
→ 0,0,0,0,0,
→ 0,0,0,0,0,
→ 0,0,0,1,0 
→ 
sparsemat(5,5,5);"";
→ 1,1,1,1,1,
→ 1,1,1,1,1,
→ 1,1,1,1,1,
→ 1,0,1,1,1,
→ 1,1,1,1,0 
→ 
sparsemat(5,5,50,100);
→ 0,17,24,80,0,
→ 0,13,30,45,0,
→ 19,0,0,0,0,
→ 93,0,23,0,69,
→ 0,88,44,31,0 

Top Back: D.2.5.5 sparsematrix Forward: D.2.5.7 sparsepoly FastBack: D. SINGULAR libraries FastForward: E. Release Notes Up: D.2.5 random_lib Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.