1. Introduction
The factorization of a matrix
by an orthogonal (or unitary) matrix
and a triangular matrix
, which is known as QR-factorization, or QR-decomposition, is a fundamental technique which is widely used in various applications in computing and data analysis. This factorization is computationally effective in solving a large linear system
(as
), in solving least-squares problems [
1,
2,
3,
4,
5,
6], in signal and image processing [
7,
8], in image watermarking [
9,
10], in improving air traffic control radar [
11], in analyzing the stability of linear systems in control theory [
12,
13], in solving linear regression problems in machine learning [
14,
15], in linear programming algorithms [
16], in processing massive datasets in parallel across a cluster of computers (tall-and-skinny matrix QR-factorizations) [
17,
18,
19], and in building effective methods for calculating multi-qubit operations in quantum computing [
20,
21,
22,
23]. The matrix
is presented as the product of two matrices,
. The inverse matrix
is calculated as
. Here,
is the conjugate transpose to
, and the inverse matrix
can be easily calculated, by using an iterative process called back substitution. QR-factorization is a well-known method in linear algebra, but questions remain regarding the most efficient way to implement it for big data in computing.
Many methods of QR-factorization were introduced for real matrices
, and then were modified for complex matrices. We mention the Gram–Schmidt process [
24,
25,
26], the method of Householder reflections (or Householder transformations) [
27,
28,
29,
30], and Givens rotations [
31,
32,
33,
34]. We consider the QR-factorization with an upper triangular matrix
and will dwell on the factorization which is calculated by the discrete signal-induced heap transformations (DsiHTs) [
35]. For a real matrix, the DsiHT can be composed by the elementary rotations. Together with these 2 × 2 basic operations, the DsiHT is determined by the path, or order, of the processing the signal components. A description of these transformations for two particular cases relating to DsiHT with weak and strong two-wheel carriages is given in [
35,
36]. These DsiHTs are called weak and strong DsiHTs, respectively. The first transformation operates on the signal
in the usual way, that is, the 2 × 2 rotations operate in the following order:
and
, then the renewed
and
, and so on. The strong DsiHT processes the signal components in the following order:
and
, then
with the renewed
and, continuing in this manner, all the signal generator energy is transferred to the first component of the transform. Every second output of the rotations is zeroed.
The present work is a continuation of the research on the QR-factorization of square matrices. From the very beginning of our work in QR-factorization, we have paid great attention to the path of the
-point DsiHT, especially for a large
. Many paths can be chosen for the transformation and, among them, we are looking for paths which lead to effective calculation of the DsiHT-based QR-factorization. Each path of the transformation determines the structure of its matrix and the number of zero coefficients in it. Therefore, we are looking for paths that determine sparse matrices of the transformation. Such paths exist and they can be used instead of the paths in the above-mentioned weak and strong DsiHTs. We present two such paths, which are called fast paths #3 and #4. The paths for the weak and strong DsiHTs in [
36] are referred to as paths #1 and #2, respectively. The DsiHTs with fast paths are defined by unitary matrices that are sparser than the matrices of the original two DsiHTs. For instance, the 256-point DsiHTs with the fast paths have 63,232 zero coefficients out of 65,536, whereas, when using path #1 or #2, the number of zero coefficients is 32,325. This means that fewer operations are required to perform the transformation
and, therefore, fewer operations are required to calculate the QR-factorization.
The main contributions of this work are the following:
Description of the fast paths for the -point DsiHT with a sparse matrix. For instance, when , the matrix of the transformation has zero coefficients.
Fast paths #3 and #4 for QR-factorization of matrices where
The concept of DsiHT with new 2 2 complex matrices for ‘complex Givens rotations.’
A reduced number of multiplications in the QR-factorization.
Algorithms with fast paths that allow us to perform all real and complex rotations in the QR-factorization only on the adjacent bit planes.
Encoded tables with angles for the real unitary matrix . Such tables can be used to generate random unitary matrices.
Illustrative examples that show the advantage of using the DsiHT with fast paths when compared to the Householder reflection-based QR-factorization.
The rest of the paper is organized in the following way: In
Section 2, the concept of the
-point DsiHT is described with examples of different paths for the
case. A comparison with the method of the Householder reflections is also given.
Section 3 describes all
-point DsiHTs with fast paths for
The matrices of the eight-point DsiHTs with five different paths are given and compared with the eight-point Householder reflection. The algorithm for the
-point DsiHT with fast path #4 is also presented in the general case, where
. In
Section 4, the DsiHT-based QR-factorization is described with the example of a 5
5 real matrix. The concept of the complex DsiHT with the fast paths and different 2
2 basic operations is presented in
Section 5. Examples with 5
5 and 256
256 complex matrices are described and compared with the Householder reflection-based QR-factorization calculated in MATLAB. In
Appendix A, our main MATLAB-based codes for QR-factorization of real and complex square matrices are presented.
2. Discrete Signal-Induced Heap Transforms
In this section, we consider the
-point DsiHT for the case where
is equal to or differs from a power of 2. The transformation requires
elementary rotations [
35]. There are many ways to calculate the transform. As an example, we consider the four-point DsiHTs which are defined by the diagrams shown in
Figure 1. The signal is considered real. These diagrams show different orders, or paths, for processing the components of the input. In part (a), the components
and
of the input signal (generator)
are processed in the natural order. This is the traditional path for processing the signal. The DsiHT with such a path is called the weak-carriage-wheel DsiHT (see [
36] for more detail). The first value of the transform is renewed three times. This is why it is denoted by
. Each two-point unitary transform
is the Givens rotation, or elementary rotation. In the figure, these rotations are depicted as butterflies. In the matrix form, the rotation
is described as
The rotation angle is defined by the inputs as
. If
, then
. The transform of the generator
is equal to
Thus, the energy
of the generator is transformed to the first component. The angles
,
are calculated from this generator. The set
is called the angular representation of the signal generator. Once the angles have been calculated, the transform of an input
is calculated by using the same path:
The result of the transformation is the signal The four-point DsiHT is a unitary transformation. Therefore, the energy of the signal is preserved,
Path #2, which is shown in the diagram in
Figure 1b, corresponds to the DsiHT which is called the strong-carriage-wheel DsiHT [
36]. Here, data processing begins with the last component
of the signal. The first component
is updated once at the end of the computation. Now, we consider two paths of the four-point DsiHT shown in
Figure 1c,d. There are two different partitions of data in the first stage of computation. Two rotations
and
can be calculated in parallel. The total number of rotations, or butterflies, is equal to 3. We will call paths #3 and #4 of the calculation shown in
Figure 1c and
Figure 1d, respectively, the fast paths. Of greatest interest are these two paths, which allow the calculation of the transform to be performed in two stages (or the minimum number of stages). Here, we also mention the following: Methods for QR-factorization by rotations are widely used in quantum computation to build quantum circuits for multi-qubit operations and quantum states preparation. All computations in quantum computing are performed with gates (operations) which are described by unitary matrices. Implementation of these multi-qubit operations in quantum circuits can be fulfilled only on the adjacent bit planes (BPs). Such bit planes differ only in one bit. Therefore, it is especially important from the very beginning to have decompositions of all matrices by basic operations on such bit planes; otherwise, we need to add many permutations inside between the gates to put all operations on adjacent bit planes, and that makes the quantum circuit complex [
37,
38]. For example, with just six qubits, the number of controlled NOT gates exceeds 1020 (theoretically) and 1868 (in quantum Shannon decomposition), while the QsiHT-based method of QR-decomposition allows the quantum circuits for six-qubit operations to be built without permutations.
In the above case, when the signals are four-point vectors, we can consider that the components and lie on the bit planes 0, 1, 2, and 3, that is, 00, 01, 10, and 11, respectively. Three butterflies in the diagrams with fast paths operate only on adjacent BPs. For instance, the second butterfly operates on BPs (10) and (11) when using path #3, and on BPs (01) and (11) when using path #4. For comparison, the butterfly in the diagram in part (a) operates on BPs (00) and (11), which are not adjacent BPs. Also, one can see that, in the diagram in part (b), the second rotation operates on non-adjacent BPs (01) and (10). In general, for any integer , we call the path of the -point DsiHT the fast path, if all butterflies (rotations) operate only on adjacent BPs.
Example 1. Let the generator be with the energy The matrices of the four-point DsiHTs generated by and the four paths in Figure 1 are as follows: The transforms
for
Each path determines the structure of the matrix. This can be easily seen by the location and the number of zero coefficients in the above matrices. The number of zero coefficients in the first two matrices is equal to 3, and, in the last two matrices, this number is 4. The first rows in these matrices are the generator
normalized to the coefficient of
, that is,
All numbers are given with an accuracy of four decimal places. The angles
(in degrees) for these transformations are given in
Table 1.
For comparison, we consider the Householder transformation matrix composed by the signal
as follows [
4,
28]:
where
is the 4
4 identity matrix and the Householder vector
is calculated as
This matrix is symmetric (without zero coefficients) and orthogonal, and
All these five matrices are different. As an example, we consider the input signal . Then, we obtain the following five different transforms:
3. -Point DsiHT, When
In this section, we describe
-point DsiHTs starting from the number
and reducing it to 3. For each of these transformations, we consider two fast paths, which are similar to the fast paths in
Figure 1c,d. First, we consider the eight-point DsiHTs with paths given in
Figure 2. Seven butterflies are used in each of the diagrams shown in
Figure 2a,b, and all butterflies operate on adjacent BPs. Four butterflies are used in the first stage, and they can be calculated in parallel. Two butterflies operate in the second stage, and one butterfly in the last stage. It is difficult to say which of these two paths is better. One can note from the diagram in
Figure 2b that the calculations after stage 1 represent the four-point DsiHT described in
Figure 1d. Likewise, for path #3, the calculations of the butterflies
and
in the diagram in
Figure 2a represent the four-point DsiHT of the updated input
.
The paths which are similar to the paths in
Figure 1a,b can also be used for the eight-point DsiHT. It should be noted that other fast paths exist for calculating the eight-point DsiHT. As an example, we consider the transformation in the diagram shown in
Figure 3. The larger the value of
, the more paths can be found for computing the
-point DsiHT.
Example 2. Let the generator be with the energy The matrices , of the eight-point DsiHTs generated by and paths #1, 2, 3, and 4 are as follows: If we consider the eight-point DsiHT with path #5 shown in
Figure 3, we obtain the following matrix of the transformation:
Each path defines the structure of the transformation matrix. The first rows in these matrices are the normalized generator
, that is,
and
. The angles
of rotations in these transformations are given in
Table 2 (in degrees). The number of zero coefficients in these matrices is also shown in the table (in the last column).
Now, we consider the Householder transformation matrix calculated as
/
and equal to
There is no zero coefficient in the matrix. The determinant of this matrix is equal to and the transform The vector is calculated as
One can notice that the number of zero coefficients in the matrices
and
(and
) is much greater than in the matrices
and
. These numbers are equal to 32 and 21, respectively. The number,
of zero coefficients in the matrices
and
is the same, as is the number,
of zero coefficients in the matrices
and
. In the case where
these numbers are calculated as follows:
These estimates, as well as the other equations presented below, were derived and then thoroughly verified using computer simulations with various matrices for arbitrary integer .
Figure 4 shows the graphs of these functions in percentage terms for
,
that is, the number of zeros as a percentage of the matrix size
is calculated for each of the following functions:
For comparison, the first nine values of these numbers are given in
Table 3. The table also shows the difference
between the numbers
and
and their percentage compared to all
coefficients in the matrices.
For
, the difference of zero coefficients
and
is equal to 514,559. When multiplying matrices of the 1024-point DsiHT by a 1024-D vector
, the calculation requires no more than
multiplications, if the transforms with paths #3 and 4 are used. For matrices with paths #1 and #2, the calculation requires
multiplications, or more than 46 times as many. In the general case of
, the number of multiplications when multiplying the matrices
by the vector
is estimated as
and, when multiplying
, the number of multiplications is estimated as
The number of operations saved when using the fast paths #3 and #4 is
These numbers are shown in column number 4 in
Table 3.
Next, we show that the diagrams of the eight-point DsiHT, which are shown in
Figure 2 for two different paths, can be used and simplified when calculating the seven-, six-, and five-point DsiHTs, by removing the last inputs in the diagrams.
3.1. The -Point DsiHT
Let us consider the
case and the signal generator
. It is possible to consider the extended zero-padded 8-D vector
and use the diagrams in
Figure 2, after removing rotation number 4 and then changing the numbers of the next three rotations. The corresponding diagrams are shown in
Figure 5. In stage 1, three rotations are used. The total number of rotations is equal to six.
3.2. The -Point DsiHT
The diagrams for calculating the six-point DsiHTs via paths #3 and #4 are shown in
Figure 6, in parts (a) and (b), respectively. For that, the diagrams in
Figure 5 were used, after removing the last component
from the input. In these two diagrams, the numbers of rotations at stages 1 and 2 are different. The total number of rotations is five.
3.3. The -Point DsiHT
The last two simplifications of the diagrams of the eight-point DsiHT for the five-point DsiHT are shown in
Figure 7. A total of four butterflies are used in both diagrams.
3.4. The -Point DsiHT
The diagrams of the four-point DsiHTs are given in
Figure 1. For the three-point DsiHT, there are only two paths that can be considered. The diagrams with these paths are shown in
Figure 8. Two butterflies are used for these transforms.
3.5. Algorithm of the DsiHT with Path #4
We stand on path #4, for any order of the DsiHT. The algorithm of the transformation with this path can be described as follows: Consider the smallest power of two, The calculation of the transform generated by the signal can be performed in two steps as follows:
The Givens rotations are applied to the pairs:
We will receive the signal
The
-point DsiHT with fast path #4 is applied to the
-point signal
The total number of rotations is equal to .
As an example, we consider the diagram of the seven-point DsiHT which is shown in
Figure 5 part (b), where
. The first three rotations are applied to the pairs
,
, and
. Then, the first outputs of these rotations,
together with the input component
, are used as the input signal,
, for the four-point DsiHT. The composition of the seven-point DsiHT is described by the following six matrices of rotations (or butterflies
,
):
Here,
, when
, denotes the matrix composed by the 7
7 identity matrix [
] and coefficients of the matrix rotation
at the points (
i,
i), (
i,
), (
,
i), and (
,
). Thus,
where
and
,
The transform of the signal generator
is the following vector:
3.6. Number of Zero Coefficients in the DsiHT Matrices
For the
-point DsiHT calculated via paths #3 and 4, the number
of zero coefficients is estimated as follows: If
, where
the following recurrence formula is valid:
In other words, in the
matrix of the
-point DsiHT, there is
more zero coefficients than in the matrix of the
-point DsiHT. If we denote
where
then the number
can be calculated as follows:
If
, then
, calculated by Equation (20). A few values of these numbers are shown in
Table 4.
The number of multiplications when multiplying the matrices
by the
-dimensional vector
can be estimated as
These numbers are also given in
Table 4, along with the maximum number of multiplications
for comparison. Note that, for the
-point DsiHT with path #1, the number of zero coefficients is calculated by
, for any
4. DsiHT-Based QR-Factorization
In this section, we describe the QR-factorization of a square matrix
of size
by the Givens rotations. The unitary matrix
is considered with real coefficients. In the QR-factorization,
DsiHTs are used. This factorization is illustrated below for a
unitary matrix:
The first five-point DsiHT,
is generated by the first column of the matrix
and then it is applied to each of its columns. Four zero coefficients will be obtained in the new matrix
in its first column, as shown above. A similar transform will be applied on the 4
4 submatrix (highlighted in red) of
. Namely, the four-point DsiHT,
, will be generated by the last four components of the second column of the matrix
. This transform will be applied to each column of the 4
4 submatrix. In the new matrix
, another three zero coefficients in the second column will be obtained. Then, the three-point DsiHT,
, will be generated by the first column of the 3
3 submatrix of
and applied on this submatrix. We will obtain a new matrix
with nine zero coefficients, as shown in Equation (32). The last two-point DsiHT,
, will be generated by the last two coefficients of the fourth column of
and applied to its 2
2 submatrix. Thus, the matrix triangularization is completed as follows:
Here,
is the identity
matrix. If we denote the unitary matrix
and its inverse,
then we can write
This is the result of the QR-factorization. The matrix
is upper triangular, and
is the unitary matrix. The matrix operation ‘′’ stands for the matrix transposition.
Let us estimate the number
of multiplications in the QR-factorization of the 5
5 matrix
. The first five-point DsiHT is applied to five columns of
. Then, the second four-point DsiHT is applied to four columns of the 4
4 submatrix of
, and so on. Thus, considering the number of zero coefficients in the matrices of the DsiHTs, we obtain the following estimation:
The number of rotations that perform the QR-factorization of the matrix is equal to If we use the Householder transformations in the QR-factorization of the same 5 5 matrix, the number of multiplications will be estimated by
Example 3. Consider the following randomly generated 5 5 matrix: The QR-factorization of the matrix,
, where the upper triangular matrix
is calculated, is as follows: The first five-point DsiHT with fast path #4 is generated by the column
Therefore, the first matrix in this factorization is equal to the following:
At the next three stages of the matrix factorization, the matrices are composed by the matrices of the four-, three-, and two-point DsiHTs and are equal to
and
The unitary matrix
is calculated by Equation (34) and is equal to the following:
The triangular matrix is as follows:
Ten angles of rotations in these four DsiHTs are given in
Table 5 (in degrees). This is an encoded table of the QR-factorization by the DsiHTs with path #4. In other words, the unitary matrix Q is encoded in this table.
We remind readers that, in the QR-factorization, the triangularization
is accomplished by a unitary matrix
. The original matrix is integer-valued, and it is always possible to fulfill the triangularization via the integer matrices only, as shown below:
The determinant of the matrix is 1, but this matrix is not unitary. To calculate the matrix from this equation as , the inverse of the matrix is required, which is not the transpose matrix, that is,
The QR-factorization of the same matrix
by the Householder reflections results in the following matrices:
and
It can be noted that the coefficients of these matrices differ only in signs from the corresponding matrices of the DsiHT-based QR-factorization, given in Equations (40) and (41). This example illustrates the advantage of the DsiHT-based method over the Householder reflection method. The results are almost the same, but the DsiHTs reduce the operations of multiplication by the number , plus the encoded QR-factorization table is generated.
Such a table can be used to create a unitary matrix 5
5, as
or
Indeed, if we randomly change the angles in
Table 5, we will obtain different unitary matrices
. These four matrices are composed of 10 rotations. In the general case of
, such a table with randomly chosen angles for
rotations can be used as an encoding table to generate unitary
matrices. The set of bit planes on which these rotations operate is fixed. This set will only change if we change the paths for DsiHTs. Thus, one code (with arbitrarily specified angles) can be used to generate a random unitary matrix.
The numbers of multiplication operations for the QR-factorization by the Householder reflections and DsiHTs with paths #1 and #4 are calculated by
where
is calculated by Equation (31). The values of these estimations for small values of
and for powers of two,
and
, are given in
Table 6.
One can note that the DsiHT-based method with fast path #4 requires a smaller number of multiplications when compared with path #1 as well as the Householder reflection-based method. The graphs of the functions
and
are shown in
Figure 9a, where
, and in part (b), where
.
For comparison with the method of DsiHT with path #4,
Figure 10 illustrates the ratios of functions
and
in the integer interval [2,2048]. These two curves are approximately equal to the lines with the slopes
and
5. Complex QsiHT
In this section, we describe the complex DsiHTs that allow for QR-factorization of complex matrices. The DsiHTs described above are real and composed of rotation operations, or butterflies in the diagrams, denoted by
, which are the basic elements (building blocks) from which we build a transformation. Each of them is described by a 2
2 unitary matrix. For the complex DsiHT, we just need to replace the real butterflies with complex ones, leaving the paths the same. Therefore, the fast complex DsiHT is defined as a complex extension of the real DsiHT with the same fast path. These complex transformations can then be used in the QR-factorization of complex matrices in a similar way to how they are used for the decomposition of real matrices. As shown in [
36], there are different complex matrices
that can be used as the basis elements to compose the
-point complex DsiHT.
- A.
First, we consider the following 2 × 2 matrix:
Numbers
and
are complex. The matrix
is unitary and its determinant
and
The matrix product is
It should be noted that such matrices are used in quantum computation for realization of complex multi-qubit operations [
37]. Therefore, this matrix is decomposed by basic 2
2 operations, or gates. For that, the polar form of the numbers is considered, that is,
and
. Then, Equation (48) can be written as
This complex matrix can be encoded by four angles in the following way: First, we calculate the angle
) and then denote the cosine and sine coefficients
The matrix
can be written as
or
The first matrix in this factorization is known as the phase shift, the second and fourth ones are
-rotations [
39], and the third matrix is the matrix of the elementary rotation. Thus, we can encode the matrix
by four angles as
The QR-factorization of a complex matrix by such complex
matrices is described in detail in [
36]. For this purpose, the concepts of the complex DsiHTs with the strong and weak carriage wheels are used.
- B.
Other 2
2 matrices also can be used instead of the matrix
. We mention the known complex Givens rotation with the matrix [
4],
When applying the matrix
to the vector generator
we obtain
. Two coefficients of this matrix are real, and, in the matrix
, only one coefficient is real. We can consider the complex matrix with all complex coefficients. For instance, the unitary matrix is defined as follows:
for which
=
The complex vector
is rotated to the positive or negative direction of the real axis. The matrices
and
can be expressed by the matrix
as follows:
- C.
A comparison of the QR-factorizations of a complex square matrix by the matrices
,
, and
, when using the weak and strong DsiHTs, is given in [
36], together with examples and MATLAB-based codes.
The following should be noted about the matrix
: The QR-factorization by this matrix can be calculated analytically without rotation angles and matrices. For simplicity of calculations, we consider the weak DsiHTs. First, let the matrix
be real. The following notations for an input
-dimensional vector
and the vector generator
are used:
and
for the partial energies
of the signal generator. The DsiHT of the input vector
, that is,
can be calculated by the correlation data as follows:
For a given generator
, all values of
and
can be calculated in advance. The coefficients
of the matrix
can be obtained from Equations (57)–(60). For that, the standard procedure is used. The m-th column of this matrix is the DsiHT of the unit vector
, with 1 at the m-th position. Therefore, all coefficients can be calculated using the formulas
The diagonal coefficients of this matrix represent the ratios of the energies of the first components of the signal to the components.
When the matrix
is complex, the complex DsiHT can be calculated by using the similar formulas. The partial cross-correlations of the complex input
with the complex generator
are calculated by
and the partial energies
of the generator are calculated by
The above matrices , , and can be used for calculating the DsiHTs in QR-factorization with fast paths #3 and #4. However, we consider another and more effective way to perform the basic operation on complex data.
- D.
We introduce a new matrix instead of the above matrix . First, we remove the phases from the complex numbers and , as In the matrix form, this operation can be written as
Then, the elementary rotation can be used on the real vector:
Here, the rotation angle is calculated as
. If
, then
. We obtain the following complex-to-real transformation:
with the matrix
This matrix is simple when compared to the matrix , and it can be encoded by three angles We also can write . If the input and are real, we prefer to use the original matrix of rotation, which is defined in Equation (1). Then, the matrix will be encoded as . The complex -point DsiHT with the basic matrix in Equation (67) is a straightforward extension of the real -point DsiHT.
Example 4. Let us consider the complex five-point signal The matrix of the five-point DsiHT generated by
and path #4 has the following complex unitary
matrix:
This matrix has eight zero coefficients, as in the case of real matrices. The determinant of the matrix is equal to
and
Up to the constant
, the first row of the matrix is the generator
, that is, it is equal to
A diagram of this transformation is shown in
Figure 11 and it looks like what is shown in
Figure 7b. Only the butterflies with rotations
are changed by the complex ‘butterflies’ with operations
.
All angles of the complex operations
in this DsiHT are given in
Table 7.
Now, we consider the example of the QR-factorization of a complex matrix by the DsiHT with path #4.
Example 5. Consider the following 5 × 5 complex matrix: The QR-factorization of this matrix,
by four complex DsiHTs, each with path #4, results in the following matrices:
and (upper triangular)
We need to mention that the coefficients in the diagonal of the upper triangular matrix
are real, except the last coefficient. Therefore, the imaginary part of the matrix has four more zeros than the real part. The angles of all ten complex operations
in this QR-factorization are given in
Table 8.
The unitary matrix is equal to
.
Table 7 can be considered as an encoded table of angles for
. Any such encoded table, namely, the set of 30 angles, can be used to generate a complex unitary 5
5 matrix. In the general case of
, such encoded tables of angles for
DsiHTs with path #4 can be used to generate a complex unitary
matrix. The number of angles in the encoded table is equal to
Now, we will analyze the MATLAB version of the QR-factorization of the same matrix,
, which is calculated by the function ‘qr.m,’ as ‘[Q_M,R_M] = qr(A).’ The method of the Householder transformations is programmed in this function. Many coefficients of these two matrices are equal up to the sign of the coefficients of the corresponding matrices
and
. Therefore, we consider the pointwise ratio of the matrices
and
Here, the symbol ‘*’ is used at points where the coefficients of the matrices are zero (as 0/0). The last coefficients of the triangular matrices are and The major difference of these matrices is in the coefficients of the last columns.
Although we are writing
and
, there are small errors in calculation of the matrix
by
and
matrices. To compare the results of the QR-factorization, the precision of computation has been estimated by the 2-norms of the matrix
and matrix
, by using the MATLAB function “norm.m.” The results of the calculation are as follows:
Relative to the 2-norm, the error of the QR-factorization by the DsiHTs with fast path #4 is more than two times smaller than the error when using the method of the Householder transformations.
As mentioned above, the fast paths, like paths #3 and #4, allow us to decompose the matrix
by using matrices with more zero coefficients than when using paths #1 and #2. It means that fewer operations of multiplication and addition will be used, and results will be more accurate. That can be verified in this example as well. For instance, we consider the QR-factorization by DsiHTs with path #1 (that is, the DsiHTs with the weak carriage wheels). The calculations by the analytical Equation (56) result in the following complex matrices:
Here, only those coefficients in the matrices and that differ from the coefficients of the corresponding matrices and are given. All other coefficients are equal and marked by ‘.’ Note that all coefficients in the above matrices are given with an accuracy of up to four decimal places.
The results of the calculation of the 2-norm of the matrix
are as follows:
Relative to the 2-norm, the error of the QR-factorization by the DsiHTs with fast path #1 is smaller than the error when using the Householder transformations. However, this 2-norm is larger than the 2-norm of the factorization by the fast paths. Namely,
In conclusion, we consider the example of a complex matrix of a large size, and we compare the results of the QR-factorization by the DsiHTs with path #4 with the MATLAB version of the factorization.
Example 6. The 256 256 complex matrix is composed of two real images, as shown in Figure 12a. The real part of this matrix is the ‘cameramen.tif’ image of 256 256 pixels. The imaginary part of this matrix represents the grayscale ‘peppers.tiff’ image of 512 512 pixels after down-sampling to the size of 256 256 pixels. These images are taken from the database at the following address: http://sipi.usc.edu/database (accessed on 1 January 2020). The real and imaginary parts of this complex matrix are integer-valued non-negative matrices. The result of the DsiHT-based QR-factorization of 256 256 complex image is shown in Figure 12b. Visually, it is difficult to see the difference between these two images in this figure. The difference matrix has values in the small interval and is shown in Figure 12c as the image after scaling using the MATLAB function ‘imagesc.m.’ The 2-norm of the difference matrix is equal to Figure 13 shows the image of the unitary matrix
together with the image of the triangular matrix
. Since the values of the matrix
are small, this matrix is displayed at an absolute scale with a factor of 2000. The matrix of
is also displayed at an absolute scale with a factor of 3.
For comparison,
Figure 14a shows the result
obtained when using MATLAB code ‘qr(A).’ The 2-norm of the difference matrix
is equal to
This 2-norm is 1.2337 times larger than the 2-norm
Since the original images are integer-valued, the results
and
can be rounded before displaying them. The rounding of the matrix
is shown in
Figure 14b. There is a zero error between the rounded matrix
and the matrix
. The same is true for the rounded matrix
.