public double[] MeasureEntanglementWitness(int[] states, int count)
        {
            double[] witness = new double[states.Length];

            QArray <QArray <double> > weights = GetAngles(TimeInterval);

            using (var sim = new QuantumSimulator())
            {
                foreach (int n in states)
                {
                    var res = QNNChunkedMeasureEntanglement.Run(sim, weights, count, n).Result;

                    // data processing for returned values from quantum neural network
                    witness[n - 1] = (double)res / (double)count;
                }
            }

            return(witness);
        }
Example #2
0
        public double MeasureEntanglementWitness(Complex[] state, int count)
        {
            double witness = 0;

            QArray <QArray <double> > weights    = GetAngles(TimeInterval);
            QArray <double>           parameters = new QArray <double>(state.Length * 2);

            for (int n = 0; n < state.Length; n++)
            {
                parameters[2 * n]     = state[n].Real;
                parameters[2 * n + 1] = state[n].Imaginary;
            }

            using (var sim = new QuantumSimulator())
            {
                long res = QNNChunkedMeasureEntanglement.Run(sim, weights, parameters, count).Result;

                // data processing for returned values from quantum neural network
                witness = (double)res / (double)count;
            }

            return(witness);
        }