Hi,
I'm implementing a quantum computing simulator using cuTensorNet and I would like to know if there is a preferred way of doing it.
I already implemented such a simulator running on cpu (basically it's just a 'proof of the concept', it's not something performant, neither for tensor contractions, nor for 'contractors' that pick the contraction paths)... there I chose to construct both the circuit tensor network and the 'super' part (as in both 'ket' and 'bra').
Here is the source code: https://github.com/QoroQuantum/maestro/blob/main/TensorNetworks/TensorNetwork.h
I believe this is also the way qiskit aer does it (using cuTensorNet).
A qubit measurement in my example code is dealt with by first stacking a projector tensor between the 'bra' and 'ket' tensor networks, connecting all legs between 'bra' and 'ket' and contracting the whole tensor network to get the probability (something like this: https://github.com/QoroQuantum/maestro/blob/c856480c92221fb097c79f231a659bf87d2f86c5/TensorNetworks/TensorNetwork.h#L76 )... then using a random number generator the result of the measurement is supplied and the proper/corresponding projector replaces the previous one... and then other gates are added and so on.
What would be the best way of doing something similar with cuTensorNet? Should I start with cutensornetCreateState with CUTENSORNET_STATE_PURITY_PURE, add gate tensors and then when reaching a measurement... should I use an accessor to get the amplitude? Or maybe should I compute the expectation for Z on the measured qubit?
Or should I go with a similar approach as the one described above - start from qubits tensors for both 'ket' and 'bra' and so on?
Thank you!