Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Pisal <[email protected]>
  • Loading branch information
sacpis committed Jan 15, 2025
1 parent b2e5e1d commit aa08e21
Showing 1 changed file with 52 additions and 17 deletions.
69 changes: 52 additions & 17 deletions runtime/cudaq/evolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

#pragma once

#include "common/EvolveResult.h"
#include "cudaq/base_integrator.h"
#include "cudaq/operators.h"
#include "cudaq/schedule.h"
#include "cudaq/base_integrator.h"
#include "common/EvolveResult.h"

#include <Eigen/Dense>
#include <map>
Expand All @@ -22,25 +22,60 @@
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 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>> &parameters, double dt, bool use_gpu = false);
/// 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>> &parameters, 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>> &parameters, double dt);
/// 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>> &parameters, 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);
/// 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);
/// 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 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);
/// 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);
};
}
} // namespace cudaq

0 comments on commit aa08e21

Please sign in to comment.