Exemplo n.º 1
0
/* TreeParityMachine */
void TreeParityMachine::ComputeTPMResult (const DynamicArray <int> & X) {
	int i, j, sum;
	TPMOutput = 1;
	for (i = 0; i < K; i++) {
		sum = 0;
		for (j = 0; j < N; j++) {
			sum = sum + (W.Z[i * N + j] * X.Z[i * N + j]);
		}
		H.Z[i]= Signum(sum);
		TPMOutput = TPMOutput * Signum (sum);
	}
}
Exemplo n.º 2
0
void DateTime::adjust(int minutes)
{
    long tmp, mod, nxt;

    tmp = mm + minutes;
    nxt = tmp / 60;// hours
    mod = abs(tmp) % 60;
    mod = mod * Signum(tmp) + 60;
    mod %= 60;
    mm = mod;

    tmp = nxt + hh;
    nxt = tmp / 24;
    mod = abs(tmp) % 24;
    mod = mod * Signum(tmp) + 24;
    mod %= 24;
    hh = mod;

    tmp = nxt + d;
    mod = LengthOfMonth();

    if (tmp > mod)
    {
        tmp -= mod;
        d = tmp + 1;
        m++;
    }
    if (tmp < 1)
    {
        m--;
        mod = LengthOfMonth();
        d = tmp + mod;
    }

    tmp=yOff;
    if(m == 0)
    {
        m = 12;
        tmp--;
    }

    if(m > 12)
    {
        m = 1;
        tmp++;
    }

    tmp += 100;
    tmp %= 100;
    yOff = tmp;
}
Exemplo n.º 3
0
int Gamepad::RightStick_Y() {

	int raw = (int)m_State.Gamepad.sThumbRY;

	if (abs(raw) - RYDeadzone <= 0) {
		return 0;
	}
	else {
		return Signum(raw)*(abs(raw) - RYDeadzone)*RYScale / (stickMax - RYDeadzone);
	}

}
Exemplo n.º 4
0
int Gamepad::LeftStick_Y() {

	int raw = (int)m_State.Gamepad.sThumbLY;

	if (abs(raw) - LYDeadzone <= 0) {
		return 0;
	}
	else {
		return Signum(raw)*(abs(raw) - LYDeadzone)*LYScale / (stickMax - LYDeadzone);
	}

}