cpx_mtx_get(stateVector, 0, i, &n);
if (bit == 0) prob0 += cpx_magsqr(&n);
}
- float r = (ctx->hidden_variable) ? qansel_rand_h() : qansel_rand_t(ctx);
+ float r = (ctx->hidden_variable_set) ? qansel_rand_h() : qansel_rand_t(ctx);
//add any error skew if desired
if (ctx->noise > 0)
{
for (int i = 0; i < qubitCountPow2; i++) stats[i] = 0;
for (int i = 0; i < (ctx->bsampling_shots); i++)
{
- float r = (ctx->hidden_variable) ? qansel_rand_h() : qansel_rand_t(ctx);
+ float r = (ctx->hidden_variable_set) ? qansel_rand_h() : qansel_rand_t(ctx);
float j = 0;
//printf("--------------------------------\n");
for (unsigned int j = 0; j < qubitCountPow2; j++)
unsigned short stats = 0;
for (int i = 0; i < (ctx->bsampling_shots); i++)
{
- float r = (ctx->hidden_variable) ? qansel_rand_h() : qansel_rand_t(ctx);
+ float r = (ctx->hidden_variable_set) ? qansel_rand_h() : qansel_rand_t(ctx);
stats += r < prob ? 1 : 0;
}
printf("0\t%i\t%.2f%%\n", (ctx->bsampling_shots) - stats, (((float)(ctx->bsampling_shots) - (float)stats) / (float)(ctx->bsampling_shots)) * (float)100);
if (!qanselContextValidate(ctx)) return 0;
qansel_rand_s(qansel_hardware_getseed());
- if (ctx != NULL && ctx->hidden_variable != 0)
+ if (ctx != NULL && ctx->hidden_variable_set)
{
unsigned int tmp;
memcpy(&tmp, &(ctx->hidden_variable), sizeof(unsigned int));
}
switch (instr)
{
- case 1: ctx->hidden_variable = d0; break;
+ case 1: ctx->hidden_variable_set = 1; ctx->hidden_variable = d0; break;
case 2: ctx->noise = d0; break;
}
}
tmp[strlen] = 0;
if (strcmp(tmp, "rand") == 0)
{
- ctx->hidden_variable = 0;
+ ctx->hidden_variable_set = 0;
return 1;
}
else if (strcmp(tmp, "exit") == 0) instr = QANSEL_INSTRUCTION_EXIT;