m  a  t  g  e  n

Matgen Version 0.3 docs

Man page   README   NEWS   ChangeLog   

matgen online man page

 

Index

NAME
VERSION
SYNOPSIS
DESCRIPTION
MATRIX TYPES
Random sparse matrices
Random sparse matrices by row
BUGS
COPYRIGHT
AUTHORS

 

NAME

matgen - a random sparse matrix generator in MatrixMarket file format  

VERSION

This is the manpage for matgen 0.3  

SYNOPSIS

matgen inputfile

 

DESCRIPTION

matgen generates random sparse matrices to stdout in MatrixMarket file format taking information from an input file with the properties of the matrix to be generated.

It can generate the following types of matrices:

random sparse matrix
Matrices where the user specify a non-zero density (among other properties) and matgen generates the matrix randomly.

random sparse matrix by row
Matrices where the user specify numbers of non-zeros per row (among other properties) and matgen generates the matrix row by row

Bellow is a description of the input files and the options for each matrix type.

 

MATRIX TYPES

 

Random sparse matrices

For this type of matrices, user must input a desired non-zero density, among other inputs, and the program generates non-zero elements until this density is achieved. The generation can take a long time for large matrices (above 5000x5000), for the program does a strict verification to avoid the generation of repeated entries. which is time consuming due to the way the program stores the matrix (in condensed row format),
 to save memory.

The input file for matrices of this type is as follow. Strings starting and ending with a # character (including multilines strings) are treated as comments.


   # Matrix type #
   0
   #Symmetry:   (0 - non-symmetric / 1 - symmetric)#

   0
   #Number of rows#
   10000
   #Number of cols#
   10000
   #Non-zero density#
   0.0007
   #Non-zero diagonal (0 - no / 1 - yes)#
   1
   #diagonal dominant (0 - no / 1 - yes)#
   1
   #diagonal multiplication factor#
   1.0
   #minimum#
   0
   #maximum#
   1
   #force sparse output format  (0 - no / 1 - yes)#
   1

matrix type
0 for random sparse matrices. This value tells the program to generate a random sparse matrix.

symmetry
This flag is not yet implemented. But in some future release it will be working.

number of rows & cols
Number of rows and cols of the matrix to be generated.

non-zero density
This value controls the number of non-zeros to be generated. It is defined as being num_non-zeros/(numrows*numcols).

non-zero diagonal
Flag to control whether to generate a matrix with a non-zeros diagonal or not. If this flag is 1 and diagonal-dominant is 0, the diagonal elements will have random values as the other non-zero elements.

diagonal dominant
Flag to control whether to generate a diagonal dominant matrix, a matrix in which the diagonal elements are equal or greater than the sum of the absolute values of the elements in its row.

diagonal multiplication factor
Value which will multiply the sum of absolute values for elements of a row in diagonal dominant matrices. The diagonal elements will be calculated by:

diag_element=(diag_multiplication_fact)*(sum_abs_values)

minimum & maximum
Limits for the random values to be generated.

force sparse output format
Use this flag to force output in sparse format. This is useful if you want to visualize the generated matrix with some matrix viewer, for some of them only read input in MatrixMarket sparse format.

For a very good matrix viewer see James Kohl's MatView at http://www.epm.ornl.gov/~kohl/MatView

 

Random sparse matrices by row

This type of matrix is generated *VERY* much faster. The user must input limits for random numbers of non-zeros per row. For each row, the program generates a random number of non-zeros, and generates the non-zeros values, checking for repeated elements line by line, which causes it to be much faster than in the previous type.

For matrices with non-zero diagonal, the diagonal element is accounted in the counting of non-zero values per row, so the row has exactly the number of non-zeros specified.

Symmetry is not, and may never be, implemented in this type of matrix. This type is useful to generate matrices similar to the ones which arise from the discretisation of PDEs over triangular non-structured meshes. The random number of non-zeros per row can be tunned to be similar to the number of neighbors each node has in such meshes. (Typical values are from 2 to 10).

The input file for matrices of this type is as follow. Strings starting and ending with a # character (including multilines strings) are treated as comments.


   #Type#
   1    

   #Number of rows#
   5000
   #Number of cols#
   5000
   #max non-zeros per row#
   10
   #min non-zeros per row#
   2
   #Non-zero diagonal (0 - no / 1 - yes)#
   1
   #diagonal dominant (0 - no / 1 - yes)#
   1
   #diagonal multiplication factor#
   1.1
   #minimum#
   0
   #maximum#
   1
   #force sparse output format  (0 - no / 1 - yes)#
   1

matrix type
1 for random sparse matrices by row. This value tells the program to generate a random sparse matrix by row.

max & min non-zeros per row
Limits for the random number of non-zeros per row.

The other inputs are the same as for the random sparse matrix.

 

BUGS

As this software is under development, you can find some bugs. Please send any comments, suggestions or bug reports to the author at bonon@users.sourceforge.net A know serious problem is when you want to generate matrices with a high non-zero density for which the program spend a lot of time checking for repeated entries. This should not be a problem since only sparse matrices are supported by now. But in some cases, i.e. one-column matrices for the right-hand-side of linear systems, a high non-zero density is desirable, and the matrix generation can last a long time. This will be fixed in future versions by the addition of algorithms specially designed to support matrices with one small dimension (rows or columns).

 

COPYRIGHT

Copyright (C) 2000,2001 Ricardo Bonon.

No guarantees or warranties or anything are provided or implied in any way whatsoever. Use this program at your own risk. Permission to use this program for any purpose is given, as long as the copyright is kept intact. matgen is distributed under the terms of the GNU Publishing License.

 

AUTHORS

Ricardo Bonon <bonon@users.sourceforge.net>

If you find matgen useful, please drop me a note.