Skip to content

Commit

Permalink
Bravyi-Kitaev implementation (NVIDIA#35)
Browse files Browse the repository at this point in the history
This is the implementation of the Bravyi-Kitaev fermionic transformation. The was largely a translation from the OpenFermion BK python implementation into C++:

https://github.com/quantumlib/OpenFermion/blob/master/src/openfermion/transforms/opconversions/bravyi_kitaev.py
  • Loading branch information
wsttiger authored Dec 19, 2024
1 parent bd893b8 commit 5503237
Show file tree
Hide file tree
Showing 8 changed files with 1,250 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright (c) 2024 NVIDIA Corporation & Affiliates. *
* All rights reserved. *
* *
* This source code and the accompanying materials are made available under *
* the terms of the Apache License 2.0 which accompanies this distribution. *
******************************************************************************/
#pragma once

#include "cudaq/solvers/operators/molecule/fermion_compiler.h"

namespace cudaq::solvers {

/// @brief Helper function used by the Bravyi-Kitaev transformation.
cudaq::spin_op seeley_richard_love(std::size_t i, std::size_t j,
std::complex<double> coef, int n_qubits);

/// @brief Map fermionic operators to spin operators via the
/// Bravyi-Kitaev transformation.
class bravyi_kitaev : public fermion_compiler {
public:
cudaq::spin_op generate(const double constant, const cudaqx::tensor<> &hpq,
const cudaqx::tensor<> &hpqrs,
const cudaqx::heterogeneous_map &options) override;

CUDAQ_EXTENSION_CREATOR_FUNCTION(fermion_compiler, bravyi_kitaev)
};
CUDAQ_REGISTER_TYPE(bravyi_kitaev)
} // namespace cudaq::solvers
1 change: 1 addition & 0 deletions libs/solvers/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ add_library(cudaq-solvers SHARED
operators/molecule/drivers/pyscf_driver.cpp
operators/molecule/fermion_compilers/fermion_compiler.cpp
operators/molecule/fermion_compilers/jordan_wigner.cpp
operators/molecule/fermion_compilers/bravyi_kitaev.cpp
operators/molecule/molecule.cpp
operators/graph/max_cut.cpp
operators/graph/clique.cpp
Expand Down
Loading

0 comments on commit 5503237

Please sign in to comment.