x = IR.RealVE("x", gid, 0.01, 100.0) gid += 1 y = IR.RealVE("y", gid, 0.01, 100.0) gid += 1 x2 = IR.BE("*", gid, x, x) gid += 1 y2 = IR.BE("*", gid, y, y) gid += 1 x2y2 = IR.BE("+", gid, x2, y2) gid += 1 sqrt_x2y2 = IR.UE("sqrt", gid, x2y2) gid += 1 sqrt_x = IR.BE("+", gid, sqrt_x2y2, x) gid += 1 two_sqrt_x = IR.BE("*", gid, IR.FConst(2.0), sqrt_x) gid += 1 sqrt_all = IR.UE("sqrt", gid, two_sqrt_x) gid += 1 half_sqrt_all = IR.BE("*", gid, IR.FConst(0.5), sqrt_all) IR.TuneExpr(half_sqrt_all)
import tft_ir_api as IR var_u = IR.RealVE("u", 0, (-100.0 - 0.0000001), (100.0 + 0.0000001)) var_v = IR.RealVE("v", 1, (20.0 - 0.000000001), (20000.0 + 0.000000001)) var_T = IR.RealVE("T", 2, (-30.0 - 0.000001), (50.0 + 0.000001)) t1 = IR.BE("+", 4, IR.FConst(331.4), IR.BE("*", 3, IR.FConst(0.6), var_T)) temp = IR.BE("+", 5, t1, var_u) temp = IR.BE("*", 8, temp, temp) r = IR.BE("/", 9, IR.BE("*", 7, IR.UE("-", 6, t1), var_v), temp) IR.TuneExpr(r)
import tft_ir_api as IR gid = 0 x = IR.RealVE('x', gid, -10.0, 10.0) e = IR.RealVE('e', gid + 1, -0.000001, 0.000001) gid += 2 temp0 = IR.BE('+', gid, x, e) temp1 = IR.UE('cos', gid + 1, temp0) rel = IR.BE('-', gid + 3, temp1, IR.UE('cos', gid + 2, x)) IR.TuneExpr(rel)
import tft_ir_api as IR gid = 0 x = IR.RealVE('x', gid, -1.0, 1.0) gid += 1 temp0 = IR.UE('log', gid + 1, IR.BE('-', gid, IR.FConst(1.0), x)) temp1 = IR.UE('log', gid + 3, IR.BE('+', gid + 2, IR.FConst(1.0), x)) gid += 4 rel = IR.BE('/', gid, temp0, temp1) gid += 1 IR.TuneExpr(rel)
import tft_ir_api as IR gid = 0 x = IR.RealVE('x', gid , -10.0, 10.0) e = IR.RealVE('e', gid+1, -0.000001, 0.000001) gid += 2 temp0 = IR.UE('sin', gid+1, IR.BE('/', gid, e, IR.FConst(2.0))) gid += 2 temp1 = IR.BE('/', gid+2, IR.BE('+', gid+1, x, IR.BE('+', gid, x, e)), IR.FConst(2.0)) gid += 3 rel = IR.BE('*', gid+2, IR.FConst(-2.0), IR.BE('*', gid+1, temp0, IR.UE('sin', gid, temp1))) gid += 3 IR.TuneExpr(rel)
gid_data_ave = gid_data gid_data_dev = gid_data gid_data_x = gid_data ave = IR.RealVE("ave", gid_data_ave, -1.0, 1.0) dev = IR.RealVE("dev", gid_data_dev, 1.0, 3.0) x = IR.RealVE("x", gid_data_x, -10.0, 10.0) sqrt_2pi = IR.FConst(math.sqrt(2.0 * math.pi)) temp3 = IR.BE("*", 3, dev, sqrt_2pi) a = IR.BE("/", 4, IR.FConst(1.0), temp3) b = ave c = dev temp5 = IR.BE("-", 5, x, b) temp6 = IR.BE("*", 6, temp5, temp5) temp7 = IR.BE("*", 7, IR.FConst(2.0), IR.BE("*", 7, c, c)) temp8 = IR.UE("-", 8, IR.BE("/", 8, temp6, temp7)) temp9 = IR.UE("exp", 9, temp8) rel = IR.BE("*", 10, a, temp9) IR.SetGroupWeight(9, 100.0) IR.TuneExpr(rel)
# ======== # sin(A/2) = +/- \sqrt{\frac{1 - cos(A)}{2.0}} # ======== import math import tft_ir_api as IR x = IR.RealVE("x", 0, 0.0, 20.0) a = IR.RealVE("a", 0, 1.0, 5.0) x2 = IR.BE("*", 1, x, x) a2 = IR.BE("*", 2, a, a) a3 = IR.BE("*", 3, a, a2) e_0 = IR.BE("*", 4, IR.FConst(-1.0), x2) e_1 = IR.BE("*", 5, IR.FConst(2.0), a2) e_2 = IR.BE("/", 6, e_0, e_1) e = IR.UE("exp", 7, e_2) d_0 = IR.BE("*", 8, x2, e) d = IR.BE("/", 9, d_0, a3) rel = IR.BE("*", 10, IR.FConst(math.sqrt(2.0 / math.pi)), d) IR.SetGroupWeight(7, 100.0) IR.TuneExpr(rel)
import math import tft_ir_api as IR r = IR.RealVE("r", 0, 1.0, 10.0) h = IR.RealVE("h", 1, 1.0, 10.0) pi = IR.FConst(math.pi) h2 = IR.BE("*", 2, h, h) r2 = IR.BE("*", 3, r, r) hr2 = IR.BE("+", 4, h2, r2) pir = IR.BE("*", 5, pi, r) tm1 = IR.UE("sqrt", 6, hr2) tm2 = IR.BE("+", 7, r, tm1) rel = IR.BE("*", 8, pir, tm2) IR.SetGroupWeight(6, 16.0) IR.TuneExpr(rel)