-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sachin Pisal <[email protected]>
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
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,46 @@ | ||
/****************************************************************-*- C++ -*-**** | ||
* Copyright (c) 2022 - 2025 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/operators.h" | ||
#include "cudaq/schedule.h" | ||
#include "cudaq/base_integrator.h" | ||
#include "common/EvolveResult.h" | ||
|
||
#include <Eigen/Dense> | ||
#include <map> | ||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace cudaq { | ||
class Evolution { | ||
public: | ||
/// Computes the Taylor series expansion of the matrix exponential. | ||
static Eigen::MatrixXcd taylor_series_expm(const Eigen::MatrixXcd &op_matrix, int order = 20); | ||
|
||
/// Computes the evolution step matrix | ||
static Eigen::MatrixXcd compute_step_matrix(const operator_sum &hamiltonian, const std::map<int, int> &dimensions, const std::map<std::string, std::complex<double>> ¶meters, double dt, bool use_gpu = false); | ||
|
||
/// Adds noise channels based on collapse operators. | ||
static void add_noise_channel_for_step(const std::string &step_kernel_name, cudaq::noise_model &noise_model, const std::vector<operator_sum> &collapse_operators, const std::map<int, int> &dimensions, const std::map<std::string, std::complex<double>> ¶meters, double dt); | ||
|
||
/// Launches an analog Hamiltonian kernel for quantum simulations. | ||
static evolve_result launch_analog_hamiltonian_kernel(const std::string &target_name, const operator_sum &hamiltonian, const std::shared_ptr<Schedule> &schedule, int shots_count, bool is_async = false); | ||
|
||
/// Generates evolution kernels for the simulation. | ||
static std::vector<std::string> evolution_kernel(int num_qubits, const std::function<Eigen::MatrixXcd(const std::map<std::string, std::complex<double>> &, double)> &compute_step_matrix, const std::vector<double> tlist, const std::vector<std::map<std::string, std::complex<double>>> &schedule_parameters); | ||
|
||
/// Evolves a single quantum state under a given hamiltonian. | ||
static evolve_result evolve_single(const operator_sum &hamiltonian, const std::map<int, int> &dimensions, const std::shared_ptr<Schedule> &schedule, state initial_state, const std::vector<operator_sum> &collapse_operators = {}, const std::vector<operator_sum> &observables = {}, bool store_intermediate_results = false, std::shared_ptr<BaseIntegrator<state>> integrator = nullptr, std::optional<int> shots_count = std::nullopt); | ||
|
||
/// Evolves a single or multiple quantum states under a given hamiltonian. | ||
static std::vector<evolve_result> evolve(const operator_sum &hamiltonian, const std::map<int, int> &dimensions, const std::shared_ptr<Schedule> &schedule, const std::vector<state> &initial_states, const std::vector<operator_sum> &collapse_operators = {}, const std::vector<operator_sum> &observables = {}, bool store_intermediate_results = false, std::shared_ptr<BaseIntegrator<state>> integrator = nullptr, std::optional<int> shots_count = std::nullopt); | ||
}; | ||
} |