• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 14618237876

23 Apr 2025 12:33PM UTC coverage: 87.925% (-0.3%) from 88.192%
14618237876

push

github

web-flow
Add initial C API for circuit construction (#14006)

* Add initial C API for circuit construction

Building off the infrastructure for the sparse observable added in
PR #13445 this commit adds a C FFI for building Quantum Circuits. Right
now there is a function to create an empty circuit with n qubits and m
clbits and then a function to add standard gates to a circuit and then
also get the op counts out of a circuit. This is a start of the
functionality for a C API around interacting with circuits, later PRs
will expand this so we can have a more fully featured C API in the
future.

Part of #13276

* Add functions for standard instructions (except delay)

* Apply suggestions from code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Rename qk_circuit_free_count_ops() to qk_opcounts_free()

This also updates the test logic to make sure we always free even in
case of a failure.

* Add release note

* Add function to get instruction details

* Rename QkStandardGate -> QkGate

* Apply suggestions from code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Add safety comments

* Add methods to lookup num qubits and num params for gates

* Update docs around null pointers for qubits and params on gate append function

* Fix clang-format-14 error

Locally I was using clang-format-19 while in CI we run with
clang-format-14. Version 14 was flagging this difference while version
19 was happy. This commit makes the change to make version 14 happy in
CI.

* Add missing if to docstrings

* Fix merge

* Fix macOS tests

* Fix cformat

* Update test/c/CMakeLists.txt

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Try static lib for common

* Fix windows build warnings

* Try adding the parent path to the path on windows

* Use const pointers for strings in structs

* Improve docstrings for C API

* Improve equality check failures in sanity check tests

* Fix rustfmt

* Simplify cmake config for tests

* Apply naming suggestions

---------

... (continued)

14 of 267 new or added lines in 5 files covered. (5.24%)

28 existing lines in 2 files now uncovered.

74222 of 84415 relevant lines covered (87.93%)

435922.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/crates/cext/src/pointers.rs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc