Effective Methods of QR-Decompositions of Square Complex Matrices by Fast Discrete Signal-Induced Heap Transforms

The purpose of this work is to present an effective tool for computing different QR-decompositions of a complex nonsingular square matrix. The concept of the discrete signal-induced heap transform (DsiHT, Grigoryan 2006) is used. This transform is fast, has a unique algorithm for any length of the input vector/signal and can be used with different complex basic 2x2 transforms. The DsiHT zeroes all components of the input signal while moving or heaping the energy of the signal into one component, such as the first. We describe three different types of QR-decompositions that use the basic transforms with the T, G, and M-type complex matrices we introduce, and also without matrices, but using analytical formulas. We also present the mixed QR-decomposition, when different type DsiHTs are used at different stages of the algorithm. The number of such decompositions is greater than 3^((N-1)), for an NxN complex matrix. Examples of the QR-decomposition are described in detail for the 4x4 and 6x6 complex matrices and compared with the known method of Householder transforms. The precision of the QR-decompositions of NxN matrices, when N are 6, 13, 17, 19, 21, 40, 64, 100, 128, 201, 256, and 400 is also compared. The MATLAB-based scripts of the codes for QR-decompositions by the described DsiHTs are given.


INTRODUCTION
The QR-decomposition, or factorization of a non-singular matrix  =  into a unitary matrix  and an upper triangular matrix , as well as the factorization  =  with a low triangular matrix  are powerful tools for solving linear systems of equations  =  in many applications in computing and data analysis [1]- [7].Here, the matrix  is a real or complex non-singular matrix.The matrix  is unitary, and therefore its inverse is the transpose conjugate  * matrix.The calculation of inverse of the triangular matrix is not a difficult task.Therefore, the solution of the system of equation can be calculated by  =  −1 = −1  *  for the QR-decomposition, and  =  −1 = −1  *  for the QL-decomposition.Many known methods of QR-decomposition of real matrices were modified for the complex case.They include the Gramm-Schmidt process [8], the method of Householder transformations (or Householder reflections) [9], and the Givens rotations [10,11].
In this work we focus on the QR-decomposition and describe three types of decompositions, by using the concept of the discrete signal-induced heap transform (DsiHT) [12]- [14].In the case of real matrices, the detail description of the DsiHT method of QR-decomposition is given in [16].For complex matrices, there are different types of 2×2 basic complex unitary transforms can, that transfer energy of the 2-point signal to the first components, while zeroing the second one.The path of the DsiHT, i.e., the order of sequential processing (or rotating in some cases) of data of the signal is an important characteristic of the transform.The DsiHTs with different paths result in different QR-decomposition of the same matrix, as shown in [17] on examples with the so-called weak and strong-DsiHTs.The interesting property of the QRdecomposition by the DsiHT is in the presence of analytical equations that allow to calculate the transforms and their matrices without using the basic matrices of rotations.The case with complex matrices is much richer than real matrices, since there are many different basic transforms, not only "Givens rotations," that can be considered in the DsiHT.Examples of such transforms and their application in QR-decomposition of complex matrices are described and compared with the complex Householder transform-based QRdecomposition.
The rest of this paper is organized in the following way.In Section II, the concept of the DsiHT is described with examples of two-wheel carriages that illustrate the performance of the transform.The basic complex matrices of the 2×2 transforms composing the -point DsiHT are described in Section III.These matrices are classified by the basic transforms use them and are called the , , and -type complex matrices.The concept of the DsiHT which can be calculated without matrices but by analytical formulas is also described.The QR-decompositions with three types of DsiHTs are presented with examples in Section IV.It is shown that the -type DsiHT based QR decomposition is close to the result of the Householder transform method, and other two types of QR-decomposition differ much.The scripts for MATLAB-based codes for computing the DsiHT and described QR-decompositions are given in Section V.In Section VI, the concept of the mixed QR-decomposition is presented, when different type DsiHTs are used in different stages of decomposition.The number of such decompositions is greater than 3 (−1) for an  ×  complex matrices, which is a very large number for large .The questions related to the selection of the QRdecomposition from such large number of cases are not discussed here in detail, since it beyond the score of this work.

BASIC 2×2 MATRICES IN COMPLEX ALGEBRA
In this section, we describe briefly the concept of the discrete signal-induced heap transform (DsiHT) [12,15].The transform is unitary and is defined by a non-zero vector, or signal  = ( 0 ,  1 ,  2 , … ,  −1 ), without any constrain on the length  and signal itself; it may be real and complex.This signal is called the generator of the DsiHT; the signal generates the unitary transform which is applying on other signals  = ( 0 ,  1 ,  2 , … ,  −1 ).We consider the case when the -point DsiHT is calculating by ( − 1) basic transformations , each of which is applying only on two components of the renewal vector  in a certain order, or a path.
In the simple form, the DsiHT is calculated by applying a set of basic transformations .The 2 × 2 matrix of such a transformation is defined by a chosen vector (, ) from the condition In the case when  and  are real,  can be considered as the Givens rotation with the matrix ).
If  = 0, the angle of rotation  = −/2, or /2.The concept of the -point DsiHT of the signal  is illustrated in the diagram of Fig. 1.This is the socalled weak carriage with two wheels, one "rotates" the generator  and another wheel "rotates" the signal .When the carriage moves, the generator components work together with the first element  0 and update/renew its value at each step.At the same time, the transformation , which is determined during the rotation of the first wheel, is applying to the two components of the input signal .In this wheel, the components of  are processing together with the first element  0 and update its value.The -point DsiHT with such a carriage is called a weak DsiHT, since the components   and   of the generator and signal are processed in the natural order of the index , i.e.,  0 with  1 , then  2 ,  3 , … ,  −1 , and the same for the signal .This is the natural path of the DsiHT and the path can be chosen differently [16].For instance, the concept of the strong DsiHT is defined by the path in order  −1 with  −2 , then  −3 , … ,  1 ,  0 , and the same for the signal .The carriage of the strong DsiHT is illustrated in Fig. 2. We consider the DsiHT with the natural path.
• Calculate the matrix of the transform  1 that is generated by the vector ( 0 ,  1 )′.
The determinant of the matrix det  1 = 1.The first row of the matrix is the generator  and the last row is the same generator only with the splash at the end.This value is calculated by 31 = 1 + 1 + 2 2 + 4 2 + 3 .
This matrix can be presented as .

Calculation of the DsiHT by Analytical Equations
It is important to note that the -point DsiHT can be obtained without calculation of the angles   and trigonometric functions cos   and sin   , but by using the analytical formulas [15].For that, we consider the following notations, which represent respectively the partial cross-correlation of  with the vector generator : Preprint 02/27/2021 and the partial and full energies of the signal generator The components of the DsiHT on the k-th iteration can be expressed by the correlation data as follows: On the final stage, the value of the first component is defined by which is the correlation coefficient of the input signal  with the normalized generator .For a given generator, all values of   (, ) and  −1 ()  (), can be calculated in advance.In the case when  = , and   (1) = 0, for all  = 1,2, … , ( − 1).

COMPLEX BASIC MATRICES
The -point DsiHT is calculated, by applying ( − 1) basic transformations  on two different components of the renewal vector in a certain order, or the path.In this section, we consider the concept of the complex DsiHT.The basic transformation of the DsiHT, which is defined by a complex vector ( 0 ,  1 )′, and then, is applied to a complex input ( 0 ,  1 )′ is calculated as follows: The complex matrix of this transformation is and the determinant is 1.It is not difficult to verify that the matrix  is unitary, i.e., the multiplication of  with its conjugate transpositon (  ̅̅̅̅ )= , where  is the 2×2 identity matrix.

DsiHT with Analytical Equations
The complex DsiHT can also be calculated by using analytical equations ( 5) and ( 6), similar to the case with real vectors.For complex vectors, the partial cross-correlation of  with the vector-generator  in the first  components is calculated by and the energies in the first  components of the signal-generator by The 2×2 matrix calculated by analytical equations ( 7) and ( 8) for the  = 2 case will be denoted by .This matrix is different from matrix  and equals One coefficient of the matrix is a real number, and all coefficients are complex in the matrix .The matrix  is unitary and the determinant of the matrix is the complex number and |det | = 1.The matrix product ( 0 ,  1 )′ equals

DsiHT with Complex Givens Rotations
We consider the known complex Givens rotation [4] which is defined by the matrix Here, the complex sign function is defined by sign( 0 ) =  0 /| 0 |.The determinant of this matrix is 1.For the  0 = 0 case, the above matrix is defined as i.e., it is considered that sign(0) = 1.The matrix  is half-complex, meaning that in each row and column there is a real number | 0 |.It should be noted that all coefficients of the basic matrix  in Eq. 9 are complex numbers.When applying the matrix  on the vector-generator ( 0 ,  1 )′ we obtain or where sign( 0 ) is a complex number with norm 1.The matrix  is unitary, i.e., (  ̅̅̅̅ )= .
The determinants of these matrices, det  = det  = 1, det  = 0.3162 − 0.9487, and |det | = 1.Up to the coefficient 1/√39, the matrix  is integer-valued for integer complex generator, and matrices  and  are more complicated; they have additional coefficents with √10 = 3.1623.When applying these matrices on the vector ( 0 ,  1 )′ = (1 + 3, −2 + 5)′, we obtain the following vectors: and |1.9748 + 5.9245|= 6.2450.Thus, the results of the transforms  and  are different from  in the first component which is complex.Now, we consider the transforms of the vector  = ( 0 ,  To describe the difference between the DsiHT generated by basic 2×2 transforms of different types, we consider the matrices of these DsiHTs for the  = 4 case.
The vector-generator  is not in the first row of matrix .The first coefficient of this matrix is the real number 0.6220, not complex as in the vector-generator.
For the input vector  = (2 − 3, 1 − 4, −7 + , 3 + 5), the transforms equal Thus, we have three types of matrices T, M, and G for basic transforms that can be used in the QR decomposition by the DsiHT.These matrices are different, but these transforms move the energy of vector  = (x 0 , x 1 ) to the first component and zeroing the second one.

QR DECOMPOSITIONS WITH THE DSIHT
In this section, we analyze the application of the DsiHTs that are based on basic transformations , M and  in QR decomposition of a square complex matrix.The QR-decomposition is described in detail on the example with a 4 × 4 matrix.Let  be the following 4 × 4 complex square matrix with det() ≠ 0: First, we take the first column of the matrix as the vector  = ( 0 ,  1 ,  2 ,  3 )′.This vecor will be the generator for the DsiHT, which we consider of the type .We denote the matrix of DsiHT by   .The application of the DsiHT on the same vector is a vector  ̅ =   () = (||||, 0, 0, 0)′, where |||| is the energy of the vector, Therefore, when multiplying the matrices   and , we obtain the matrix  1 of the following form: In the second step, this 3 × 3 complex submatrix  1 is processed similarly.The first vector-column  = ( ̂1,  ̂2,  ̂3)′ is used as a generator for the 3-point DsiHT.We denote by   the matrix of this DsiHT.As a result, we obtain the following matrix: Here, |||| = √| ̂1| 2 + | ̂2| 2 + | ̂3| 2 .In the last stage of calculation, the basic transform with the vectorgenerator  = (̃2, ̃3)′ is applied on two vectors (̃2, ̃3) ′ and ( ̃2,  ̃3)′.Denoting by   the matrix of this transform, we obtain the final triangularization, Preprint 02/27/2021 , where |||| = √|2| 2 + |̃3| 2 .The matrix of the transformation, or triangularization  →  is Each of these DsiHTs is unitary, and therefore this matrix  is unitary.The inverse matrix  =  −1 is also unitary and can be written as Thus, we have an explicit representation of the matrix .Here, the operation  ′ denotes the conjugate transposition of a matrix .Thus,  =  and we obtain the following decomposition of the matrix : It should be noted that if we apply instead of -type DsiHT the transform of type M or G in the above example, the diagonal coefficients of the matrix  will be changed as follows.In the case of the -type DsiHT, and in the case of the G-type DsiHT, these coefficients will be changed as

Example 4×4:
We consider the method of QR-decomposition that is similar to the method of the Householder transformations, only the DsiHTs will be used instead of the Householder transformations.First, we calculate the DsiHT by using the analytical equations, instead of matrix multiplications.Let  be the following complex 4 × 4 matrix: ] .
The method of QR decomposition of  with the DsiHTs results in the following presentations of the matrix  = .
Up to the signs ±, many coefficients of the matrix   are equal to the coefficients of   , and the main difference in the 4th columns of these matrices.In the matrices   and   , the last coefficients are different, others are the same or differ only in the sign.
This decomposition is very different from the above three QR-decompositions.All coefficients of the first 3 columns of matrices   and   differ from the coefficients of the corresponding matrices of the above decompositions by the T-and M-type, as well as the Householder QR decomposition.The last columns in matrices   and   are equal, as well as in matrices   and   .
Here, we want to mention that if we apply the strong DsiHTs starting from the last column of the matrix, we obtain the decomposition of the matrix  =  with the left triangular matrix.For the G-type strong DsiHT, the matrix  is One can notice from this example that the QR-decomposition by the G-type DsiHTs differs much from the decomposition by the Householder transforms.The QR-decomposition by M-type DsiHTs is very similar to the Householder transform method.The M-type DsiHT is fast and can be implemented by using 2×2 basic transformations, as well by the analytical equations.To analyse the difference of these two decompositions in more detail, we consider the example with a 6×6 complex matrix .
Example 6×6: Let the matrix  be the following: .
The QR-decomposition by the -type DsiHTs results in the following matrices:

% -
In this matrix, the coefficients of the 3 rd and 6 th rows and the sign in 5 th row differ from the corresponding coefficients of matrix   .
It should be noted that instead of combination of types [1 2 3 1 1], we can use other combinations with 1,2, and 3.The number of such combinations is 3 5 = 243.In general case of the  ×  matrix, we can choose one combination of with numbers presenting the types of the DsiHT.The number of such combinations equals 3 (−1) and they can be used for calculating the QR-decomposition by the DsiHTs.The combinations with all 1s, 2s, and 3s correspond to the QR-decompositions by the , , and -type DsiHTs.Also, different paths can be used for the DsiHT, which increases the number of possible QR decompositions.
In conclusion, we consider a few QR-decompositions which were calculated for the pseudorandom integer  ×  matrices  with complex coefficients with real and imaginary parts in the range 1: .For that, the MATLAB function 'randi.m' is used.Twelve values of  were arbitrary chosen to be 6, 13,17,19,21,40,64,100,128,201,256, and 400.The QR-decompositions for each of these values of  were calculated by the -type DsiHT and the Householder transforms; the script of the code is given below for the QR decomposition of the random complex 400× 400 matrix.

Summary Results
To compare the results of the QR-decomposition, the precision of computation was estimated by the 2norms of the matrix ∆  = ( −     ) and matrix ∆  = ( −     ), by using the MATLAB function "norm.m."The results of estimations are given in Table 1.One can notice that in most cases the 2-norm of the QR-decomposition by the -type DsiHTs is less than the same norm when using the Householder transforms.

Figure 1 :
Figure 1: The two-wheel carriage of the DsiHT.

Figure 2 :
Figure 2: The two-wheel carriage of the strong DsiHT.
call: run_Matrix4x4general.m / from the library of Art Grigoryan % QR-decomposition by the DsiHT (of =amqr_complex(X,ntype); % the DsiHT method of QR-decomposition Q=U'; Q*R % = X [QH,RH]=qr(X); % MATLAB function (using the Householder transform) QH*RH % = X % - and the matrix  2 of this DsiHT with det  2 = 1 is The outputs of , , and  are different.The matrix  has commom with matrices  and .The second components of the transform  and  are the same, and the first components of the transform  and  are the same.For all these transforms, the energy of the input vector is preserved, The first column of the matrix   is proportional to the first column of the matrix , The last column of the matrix   is different from the last columns of the matrices   and   , other coefficients are equal up to the sign.The same differences can be seen in the triangular matrices   ,   , and   .

.
The method of Householder transforms which is performed by the MATLAB function 'qr.m' results in the following matrices   and   in the QR-decomposition  =     .In the matrix   , the last column differs from the same column in the matrix   , when using the M-type matrices in QR-decomposition.The remaining part, or the 6×5 sub-matrix of   differs from the same sub-matrix of   only by the sign.Thus, we can write the matrix   in the following way:All coefficients of the triangular matrix   , except the last coefficient, equal to the corresponding coefficients of the matrix   with the sign minus.In matrix   , this coefficient equals −4.1941 and in the matrix   such coefficient is 2.1708 + 3.5886.Therefore, we can write that

Table 1 .
The precision of the QR-decomposition by the -type DsiHT and Householder transforms.