Giter Club home page Giter Club logo

qpanda-lite's People

Contributors

agony5757 avatar automatic-code-ztr avatar chaos-paradox avatar didaozi avatar richardsun2019 avatar sbzhao avatar yunj1e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

qpanda-lite's Issues

Incompatible Rz Implementation

https://github.com/Agony5757/QPanda-lite/blob/b47d14d295d68f51772a7922e60c981aad5b3a59/QPandaLiteCpp/src/simulator.cpp#L354C26-L354C26

The desired matrix form of RZ is supposed to be,

$$ \begin{bmatrix} \exp(-i\theta/2) & 0 \\ 0 & \exp(i\theta/2) \end{bmatrix}. $$

But the current implementation is,

$$ \begin{bmatrix} 1 & 0 \\ 0 & \exp(i\theta) \end{bmatrix}. $$

Although there is only a global phase for the single-qubit case, there will be issues if we add control to it due to the extra phase.

Control version of quantum gate in both Simulator and NoisySimulator

Simulator

if (!control_enable(i, global_controller))
    continue;

do nothing at all. It will need something like

bool control_active = true;

for (size_t q : global_controller) {

    if (!((i >> q) & 1)) {
        control_active = false;
        break;
    }
}

to collect the boolean value regarding the global_controller string.

NoisySimulator

The current version of NoisySimulator::execute_once() does not care global control part. It would be better to add,

                case (uint32_t)SupportOperationType::CNOT:
				if (!opcode.global_controller.empty())
                {
                    // If there are global controllers, use the cnot_cont method
                    simulator.cnot_cont(opcode.qubits[0], opcode.qubits[1], opcode.global_controller);
                }
                else
                {
                    // If there are no global controllers, use the regular cnot method
                    simulator.cnot(opcode.qubits[0], opcode.qubits[1]);
                }
				break;

to temporarily solve the issue.

The two code blocks are able to temporarily solve the problem, but the final version may end up with better solutions :)

[bug]

Traceback (most recent call last):
File "c:\Users\Administrator\Desktop\watchdog\watchdog_20240107_222310\Lorantz.py", line 464, in
val_model("val",rho = 24.8,train_set=600)
File "c:\Users\Administrator\Desktop\watchdog\watchdog_20240107_222310\Lorantz.py", line 440, in val_model
pre_label=model(batch_text)
File "pyvqnet\nn\module.py", line 613, in pyvqnet.nn.module.Module.call
File "c:\Users\Administrator\Desktop\watchdog\watchdog_20240107_222310\models.py", line 353, in forward
output, (h_n, _) = self.rnn(x)
File "pyvqnet\nn\module.py", line 613, in pyvqnet.nn.module.Module.call
File "c:\Users\Administrator\Desktop\watchdog\watchdog_20240107_222310\models.py", line 211, in forward
i_t = self.sigmoid(self.vqc_input(encoding_input[:, :hs]))
File "pyvqnet\nn\module.py", line 613, in pyvqnet.nn.module.Module.call
File "c:\Users\Administrator\Desktop\watchdog\watchdog_20240107_222310\QLayer.py", line 313, in forward
outputs = [
File "c:\Users\Administrator\Desktop\watchdog\watchdog_20240107_222310\QLayer.py", line 314, in
calculate_expectation(output, self.hamiltonian)
File "C:\ProgramData\Anaconda3\envs\kynb310\lib\site-packages\qpandalite\analyzer\expectation.py", line 59, in calculate_expectation
return [calculate_expectation(measured_result, h) for h in hamiltonian]
ate_expectation
return _calculate_expectation_dict(measured_result, hamiltonian, nqubit)
File "C:\ProgramData\Anaconda3\envs\kynb310\lib\site-packages\qpandalite\analyzer\expectation.py", line 15, in _calculate_expectation_dict

task.py 240行 key.append(hex(i))

[bug]simulator可能存在计算错误

QINIT 1
CREG 1
RX q[0], (-1.57)
RZ q[0], (1.57)
H q[0]
MEASURE q[0],c[0]

这个线路应该和

QINIT 1
CREG 1
X q[0]
MEASURE q[0],c[0]

结果一致,pyqpanda模拟结果分别为{'0': 3.170681151136739e-07, '1': 0.9999996829318852},{'0': 0.0, '1': 1.0},与理论预期一致; 但qpandalite分别为[0.9999996829318849, 3.170681151136738e-07]和[0.0, 1.0],排除了顺序问题确实有误。将H q[0]替换为RY q[0], (-1.57)时同样有问题。

2023-10-26 TODO

  • Modify analyze_circuit under the standard OriginIR_base_parser
    Following Q1: For the operations that are not affected by the dagger, do we need to keep the "_dg"?
    For example: {'H': 3, 'CNOT': 3, 'CCCNOT': 1, 'X_dg': 2, 'Z_dg': 3, 'X': 1, 'Z': 1, 'CCNOT': 1, 'CCCCNOT': 1, 'CCCNOT_dg': 1, 'CNOT_dg': 1, 'CZ_dg': 1, 'CCNOT_dg': 1},
    Following Q2: At what level we do not need to care about them anymore? circuit <-> OriginIR ->simulator
    A2: We might name the operation in the OriginIR_base_parser, given its status of control and dagger_not

  • Modify qasm under the standard OriginIR_line_parser

  • Add dagger/ barrier support when converting OriginIR to QASM
    There is no specific flag in QASM, RXGate(-0.4).inverse() ->rx(0.4) q[?]. Others follow a similar rule, all of the QE primitives have their own inverse() method to deal with the dagger issue.

  • Add dagger/ barrier support when converting QASM to OriginIR
    Based on the point above, I guess the transition from QASM to OriginIR would be easier.

  • Circuit.remapping does not support partial-remapping currently, might need a discussion about it.

  • Dagger not done

Will close it after finish all of them. :^)

<docs> task

  • Clean up the docs of the task that are messy at the moment.
  • Add the workflow for submitting tasks for multiple platforms(Figures!!!).
  • Note that submitting to OriginQ servers might need the VPN.

My design is:
It has one at the table of content "qpandalite.task package" with "IBM, Quafu, OriginQ, OriginQ,_dummy" four subpackages instead of three table of content items :^(
toc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.