General Mathematics Vol. 18, No. 1 (2010), 25–32 Remarks on the cyclic reduction method 1 Ioana Chiorean Abstract A tridiagonal system of equations appears often by discretization of differential equations. Several methods for solving such a system are known. The aim of this paper is to compare, from computational time point of view, the cyclic reduction method and an alternative, which uses recurrence relations, by using parallel calculus. 2000 Mathematics Subject Classification: 65F05, 65M06, 65Y05. Key words and phrases: Numerical analysis, differential equation, parallel calculus. 1 Received 05 June, 2009 Accepted for publication (in revised form) 15 September, 2009 25 26 1 I. Chiorean Introduction A tridiagonal system of equations has the following form: b1 c1 0 a 2 b2 c2 .. . a 3 b3 (1) .. .. .. . . . .. .. . . cn−1 0 a n bn or (2) ai xi−1 + bi xi + ci xi+1 = di , i = 1, n with a1 = 0 and cn = 0. Due to the fact that such a system appears very often in all sort of problems, there are many approaches for solving it, both with serial and parallel computers. It is well known the Thomas algorithm, which generates the solution after O(n) operations (see [2]), but also algorithms which generate logarithmical time of execution (see [1]), which use different parallel techniques, as cyclic even-odd reduction. In what follows, we take into account the Thomas algorithm and show that its coefficient can be computed also in logarithmical time. 2 Thomas Algorithm It is also called ”the tridiagonal matrix algorithm”. Remarks on the cyclic reduction method 27 Starting with a system of type (1), the method has the following steps: Step 1. Modify the coefficients of c 1 , b1 (3) c0i = ci , bi − c0i−1 ai d1 , b1 d0i = (4) di − d0i−1 ai , bi − c0i−1 ai system (1) according with formulas: i=1 i = 2, 3, . . . , n − 1 i=1 i = 2, 3, . . . , n Step 2. The solution is obtained by back substitution: xn = d0n xi = d0i − c0i xi+1 , i = n − 1, n − 2, . . . , 1 It is clear that the solution of our system is obtained after O(n) opera- tions. 3 The Cyclic Even-Odd Reduction Method Another possibility for solving a system of type (1) is given by a technique called Cyclic Even-Odd Reduction. In the general case, considering a first order recurrence (5) xi = ai + bi xi−1 where ai and bi are known (i = 1, n) and x1 , . . . , xn are to be calculated, with x0 = α, given, we set a0 = α and ai = 0 for i < 0 and bi = 0 for i ≤ 0. Then (5) will also hold for i ≤ 0, with xi = 0 for i < 0. 28 I. Chiorean In (3) we replace i by i − 1 and we get: (1) (6) (1) xi = ai + bi (ai−1 + bi−1 xi−2 ) = ai + bi xi−2 Then, in (6) we replace i by i − 2 and we get (1) (7) (1) (1) (1) (2) (2) xi = ai + bi (ai−2 + bi−2 xi−4 ) = ai + bi xi−4 Continuing in this way, xi can be expressed successively in terms on xi−1 , xi−2 , xi−4 , xi−8 , . . . and after at most k steps, where k = dlog 2 ne, the index (k) (k) i − 2k will be negative or zero, and therefore bi−2k = 0, then xi = ai−2k . How can we apply this method to solve a system of type (1)? Like in [3], consider the three equations involving xi : (8) ai−1 xi−2 + bi−1 xi−1 + ci−1 xi = yi−1 (9) ai xi−1 + (10) bi xi + ci xi+1 = yi ai+1 xi + bi+1 xi+1 + ci+1 xi+2 = yi+1 By subtracting suitable multiples of equations (8) and (10) from (9), we can obtain an equation of the form (11) (1) (1) (1) (1) ai xi−2 + bi xi + ci xi+2 = yi By similar manipulation of three equations of the form (11) we obtain (12) (2) (2) (2) (2) ai xi−4 + bi xi + ci xi+4 = yi and so on. Setting xi = ai = ci = yi = 0 and bi = 1 when i is outside the relevant range, after k = dlog2 ne steps, we reach the equation: (13) giving the value xi . (k) bki xi = yi Remarks on the cyclic reduction method 4 Thomas Algorithm revisited Let’s consider, again, the system (1) b1 c1 a 2 b2 c2 a 3 b3 (14) .. . 0 Then and the determinant of the matrix 0 .. . .. .. . . .. .. . . cn−1 a n bn det1 = b1 b1 c1 = b2 b1 − a2 c1 = b2 det1 −α1 det0 , det2 = a 2 b2 .. . for det0 = 1 and α1 = a2 c1 b1 c1 0 det3 = a2 b2 c2 = b3 det2 −β2 det1 with β2 = a3 c2 b1 0 a 3 b3 and so on. Then (15) detn = bn detn−1 −αn detn−1 , with αn apriori computed. 29 30 I. Chiorean Having these observations in mind, we may observe that formulas (3) becomes: c0i = (16) c1 c01 = , det1 i=1 c deti−1 c0i = i , i = 2, 3, . . . , n − 1 deti Formula (15) is a linear recurrence with two terms which can be perform, in parallel, in the following way: detn detn−1 = = (17) = b n αn 0 b n αn 1 0 b n αn 1 1 0 detn−1 detn−2 bn−1 αn−1 1 bn−1 αn−1 0 detn−2 0 1 = ··· = detn−3 b α1 det1 ... 1 1 0 det0 So, at every moment of time, we may compute det i , i = 1, n, according with relation (17). The computation takes place only at matricial level, in the following way: if we denote Mi = b i αi 1 0 , i = 1, n, the matrix multiplication in (17) may be performed on a binary tree network with 2n − 1 processors: 31 Remarks on the cyclic reduction method Mn Mn−1 Mn−2 Mn−3 ... M2 M1 Mn Mn−1 Mn−2 Mn−3 M2 M1 ... ... Mn Mn−1 . . . M1 After dlog2 ne parallel steps, the final product will be in the root. The parallel technique used here is called ”double recursive technique” (see [3]). Concerning the coefficients d0i , i = 1, n in (4), a similar result may be obtained, by considering the following determinants: det01 = b1 b1 0 det2 = a2 b1 0 det3 = a2 0 .. . b1 a2 det0n = 0 .. . 0 d1 d2 c1 b2 a3 d1 d2 d3 c1 . . . . . . 0 d1 b2 c2 ... 0 d2 a3 b3 ... .. . 0 d3 0 . . . . . . b n dn 32 I. Chiorean Then d0i = d1 d01 = , i=1 det1 0 d0i = deti , deti 5 i = 2, 3, . . . , n Conclusions In this paper, we give an anternative to the cyclic even-odd reduction scheme for solving a tridiagonal system of equations, by using Thomas algorithm and the double recursive technique. Our approach generates also an execution time of order O(log2 n). References [1] I. Chiorean, Calcul paralel, Ed. Microinformatica, 1995. [2] S.D. Conte, C. de Boor, Elementary Numerical Analysis, Mc Graw-Hill, New York, 1972. [3] J.J. Modi, Parallel Algorithms and Matrix Computation, Clarendon Press, 1988. Ioana Chiorean Babeş-Bolyai University Department of Applied Mathematics Kogălniceanu 1, Cluj-Napoca, Romania e-mail: robica chiorean@yahoo.com