.. _global: .. index:: pair: namespace; global Global Namespace ================ .. toctree:: :hidden: namespace_Base64.rst namespace_Eigen.rst namespace_GATEGPU.rst namespace_QGATE_SPACE.rst namespace_QPanda.rst namespace_gpu.rst namespace_std.rst enum_ComputeBackend.rst enum_GateType.rst enum_MetadataGateType.rst enum_NOISE_MODEL.rst enum_NodeType.rst enum_OperatorType.rst enum_Operatortype.rst enum_QError.rst struct_Complex.rst struct_QGateParam.rst struct_QubitVertice.rst class_AbstractComplexTensor.rst class_CPUComplexTensor.rst class_CPUImplQPUSingleThread.rst class_CPUImplQPUSingleThreadWithOracle.rst class_CPUImplQPUWithOracle.rst class_ComplexTensor.rst class_Edge.rst class_Instructions.rst class_MPS_Tensor.rst class_MeasureQVMType.rst class_NoisyQuantum.rst class_QProgMap.rst class_QuantumError.rst class_QuickBB.rst class_RandomEngine19937.rst class_TensorEngine.rst class_Vertice.rst class_VerticeMatrix.rst class_originirBaseVisitor.rst class_originirLexer.rst class_originirListener.rst class_originirParser.rst class_originirVisitor.rst class_qasmBaseVisitor.rst class_qasmLexer.rst class_qasmListener.rst class_qasmParser.rst class_qasmVisitor.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block // namespaces namespace :ref:`Base64`; namespace :ref:`Eigen`; namespace :ref:`GATEGPU`; namespace :ref:`QGATE_SPACE`; namespace :ref:`QPanda`; namespace :ref:`QPanda::DRAW_TEXT_PIC`; namespace :ref:`QPanda::Variational`; namespace :ref:`gpu`; namespace :ref:`std`; // typedefs typedef std::map> :target:`config_map`; typedef double :target:`qstate_type`; typedef std::complex<:ref:`qstate_type`> :target:`qcomplex_t`; typedef std::vector<:ref:`qcomplex_t`> :target:`QStat`; typedef std::vector :target:`Qnum`; typedef std::vector :target:`prob_vec`; typedef std::unordered_map`> :target:`prob_map`; typedef std::unordered_map`> :target:`stat_map`; typedef std::map :target:`prob_dict`; typedef std::vector> :target:`prob_tuple`; typedef std::shared_ptr<:ref:`QPanda::QNode`> :target:`QNodeRef`; typedef wide_integer::generic_template::uint128_t :target:`uint128_t`; typedef wide_integer::generic_template::uint256_t :target:`uint256_t`; typedef wide_integer::generic_template::uint512_t :target:`uint512_t`; typedef size_t :target:`gpu_qsize_t`; typedef float :target:`gpu_qstate_t`; typedef std::complex<:ref:`gpu_qstate_t`> :target:`gpu_qcomplex_t`; typedef std::pair :target:`gpu_pair`; typedef std::vector<:ref:`gpu_pair`> :target:`touple_prob`; typedef std::vector :target:`vec_prob`; typedef std::vector<:ref:`gpu_qsize_t`> :target:`Qnum`; typedef Eigen::Matrix<:ref:`qstate_type`, Eigen::Dynamic, 1> :target:`rvector_t`; typedef Eigen::Matrix<:ref:`qcomplex_t`, Eigen::Dynamic, 1> :target:`cvector_t`; typedef Eigen::Matrix<:ref:`qcomplex_t`, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> :target:`cmatrix_t`; typedef std::vector<:ref:`QStat`> :target:`NoiseOp`; typedef bool (*:target:`noise_mode_function`)( rapidjson::Value &, NoiseOp & ); typedef std::vector<:ref:`QGateParam`> :target:`vQParam`; typedef size_t :target:`vertex_index_t`; typedef std::vector<:ref:`vertex_index_t`> :target:`adj_arr_t`; typedef std::map<:ref:`vertex_index_t`, :ref:`adj_arr_t`> :target:`graph_data_t`; typedef float :target:`qdata_t`; typedef size_t :target:`qsize_t`; typedef std::complex<:ref:`qdata_t`> :target:`qcomplex_data_t`; typedef std::vector<:ref:`qcomplex_data_t`> :target:`qstate_t`; typedef std::vector> :target:`qprog_sequence_t`; typedef std::vector`, :ref:`qsize_t`>> :target:`qubit_vector_t`; typedef std::map`> :target:`edge_map_t`; typedef std::map<:ref:`qsize_t`, :ref:`Vertice`> :target:`vertice_map_t`; typedef std::vector<:ref:`vertice_map_t`> :target:`vertice_matrix_t`; typedef struct :ref:`QubitVertice` :target:`qubit_vertice_t`; // enums enum :ref:`ComputeBackend`; enum :ref:`GateType`; enum :ref:`MetadataGateType`; enum :ref:`NOISE_MODEL`; enum :ref:`NodeType`; enum :ref:`OperatorType`; enum :ref:`Operatortype`; enum :ref:`QError`; // structs struct :ref:`Complex`; struct :ref:`QGateParam`; struct :ref:`QubitVertice`; // classes class :ref:`AbstractComplexTensor`; class :ref:`AbstractDistributedFullAmplitudeEngine`; class :ref:`AbstractQuantumGates`; class :ref:`CPUComplexTensor`; class :ref:`CPUImplQPU`; class :ref:`CPUImplQPUSingleThread`; class :ref:`CPUImplQPUSingleThreadWithOracle`; class :ref:`CPUImplQPUWithOracle`; class :ref:`ComplexTensor`; class :ref:`DefaultRandomEngine`; class :ref:`DeleteUnitQnode`; class :ref:`DistributedFullAmplitudeEngine`; class :ref:`DoubleGateNoiseModeMap`; class :ref:`Edge`; class :ref:`Instructions`; class :ref:`MPS_Tensor`; class :ref:`MeasureQVMType`; class :ref:`NoisyCPUImplQPU`; class :ref:`NoisyQuantum`; class :ref:`QPUImpl`; class :ref:`QProgMap`; class :ref:`QuantumError`; class :ref:`QuickBB`; class :ref:`RandomEngine`; class :ref:`RandomEngine19937`; class :ref:`ReadLock`; class :ref:`SharedMutex`; class :ref:`SingleGateNoiseModeMap`; class :ref:`TensorEngine`; class :ref:`Vertice`; class :ref:`VerticeMatrix`; class :ref:`WriteLock`; class :ref:`XC_RandomEngine16807`; class :ref:`originirBaseVisitor`; class :ref:`originirLexer`; class :ref:`originirListener`; class :ref:`originirParser`; class :ref:`originirVisitor`; class :ref:`qasmBaseVisitor`; class :ref:`qasmLexer`; class :ref:`qasmListener`; class :ref:`qasmParser`; class :ref:`qasmVisitor`; // global variables const :ref:`qstate_type` :ref:`PI` = 3.14159265358979323846; constexpr :ref:`qstate_type` :target:`SQRT2` = 1.4142135623731; const :ref:`gpu_qsize_t` :target:`kThreadDim` = 1024; // global functions uint32_t :target:`LOAD`( uint32_t rs1, uint32_t rd, uint32_t imm ); uint32_t :target:`STORE`( uint32_t rs1, uint32_t rd, uint32_t imm ); uint32_t :target:`BEQ`( uint32_t rs1, uint32_t rs2, uint32_t imm ); uint32_t :target:`BNE`( uint32_t rs1, uint32_t rs2, uint32_t imm ); uint32_t :target:`BLT`( uint32_t rs1, uint32_t rs2, uint32_t imm ); uint32_t :target:`BGT`( uint32_t rs1, uint32_t rs2, uint32_t imm ); uint32_t :target:`ADDI`( uint32_t rs1, uint32_t rd, uint32_t imm ); uint32_t :target:`ANDI`( uint32_t rs1, uint32_t rd, uint32_t imm ); uint32_t :target:`XORI`( uint32_t rs1, uint32_t rd, uint32_t imm ); uint32_t :target:`ORI`( uint32_t rs1, uint32_t rd, uint32_t imm ); uint32_t :target:`ADD`( uint32_t rs1, uint32_t rs2, uint32_t rd ); uint32_t :target:`AND`( uint32_t rs1, uint32_t rs2, uint32_t rd ); uint32_t :target:`XOR`( uint32_t rs1, uint32_t rs2, uint32_t rd ); uint32_t :target:`OR`( uint32_t rs1, uint32_t rs2, uint32_t rd ); uint32_t :target:`QWAITI`(uint32_t imm); uint32_t :target:`FMR`( uint32_t rs1, uint32_t rd ); uint32_t :target:`SMIS`( uint32_t rd, uint32_t imm ); uint32_t :target:`QI`( uint32_t rs1, uint32_t rs2, uint32_t pi, uint32_t opcode1, uint32_t opcode2 ); uint32_t :target:`MEASURE`( uint32_t rs1, uint32_t pi ); std::string :target:`_file_name`(const char* file = ""); template std::string :ref:`integerToBinary`( const UnsignedIntegralType& number, int ret_len ); template std::string :ref:`integerToString`(const UnsignedIntegralType& number); template UnsignedIntegralType :ref:`getDecIndex`( const UnsignedIntegralType& num1, const UnsignedIntegralType& num2, std::vector qvec, size_t len ); :ref:`QStat` :target:`matrix_multiply`( const :ref:`QStat`& matrix_left, const :ref:`QStat`& matrix_right ); :ref:`QStat` :target:`matrix_tensor`( const :ref:`QStat`& matrix_left, const :ref:`QStat`& matrix_right ); bool :target:`equal`( const :ref:`QStat`& lhs, const :ref:`QStat`& rhs ); bool :target:`damping_kraus_operator` ( rapidjson::Value&, :ref:`NoiseOp`& noise ); bool :target:`dephasing_kraus_operator` ( rapidjson::Value&, :ref:`NoiseOp`& noise ); bool :target:`decoherence_kraus_operator` ( rapidjson::Value&, :ref:`NoiseOp`& noise ); bool :target:`double_damping_kraus_operator` ( rapidjson::Value&, :ref:`NoiseOp`& noise ); bool :target:`double_decoherence_kraus_operator` ( rapidjson::Value&, :ref:`NoiseOp`& noise ); bool :target:`pauli_kraus_map`( rapidjson::Value&, :ref:`NoiseOp`& noise ); bool :target:`decoherence_kraus_operator_p1_p2` ( rapidjson::Value& value, :ref:`NoiseOp`& noise ); bool :target:`bitflip_kraus_operator` ( rapidjson::Value& value, :ref:`NoiseOp`& noise ); bool :target:`depolarizing_kraus_operator` ( rapidjson::Value& value, :ref:`NoiseOp`& noise ); bool :ref:`bit_phase_flip_operator` (rapidjson::Value& value, :ref:`NoiseOp`& noise); bool :ref:`phase_damping_oprator`(rapidjson::Value& value, :ref:`NoiseOp`& noise); bool :target:`double_decoherence_kraus_operator_p1_p2` ( rapidjson::Value& value, :ref:`NoiseOp`& noise ); bool :target:`double_bitflip_kraus_operator` ( rapidjson::Value& value, :ref:`NoiseOp`& noise ); bool :target:`double_depolarizing_kraus_operator` ( rapidjson::Value& value, :ref:`NoiseOp`& noise ); bool :ref:`double_bit_phase_flip_operator` (rapidjson::Value& value, :ref:`NoiseOp`& noise); bool :ref:`double_phase_damping_oprator`(rapidjson::Value& value, :ref:`NoiseOp`& noise); bool :target:`kraus_matrix_oprator`( rapidjson::Value& value, :ref:`NoiseOp`& noise ); double :target:`_default_random_generator`(); double :target:`random_generator19937`( double begine = 0, double end = 1 ); void :target:`H_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`T_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`S_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`X_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`Y_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`Z_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`X1_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`Y1_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`Z1_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`RX_Gate`( :ref:`qstate_t`& gate_tensor, double angle, bool isDagger ); void :target:`RY_Gate`( :ref:`qstate_t`& gate_tensor, double angle, bool isDagger ); void :target:`RZ_Gate`( :ref:`qstate_t`& gate_tensor, double angle, bool isDagger ); void :target:`U1_Gate`( :ref:`qstate_t`& gate_tensor, double angle, bool isDagger ); void :target:`U2_Gate`( :ref:`qstate_t`& gate_tensor, double phi, double lambda, bool isDagger ); void :target:`U3_Gate`( :ref:`qstate_t`& gate_tensor, double theta, double phi, double lambda, bool isDagger ); void :target:`U4_Gate`( :ref:`qstate_t`& gate_tensor, double alpha, double beta, double gamma, double delta, bool isDagger ); void :target:`CZ_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`CNOT_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`ISWAP_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`SQISWAP_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`SWAP_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); void :target:`CR_Gate`( :ref:`qstate_t`& gate_tensor, double angle, bool isDagger ); void :target:`TOFFOLI_Gate`( :ref:`qstate_t`& gate_tensor, bool isDagger ); DLLEXPORT :ref:`ChemiQ`* :ref:`initialize`(char* dir); DLLEXPORT void :ref:`finalize`(:ref:`ChemiQ`* chemiq); DLLEXPORT void :ref:`setMolecule`(:ref:`ChemiQ`* chemiq, char* molecule); DLLEXPORT void :ref:`setMolecules`(:ref:`ChemiQ`* chemiq, char* molecules); DLLEXPORT void :ref:`setMultiplicity`(:ref:`ChemiQ`* chemiq, int multiplicity); DLLEXPORT void :ref:`setCharge`(:ref:`ChemiQ`* chemiq, int charge); DLLEXPORT void :ref:`setBasis`(:ref:`ChemiQ`* chemiq, char* basis); DLLEXPORT void :ref:`setEqTolerance`(:ref:`ChemiQ`* chemiq, double val); DLLEXPORT void :ref:`setTransformType`(:ref:`ChemiQ`* chemiq, int type); DLLEXPORT void :ref:`setUccType`(:ref:`ChemiQ`* chemiq, int type); DLLEXPORT void :ref:`setOptimizerType`(:ref:`ChemiQ`* chemiq, int type); DLLEXPORT void :ref:`setOptimizerIterNum`(:ref:`ChemiQ`* chemiq, int value); DLLEXPORT void :ref:`setOptimizerFuncCallNum`(:ref:`ChemiQ`* chemiq, int value); DLLEXPORT void :ref:`setOptimizerXatol`(:ref:`ChemiQ`* chemiq, double value); DLLEXPORT void :ref:`setOptimizerFatol`(:ref:`ChemiQ`* chemiq, double value); DLLEXPORT void :ref:`setLearningRate`(:ref:`ChemiQ`* chemiq, double value); DLLEXPORT void :ref:`setEvolutionTime`(:ref:`ChemiQ`* chemiq, double value); DLLEXPORT void :ref:`setHamiltonianSimulationSlices`(:ref:`ChemiQ`* chemiq, int value); DLLEXPORT void :ref:`setSaveDataDir`(:ref:`ChemiQ`* chemiq, char* dir); DLLEXPORT int :ref:`getQubitsNum`(:ref:`ChemiQ`* chemiq); DLLEXPORT bool :ref:`exec`(:ref:`ChemiQ`* chemiq); const DLLEXPORT char* :ref:`getLastError`(:ref:`ChemiQ`* chemiq); // macros #define :target:`ANGLE_VAR_BASE` #define :target:`COMPENSATE_ANGLE` #define :target:`CONFIG_PATH` #define :target:`CONST_GATE`(NAME) #define :target:`CONTROL_CONST_GATE`(NAME) #define :target:`CONTROL_SINGLE_ANGLE_GATE`(NAME) #define :target:`DECL_ANGLE_GATE_MATRIX`(NAME) #define :target:`DECL_GATE_MATRIX`(NAME) #define :target:`DEFAULT_THREAD_CNT` #define :target:`DOUBLE_GATE_TIME` #define :target:`DoubleGateMatrixSize` #define :target:`GATE_BARRIER` #define :target:`GATE_CNOT` #define :target:`GATE_CPHASE` #define :target:`GATE_CU` #define :target:`GATE_CZ` #define :target:`GATE_ECHO` #define :target:`GATE_H` #define :target:`GATE_I` #define :target:`GATE_ISWAP` #define :target:`GATE_ISWAPTheta` #define :target:`GATE_QDoubleGate` #define :target:`GATE_RPHI` #define :target:`GATE_RX` #define :target:`GATE_RY` #define :target:`GATE_RZ` #define :target:`GATE_S` #define :target:`GATE_SQISWAP` #define :target:`GATE_SWAP` #define :target:`GATE_T` #define :target:`GATE_TYPE_MEASURE` #define :target:`GATE_TYPE_READOUT` #define :target:`GATE_TYPE_RESET` #define :target:`GATE_U1` #define :target:`GATE_U2` #define :target:`GATE_U3` #define :target:`GATE_U4` #define :target:`GATE_X` #define :target:`GATE_X1` #define :target:`GATE_Y` #define :target:`GATE_Y1` #define :target:`GATE_Z` #define :target:`GATE_Z1` #define :target:`HIGH_FREQUENCY_QUBIT` #define :target:`INF` #define :target:`INF` #define :target:`INF` #define :target:`KMETADATA_GATE_TYPE_COUNT` #define :target:`MACRO_GET_GATETYPE`(name) #define :target:`MAX_COMPARE_PRECISION` #define :target:`MAX_LAYER` #define :target:`MAX_THREADS` #define :target:`PI` #define :target:`PI` #define :target:`PI` #define :target:`PI` #define :target:`PI` #define :target:`PRINT_TRACE` #define :target:`PRINT_TRACE` #define :target:`PRINT_TRACE` #define :target:`PRINT_TRACE` #define :target:`PRINT_TRACE` #define :target:`PRINT_TRACE` #define :ref:`QCERR`(x) #define :target:`QCERR_AND_THROW`( \ std_exception, \ _Message_ \ ) #define :ref:`QCERR_AND_THROW_ERRSTR`( \ std_exception, \ x \ ) #define :target:`QCIRCUIT_OPTIMIZER` #define :target:`QIF_REGISTER`(className) #define :target:`QPANDA_ASSERT`( \ con, \ argv \ ) #define :target:`QPANDA_BEGIN` #define :target:`QPANDA_END` #define :target:`QPANDA_MAJOR_VERSION` #define :target:`QPANDA_MINOR_VERSION` #define :target:`QPANDA_OP`( \ con, \ op \ ) #define :target:`QPANDA_PATCH_VERSION` #define :target:`QPANDA_RETURN`( \ con, \ value \ ) #define :target:`QUBIT_ADJACENT_MATRIX` #define :target:`QWHILE_REGISTER`(className) #define :target:`REGISTER_ANGLE_GATE_MATRIX`( \ NAME, \ Nx, \ Ny, \ Nz \ ) #define :target:`REGISTER_CBIT_NAME_`(classname) #define :target:`REGISTER_CEXPR`(classname) #define :target:`REGISTER_CLASSICAL_PROGRAM`(className) #define :target:`REGISTER_CMEM_SIZE_`(classname) #define :target:`REGISTER_GATE_MATRIX`( \ NAME, \ U00, \ U01, \ U10, \ U11 \ ) #define :target:`REGISTER_MEASURE`(className) #define :target:`REGISTER_PHYSICAL_QUBIT`(classname) #define :target:`REGISTER_QCIRCUIT`(className) #define :target:`REGISTER_QPROGRAM`(className) #define :target:`REGISTER_QRES_NAME`(classname) #define :target:`REGISTER_QUANTUM_MACHINE`(classname) #define :target:`REGISTER_QUBIT`(classname) #define :target:`REGISTER_QUBIT_POOL_SIZE_`(classname) #define :target:`REGISTER_RESET`(className) #define :target:`SAFE_DELETE_PTR`(p) #define :target:`SINGLETON_DECLARE`(Type) #define :target:`SINGLETON_IMPLEMENT_EAGER`(Type) #define :target:`SINGLETON_IMPLEMENT_LAZY`(Type) #define :target:`SINGLE_ANGLE_GATE`(NAME) #define :target:`SINGLE_GATE_TIME` #define :target:`SQ2` #define :target:`SQ2` #define :target:`SQ2` #define :target:`SWAP_TIME` #define :target:`SingleGateMatrixSize` #define :target:`UNDEF_DOUBLE` #define :target:`USING_QPANDA` #define :target:`VIRTUAL_Z_CONFIG` #define :target:`ZeroJudgement` #define :target:`_DOUBLE_ANGLE_GATE`(NAME) #define :target:`_DOUBLE_GATE`(NAME) #define :target:`_SINGLE_ANGLE_GATE`(NAME) #define :target:`_SINGLE_GATE`(NAME) #define :target:`_TRIPLE_GATE`(NAME) #define :target:`__FILENAME__` #define :target:`const_single_qubit_gate`( \ GATE_NAME, \ qn, \ isConjugate, \ error_rate \ ) #define :target:`control_const_single_qubit_gate`( \ GATE_NAME, \ qn, \ vControlBit, \ isConjugate, \ error_rate \ ) #define :target:`control_single_qubit_angle_gate`( \ GATE_NAME, \ qn, \ theta, \ vControlBit, \ isConjugate, \ error_rate \ ) #define :target:`iunit` #define :target:`single_qubit_angle_gate`( \ GATE_NAME, \ qn, \ theta, \ isConjugate, \ error_rate \ ) .. _details-global: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Global Variables ---------------- .. index:: pair: variable; PI .. _doxid-_q_global_variable_8h_1a4d5c20a533e37f77b0bcc6c5eb160b09: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`qstate_type` PI = 3.14159265358979323846 Square root of two Global Functions ---------------- .. index:: pair: function; integerToBinary .. _doxid-group___utilities_1gaa65528bba400afbe3456b569805c1275: .. ref-code-block:: cpp :class: doxyrest-title-code-block template std::string integerToBinary( const UnsignedIntegralType& number, int ret_len ) Unsigned integer to binary string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - const - UnsignedIntegralType & number * - int - binary string length .. rubric:: Returns: std::string unsigned integer string .. index:: pair: function; integerToString .. _doxid-group___utilities_1ga674c5935aa6e6b7f5fc63dab3b4376c2: .. ref-code-block:: cpp :class: doxyrest-title-code-block template std::string integerToString(const UnsignedIntegralType& number) Unsigned integer to binary string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - const - UnsignedIntegralType & number .. rubric:: Returns: std::string unsigned integer string .. index:: pair: function; getDecIndex .. _doxid-group___utilities_1gae427c07ca7652b1f831ccf1eda056393: .. ref-code-block:: cpp :class: doxyrest-title-code-block template UnsignedIntegralType getDecIndex( const UnsignedIntegralType& num1, const UnsignedIntegralType& num2, std::vector qvec, size_t len ) Get quantum state dec index in pmeasure. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - const - UnsignedIntegralType & num1 * - const - UnsignedIntegralType & num2 * - std::vector - qvec * - size_t - binary string length .. rubric:: Returns: Unsigned Integral Type .. index:: pair: function; initialize .. _doxid-_chemi_q_i_f_c_8h_1a54f4eda15dd20e82919fcc100fb101b1: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT :ref:`ChemiQ`* initialize(char* dir) Initialize the quantum chemistry calculation. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - std::string - The dir of the psi4 chemistry calculation package .. rubric:: Returns: ChemiQ\* a ChemiQ object ptr .. index:: pair: function; finalize .. _doxid-_chemi_q_i_f_c_8h_1a35c742ebb04759d05160c183573ab4bb: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void finalize(:ref:`ChemiQ`* chemiq) Finalize the quantum chemistry calculation. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the ChemiQ object ptr will be finalized .. index:: pair: function; setMolecule .. _doxid-_chemi_q_i_f_c_8h_1aff908db723c06f88faaaef4d80526cab: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setMolecule(:ref:`ChemiQ`* chemiq, char* molecule) Set the molecular model to calculate. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - std::string - molecule model .. index:: pair: function; setMolecules .. _doxid-_chemi_q_i_f_c_8h_1a62cbe512973d55ce78d1098c69f651b8: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setMolecules(:ref:`ChemiQ`* chemiq, char* molecules) Set the molecular model to calculate. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - char\* - the molecules ptr .. index:: pair: function; setMultiplicity .. _doxid-_chemi_q_i_f_c_8h_1afa4616781c758abdd0e310cc583cc306: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setMultiplicity(:ref:`ChemiQ`* chemiq, int multiplicity) Set the multiplicity of the molecular model. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - int - multiplicity .. index:: pair: function; setCharge .. _doxid-_chemi_q_i_f_c_8h_1a0937e49cf4c0ac3e114c6c2c449bfe40: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setCharge(:ref:`ChemiQ`* chemiq, int charge) Set the charge of the molecular model. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - int - charge .. index:: pair: function; setBasis .. _doxid-_chemi_q_i_f_c_8h_1a39356f40f231e4533f6225413d8b3901: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setBasis(:ref:`ChemiQ`* chemiq, char* basis) Set the calculation basis. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - std::string - basis .. index:: pair: function; setEqTolerance .. _doxid-_chemi_q_i_f_c_8h_1a44dc21780dca0c8b323964422b1c0493: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setEqTolerance(:ref:`ChemiQ`* chemiq, double val) Set Eq Tolerance. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - double - EqTolerance value .. index:: pair: function; setTransformType .. _doxid-_chemi_q_i_f_c_8h_1a57571abf529d58ef4d197eb838a0df97: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setTransformType(:ref:`ChemiQ`* chemiq, int type) Set the transform type from Fermion operator to Pauli operator. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - int - transform type .. rubric:: See also: QPanda::TransFormType .. index:: pair: function; setUccType .. _doxid-_chemi_q_i_f_c_8h_1a345009bff8bc327845abc1717c1714a3: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setUccType(:ref:`ChemiQ`* chemiq, int type) Set the ucc type to contruct the Fermion operator. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - int - ucc type .. rubric:: See also: QPanda::UccType .. index:: pair: function; setOptimizerType .. _doxid-_chemi_q_i_f_c_8h_1a05337011ecbc3cdaec08d1b03cecfd47: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setOptimizerType(:ref:`ChemiQ`* chemiq, int type) Set the optimizer type. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - int - optimizer type .. rubric:: See also: QPanda::OptimizerType .. index:: pair: function; setOptimizerIterNum .. _doxid-_chemi_q_i_f_c_8h_1ad864b5c29eacb4a7c6254a7ef20e0cb6: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setOptimizerIterNum(:ref:`ChemiQ`* chemiq, int value) Set the optimizer iteration number. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - size_t - iteration number .. index:: pair: function; setOptimizerFuncCallNum .. _doxid-_chemi_q_i_f_c_8h_1a561c06e5f054902e7cb65a8b242090f8: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setOptimizerFuncCallNum(:ref:`ChemiQ`* chemiq, int value) Set the optimizer function callback number. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - size_t - function callback number .. index:: pair: function; setOptimizerXatol .. _doxid-_chemi_q_i_f_c_8h_1aae3ec08bfa9031ff5a3aee9eebdc1875: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setOptimizerXatol(:ref:`ChemiQ`* chemiq, double value) Set the optimizer iteration number. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - size_t - iteration number .. index:: pair: function; setOptimizerFatol .. _doxid-_chemi_q_i_f_c_8h_1a2c60296f22a5c3d2b79b194cfc75a2d8: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setOptimizerFatol(:ref:`ChemiQ`* chemiq, double value) Set the optimizer fatol.It is the Absolute error in func(xopt) between iterations that is acceptable for convergence. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - double - absolute error between func(xopt) .. index:: pair: function; setLearningRate .. _doxid-_chemi_q_i_f_c_8h_1aa45474eef8eb830b36ff62efab13f60a: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setLearningRate(:ref:`ChemiQ`* chemiq, double value) Set the learing rate when using Gradient optimizer. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - double - learing rate .. index:: pair: function; setEvolutionTime .. _doxid-_chemi_q_i_f_c_8h_1adb9bce782572809474d8bfb805209336: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setEvolutionTime(:ref:`ChemiQ`* chemiq, double value) Set the evolution time when doing hamiltonian simulation. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - double - evolution time .. index:: pair: function; setHamiltonianSimulationSlices .. _doxid-_chemi_q_i_f_c_8h_1a7d5ccdc7d940147460c495a566c85627: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setHamiltonianSimulationSlices(:ref:`ChemiQ`* chemiq, int value) Set the hamiltonian simulation slices (e^iAt/n\*e^iBt/n)^n, n is the slices. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - double - hamiltonian simulation slices .. index:: pair: function; setSaveDataDir .. _doxid-_chemi_q_i_f_c_8h_1ab3e2454f231223067408305835b4105d: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT void setSaveDataDir(:ref:`ChemiQ`* chemiq, char* dir) Set the directory to save the calculated data. If it's a not exist dir data will not be saved. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr * - std::string - dir .. index:: pair: function; getQubitsNum .. _doxid-_chemi_q_i_f_c_8h_1a81e94b8cdf104c702a20d2f52eebced7: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT int getQubitsNum(:ref:`ChemiQ`* chemiq) get qubits num with the above config. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr .. rubric:: Returns: int -1:means failed. .. index:: pair: function; exec .. _doxid-_chemi_q_i_f_c_8h_1a76ea93400681d101a95281b713f55211: .. ref-code-block:: cpp :class: doxyrest-title-code-block DLLEXPORT bool exec(:ref:`ChemiQ`* chemiq) exec molecule calculate. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr .. rubric:: Returns: bool true:success; false:failed .. index:: pair: function; getLastError .. _doxid-_chemi_q_i_f_c_8h_1a6f7a633eff5c786c3d94002c6b8ed6dc: .. ref-code-block:: cpp :class: doxyrest-title-code-block const DLLEXPORT char* getLastError(:ref:`ChemiQ`* chemiq) get last error. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - ChemiQ\* - the target ChemiQ object ptr .. rubric:: Returns: char\* last error Macros ------ .. index:: pair: define; QCERR .. _doxid-_q_panda_namespace_8h_1acb29825331db5ae6632fbb0647a72534: .. ref-code-block:: cpp :class: doxyrest-title-code-block #define QCERR(x) QPanda2 cout error message. .. index:: pair: define; QCERR_AND_THROW_ERRSTR .. _doxid-_q_panda_namespace_8h_1aac47299986cc9e801758ad7946bea4b2: .. ref-code-block:: cpp :class: doxyrest-title-code-block #define QCERR_AND_THROW_ERRSTR(std_exception, x) output the error string to standard error and throw a standard exception. A standard exception can be of the following types: runtime_error, invalid_argument, range_error, etc