# Path: openfermioncirq/experiments/hfvqe/objective.py
# def get_matrix_of_eigs(w: np.ndarray) -> np.ndarray:
#     def __init__(self, hamiltonian: InteractionOperator, num_electrons: int):
#     def rdms_from_opdm_aa(self, opdm_aa):
#     def energy_from_opdm(self, opdm_aa: np.ndarray) -> float:
#     def global_gradient_opdm(self, params: np.ndarray,
#                               alpha_opdm: np.ndarray):
# def generate_hamiltonian(one_body_integrals: np.ndarray,
#                          two_body_integrals: np.ndarray,
#                          constant: float,
#                          EQ_TOLERANCE: Optional[float]=1.0E-12):
# class RestrictedHartreeFockObjective():
#             Y = rhf_params_to_matrix(grad_params,
#                                      len(self.occ) + len(self.virt),
#                                      self.occ, self.virt)


from typing import List, Optional
from openfermioncirq.experiments.hfvqe.objective import rhf_params_to_matrix
import cirq
import numpy as np
import scipy as sp
import openfermioncirq.experiments.hfvqe.circuits as ccc
import openfermioncirq.experiments.hfvqe.analysis as cca
import openfermioncirq.experiments.hfvqe.util as ccu


class RDMGenerator():  # testpragma: no cover
    def __init__(self, blackbox, purification: Optional[bool]=True):
        self.blackbox = blackbox
        self.noisy_opdms = []
        self.variance_dicts = []
        self.purification = purification

    def opdm_generator(self, parameters):
        opdm, var_dict = self.blackbox.calculate_rdm(parameters)
        self.noisy_opdms.append(opdm)
        self.variance_dicts.append(var_dict)
        if self.purification:

# Path: openfermioncirq/experiments/hfvqe/objective.py
# def get_matrix_of_eigs(w: np.ndarray) -> np.ndarray:
#     def __init__(self, hamiltonian: InteractionOperator, num_electrons: int):
#     def rdms_from_opdm_aa(self, opdm_aa):
#     def energy_from_opdm(self, opdm_aa: np.ndarray) -> float:
#     def global_gradient_opdm(self, params: np.ndarray,
#                               alpha_opdm: np.ndarray):
# def generate_hamiltonian(one_body_integrals: np.ndarray,
#                          two_body_integrals: np.ndarray,
#                          constant: float,
#                          EQ_TOLERANCE: Optional[float]=1.0E-12):
# class RestrictedHartreeFockObjective():
#             Y = rhf_params_to_matrix(grad_params,
#                                      len(self.occ) + len(self.virt),
#                                      self.occ, self.virt)


# Path: openfermioncirq/experiments/hfvqe/opdm_functionals.py
from typing import List, Optional
from openfermioncirq.experiments.hfvqe.objective import rhf_params_to_matrix
import cirq
import numpy as np
import scipy as sp
import openfermioncirq.experiments.hfvqe.circuits as ccc
import openfermioncirq.experiments.hfvqe.analysis as cca
import openfermioncirq.experiments.hfvqe.util as ccu



class RDMGenerator():  # testpragma: no cover
    def __init__(self, blackbox, purification: Optional[bool]=True):
        self.blackbox = blackbox
        self.noisy_opdms = []
        self.variance_dicts = []
        self.purification = purification

    def opdm_generator(self, parameters):
        opdm, var_dict = self.blackbox.calculate_rdm(parameters)
        self.noisy_opdms.append(opdm)
        self.variance_dicts.append(var_dict)
        if self.purification:

            opdm = cca.mcweeny_purification(opdm)