Generating the Matrices

The matrix corresponding to a specific instance of a model
is generated by a single call to the Fortran subroutine that
bears the name of the model. For example, a call to * mutex: *

call mutex(index,dwork,mdw,iwork,miw,n,nz,j1,k1,k2)generates the transition rate matrix corresponding to the instance

The remainder of this page explains which source code files and datasets are needed, the parameter list of the routine that when called actually generates a transition rate matrix, the storage format used to hold the matrix, and how to get the subroutines and datasets.

** The Fortran file, generate.f contains code
that is required in the generation of all models. **

The names of the subroutines that are in this file are:

** Furthermore, corresponding to each model is **

- A file containing Fortran source code.

These files are called*ncd.f, mutex.f,*...

The Fortran file associated with each model (*model.f*) contains a sample*driver*program, and subroutines that are unique to its particular model. Specificially, each file contains a*model*subroutine, a*rate*subroutine and an*instant*subroutine. Additionally, a given model may also have an associated*common*subroutine. - A dataset file.

These files are called*ncd_in, mutex_in,*...

The dataset file associated with each model (*model_in*) contains data corresponding to different sets of values for the model parameters. E.g., the file*ncd_in*contains 10 different integers corresponding to 10 different values for the number of customers in the queueing network: N = 10, 20, ... 100.

Information concerning the size of the matrices generated (the number of states and the number of nonzero elements for each diffferent set of parameter values) is provided at the end of each input data file. - A makefile:
*ncd_makefile, mutex_makefile,*...

When run, the makefile associated with each model (*model_makefile*) will produce an executable module for the sample driver.

The parameter list is the same for all model subroutines.

subroutine model(index,dwork,mdw,iwork,miw,n,nz,j1,k1,k2) Input ===> index: a particular dataset of the input file dwork: a real*8 work array iwork: an integer work array mdw,miw: the sizes of dwork and iwork respectively Output ==> n: The order of the transition rate matrix nz: The number of nonzero elements in the matrix j1: The starting location in dwork of the nonzero elements k1: The starting location in iwork of the column indices k2: The starting location in iwork of the row boundaries

A call to one of the subroutines * ncd, mutex, * ...
will generate a transition rate matrix of order * n *
that is stored in the compact **
Harwell-Boeing format **
for sparse matrices. The (*nz*) nonzero elements of the transition matrix
are stored contiguously in a real*8 work array * (dwork) *
beginning at position * j1. *
The (*nz*) column indices are stored in an
integer work array * (iwork) *
beginning at position * k1, * while the * (n+1) * row
boundary markers are stored in the same
integer work array beginning at position * k2 * .

The first subroutine in each source code file, * model.f * ,
is a sample driver program. This program
calls the subroutine for different values of * index * and hence generates
matrices corresponding to different
sets of the model's parameter values.

To execute the sample driver program for one of the models, it
suffices to overwrite * Makefile * with * model_makefile, *
execute the make operation and run the executable model file. E.g.,

cp mutex_makefile Makefile % overwrite Makefile make % make executable module mutex % run the mutex example

***************************************************************** *** A DRIVER FOR THE NCD EXAMPLE *** ***************************************************************** c *** This driver generates matrices for the first four *** c *** data sets (index = 1,4) in the file "ncd_in" *** c *** Replace parameter statement (line 3 of driver) with *** c parameter (miw=1985395,mdw=1207052) c *** to allocate sufficient memory for any/all datasets *** ***************************************************************** program driver implicit double precision (a-h,o-z) parameter (miw=175785,mdw=81222) real*4 etime,time dimension iwork(miw),dwork(mdw) open(unit=12, file='ncd_in') open(unit=14, file='ncd_matx',status='unknown') io_unit = 14 time = etime(t) do index = 1,4 print *, ' ' print *, '**********************************************' print *, '*** Dataset',index,' ***' call ncd(index,dwork,mdw,iwork,miw,n,nz,j1,k1,k2) print *, ' Now writing to: ncd_matx.' c call writeToFile(n,nz,dwork(j1),iwork(k1),iwork(k2),io_unit) print *, ' ' print *, 'Matrix has been written to: ncd_matx.' print *, ' ' end do time = etime(t)-time print *, 'Time taken:',time close(12) close(14) stop end

As stated in the comments, this driver generates four transition rate matrices corresponding to the first four data sets,