a structure-preserving method for the quaternion lu decomposition in quaternionic quantum theory

5
Computer Physics Communications 184 (2013) 2182–2186 Contents lists available at SciVerse ScienceDirect Computer Physics Communications journal homepage: www.elsevier.com/locate/cpc A structure-preserving method for the quaternion LU decomposition in quaternionic quantum theory Minghui Wang , Wenhao Ma Department of Mathematics, Qingdao University of Science and Technology, Qingdao 266061, PR China article info Article history: Received 12 March 2013 Received in revised form 28 April 2013 Accepted 1 May 2013 Available online 11 May 2013 Keywords: Quaternion matrix LU decomposition Structure-preserving algorithm abstract In this paper, for the first time, the structure-preserving Gauss transformation is defined. Then by means of its real representation matrix, we present a novel structure-preserving algorithm for the LU decom- position of a quaternion matrix. Numerical experiments show that the structure-preserving algorithm is better than that in the newest quaternion toolbox for matlab (QTFM). © 2013 Elsevier B.V. All rights reserved. 1. Introduction Quaternion matrices are first used in quantum mechanics [1]. Now, quaternions and quaternion matrices have been getting im- portant and extensive in many areas such as color image process- ing [2], special relativity [3], the preonic model [4], vector-signal processing [5], group representations [6], and so on. Quaternion matrix decompositions are important tools in ma- trix theory and practical use. But in the newest quaternion toolbox for matlab (QTFM) [7], only LU decomposition, QR decom- position and SVD are included and all algorithms for them are based on four quaternion arithmetic operations. Indeed, the com- plex or real representation method has been applied to quater- nion matrix decompositions. In [8], the complex representation matrix is used to compute the quaternion matrix decomposition and a quaternion QR algorithm was presented. But because that the algorithm applied to a complex representation matrix does not necessarily preserve accurately the structure of the complex rep- resentation matrix, the method can lead to the loss of accuracy. In this paper we will propose a structure-preserving algorithm to compute the LU decomposition of the quaternion matrix. We first define the structure-preserving Gauss transformation, and then apply it to the real representation matrix. Our method can This work was supported by the National Natural Science Foundation of China (Grant No: 11001144), the Science and Technology Program of Shandong Universities of China (J11LA04) and the Research Award Fund for outstanding young scientists of Shandong Province in China (BS2012DX009). Corresponding author. E-mail address: [email protected] (M. Wang). preserve accurately the structure of the real representation ma- trix. Recently, in [9], the authors proposed a structure-preserving algorithm for solving the right eigenvalue problem of Hermitian quaternion matrices. More information on structure-preserving methods for other problems can be found in [9–11] and their ref- erences. This paper is organized as follows. In Section 2, some basic re- sults will be recalled. In Section 3, we will present the structure- preserving algorithm for the LU decomposition of the quaternion matrix. In Section 4, two numerical experiments will be provided to compare our algorithm with that in QTFM. Finally, some con- cluding remarks will be given in Section 5. 2. Preliminaries In this section, we will recall some basic information of the quaternion and the real representation. Let R and Q = R Ri Rj Rk denote the real number field and the quaternion field, respectively, where i 2 = j 2 = k 2 =−1, ij =−ji = k, jk =−kj = i, ki =−ik = j. For a = a 1 + a 2 i + a 3 j + a 4 k, b = b 1 + b 2 i + b 3 j + b 4 k Q, the conjugate and module of a are defined as ¯ a = a 1 a 2 ia 3 ja 4 k and |a|= a ¯ a = a 2 1 + a 2 2 + a 2 3 + a 2 4 , respectively, and the multiplication is defined as ab = (a 1 b 1 a 2 b 2 a 3 b 3 a 4 b 4 ) + (a 1 b 2 + b 1 a 2 + a 3 b 4 b 3 a 4 )i + (a 1 b 3 + b 1 a 3 + a 4 b 2 b 4 a 2 )j + (a 1 b 4 + b 1 a 4 + a 2 b 3 b 2 a 3 )k. For any quaternion matrix A, A T denote its transpose. 0010-4655/$ – see front matter © 2013 Elsevier B.V. All rights reserved. http://dx.doi.org/10.1016/j.cpc.2013.05.001

Upload: wenhao

Post on 25-Dec-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A structure-preserving method for the quaternion LU decomposition in quaternionic quantum theory

Computer Physics Communications 184 (2013) 2182–2186

Contents lists available at SciVerse ScienceDirect

Computer Physics Communications

journal homepage: www.elsevier.com/locate/cpc

A structure-preserving method for the quaternion LU decompositionin quaternionic quantum theory✩

Minghui Wang ∗, Wenhao MaDepartment of Mathematics, Qingdao University of Science and Technology, Qingdao 266061, PR China

a r t i c l e i n f o

Article history:Received 12 March 2013Received in revised form28 April 2013Accepted 1 May 2013Available online 11 May 2013

Keywords:Quaternion matrixLU decompositionStructure-preserving algorithm

a b s t r a c t

In this paper, for the first time, the structure-preserving Gauss transformation is defined. Then by meansof its real representation matrix, we present a novel structure-preserving algorithm for the LU decom-position of a quaternion matrix. Numerical experiments show that the structure-preserving algorithm isbetter than that in the newest quaternion toolbox for matlab (QTFM).

© 2013 Elsevier B.V. All rights reserved.

1. Introduction

Quaternion matrices are first used in quantum mechanics [1].Now, quaternions and quaternion matrices have been getting im-portant and extensive in many areas such as color image process-ing [2], special relativity [3], the preonic model [4], vector-signalprocessing [5], group representations [6], and so on.

Quaternion matrix decompositions are important tools in ma-trix theory and practical use. But in the newest quaterniontoolbox for matlab (QTFM) [7], only LU decomposition, QR decom-position and SVD are included and all algorithms for them arebased on four quaternion arithmetic operations. Indeed, the com-plex or real representation method has been applied to quater-nion matrix decompositions. In [8], the complex representationmatrix is used to compute the quaternion matrix decompositionand a quaternionQR algorithmwas presented. But because that thealgorithm applied to a complex representation matrix does notnecessarily preserve accurately the structure of the complex rep-resentation matrix, the method can lead to the loss of accuracy.

In this paper we will propose a structure-preserving algorithmto compute the LU decomposition of the quaternion matrix. Wefirst define the structure-preserving Gauss transformation, andthen apply it to the real representation matrix. Our method can

✩ This work was supported by the National Natural Science Foundation ofChina (Grant No: 11001144), the Science and Technology Program of ShandongUniversities of China (J11LA04) and the ResearchAward Fund for outstanding youngscientists of Shandong Province in China (BS2012DX009).∗ Corresponding author.

E-mail address:[email protected] (M. Wang).

0010-4655/$ – see front matter© 2013 Elsevier B.V. All rights reserved.http://dx.doi.org/10.1016/j.cpc.2013.05.001

preserve accurately the structure of the real representation ma-trix. Recently, in [9], the authors proposed a structure-preservingalgorithm for solving the right eigenvalue problem of Hermitianquaternion matrices. More information on structure-preservingmethods for other problems can be found in [9–11] and their ref-erences.

This paper is organized as follows. In Section 2, some basic re-sults will be recalled. In Section 3, we will present the structure-preserving algorithm for the LU decomposition of the quaternionmatrix. In Section 4, two numerical experiments will be providedto compare our algorithm with that in QTFM. Finally, some con-cluding remarks will be given in Section 5.

2. Preliminaries

In this section, we will recall some basic information of thequaternion and the real representation.

Let R and Q = R ⊕ Ri ⊕ Rj ⊕ Rk denote the real number fieldand the quaternion field, respectively, wherei2 = j2 = k2 = −1, ij = −ji = k,jk = −kj = i, ki = −ik = j.For a = a1 + a2i + a3j + a4k, b = b1 + b2i + b3j + b4k ∈ Q, theconjugate andmodule of a are defined as a = a1−a2i−a3j−a4k and|a| = aa = a21 + a22 + a23 + a24, respectively, and themultiplicationis defined asab = (a1b1 − a2b2 − a3b3 − a4b4)

+ (a1b2 + b1a2 + a3b4 − b3a4)i+ (a1b3 + b1a3 + a4b2 − b4a2)j+ (a1b4 + b1a4 + a2b3 − b2a3)k.

For any quaternion matrix A, AT denote its transpose.

Page 2: A structure-preserving method for the quaternion LU decomposition in quaternionic quantum theory

M. Wang, W. Ma / Computer Physics Communications 184 (2013) 2182–2186 2183

Let Ai ∈ Rm×n (i = 1, 2, 3, 4). The real representation matrix isdefined [12] in the form

AR≡

A1 −A2 −A3 −A4A2 A1 −A4 A3A3 A4 A1 −A2A4 −A3 A2 A1

∈ R4m×4n. (2.1)

The realmatrixAR is uniquely determinedby the quaternionmatrixA = A1+A2i+A3j+A4k ∈ Qm×n, and it is referred to as a real repre-sentationmatrix of the quaternionmatrix A. Thematrix in the formof (2.1) is referred to as a real representation matrix composed ofAi ∈ Rm×n (i = 1, 2, 3, 4), and we denote it as RPM(A1, A2, A3, A4).

Then it is easy to verify the following properties.

Theorem 2.1 ([13]). Let A, B ∈ Qm×n, C ∈ Qn×s, α ∈ R. Then

(A + B)R = AR+ BR, (αA)R = αAR,

(AC)R = ARCR.

For A ∈ Qn×n, if its real representation matrix AR can be decom-posed into PRAR

= LU , where P is a permutation matrix, L is the realrepresentation matrix of a unit lower triangular quaternion matrix Land U is the real representation matrix of an upper triangular quater-nion matrix U, then it follows from Theorem 2.1 that PA = LU, whichis exactly the LU decomposition of A.

3. Structure-preserving algorithm for the LU decomposition

In this section, we will discuss the LU decomposition of thequaternion matrix by means of the real representation matrix. Ob-viously, we cannot directly decompose the real representation AR

into PAR= LU , because that P, L and U are usually not the real rep-

resentation matrices, much less the real representation matricesof a permutationmatrix, a unit lower triangular quaternionmatrixand an upper triangular quaternion matrix. But we can avoid theshortcoming by some appropriate skills.

3.1. Structure-preserving Gauss transformation

Let

τ (i,j)T= (0, . . . , 0

j

, τ(i,j)j+1 , . . . , τ (i,j)

n ),

i = 1, 2, 3, 4, j = 1, 2, . . . , n − 1

and

Lj = RPM(In − τ (1,j)eTj , −τ (2,j)eTj , −τ (3,j)eTj , −τ (4,j)eTj ).

We call Lj as a structure-preserving Gauss transformation, which isthe real representationmatrix of a unit lower triangular quaternionmatrix.

It is easy to verify that

L−1j = RPM(In + τ (1,j)eTj , τ

(2,j)eTj , τ(3,j)eTj , τ

(4,j)eTj ),

L = L−11 · · · L−1

n−1 = RPM(L1, L2, L3, L4)

with

L1 = In +

n−1j=1

τ (1,j)eTj , Li =

n−1j=1

τ (i,j)eTj ,

i = 2, 3, 4.

For a(i)= (a(i)

1 , a(i)2 , . . . , a(i)

n )T ∈ Rn, i = 1, 2, 3, 4, taking

τ (i,j)T= (0, . . . , 0

j+k−1

, τ(i,j)j+k , 0, . . . , 0

n−j−k

),

i = 1, 2, 3, 4, 1 ≤ k ≤ n − j

with

a = a(1)j

2+ a(2)

j2+ a(3)

j2+ a(4)

j2,

τ(1,j)j+k = (a(1)

j a(1)j+k + a(2)

j a(2)j+k + a(3)

j a(3)j+k + a(4)

j a(4)j+k)/a,

τ(2,j)j+k = (a(1)

j a(2)j+k − a(2)

j a(1)j+k + a(3)

j a(4)j+k − a(4)

j a(3)j+k)/a,

τ(3,j)j+k = (a(1)

j a(3)j+k − a(2)

j a(4)j+k − a(3)

j a(1)j+k + a(4)

j a(2)j+k)/a,

τ(4,j)j+k = (a(1)

j a(4)j+k + a(2)

j a(3)j+k − a(3)

j a(2)j+k − a(4)

j a(1)j+k)/a,

then we can easily verify that

LjRPM(a(1), a(2), a(3), a(4)) = RPM(a(1), a(2), a(3), a(4))

with

a(i)= a(i)

− a(i)j+kei = (a(i)

1 , . . . , a(i)j+k−1, 0,

a(i)j+k+1, . . . , a

(i)n )T , i = 1, 2, 3, 4.

3.2. LU decomposition

We apply the structure-preserving Gauss transformation to thereal representation matrix and obtain the following result.

Theorem 3.1. Suppose that A = A1 + A2i + A3j + A4k ∈ Qn×n isnonsingular. Then there exist a unit lower triangular matrix L ∈ Qn×n,a permutation matrix P ∈ Rn×n and an upper triangular matrix U ∈

Qn×n such that

PA = LU . (3.1)

Proof. We prove the result by induction on the order n of A. Whenn = 1, the result is true. Suppose that for the case 1 ≤ n < m,there exist the real presentation matrix L of a unit lower triangularquaternion matrix, a permutation matrix P ∈ Rn×n and the realpresentation matrix U of an upper triangular quaternion matrixsuch that

LPRAR= U .

For n = m, we partition Ai into

Ai =

a(i)11 A(i)

12

A(i)21 A(i)

22

, i = 1, 2, 3, 4,

where A(i)12 ∈ R1×(n−1), A(i)

21 ∈ R(n−1)×1, A(i)22 ∈ R(n−1)×(n−1).

If A(1, 1) ≡ a(1)11 + a(2)

11 i + a(3)11 j + a(4)

11 k = 0, we choose i0 suchthat

|a(1)i01

+ a(2)i01

i + a(3)i01

j + a(4)i01

k| = max1≤i≤n

|a(1)i1 + a(2)

i1 i + a(3)i1 j + a(4)

i1 k|,

then swap lows 1 and i0 of Ai, i = 1, 2, 3, 4, simultaneously. Thatis, there exists a permutation matrix P1 ∈ Rn×n such that

P1Ai =

a(i)11 A(i)

12

A(i)21 A(i)

22

, Ai, i = 1, 2, 3, 4,

where A(i)12 ∈ R1×(n−1), A(i)

21 ∈ R(n−1)×1, A(i)22 ∈ R(n−1)×(n−1) and

a(1)11 + a(2)

11 i + a(3)11 j + a(4)

11 k = 0.

We take a 4m× 4m structure-preserving Gauss transformationL(1)

= RPM(L(1)1 , L(1)

2 , L(1)3 , L(1)

4 ) with α = |a(1)11 + a(2)

11 i + a(3)11 j +

a(4)11 k|

2,

L(1)1 =

1 0∗ In−1

, L(1)

2 =

0 0∗ 0

,

L(1)3 =

0 0∗ 0

, L(1)

4 =

0 0∗ 0

,

Page 3: A structure-preserving method for the quaternion LU decomposition in quaternionic quantum theory

2184 M. Wang, W. Ma / Computer Physics Communications 184 (2013) 2182–2186

where, for k = 1, 2, . . . , n − 1

L(1)1 (1 + k, 1) = −(A1(1, 1)A1(1 + k, 1) + A2(1, 1)A2(1 + k, 1)

+ A3(1, 1)A3(1 + k, 1) + A4(1, 1)A4(1 + k, 1))/a,

L(1)2 (1 + k, 1) = −(A1(1, 1)A2(1 + k, 1) − A2(1, 1)A1(1 + k, 1)

+ A3(1, 1)A4(1 + k, 1) − A4(1, 1)A3(1 + k, 1))/a,

L(1)3 (1 + k, 1) = −(A1(1, 1)A3(1 + k, 1) − A2(1, 1)A4(1 + k, 1)

− A3(1, 1)A1(1 + k, 1) + A4(1, 1)A2(1 + k, 1))/a,

L(1)4 (1 + k, 1) = −(A1(1, 1)A4(1 + k, 1) + A2(1, 1)A3(1 + k, 1)

− A3(1, 1)A2(1 + k, 1) − A4(1, 1)A1(1 + k, 1))/a.

L(1) is obviously the real representation matrix of a unit lowertriangular quaternion matrix. It is easy to verify that

L(1)PRAR=

a(1)11 A(1)

12 −a(2)11 −A(2)

12 −a(3)11 −A(3)

12 −a(4)11 −A(4)

12

0 A(1)22 0 −A(2)

22 0 −A(3)22 0 −A(4)

22

a(2)11 A(2)

12 a(1)11 A(1)

12 −a(4)11 −A(4)

12 a(3)11 A(3)

12

0 A(2)22 0 A(1)

22 0 −A(4)22 0 A(3)

22

a(3)11 A(3)

12 a(4)11 A(4)

12 a(1)11 A(1)

12 −a(2)11 −A(2)

12

0 A(3)22 0 A(4)

22 0 A(1)22 0 −A(2)

22

a(4)11 A(4)

12 −a(3)11 −A(3)

12 a(2)11 A(2)

12 a(1)11 A(1)

12

0 A(4)22 0 −A(3)

22 0 A(2)22 0 A(1)

22

, AR

is still the real representation matrix of a block upper triangularquaternion matrix.

The submatrix of AR by deleting the 1,m + 1, 2m + 1, 3m +

1 rows and columns is also the real representation matrix of aquaternion matrix with order m − 1, denoted by AR. By the intro-duction assumption, there exists the real representation matrix

L = RPM(L1, L2, L3, L4) ∈ R4(m−1)×4(m−1)

of a unit lower triangular quaternionmatrix, a permutationmatrixP ∈ R(m−1)×(m−1) and the real presentation matrix U of an uppertriangular quaternion matrix such that

LPRAR= U .

Define

L(2)= RPM(F1, F2, F3, F4),

Fi = diag(1, Li), i = 1, 2, 3, 4

and

P2 = diag(1, P), P = P2P1, LR = L(2)PR2 L

(1)PR2T.

It is easy to verify that LR is the real representation matrix of a unitlower triangular quaternion matrix Lwith order n and

LRPRAR= UR,

where U is an upper triangular quaternion matrix, that is

LPA = U .

Let L = L−1, which is also obviously a unit lower triangular quater-nion matrix, then we have

PA = LU .

Therefore for n = m, the result of the theorem also holds.The proof of the theorem is completed. �

3.3. Structure-preserving algorithm

In this subsection, we will give an algorithm on the basis of theProof of Theorem 3.1.

Algorithm 3.1. For a given nonsingularmatrix A = A1+A2i+A3j+A4k ∈ Qn×n, where Ai ∈ Rn×n, i = 1, 2, 3, 4. The algorithm obtainsa permutation matrix P , a unit lower triangular quaternion matrixL and an upper triangular quaternion matrix U such that PA = LU .

Function: [P, L,U] = LU(A1, A2, A3, A4)

n = size(A1);

p = 1 : n;% record row swappingfor j = 1 : n − 1% row swappingd = zeros(n − j + 1, 1);for i = j : nd(i − j + 1) = A1(i, j)2 + A2(i, j)2 + A3(i, j)2 + A4(i, j)2;end[a, k] = max(abs(d)); k = k + j − 1;%a = A1(j, j)2 + A2(j, j)2 + A3(j, j)2 + A4(j, j)2;if k = jw = A1(k, :); A1(k, :) = A1(j, :); A1(j, :) = w;

w = A2(k, :); A2(k, :) = A2(j, :); A2(j, :) = w;

w = A3(k, :); A3(k, :) = A3(j, :); A3(j, :) = w;

w = A4(k, :); A4(k, :) = A4(j, :); A4(j, :) = w;

w = p(k); p(k) = p(j); p(j) = w;

end% end row swappingfor i = j + 1 : nL1 = −(A1(j, j)A1(i, j) + A2(j, j)A2(i, j) + A3(j, j)A3(i, j) + A4(j, j)A4(i, j))/a;L2 = −(A1(j, j)A2(i, j) − A2(j, j)A1(i, j) + A3(j, j)A4(i, j) − A4(j, j)A3(i, j))/a;L3 = −(A1(j, j)A3(i, j) − A2(j, j)A4(i, j) − A3(j, j)A1(i, j) + A4(j, j)A2(i, j))/a;L4 = −(A1(j, j)A4(i, j) + A2(j, j)A3(i, j) − A3(j, j)A2(i, j) − A4(j, j)A1(i, j))/a;form = j + 1 : nA1(i,m) = A1(i,m) + L1A1(j,m) − L2A2(j,m) − L3A3(j,m) −

L4A4(j,m);

A2(i,m) = A2(i,m) + L1A2(j,m) + L2A1(j,m) + L3A4(j,m) −

L4A3(j,m);

A3(i,m) = A3(i,m) + L1A3(j,m) − L2A4(j,m) + L3A1(j,m) +

L4A2(j,m);

A4(i,m) = A4(i,m) + L1A4(j,m) + L2A3(j,m) − L3A2(j,m) +

L4A1(j,m);

endA1(i, j) = −L1; A2(i, j) = −L2; A3(i, j) = −L3; A4(i, j) = −L4;endendl1 = tril(A1, −1) + eye(n); l2 = tril(A2, −1); l3 = tril(A3, −1);l4 = tril(A4, −1);u1 = triu(A1); u2 = triu(A2); u3 = triu(A3); u4 = triu(A4)

1;L = l1 + l2i + l3j + l4k; U = u1 + u2i + u3j + u4k;% construct permutation matrix PQ = eye(n); P = eye(n);for k = 1 : nP(k, :) = Q (p(k), :);end �

1 tril(X, −1) and triu(X) are strictly lower triangular part and upper triangularpart of X , respectively. Eye(n) is the n-by-n identity matrix.

Page 4: A structure-preserving method for the quaternion LU decomposition in quaternionic quantum theory

M. Wang, W. Ma / Computer Physics Communications 184 (2013) 2182–2186 2185

Remark 1. Algorithm 3.1 takes about 32n3/3 flops. It is wellknown that the real LU decomposition algorithm needs about n3/3additions and n3/3 multiplications. Also, a quaternion multiplica-tion needs 16 multiplications and 12 additions and a quaternionaddition needs 4 additions. Therefore, the quaternion LU decom-position algorithm, which is based on QTFM, takes about 32n3/3flops, too.

Remark 2. In Algorithm 3.1, l1 is a unit lower triangular matrix,li (i = 2, 3, 4) is strictly lower triangular matrix and |lk(i, j)| < 1,k = 1, 2, 3, 4, i > j. Therefore, in general, Algorithm 3.1 is stable.

Remark 3. The biggest advantage of Algorithm 3.1 is that it needsonly real number operations and does not depend on QTFM. So Al-gorithm 3.1 has more portability than the function lu in QTFM. Al-though Algorithm 3.1 does not decrease computation complexity,to our surprise, the following numerical examples show that Algo-rithm 3.1 runs significantly faster than the function lu in QTFM.

4. Numerical examples

In this section, we present two numerical examples to demon-strate the efficiency of the structure-preserving algorithm. Ourexamples are performed on an Intel Dual Core 1.53 GHz/2.00 GBcomputer using Matlab 2009a.

Example 1. Given a quaternion matrix A = A1 + A2i + A3j + A4k,where

A1 =

9 12 −37 6−8 0 19 −717 43 −19 078 −98 0 12

,

A2 =

10 2 −9 87 0 19 −71 −4 9 217 0 4 −1

,

A3 =

0 8 0 36−3 0 9 −91 0 9 12

−7 13 0 7

,

A4 =

17 0 −17 30 8 0 01 0 9 190 10 1 −12

.

Using Algorithm 3.1, [L,U, P] = LU(A1, A2, A3, A4), we get L =

L1 + L2i + L3j + L4k,U = U1 + U2i + U3j + U4k, where

L1 =

1 0 0 00.2145 1 0 0

−0.0896 −0.1568 1 00.1249 0.2868 −0.6002 1

,

L2 =

0 0 0 0−0.0078 0 0 00.0974 0.1442 0 00.0967 0.2556 0.2837 0

,

L3 =

0 0 0 00.0307 0 0 0

−0.0469 −0.0296 0 0−0.0091 0.1193 0.5523 0

,

L4 =

0 0 0 00.0149 0 0 00.0045 0.1255 0 00.2258 0.2978 −0.2253 0

,

Table 1Comparison between Algorithm 3.1 and the function lu in QTFM.

n Algorithm 3.1 Function lu in QTFMCPU time ∥PA−LU∥F

∥A∥FCPU time ∥PA−LU∥F

∥A∥F

50 0.0152 6.4e−16 0.0828 1.3e−15100 0.0898 1.2e−15 0.2283 3.0e−15200 0.5465 2.7e−15 1.1012 7.2e−15300 1.9687 3.9e−15 5.4427 1.1e−14400 5.4032 5.3e−15 12.988 1.5e−14500 11.522 7.0e−15 28.277 2.2e−14600 18.920 8.7e−15 44.748 2.8e−14800 47.726 1.1e−14 106.45 3.8e−14

1000 95.234 1.5e−14 206.60 4.9e−141500 335.47 2.2e−14 666.96 7.8e−14

U1 =

78 −98 0 120 64.57 −19.02 −2.530 0 18.44 −1.2760 0 0 10.27

,

U2 =

7 0 4 −10 −4.875 8.111 21.780 0 24.80 −3.090 0 0 1.371

,

U3 =

−7 13 0 70 0.146 8.933 10.240 0 10.18 −7.090 0 0 25.32

,

U4 =

0 10 1 −120 −0.586 8.908 21.420 0 2.159 −0.2070 0 0 −6.537

,

P =

0 0 0 10 0 1 00 1 0 01 0 0 0

and the error ∥PA − LU∥F/∥A∥F = 8.0023e

− 017.The result shows that our algorithm is effective.For comparison, using the function lu in QTFM, [L, U, P] =

lu(A1, A2, A3, A4), we get L = L1 + L2i + L3j + L4k, U = U1 +

U2i + U3j + U4k, where

L1 =

1 0 0 04.541 1 0 00.616 0.048 1 0

−0.452 −0.056 −0.754 1

,

P =

0 0 1 00 0 0 11 0 0 00 1 0 0

,

and the error ∥PA − LU∥F/∥A∥F = 1.5309e − 016.Noticing that |L1(2, 1)| > 1 and P = P , we think that the

function lu in QTFM is debatable.

Example 2. Compare Algorithm 3.1 with the function lu in QTFM.Given an n × n quaternion matrix A, which is generated by meansof 100 × rand(n).

Table 1 gives the data on CPU times (second) and errors for dif-ferent order n. From Table 1, we see that the CPU time costed byAlgorithm 3.1 is about a half of that by the function lu in QTFM.When n is small, Algorithm 3.1 run faster.

5. Conclusions

In this paper, we define the structure-preserving Gauss trans-formation, apply it to the real representation matrix of a quater-nion matrix and obtain a structure-preserving algorithm for its LU

Page 5: A structure-preserving method for the quaternion LU decomposition in quaternionic quantum theory

2186 M. Wang, W. Ma / Computer Physics Communications 184 (2013) 2182–2186

decomposition. Although the flops of our algorithm are theoreti-cally about the same as those of the function lu in QTFM, our al-gorithm runs faster, perhaps because it needs only real arithmeticoperations.

Acknowledgments

The authors are grateful to two anonymous referees for theirvaluable comments and suggestions.

References

[1] S.L. Adler, Quaternionic Quantum Mechanics and Quantum Fields, OxfordUniversity Press, NewYork, 1995.

[2] N. Le Bihan, S.J. Sangwine, Quaternion principal component analysis of colorimages, in: IEEE International Conference on Image Processing, Vol. 1, ICIP,2003, pp. 809–812.

[3] S. De Leo, Quaternion and special relativity, J. Math. Phys. 37 (1996)2955–2968.

[4] S.L. Adler, Composite leptons and quark constructed as triply occupiedquasi- particle in quaternionic quantum mechanics, Phys. Lett. B 332 (1994)358–365.

[5] N. Le Bihan, J. Mars, Singular value decomposition of quaternion matrices:a new tool for vector-sensor signal processing, Signal Process. 84 (7) (2004)1177–1199.

[6] S. De Leo, G. Ducati, Quaternionic groups in physics, Int. J. Theor. Phys. 38(1999) 2197–2220.

[7] S. Sangwine, N. Le Bihan, Quaternion toolbox for matlab,http://qtfm.sourceforge.net/.

[8] A. Bunse-Gerstner, R. Byers, V.Mehrmann, A quaternion QR algorithm, Numer.Math. 55 (1) (1989) 83–95.

[9] Z. Jia, M. Wei, S. Ling, A new structure-preserving method for quaternionHermitian eigenvalue problems, J. Comput. Appl. Math. 239 (2013) 12–24.

[10] D. Chu, X. Liu, V. Mehrmann, A numerical method for computing theHamiltonian Schur form, Numer. Math. 105 (2007) 375–412.

[11] D.S. Mackey, N. Mackey, F. Tisseur, Structured tools for structured matrices,Electron. J. Linear Algebra. 10 (2003) 106–145.

[12] T. Jiang, Algebraic methods for diagonalization of a quaternion matrix inquaternionic quantum theory, J. Math. Phys. 46 (2005) 052106.

[13] M. Wang, M. Wei, Y. Feng, An iterative algorithm for least squares problem inquaternionic quantum theory, Comput. Phys. Comm. 179 (2008) 203–207.