private void AddResults(Dictionary <string, float> results, List <int> emotionBits) { foreach (var entry in results) { if (entry.Value == 0) { continue; } if (!entry.Key.Contains('1') && !state.AllowBlanks) { continue; } var newState = new QuantumEmotions.EmotionState(); newState.emotions = new List <bool>(new bool[emotions.emotions.Count]); for (var i = 0; i != entry.Key.Length; ++i) { var index = emotionBits[i]; newState.emotions[index] = (entry.Key[i] == '1'); } newState.probability = entry.Value; emotions.states.Add(newState); } }
public void Setup(Sprite sprite, InstaImageState state) { actualImage.sprite = sprite; emotions.emotions.Clear(); emotions.states.Clear(); this.state = state; foreach (var request in state.requests) { if (request.hamiltonian.Length == 0) { emotions.emotions.AddRange(request.emotions); var estate = new QuantumEmotions.EmotionState { emotions = Enumerable.Repeat(true, request.emotions.Length).ToList() }; emotions.states.Add(estate); } else { QiskitClient.instance.SendRequest(request, this); } } }