50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
# const int n_p_pad = (n_p + 7) & ~7;
|
|
|
|
# ADDs: n_iter * n_p * 33 +
|
|
# n_iter * n_p * (n_p_pad / 8) * 232 +
|
|
# n_iter * n_p * board.n_obstacles * 10
|
|
|
|
# MULTs: n_iter * n_p * 40 +
|
|
# n_iter * n_p * (n_p_pad / 8) * 320 +
|
|
# n_iter * n_p * board.n_obstacles * 13
|
|
|
|
# DIVs: n_iter * n_p * (n_p_pad / 8) * 8 +
|
|
# n_iter * n_p * board.n_obstacles
|
|
|
|
# SQRTs: n_iter * n_p +
|
|
# n_iter * n_p * (n_p_pad / 8) * 24 +
|
|
# n_iter * n_p * board.n_obstacles
|
|
|
|
# EXPs: n_iter * n_p * board.n_obstacles
|
|
|
|
|
|
def adds(n_iter: int, n_p: int, n_obs: int = 2) -> int:
|
|
n_p_pad = (n_p + 7) & ~7
|
|
return int(n_iter * n_p * (33 + (n_p_pad // 8) * 232 + n_obs * 10))
|
|
|
|
|
|
def mults(n_iter: int, n_p: int, n_obs: int = 2) -> int:
|
|
n_p_pad = (n_p + 7) & ~7
|
|
return int(n_iter * n_p * (40 + (n_p_pad // 8) * 320 + n_obs * 13))
|
|
|
|
|
|
def divs(n_iter: int, n_p: int, n_obs: int = 2) -> int:
|
|
n_p_pad = (n_p + 7) & ~7
|
|
return int(n_iter * n_p * ((n_p_pad // 8) * 8 + n_obs))
|
|
|
|
|
|
def sqrts(n_iter: int, n_p: int, n_obs: int = 2) -> int:
|
|
n_p_pad = (n_p + 7) & ~7
|
|
return int(n_iter * n_p * (1 + (n_p_pad // 8) * 24 + n_obs))
|
|
|
|
|
|
def exps(n_iter: int, n_p: int, n_obs: int = 2) -> int:
|
|
n_p_pad = (n_p + 7) & ~7
|
|
return int(n_iter * n_p * n_obs)
|
|
|
|
|
|
def total(n_iter: int, n_p: int, n_obs: int = 2) -> int:
|
|
return adds(n_iter, n_p, n_obs) + mults(n_iter, n_p, n_obs) + divs(
|
|
n_iter, n_p, n_obs) + sqrts(n_iter, n_p,
|
|
n_obs) + exps(n_iter, n_p, n_obs) * 30
|