Skip to content
Merged
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
31 changes: 28 additions & 3 deletions crates/cext-vtable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ mod circuit {
#[cfg(feature = "addr")]
use qiskit_cext::circuit::*;

#[rustfmt::skip] // Don't wrap long lines so everything stays on one line for counting.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This skips all rustfmt rules for the annotated scope right? I couldn't find a way to just set a custom line length so I guess this is fine. Hopefully the formatting doesn't get too wonky.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah - some of the register lines are too long right now, but no so long that rustfmt gives up on its own (like some of the transpiler-pass lines)

pub static FUNCTIONS: ExportedFunctions = ExportedFunctions::leaves(100, || {
vec![
export_fn!(qk_circuit_new),
Expand Down Expand Up @@ -78,10 +79,21 @@ mod circuit {
export_fn!(qk_circuit_get_instruction),
export_fn!(qk_circuit_instruction_clear),
export_fn!(qk_opcounts_clear),
export_fn!(qk_circuit_to_python, feature = "python_binding"),
export_fn!(qk_circuit_delay),
export_fn!(qk_circuit_to_dag),
export_fn!(qk_circuit_copy_empty_like),
export_fn!(qk_circuit_num_param_symbols),
export_fn!(qk_circuit_parameterized_gate),
export_fn!(qk_circuit_to_python, feature = "python_binding"),
export_fn!(qk_circuit_to_python_full, feature = "python_binding"),
export_fn!(qk_circuit_borrow_from_python, feature = "python_binding"),
export_fn!(qk_circuit_convert_from_python, feature = "python_binding"),
export_fn!(qk_quantum_register_to_python, feature = "python_binding"),
export_fn!(qk_quantum_register_borrow_from_python, feature = "python_binding"),
export_fn!(qk_quantum_register_convert_from_python, feature = "python_binding"),
export_fn!(qk_classical_register_to_python, feature = "python_binding"),
export_fn!(qk_classical_register_borrow_from_python, feature = "python_binding"),
export_fn!(qk_classical_register_convert_from_python, feature = "python_binding"),
export_fn!(qk_circuit_draw),
]
});
Expand Down Expand Up @@ -229,6 +241,8 @@ mod sparse_observable {
export_fn!(qk_obsterm_str),
export_fn!(qk_bitterm_label),
export_fn!(qk_obs_to_python, feature = "python_binding"),
export_fn!(qk_obs_borrow_from_python, feature = "python_binding"),
export_fn!(qk_obs_convert_from_python, feature = "python_binding"),
]
});
}
Expand Down Expand Up @@ -268,6 +282,14 @@ mod transpiler {
export_fn!(qk_transpile_layout_to_python, feature = "python_binding"),
]
});
pub static TRANSPILE_STATE: ExportedFunctions = ExportedFunctions::leaves(15, || {
vec![
export_fn!(qk_transpile_state_new),
export_fn!(qk_transpile_state_free),
export_fn!(qk_transpile_state_layout),
export_fn!(qk_transpile_state_layout_set),
]
});

mod target {
use crate::impl_::prelude::*;
Expand Down Expand Up @@ -357,6 +379,8 @@ mod transpiler {
export_fn!(unitary_synthesis::qk_transpiler_pass_standalone_unitary_synthesis),
export_fn!(vf2::qk_transpiler_pass_standalone_vf2_layout_average),
export_fn!(vf2::qk_transpiler_pass_standalone_vf2_layout_exact),
export_fn!(convert_to_pauli_rotations::qk_transpiler_pass_standalone_convert_to_pauli_rotations),
export_fn!(litinski_transformation::qk_transpiler_pass_standalone_litinski_transformation),
]
});
static FUNCTIONS_SABRE: ExportedFunctions = ExportedFunctions::leaves(5, || {
Expand Down Expand Up @@ -389,6 +413,7 @@ mod transpiler {
.add_child(0, &TRANSPILE_FUNCTION)
.add_child(20, &NEIGHBORS)
.add_child(35, &TRANSPILE_LAYOUT)
.add_child(50, &target::FUNCTIONS)
.add_child(150, &passes::FUNCTIONS);
.add_child(50, &TRANSPILE_STATE)
.add_child(150, &target::FUNCTIONS)
.add_child(250, &passes::FUNCTIONS);
}