GetStatevector failed in Mac build
Closed this issue · 2 comments
HuangJunye commented
The apparent lag in the Mac build is not due to slow communication, but due to failure of showing paddle by starting GetStatevetor() coroutine in (from Line 58 in CircuitGridClient.cs):
private void GetStateVector(string gateString)
{
string urlString = API_URL + API_VERSION + Endpoint.get_statevector;
StartCoroutine(PostRequest(urlString, circuitDimensionString, gateString, (results) => {
// Deserialize stateVector from JSON
// TODO: come up with a better way to abstract this out
var obj = JsonConvert.DeserializeObject<RootObject>(results);
Complex[] stateVector = new Complex[stateNumber];
double[] stateProbability = new double[stateNumber];
for (int i = 0; i < stateNumber; i++)
{
stateVector[i] = new Complex(obj.__ndarray__[i].__complex__[0], obj.__ndarray__[i].__complex__[1]);
stateProbability[i] = Complex.Pow(stateVector[i], 2).Magnitude;
paddleArray[i].GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, (float)stateProbability[i]);
}
// Debug.Log("State Probability: [" + string.Join(", ", stateProbability) + "]");
}));
}
I guess the problem is caused by the way I pass complex number from python server to the game. Do you have any idea how to fix this issue?
HuangJunye commented
@filemaster Can you have a look at this issue? Check the feature/changeResolution
branch. I will send you a build I made.
filemaster commented
It is fixed in the PR #58