Beispiel #1
0
        private IQubitDto mapQubitToDto(QubitDao dao)
        {
            var dto           = _producer.ProduceQubitDto();
            var oneAmplitude  = _producer.ProduceComplexDto();
            var zeroAmplitude = _producer.ProduceComplexDto();

            oneAmplitude.Real      = dao.OneAmplitude.Real;
            oneAmplitude.Imaginary = dao.OneAmplitude.Imaginary;

            zeroAmplitude.Real      = dao.ZeroAmplitude.Real;
            zeroAmplitude.Imaginary = dao.ZeroAmplitude.Imaginary;

            dto.OneAmplitude  = oneAmplitude;
            dto.ZeroAmplitude = zeroAmplitude;

            return(dto);
        }
Beispiel #2
0
        public async Task <ICircuitResultDto> ExecuteCircuitHandler(Guid Uuid)
        {
            /*
             *  Here should be implemented the usage of the simulator library to execute quantum cirquit represented by
             *  cirquitDao found in database.
             *  The state of register in cirquit after executing of all quantum gates should be returned as result;
             */

            var circuitDao = await _circuitRepository.FindCircuit(Uuid);

            if (circuitDao == null)
            {
                return(null);
            }

            //Todo: Here some operations to simulate circuit

            //temporarily return fake result
            var result = _producer.ProcudeCircuitResultDto();

            result.ResultingRegister             = _producer.ProduceRegisterDto();
            result.ResultingRegister.Type        = "register";
            result.ResultingRegister.InputCount  = 0;
            result.ResultingRegister.OutputCount = 2;

            var firstCubit  = _producer.ProduceQubitDto();
            var secondCubit = _producer.ProduceQubitDto();

            firstCubit.OneAmplitude   = _producer.ProduceComplexDto();
            firstCubit.ZeroAmplitude  = _producer.ProduceComplexDto();
            secondCubit.OneAmplitude  = _producer.ProduceComplexDto();
            secondCubit.ZeroAmplitude = _producer.ProduceComplexDto();

            result.ResultingRegister.Qubits = new List <IQubitDto>()
            {
                firstCubit,
                secondCubit
            };

            return(result);
        }