public virtual void SimulateInPlace(QuantumCircuitFloat circuit, ref ComplexNumberFloat[] amplitudes)
        {
            int length = circuit.AmplitudeLength;

            if (amplitudes == null || amplitudes.Length != length)
            {
                //Post message
                amplitudes = new ComplexNumberFloat[length];
            }

            float sum = circuit.ProbabilitySum();

            //if
            if (sum > MathHelper.Eps)
            {
                if (sum < 1 - MathHelper.Eps || sum > 1 + MathHelper.Eps)
                {
                    circuit.Normalize(sum);
                }

                for (int i = 0; i < amplitudes.Length; i++)
                {
                    amplitudes[i] = circuit.Amplitudes[i];
                }
            }
            else
            {
                //Initialize the all 0 vector
                amplitudes[0].Real = 1;
            }
        }
        public virtual ComplexNumberFloat[] Simulate(QuantumCircuitFloat circuit)
        {
            float sum = circuit.ProbabilitySum();

            if (sum > MathHelper.EpsFloat)
            {
                if (sum < 1 - MathHelper.EpsFloat || sum > 1 + MathHelper.EpsFloat)
                {
                    circuit.Normalize(sum);
                }

                ComplexNumberFloat[] amplitudes = new ComplexNumberFloat[circuit.AmplitudeLength];

                for (int i = 0; i < amplitudes.Length; i++)
                {
                    amplitudes[i] = circuit.Amplitudes[i];
                }
                return(amplitudes);
            }
            else
            {
                //Initialize the all 0 vector
                ComplexNumberFloat[] amplitudes = new ComplexNumberFloat[circuit.AmplitudeLength];
                amplitudes[0].Real = 1;
                return(amplitudes);
            }
        }