forked from NVIDIA/cudaqx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bravyi-Kitaev implementation (NVIDIA#35)
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
Showing
8 changed files
with
1,250 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
libs/solvers/include/cudaq/solvers/operators/molecule/fermion_compilers/bravyi_kitaev.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.