## 背景介绍

$U_{r}U_{r-1}…U_{1}U=I_{N}$

$U=U_{1}^{T}U_{2}^{T}U_{3}^{T}…U_{r-1}^{T}U_{r}^{T}$

## 示例程序:

#include "QPanda.h"
int main(int argc, char** argv)
{
CPUQVM qvm;
qvm.init();
auto qvec = qvm.qAllocMany(2);
auto cvec = qvm.cAllocMany(2);

QStat matrix =
{
qcomplex_t(0.652943, 0.57122),qcomplex_t(-0.29939, 0.282333), qcomplex_t(-0.191003, 0.120122), qcomplex_t(0.16255, -0.026325),
qcomplex_t(-0.29939, 0.282333),  qcomplex_t(0.652943, 0.57122),  qcomplex_t(-0.16255, 0.026325), qcomplex_t(0.191003, -0.120122),
qcomplex_t(-0.191003, 0.120122), qcomplex_t(-0.16255, 0.026325), qcomplex_t(0.652943, 0.57122), qcomplex_t(0.29939, -0.282333),
qcomplex_t(0.16255, -0.026325),  qcomplex_t(0.191003, -0.120122), qcomplex_t(0.29939, -0.282333), qcomplex_t(0.652943, 0.57122)
};
auto decompose_cir = matrix_decompose(qvec, matrix);
auto result_matrix = getCircuitMatrix(decompose_cir);

cout <<matrix << endl;
cout << result_matrix << endl;
cout << decompose_cir << endl;

qvm.finalize();
return 0;
}


### 输出结果：

(0.652943,0.57122) (-0.29939,0.28233) (-0.191003,0.1201) (0.16255,-0.0263)
(-0.29939,0.28233) (0.652943,0.57122) (-0.16255,0.02632) (0.191003,-0.120)
(-0.191003,0.1201) (-0.16255,0.02632) (0.652943,0.57122) (0.29939,-0.2823)
(0.16255,-0.02632) (0.191003,-0.1201) (0.29939,-0.28233) (0.652943,0.5712)

(0.652943,0.57122) (-0.29939,0.28233) (-0.191003,0.1201) (0.16255,-0.0263)
(-0.29939,0.28233) (0.652943,0.57122) (-0.16255,0.02632) (0.191003,-0.120)
(-0.191003,0.1201) (-0.16255,0.02632) (0.652943,0.57122) (0.29939,-0.2823)
(0.16255,-0.02632) (0.191003,-0.1201) (0.29939,-0.28233) (0.652943,0.5712)

## 新方法的亮点

www.originqc.com.cn