class QPanda::JsonConfigParam

Overview

json configuration parameter More…

#include <JsonConfigParam.h>

class JsonConfigParam
{
public:
    // methods

    bool load_config(const std::string config_data = CONFIG_PATH);
    rapidjson::Document& get_root_element();

    bool getMetadataConfig(
        int& qubit_num,
        std::vector<std::vector<double>>& qubit_matrix
        );

    bool getClassNameConfig(std::map<std::string, std::string>& class_names);
    bool getQuantumCloudConfig(std::map<std::string, std::string>& cloud_config);

    bool getQGateConfig(
        std::vector<std::string>& single_gates,
        std::vector<std::string>& double_gates
        );

    bool getQGateTimeConfig(std::map<GateType, size_t>& gate_time);
    bool getInstructionConfig(std::map<std::string, std::map<std::string, uint32_t>>&);

    static bool readAdjacentMatrix(
        const rapidjson::Value& AdjacentMatrixElement,
        int& qubit_num,
        std::vector<std::vector<double>>& qubit_matrix
        );

    static bool loadQuantumTopoStructure(
        const std::string& xmlStr,
        const std::string& dataElementStr,
        int& qubitsCnt,
        std::vector<std::vector<double>>& vec,
        const std::string configFile = ""
        );
};

Detailed Documentation

json configuration parameter

Methods

bool load_config(const std::string config_data = CONFIG_PATH)

Load config data.

Parameters:

const

std::string It can be configuration file or configuration data, which can be distinguished by file suffix, so the configuration file must be end with “.json”, default is CONFIG_PATH

Returns:

Return false if any error occurs, otherwise return true

static bool readAdjacentMatrix(
    const rapidjson::Value& AdjacentMatrixElement,
    int& qubit_num,
    std::vector<std::vector<double>>& qubit_matrix
    )

read topological structure from json config file

Parameters:

const

rapidjson::Value& json value

int&

qubit number

std::vector<std::vector<int>>

qubit matrix

Returns:

bool

static bool loadQuantumTopoStructure(
    const std::string& xmlStr,
    const std::string& dataElementStr,
    int& qubitsCnt,
    std::vector<std::vector<double>>& vec,
    const std::string configFile = ""
    )

load quantum circuit topological structure