Skip to content

Commit b824284

Browse files
committed
✨ Rename staticQubitWithOp to staticQubitsWithOps and update related test cases across various dialects and programs to reflect the new functionality of allocating multiple static qubits and applying operations.
1 parent ea7b675 commit b824284

13 files changed

Lines changed: 59 additions & 49 deletions

File tree

mlir/unittests/Compiler/test_compiler_pipeline.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ INSTANTIATE_TEST_SUITE_P(
194194
MQT_NAMED_BUILDER(mlir::qc::staticQubits),
195195
MQT_NAMED_BUILDER(mlir::qir::staticQubits), false},
196196
CompilerPipelineTestCase{
197-
"StaticQubitWithOp", nullptr,
198-
MQT_NAMED_BUILDER(mlir::qc::staticQubitWithOp),
199-
MQT_NAMED_BUILDER(mlir::qc::staticQubitWithOp),
200-
MQT_NAMED_BUILDER(mlir::qir::staticQubitWithOp), false},
197+
"StaticQubitsWithOps", nullptr,
198+
MQT_NAMED_BUILDER(mlir::qc::staticQubitsWithOps),
199+
MQT_NAMED_BUILDER(mlir::qc::staticQubitsWithOps),
200+
MQT_NAMED_BUILDER(mlir::qir::staticQubitsWithOps), false},
201201
CompilerPipelineTestCase{"AllocQubit",
202202
MQT_NAMED_BUILDER(qc::allocQubit), nullptr,
203203
MQT_NAMED_BUILDER(mlir::qc::allocQubit),

mlir/unittests/Conversion/QCOToQC/test_qco_to_qc.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ TEST_P(QCOToQCTest, ProgramEquivalence) {
117117
/// @{
118118
INSTANTIATE_TEST_SUITE_P(
119119
QCOQubitManagementTest, QCOToQCTest,
120-
testing::Values(QCOToQCTestCase{"StaticQubits",
121-
MQT_NAMED_BUILDER(qco::staticQubits),
122-
MQT_NAMED_BUILDER(qc::staticQubits)},
123-
QCOToQCTestCase{"StaticQubitWithOp",
124-
MQT_NAMED_BUILDER(qco::staticQubitWithOp),
125-
MQT_NAMED_BUILDER(qc::staticQubitWithOp)}));
120+
testing::Values(
121+
QCOToQCTestCase{"StaticQubits", MQT_NAMED_BUILDER(qco::staticQubits),
122+
MQT_NAMED_BUILDER(qc::staticQubits)},
123+
QCOToQCTestCase{"StaticQubitsWithOps",
124+
MQT_NAMED_BUILDER(qco::staticQubitsWithOps),
125+
MQT_NAMED_BUILDER(qc::staticQubitsWithOps)}));
126126
/// @}
127127

128128
/// \name QCOToQC/Modifiers/InvOp.cpp

mlir/unittests/Conversion/QCToQCO/test_qc_to_qco.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ INSTANTIATE_TEST_SUITE_P(
119119
testing::Values(
120120
QCToQCOTestCase{"StaticQubits", MQT_NAMED_BUILDER(qc::staticQubits),
121121
MQT_NAMED_BUILDER(qco::staticQubits)},
122-
QCToQCOTestCase{"StaticQubitWithOp",
123-
MQT_NAMED_BUILDER(qc::staticQubitWithOp),
124-
MQT_NAMED_BUILDER(qco::staticQubitWithOp)}));
122+
QCToQCOTestCase{"StaticQubitsWithOps",
123+
MQT_NAMED_BUILDER(qc::staticQubitsWithOps),
124+
MQT_NAMED_BUILDER(qco::staticQubitsWithOps)}));
125125
/// @}
126126

127127
/// \name QCToQCO/Modifiers/InvOp.cpp

mlir/unittests/Conversion/QCToQIR/test_qc_to_qir.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,9 @@ INSTANTIATE_TEST_SUITE_P(
624624
MQT_NAMED_BUILDER(qir::emptyQIR)},
625625
QCToQIRTestCase{"StaticQubits", MQT_NAMED_BUILDER(qc::staticQubits),
626626
MQT_NAMED_BUILDER(qir::emptyQIR)},
627-
QCToQIRTestCase{"StaticQubitWithOp",
628-
MQT_NAMED_BUILDER(qc::staticQubitWithOp),
629-
MQT_NAMED_BUILDER(qir::staticQubitWithOp)},
627+
QCToQIRTestCase{"StaticQubitsWithOps",
628+
MQT_NAMED_BUILDER(qc::staticQubitsWithOps),
629+
MQT_NAMED_BUILDER(qir::staticQubitsWithOps)},
630630
QCToQIRTestCase{"AllocDeallocPair",
631631
MQT_NAMED_BUILDER(qc::allocDeallocPair),
632632
MQT_NAMED_BUILDER(qir::emptyQIR)}));

mlir/unittests/Dialect/QC/IR/test_qc_ir.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,9 @@ INSTANTIATE_TEST_SUITE_P(
899899
MQT_NAMED_BUILDER(emptyQC)},
900900
QCTestCase{"StaticQubits", MQT_NAMED_BUILDER(staticQubits),
901901
MQT_NAMED_BUILDER(emptyQC)},
902-
QCTestCase{"StaticQubitWithOp", MQT_NAMED_BUILDER(staticQubitWithOp),
903-
MQT_NAMED_BUILDER(staticQubitWithOp)},
902+
QCTestCase{"StaticQubitsWithOps",
903+
MQT_NAMED_BUILDER(staticQubitsWithOps),
904+
MQT_NAMED_BUILDER(staticQubitsWithOps)},
904905
QCTestCase{"AllocDeallocPair", MQT_NAMED_BUILDER(allocDeallocPair),
905906
MQT_NAMED_BUILDER(emptyQC)}));
906907
/// @}

mlir/unittests/Dialect/QCO/IR/test_qco_ir.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,8 +1060,9 @@ INSTANTIATE_TEST_SUITE_P(
10601060
MQT_NAMED_BUILDER(emptyQCO)},
10611061
QCOTestCase{"StaticQubits", MQT_NAMED_BUILDER(staticQubits),
10621062
MQT_NAMED_BUILDER(emptyQCO)},
1063-
QCOTestCase{"StaticQubitWithOp", MQT_NAMED_BUILDER(staticQubitWithOp),
1064-
MQT_NAMED_BUILDER(staticQubitWithOp)},
1063+
QCOTestCase{"StaticQubitsWithOps",
1064+
MQT_NAMED_BUILDER(staticQubitsWithOps),
1065+
MQT_NAMED_BUILDER(staticQubitsWithOps)},
10651066
QCOTestCase{"AllocDeallocPair", MQT_NAMED_BUILDER(allocDeallocPair),
10661067
MQT_NAMED_BUILDER(emptyQCO)}));
10671068
/// @}

mlir/unittests/Dialect/QIR/IR/test_qir_ir.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -522,18 +522,20 @@ INSTANTIATE_TEST_SUITE_P(
522522
/// @{
523523
INSTANTIATE_TEST_SUITE_P(
524524
QIRQubitManagementTest, QIRTest,
525-
testing::Values(
526-
QIRTestCase{"AllocQubit", MQT_NAMED_BUILDER(allocQubit),
527-
MQT_NAMED_BUILDER(allocQubit)},
528-
QIRTestCase{"AllocQubitRegister", MQT_NAMED_BUILDER(allocQubitRegister),
529-
MQT_NAMED_BUILDER(allocQubitRegister)},
530-
QIRTestCase{"AllocMultipleQubitRegisters",
531-
MQT_NAMED_BUILDER(allocMultipleQubitRegisters),
532-
MQT_NAMED_BUILDER(allocMultipleQubitRegisters)},
533-
QIRTestCase{"AllocLargeRegister", MQT_NAMED_BUILDER(allocLargeRegister),
534-
MQT_NAMED_BUILDER(allocLargeRegister)},
535-
QIRTestCase{"StaticQubits", MQT_NAMED_BUILDER(staticQubits),
536-
MQT_NAMED_BUILDER(staticQubits)},
537-
QIRTestCase{"StaticQubitWithOp", MQT_NAMED_BUILDER(staticQubitWithOp),
538-
MQT_NAMED_BUILDER(staticQubitWithOp)}));
525+
testing::Values(QIRTestCase{"AllocQubit", MQT_NAMED_BUILDER(allocQubit),
526+
MQT_NAMED_BUILDER(allocQubit)},
527+
QIRTestCase{"AllocQubitRegister",
528+
MQT_NAMED_BUILDER(allocQubitRegister),
529+
MQT_NAMED_BUILDER(allocQubitRegister)},
530+
QIRTestCase{"AllocMultipleQubitRegisters",
531+
MQT_NAMED_BUILDER(allocMultipleQubitRegisters),
532+
MQT_NAMED_BUILDER(allocMultipleQubitRegisters)},
533+
QIRTestCase{"AllocLargeRegister",
534+
MQT_NAMED_BUILDER(allocLargeRegister),
535+
MQT_NAMED_BUILDER(allocLargeRegister)},
536+
QIRTestCase{"StaticQubits", MQT_NAMED_BUILDER(staticQubits),
537+
MQT_NAMED_BUILDER(staticQubits)},
538+
QIRTestCase{"StaticQubitsWithOps",
539+
MQT_NAMED_BUILDER(staticQubitsWithOps),
540+
MQT_NAMED_BUILDER(staticQubitsWithOps)}));
539541
/// @}

mlir/unittests/programs/qc_programs.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ void staticQubits(QCProgramBuilder& b) {
3434
b.staticQubit(1);
3535
}
3636

37-
void staticQubitWithOp(QCProgramBuilder& b) {
38-
auto q = b.staticQubit(0);
39-
b.h(q);
37+
void staticQubitsWithOps(QCProgramBuilder& b) {
38+
auto q0 = b.staticQubit(0);
39+
auto q1 = b.staticQubit(1);
40+
b.h(q0);
41+
b.h(q1);
4042
}
4143

4244
void allocDeallocPair(QCProgramBuilder& b) {

mlir/unittests/programs/qc_programs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ void allocLargeRegister(QCProgramBuilder& b);
3333
/// Allocates two inline qubits.
3434
void staticQubits(QCProgramBuilder& b);
3535

36-
/// Allocates a static qubit and applies an operation.
37-
void staticQubitWithOp(QCProgramBuilder& b);
36+
/// Allocates two static qubits and applies operations.
37+
void staticQubitsWithOps(QCProgramBuilder& b);
3838

3939
/// Allocates and explicitly deallocates a single qubit.
4040
void allocDeallocPair(QCProgramBuilder& b);

mlir/unittests/programs/qco_programs.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ void staticQubits(QCOProgramBuilder& b) {
3838
b.staticQubit(1);
3939
}
4040

41-
void staticQubitWithOp(QCOProgramBuilder& b) {
42-
auto q = b.staticQubit(0);
43-
b.h(q);
41+
void staticQubitsWithOps(QCOProgramBuilder& b) {
42+
auto q0 = b.staticQubit(0);
43+
auto q1 = b.staticQubit(1);
44+
q0 = b.h(q0);
45+
q1 = b.h(q1);
4446
}
4547

4648
void allocDeallocPair(QCOProgramBuilder& b) {

0 commit comments

Comments
 (0)