Mar 19, 2007 - Department of Mathematics , University of Roorkee , Roorkee, UP,. India ... Suppose GA is associated digraph of the system. In digraph ...
This article was downloaded by: [Indian Institute of Technology Roorkee] On: 14 November 2014, At: 21:51 Publisher: Taylor & Francis Informa Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House, 37-41 Mortimer Street, London W1T 3JH, UK
International Journal of Computer Mathematics Publication details, including instructions for authors and subscription information: http://www.tandfonline.com/loi/gcom20
Solution of a sparse linear system by using digraph a
R.C. Mittal & Ahmad Al-Kurdi
a
a
Department of Mathematics , University of Roorkee , Roorkee, UP, India Published online: 19 Mar 2007.
To cite this article: R.C. Mittal & Ahmad Al-Kurdi (2000) Solution of a sparse linear system by using digraph, International Journal of Computer Mathematics, 74:2, 151-158, DOI: 10.1080/00207160008804930 To link to this article: http://dx.doi.org/10.1080/00207160008804930
PLEASE SCROLL DOWN FOR ARTICLE Taylor & Francis makes every effort to ensure the accuracy of all the information (the “Content”) contained in the publications on our platform. However, Taylor & Francis, our agents, and our licensors make no representations or warranties whatsoever as to the accuracy, completeness, or suitability for any purpose of the Content. Any opinions and views expressed in this publication are the opinions and views of the authors, and are not the views of or endorsed by Taylor & Francis. The accuracy of the Content should not be relied upon and should be independently verified with primary sources of information. Taylor and Francis shall not be liable for any losses, actions, claims, proceedings, demands, costs, expenses, damages, and other liabilities whatsoever or howsoever caused arising directly or indirectly in connection with, in relation to or arising out of the use of the Content. This article may be used for research, teaching, and private study purposes. Any substantial or systematic reproduction, redistribution, reselling, loan, sub-licensing, systematic supply, or distribution in any form to anyone is expressly forbidden. Terms & Conditions of access and use can be found at http://www.tandfonline.com/page/terms-and-conditions
Downloaded by [Indian Institute of Technology Roorkee] at 21:51 14 November 2014
Intern. J. Computer Marh., Vol. 74, pp. 151- 158 Reprints available directly from the publisher Photocopying permitted by license only
0ZOO0 OPA (Overseas Publishers Association) N.V. Published by License under the Gordon and Breach Science Publishers imprint. Printed in Singapore.
SOLUTION OF A SPARSE LINEAR SYSTEM BY USING DIGRAPH R. C. MITTAL* and AHMAD AL-KURD1 Department of Mathematics, University of Roorkee, Roorkee ( U P ) India (Received 8 June 1999; In final form I5 July 1999)
In this work, a method is given to compute solution of a sparse system of linear equations using Cramer's rule. The solution is computed with the help of digraph approach given in Chen, wherein only the non-zero entries are used. Only integer entries including right hand side are considered. We show that efficiency with which a sparse linear system can be analyzed by digital computer using digraph approach as a tool depends largely upon the efficiency with which I-factors and 1-factorial connections are generated. Finally, the usefulness of digraph approach is discussed. The program is experimented by applying on three examples. Keyworh: Sparse linear system; Cramer's rule; determinant; permanent; digraph; storage scheme; CPU time C . R. Categories: G2.2, G1.3
INTRODUCTION Consider a system of linear equations
Suppose GA is associated digraph of the system. In digraph approach, the analysis of a linear system reduces ultimately to that of listing the set of certain types of subgraphs, called 1-factors and 1-factorial connections [I]. The basic idea of associating digraph with a system of linear equations was first introduced by Mason in 1953. Another representation of equations as
*Corresponding author.
Downloaded by [Indian Institute of Technology Roorkee] at 21:51 14 November 2014
152
R. C. MITTAL AND A. AL-KURD1
digraph has been described by Coates in 1959. However, Konig [I], was the first to apply a digraph to evaluate the determinant in 1916. It has been utilized for various purposes by many authors such as Chen and others. The determinant of a digraph associated with a linear system can be evaluated by Gaussian's elimination. The process is very slow and very complicated if the system is given in literal form rather than in numerical form. Moreover, digraph of a linear system can be set up by merely inspecting the system without necessity of formulating the associated equations. In such cases, digraph approach is useful, especially when computing symbolic system functions. In almost all practical applications such as networks, the coefficient matrix correspond to a linear system is sparse [2]. To this, it is wasteful to use general methods to solve such system. The goal here is to save implementation time and memory size as well. However, for a sparse matrix, first one has to find a storage scheme for non-zero entries and use it to computing the solution. Generally, iterative methods are preferred for a solution of sparse linear system over direct methods [3]. Despite the high computational cost, direct methods are useful for solving sparse system because of their generality and robustness. Cramer's rule, however, is one of direct methods, which is seldom used because n + l determinants each of order n x n are to be computed. As each determinant contains n! terms, the number of operations is very large and thereby the method is not efficient for general system. For a sparse linear system, the number of operations, however, is considerably reduced. Therefore, efforts are made in this work to compute the solution. Chen has defined digraph approach on basis of Cramer's rule. The digraph approach of obtaining a direct solution to sparse linear system of equations consists of two phases: computing 1-factors and 1-factorial connections and applying the Cramer's rule. We have developed a C++ program based on digraph to find the solution of sparse linear system. The C++ program is experimented on three examples. The experiments are done on an IBM Compatible PC with Pentium I1 processor and 266 MHz speed. The CPU time taken is reported in Table I.
COMPUTATION OF DETERMINANTS
In this section, we show the relationship between the terms in the expansion of determinant of A and certain types of subgraphs of the associated digraph G A of A.
DIGRAPH SOLUTION FOR SPARSE LINEAR SYSTEM
153
DEFINITION 1 Let A be a square matrix of order n. The associated graph GA of A is an n-nodes weighted and labeled digraph such that there exists an edge (i,j ) with weight aii if aji # 0 for i,j = 1,2, . . . ,n and vice versa.
Downloaded by [Indian Institute of Technology Roorkee] at 21:51 14 November 2014
Let A be 4 x 4 matrix
The associated digraph GA of (2) is as shown in Figure 1 . In order to compute determinant of A, we introduce the following definitions: 1. A 1-factor of digraph G is a spanning subgraph of G, which is regular of degree 1 [4]. 2. A path {u - v) in a digraph is a sequence of distinct nodes and contiguous edges leading from u to v such that there are no repeating edges. 3. A circuit is path, which begins and ends at the same node.
DEFINITION 2 Let GA be the associated digraph of a square matrix A of order n. The determinant of A is defined by
where h is 1-factor in GA and Lh is number of directed circuits in h and f (h) denotes the product of weights associated with the edges of h.
FIGURE 1 Tbe associated digraph GA of A.
154
R. C. MITTAL AND A. AL-KURD1
Downloaded by [Indian Institute of Technology Roorkee] at 21:51 14 November 2014
For illustrative purpose, the 1-factors of Figure 1 is presented in Figure 2. According to (3), the determinant of (2) is given
DEFINITION 3 A 1-factorial connection from node i to node j of digraph GA is a spanning subgraph of GA which contains: (i) A directed path from i to j; (ii) A set of node-disjoint circuits which include all nodes of GA except these contained in (i). An example of a set of 1-factorial connections from 1 to 3 in G A of Figure 1 is presented in Figure 3. DEFINITION 4 Let G A be the associated digraph of a square matrix A of order n, then the cofactor of the (i,j)-element of A is defined by
FIGURE 2 The set of 1-factors of G,.
FIGURE 3 The l-factorial connections from l to 3 in GA.
DIGRAPH SOLUTION FOR SPARSE LINEAR SYSTEM
155
where Hij is a 1-factorial connection from i to j in GA, and LH is the number of direct circuits in HW
Downloaded by [Indian Institute of Technology Roorkee] at 21:51 14 November 2014
SOLUTION OF SYSTEM BY CRAMER'S RULE
Consider the system of linear algebraic equations (1). According to Cramers's rule, the solution of (1) is given
where A, is a matrix obtained from A by replacing its m-th column by b. Substituting (3) and (4) into (5), we get the solution of (1) using digraph
where H(,+l,m is a I-factorial connection from n + 1 to m in GAu,Au is the augmented matrix; h is a 1-factor in GA; and LH, Lh are the number of directed circuits in H(,+l,, and h, respectively.
STORAGE SCHEME
A short presentation of the storage technique described here is based on the idea proposed in [5]. The storage scheme, which we are going to discuss, is designed for sparse matrices. The version given here is a row-oriented scheme in which non-zero elements are stored row-by-row, with each row, non-zero elements are stored in the order of increasing column index. Storing given matrix A with the above mentioned scheme requires two one-dimensional arrays Value and ICOL of length na, where na is the number of non-zero elements in the matrix. The array Value contains the non-zero elements of A stored row-by-row and ICOL contains the column indices, which correspond to the non-zero elements in the array Value. Beginning column index of a row in ICOL is negative. For example, for (2), the arrays Value and ICOL are
---row1
Value= ail ICOL= - 1
row2
a14 a22
4
-2
row3
a23
3
a31
-1
row4
a33
3
a41
-1
a44
4
R. C. MITTAL AND A. AL-KURD1
156
In the present work, digraph approach is implemented by using the above storage scheme.
Downloaded by [Indian Institute of Technology Roorkee] at 21:51 14 November 2014
NUMERICAL EXPERIMENTS The digraph approach discussed here is implemented in turbo C++. The program is run successfully on an IBM Compatible PC with Pentium I1 processor and 266MHz speed. Only the non-zero entries of A are stored using the storage scheme outlined in the previous section. The program is tested on the following three examples. Example 1
Value={5,2,-l,1,7,-ll-2,5,-l,-l,1,6,2,-1,3,1,2,-9,3,1,4, -2,5,3,10,4,5,2,3,-6,2,3,4) ICOL = {-1,2,3,6, -2,8,-1,3,4,9, -2,4,7,10, -5,7,-6, -7, -8, -5,9,-5,10,-1,2,3,4,5,6,7,8,9,10) Example 2
Va1ue={5,2,-1,1,-1,7,-1,1~1,-2,5,-1,-1,1,6,2,-1,3,1,2,-9, - l,-2,3,l,1,4,-2,5,3,l,-1,1,212,5,1,3,2,2,-1~3,4,-6, 5,11,4,6,2,2,-4,4,4,4,1,8,3,5,-5) ICOL = {-1,2,3,6,12, -2,8,12,14, -1,3,4,9, -2,4,7,10, -5,7,-6, - 7,13,15,-8,13,-5,9,-5,10,15,-4,6,9,11,-1,12,-2,13, -7,8,11,12,14,-15,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) Example 3
Va1ue={5,1,-1,7,1,-1,5,-1,1,6,-1,2,3,1,2,-9,-1,1,3,1,1,4,-1, -2,5,3,1,2,2,5,1,3,2,4,-6,2,2,2,-4,1,1,5,-2,1,3,1,5,8, 6,6,9,2,3, -5,3,3,7,2,4,3,5, -2,l,-4,7,2,6) ICOL = {-1,6,12,-2,14,20,-3,9,18,-4,16,20,-5,7,-6, -7,13,18, - 8,13,-5,9,19,-5, 10,15, -4,11,-1,12,-2,13, - 7,14,-15, -4,10,16,-17,-3,15,18,-2,7,19,-1,20,-1, 2,3,4,5,6,7,8,9,10,11,12,13,14,15, l6,l7,18,19,2O} The program produces exact results. The CPU time taken is given in the Table I.
DIGRAPH SOLUTION FOR SPARSE LINEAR SYSTEM
157
TABLE I CPU time taken in solving examples Example
Size of matrix n
No. of non-zero entries nu
CPU time taken in seconh
Downloaded by [Indian Institute of Technology Roorkee] at 21:51 14 November 2014
0.549451 sec. 134.780220sec. 6924.230769sec.
From the Table, its clear that the digraph approach (6) is not efficient to solve (1) because when analyzing the system by a digital computer, one must retain the set of all I-factors in computer memory and check each new 1-factor against the list for possible duplications. Moreover, CPU time for checking duplications and canceling it is very large when the number of 1-factors could be in the thousands. The main difficulty in generating 1-factors and 1-factorial connections by digraph lies in the fact that the number of operations increases with the number of nodes. However, efficiency with which sparse linear system can be analyzed by a digital computer using (6) as a tool depends largely upon the efficiency with which the I-factors and I-factorial connections are generated. The process of computing 1-factors and 1-factorial connections requires too much time because of checking each computed circuit with the remaining circuits. On the other hand, we may conclude that the formula (6) to solve ( 1 ) is very useful from practical viewpoint of computer analysis of very large networks when the (6) is seen at its best, when the weights are given in literal form rather than in numerical form and there is no necessity of formulating the system of linear equations. It is also useful when computing digraph admittance, which is impossible to be computed by Gaussian's elimination.
CONCLUSIONS
From the numerical experiments, it may easily be concluded that digraph approach is not efficient and its efficiency with which a sparse linear system can be analyzed by a digital computer depends largely upon the efficiency with which the 1-factors and 1-factorial connections are generated. Some of the main features of digraph based solution of a linear system by Cramer's rule are in: 1. Generating circuits and paths and thereby computing I-factors and 1factorial connections. 2. Computing Hamilton's circuit and Euler's lines [I]. 3. Computing the determinant and permanent of a sparse matrix.
Downloaded by [Indian Institute of Technology Roorkee] at 21:51 14 November 2014
158
R. C. MITTAL AND A. AL-KURD1
4. Computing the exact solution of a sparse linear system in case all the entries in A, are integers. 5. In networks theory and structural mechanics analysis the matrices are often given in literal form rather than in numerical form. T h s approach suits very well in such cases. 6. Computing digraph admittance from node to another, which is impossible to be computed by Gaussian's elimination.
References [I] Chen, W. K., Applied Graph Theory, North-Holland Publishing Company, New York, 1976
[2] ~ i a i R. , N., Brameller, A. B. and Hamman, Y. M., Sparsity, Pitman Publishing, 1976. [3] Hoffman, J. D., Numerical Methods for Engineers and Scientists, MacGraw-Hill, Inc., New York, 1993. [4] Wilson, R. J., Applications of Graph Theory, Academic Press, Inc., London, 1979. [S] Key, J. E. (1973). Computer Program for Solution of Large Sparse Unsyrnmetric System of Linear Equations, Znt. J. Numer. Metho& in Eng.,6, 497-509.