Skip to content

Commit

Permalink
fix cpp format
Browse files Browse the repository at this point in the history
Signed-off-by: Melody Ren <[email protected]>
  • Loading branch information
melody-ren committed Dec 5, 2024
1 parent 75fa658 commit d6266ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace cudaq::solvers {
class jordan_wigner : public fermion_compiler {
public:
cudaq::spin_op generate(const double constant, const cudaqx::tensor<> &hpq,
const cudaqx::tensor<> &hpqrs,
const cudaqx::tensor<> &hpqrs,
const double tolerance = 1e-15) override;

CUDAQ_EXTENSION_CREATOR_FUNCTION(fermion_compiler, jordan_wigner)
Expand Down
16 changes: 10 additions & 6 deletions libs/solvers/python/bindings/solvers/py_solvers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ void bindOperators(py::module &mod) {

mod.def(
"jordan_wigner",
[](py::buffer hpq, py::buffer hpqrs, double core_energy = 0.0, double tolerance = 1e-15) {
[](py::buffer hpq, py::buffer hpqrs, double core_energy = 0.0,
double tolerance = 1e-15) {
auto hpqInfo = hpq.request();
auto hpqrsInfo = hpqrs.request();
auto *hpqData = reinterpret_cast<std::complex<double> *>(hpqInfo.ptr);
Expand All @@ -218,7 +219,8 @@ void bindOperators(py::module &mod) {
return fermion_compiler::get("jordan_wigner")
->generate(core_energy, hpqT, hpqrsT, tolerance);
},
py::arg("hpq"), py::arg("hpqrs"), py::arg("core_energy") = 0.0, py::arg("tolerance") = 1e-15,
py::arg("hpq"), py::arg("hpqrs"), py::arg("core_energy") = 0.0,
py::arg("tolerance") = 1e-15,
R"#(
Perform the Jordan-Wigner transformation on fermionic operators.
Expand All @@ -236,7 +238,7 @@ hpqrs : numpy.ndarray
core_energy : float, optional
The core energy of the system when using active space Hamiltonian, nuclear energy otherwise. Default is 0.0.
tolerance : float, optional
The threshold value for ignoring small coefficients in the one-body integrals.
The threshold value for ignoring small coefficients.
Coefficients with absolute values smaller than this tolerance are considered as zero.
Default is 1e-15.
Expand Down Expand Up @@ -271,7 +273,8 @@ RuntimeError

mod.def(
"jordan_wigner",
[](py::buffer buffer, double core_energy = 0.0, double tolerance = 1e-15) {
[](py::buffer buffer, double core_energy = 0.0,
double tolerance = 1e-15) {
auto info = buffer.request();
auto *data = reinterpret_cast<std::complex<double> *>(info.ptr);
std::size_t size = 1;
Expand All @@ -292,7 +295,8 @@ RuntimeError
return fermion_compiler::get("jordan_wigner")
->generate(core_energy, hpq, hpqrs, tolerance);
},
py::arg("hpq"), py::arg("core_energy") = 0.0, py::arg("tolerance") = 1e-15,
py::arg("hpq"), py::arg("core_energy") = 0.0,
py::arg("tolerance") = 1e-15,
R"#(
Perform the Jordan-Wigner transformation on fermionic operators.
Expand All @@ -309,7 +313,7 @@ hpq : numpy.ndarray
core_energy : float, optional
The core energy of the system. Default is 0.0.
tolerance : float, optional
The threshold value for ignoring small coefficients in the one-body integrals.
The threshold value for ignoring small coefficients.
Coefficients with absolute values smaller than this tolerance are considered as zero.
Default is 1e-15.
Expand Down

0 comments on commit d6266ce

Please sign in to comment.