Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ build/*

# others
.DS_Store
.cache/
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ if(MSVC)
set(BUILD_SHARED_LIBS TRUE)
set(CMAKE_CXX_FLAGS "/std:c++17 ${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-fPIC -std=c++17 ${CMAKE_CXX_FLAGS}")
if(APPLE)
# Add macOS SDK paths for standard library headers
execute_process(COMMAND xcrun --show-sdk-path OUTPUT_VARIABLE MACOS_SDK_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isysroot ${MACOS_SDK_PATH}")
include_directories(SYSTEM ${MACOS_SDK_PATH}/usr/include/c++/v1)
endif()
endif()

# if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
Expand Down
2 changes: 1 addition & 1 deletion src/test/test_apply_xfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,5 @@ int main() {
}
}

best_graph->to_qasm("test.qasm", false, false);
best_graph->to_qasm(std::string("test.qasm"), false, false);
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The std::string() wrapper is unnecessary since to_qasm accepts const std::string& which allows implicit conversion from string literals. This is inconsistent with similar calls in other test files. Consider using the literal directly: best_graph->to_qasm("test.qasm", false, false);

Suggested change
best_graph->to_qasm(std::string("test.qasm"), false, false);
best_graph->to_qasm("test.qasm", false, false);

Copilot uses AI. Check for mistakes.
}
2 changes: 1 addition & 1 deletion src/test/test_from_and_to_qasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ int main() {
// GateType::rxx3});
auto graph =
Graph::from_qasm_file(&ctx, "../experiment/nam_rm_circs/gf2^6_mult.qasm");
graph->to_qasm("test.qasm", false, false);
graph->to_qasm(std::string("test.qasm"), false, false);
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The std::string() wrapper is unnecessary since to_qasm accepts const std::string& which allows implicit conversion from string literals. This is inconsistent with other test files like test_rotation_merging.cpp and test_toffoli_flip.cpp where variables of type std::string are passed directly. Consider using the literal directly: graph->to_qasm("test.qasm", false, false);

Suggested change
graph->to_qasm(std::string("test.qasm"), false, false);
graph->to_qasm("test.qasm", false, false);

Copilot uses AI. Check for mistakes.
}
2 changes: 1 addition & 1 deletion src/test/test_graph_to_qasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ int main() {
}

Graph graph(&ctx, dag);
graph.to_qasm("temp.qasm", /*print_result=*/true, true);
graph.to_qasm(std::string("temp.qasm"), /*print_result=*/true, true);
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The std::string() wrapper on line 20 is inconsistent with line 21 where draw_circuit (which also accepts const std::string& parameters) is called with string literals directly. Since to_qasm accepts const std::string&, the explicit wrapper is unnecessary - string literals implicitly convert to std::string. Consider removing the wrapper for consistency: graph.to_qasm("temp.qasm", /*print_result=*/true, true);

Suggested change
graph.to_qasm(std::string("temp.qasm"), /*print_result=*/true, true);
graph.to_qasm("temp.qasm", /*print_result=*/true, true);

Copilot uses AI. Check for mistakes.
graph.draw_circuit("temp.qasm", "temp.png");
}
3 changes: 2 additions & 1 deletion src/test/test_rigetti_td_disabled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ int main(int argc, char **argv) {
&union_ctx_0, eqs_h_cz, fn, /*print_message=*/
true);
graph_after_h_cz_merge->to_qasm(
"circuit/voqc-benchmarks/after_h_cz_merge.qasm", false, false);
std::string("circuit/voqc-benchmarks/after_h_cz_merge.qasm"), false,
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The std::string() wrapper is inconsistent with line 114 in the same file where to_qasm(output_fn, false, false) is called without wrapping. Since the function signature is void to_qasm(const std::string &save_filename, bool print_result, bool print_guid), string literals implicitly convert to const std::string&. Consider removing the wrapper for consistency: graph_after_h_cz_merge->to_qasm("circuit/voqc-benchmarks/after_h_cz_merge.qasm", false, false);

Suggested change
std::string("circuit/voqc-benchmarks/after_h_cz_merge.qasm"), false,
"circuit/voqc-benchmarks/after_h_cz_merge.qasm", false,

Copilot uses AI. Check for mistakes.
false);

// Shift the context to Rigetti Agave
RuleParser rules({"h q0 = rx q0 pi; rz q0 0.5pi; rx q0 0.5pi; rz q0 -0.5pi;",
Expand Down
Loading