@@ -86,6 +86,30 @@ TEST_F(QCOMatrixTest, CXOpMatrix) {
8686}
8787// / @}
8888
89+ // / \name QCO/Modifiers/PowOp.cpp
90+ // / @{
91+ TEST_F (QCOMatrixTest, PowRxxOpMatrix) {
92+ auto moduleOp = QCOProgramBuilder::build (context.get (), powRxx);
93+ ASSERT_TRUE (moduleOp);
94+
95+ // Get the PowOp from the module
96+ auto funcOp = *moduleOp->getBody ()->getOps <func::FuncOp>().begin ();
97+ auto powOp = *funcOp.getBody ().getOps <PowOp>().begin ();
98+ auto matrix = powOp.getUnitaryMatrix ();
99+
100+ // RXX(0.123)^2 = RXX(2 * 0.123) = RXX(0.246)
101+ const auto definition = dd::opToTwoQubitGateMatrix (qc::OpType::RXX , {0.246 });
102+ Eigen::Matrix4cd eigenDefinition;
103+ eigenDefinition << definition[0 ][0 ], definition[0 ][1 ], definition[0 ][2 ],
104+ definition[0 ][3 ], definition[1 ][0 ], definition[1 ][1 ], definition[1 ][2 ],
105+ definition[1 ][3 ], definition[2 ][0 ], definition[2 ][1 ], definition[2 ][2 ],
106+ definition[2 ][3 ], definition[3 ][0 ], definition[3 ][1 ], definition[3 ][2 ],
107+ definition[3 ][3 ];
108+
109+ ASSERT_TRUE (matrix->isApprox (eigenDefinition));
110+ }
111+ // / @}
112+
89113// / \name QCO/Modifiers/InvOp.cpp
90114// / @{
91115TEST_F (QCOMatrixTest, InverseIswapOpMatrix) {
0 commit comments