public virtual void Explore(IQuantumBasis basis, string description)
        {
            textBox.Text = description + "\r\n";
            textBox.Text += basis.Debugger.FullDebug;

            Text += "" + description;

            Show();
        }
        private double[] generateProbabilities(IQuantumState state, IQuantumBasis basis)
        {
            IQuantumStateDebugger stateDebugger = state.Debugger;
            IQuantumBasisDebugger basisDebugger = basis.Debugger;
            IComplexMatrix matrix = basisDebugger.getMatrix();
            IComplexMatrix vector = stateDebugger.getVectorInternal();
            IComplexMatrix limit = ComplexMatrixFactory.Operations.Multiplication(matrix, vector);
            // Si el vector "limit" esta normalizado,
            // la suma de todas sus componentes a la norma, deben dar 1
            // ==> probablidades
            IComplexMatrix normalized = ComplexMatrixFactory.Operations.Normalize(limit);
            IComplexNumber[] tempComplex = normalized.extractAsArray();
            int count = tempComplex.Length;
            double[] result = new double[count];
            for (int k = 0; k < count; k++)
            {
                result[k] = ComplexNumberFactory.Operations.PoweredNorm(tempComplex[k]);
            }

            if (Configuration.EffectiveLogEnabled)
            { LoggerFactory.Default.Log("Measurament Probabilities Distribution",ArrayTools.ExplodeArrayAsString(result)); }

            return result;

            //IQuantumStateDebugger debugger = state.Debugger;
            //IComplexMatrix vector = debugger.getVectorNormalized();
            //int count = vector.countTotalElements();
            //double[] result = new double[count];
            //IComplexNumber element;
            //for (int i = 0; i < count; i++)
            //{
            //    element = vector.getElement(i, 0);
            //    result[i] = FactoryComplexNumber.Operations.PoweredNorm(element);
            //}
            //DefaultLogger.Instance.Log("Measurament Probabilities Distribution"+ArrayTools.ExplodeArrayAsString(result));
            //return result;
        }
        private void updateState(IQuantumState state, IQuantumBasis basis, int selected)
        {
            IQuantumState baseState = basis.getState(selected);

            IComplexMatrix coefficients = baseState.generateQuantumDebugger().getVectorInternal();

            state.generateQuantumDebugger().setVectorInternal(coefficients);
        }
 public virtual void InitializeIntoBasis(IQuantumBasis basis, int element)
 {
     IQuantumBasisInitializerOperator quantumOperator = FactoryQuantumOperator.generateBasisInitializerOperator();
     quantumOperator.ReferenceBasis = basis;
     quantumOperator.ReferenceElement = element;
     quantumOperator.Evaluate(InternalState);
 }
Ejemplo n.º 5
0
 public QuBasisDebugger(IQuantumBasis basis)
     : base()
 {
     _basis = basis;
 }