public virtual void Explore(IQuantumState state, string description) { IQuantumStateDebugger debugger = state.generateQuantumDebugger(); int count = debugger.getNumLevels(); Show(); }
public override void Evaluate(IQuantumState state) { IQuantumStateDebugger debuggerData = state.generateQuantumDebugger(); IQuantumStateDebugger debuggerElement = ReferenceBasis.getState(ReferenceElement).generateQuantumDebugger(); debuggerData.setVectorInternal(debuggerElement.getVectorInternal()); }
public override void Evaluate(IQuantumState state) { IQuantumStateDebugger debugger = state.generateQuantumDebugger(); IComplexMatrix vector = debugger.getVectorInternal(); vector.Randomize(); debugger.setVectorInternal(vector); }
public virtual void Explore(IQuantumState state, string description) { textBox.Text = state.generateQuantumDebugger().FullDebug; Text += ": " + description; Show(); }
// INTERNAL STATE public override void AssociateState(IQuantumState state) { if (state != null) { if (state.generateQuantumDebugger().getNumLevels() != (int)InformationArity.Binary) { throw new ExceptionDataError(); } } setInternalState( state ); }
// override public void Evaluate(IQuantumState state) // { // if (EffectiveNoiseFactor != 0) // { // IQuantumStateDebugger debugger = state.generateQuantumDebugger(); // IComplexMatrix stateVector = debugger.getVectorInternal(); // IComplexMatrix noiseVector = generateNoiseVector(stateVector.countTotalElements()); // IComplexMatrix tempVector = FactoryComplexMatrix.Operations.Add(stateVector, noiseVector); // IComplexMatrix noiseMatrix = generateNoiseMatrix(tempVector.countTotalElements()); // IComplexMatrix resultVector = FactoryComplexMatrix.Operations.Multiplication(noiseMatrix, stateVector); // debugger.setVectorInternal(resultVector); // } // } public override void Evaluate(IQuantumState state) { if (EffectiveNoiseFactor != 0) { IQuantumStateDebugger debugger = state.generateQuantumDebugger(); IComplexMatrix stateVector = debugger.getVectorInternal(); IComplexMatrix noiseVector = generateNoiseVector(stateVector.countTotalElements()); IComplexMatrix tempVector = FactoryComplexMatrix.Operations.Add(stateVector, noiseVector); IComplexMatrix noiseMatrix = generateNoiseMatrix(tempVector.countTotalElements()); IComplexMatrix resultVector = FactoryComplexMatrix.Operations.Multiplication(noiseMatrix, stateVector); debugger.setVectorInternal(resultVector); } }
private double[] generateProbabilities(IQuantumState state, IQuantumBasis basis) { IQuantumStateDebugger stateDebugger = state.generateQuantumDebugger(); IQuantumBasisDebugger basisDebugger = basis.generateQuantumDebugger(); IComplexMatrix matrix = basisDebugger.getMatrix(); IComplexMatrix vector = stateDebugger.getVectorInternal(); IComplexMatrix limit = FactoryComplexMatrix.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 = FactoryComplexMatrix.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] = FactoryComplexNumber.Operations.PoweredNorm(tempComplex[k]); } if (Configuration.EffectiveLogEnabled) { LoggerFactory.Default.Log("Measurament Probabilities Distribution: " + ArrayTools.ExplodeArrayAsString(result)); } return result; //IQuantumStateDebugger debugger = state.generateQuantumDebugger(); //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; }
public void transmitQuantum(IProtocolAgent agent, IQuantumState state) { TesterLog("QUANTUM TRANSMISSION " + agent.AgentName); TesterLog(state.generateQuantumDebugger().FullDebug); }
public void receiveQuantum(IProtocolAgent agent, IQuantumState state) { TesterLog("QUANTUM RECEPTION " + agent.AgentName); TesterLog(state.generateQuantumDebugger().FullDebug); }
private void updateState(IQuantumState state, IQuantumBasis basis, int selected) { IQuantumState baseState = basis.getState(selected); IComplexMatrix coefficients = baseState.generateQuantumDebugger().getVectorInternal(); state.generateQuantumDebugger().setVectorInternal(coefficients); }
private void GENE_SlaveProcessQuantumKeyData(IProtocolAgent agent, IQuantumState state) { int receivedPos = Slave.counterReceivedQuantum - 1; BB84Log("GENE: STEP 1: ", receivedPos, " | Slave State Received: ", state.generateQuantumDebugger().ShortDebug); // get the bit IQuantumBit quantumBit = FactoryQuantumData.generateBit(false); quantumBit.AssociateState(state); bool usedBasis = FactoryRandom.GetSingleBinary(); bool decodedBit = FactoryQuantumData.decodeBitByBasis(quantumBit,usedBasis); BB84Log("GENE: STEP 1: ", receivedPos, " | Slave conversion into Bit: ", decodedBit.ToString()); // store 'usedBasis' and 'decodedBit' GENE_slaveUsedBasisCollection.Add(usedBasis); GENE_slaveDecodedBitCollection.Add(decodedBit); }
private void GENE_EavesdropperProcessQuantumKeyData(IProtocolAgent agent, IQuantumState state) { int receivedPos = Eavesdropper.counterReceivedQuantum - 1; BB84Log("GENE: STEP 1: ", receivedPos, " | Eavesdropper State Received: ", state.generateQuantumDebugger().ShortDebug); // get the bit IQuantumBit quantumBit = QuantumDatatypeFactory.generateBit(false); quantumBit.AssociateState(state); bool usedBasis = RandomnessAlgorithmFactory.GetSingleBinary(); bool decodedBit = QuantumDatatypeFactory.decodeBitByBasis(quantumBit, usedBasis); BB84Log("GENE: STEP 1: ", receivedPos, " | Eavesdropper conversion into Bit: ", decodedBit.ToString()); // store 'usedBasis' and 'decodedBit' GENE_eavesdropperUsedBasisCollection.Add(usedBasis); GENE_eavesdropperDecodedBitCollection.Add(decodedBit); }
private static void OrtoNormalize(IQuantumState state, int pos) { IQuantumStateDebugger debugger = state.generateQuantumDebugger(); for (int i = 0; i < debugger.getNumLevels(); i++) { if (i == pos) { debugger.setCoefficientInternal(FactoryComplexNumber.generateIdentity(), pos); } else { debugger.setCoefficientInternal(FactoryComplexNumber.generateSimetry(), pos); } } }