1- ; Hard benchmarks extracted from growlibm/omerc.cpp Oblique Mercator setup, focusing on tight domain guards and coupled trig/hyperbolic transforms.
1+ (FPCore (W)
2+ :name "omerc-forward-half-diff"
3+ :pre (not (= W 0.0))
4+ (* 0.5 (- W (/ 1.0 W))))
25
3- (FPCore (S V singam cosgam T)
4- :name "omerc-hard-u-mix"
5- :pre (and (> (fabs T) 1e-12)
6- (< (fabs singam) 1)
7- (< (fabs cosgam) 1)
8- (< (fabs V) 1))
9- (/ (- (* S singam) (* V cosgam)) T))
6+ (FPCore (W)
7+ :name "omerc-forward-half-sum"
8+ :pre (not (= W 0.0))
9+ (* 0.5 (+ W (/ 1.0 W))))
10+
11+ (FPCore (S T singam cosgam B lam)
12+ :name "omerc-forward-U"
13+ :pre (not (= T 0.0))
14+ (let* ((V (sin (* B lam))))
15+ (/ (- (* S singam) (* V cosgam)) T)))
1016
1117(FPCore (U ArB)
12- :name "omerc-hard-log-ratio"
13- :pre (and (< (fabs U) 0.999999)
14- (> ArB 0))
15- (* 0.5
16- (* ArB
17- (log (/ (- 1 U)
18- (+ 1 U))))))
19-
20- (FPCore (ArB S V singam cosgam temp)
21- :name "omerc-hard-atan2-rot"
22- :pre (and (>= (fabs temp) 1e-7)
23- (< (fabs singam) 1)
24- (< (fabs cosgam) 1)
25- (< (fabs V) 1))
26- (* ArB
27- (atan2 (+ (* S cosgam)
28- (* V singam))
29- temp)))
18+ :name "omerc-forward-v"
19+ :pre (< (fabs U) 1.0)
20+ (* 0.5 (* ArB (log (/ (- 1.0 U) (+ 1.0 U))))))
21+
22+ (FPCore (S B lam cosgam singam ArB)
23+ :name "omerc-forward-u-atan"
24+ :pre (>= (fabs (cos (* B lam))) 1e-7)
25+ (let* ((V (sin (* B lam)))
26+ (temp (cos (* B lam)))
27+ (numer (+ (* S cosgam) (* V singam))))
28+ (* ArB (atan2 numer temp))))
29+
30+ (FPCore (A lam)
31+ :name "omerc-forward-u-linear"
32+ (* A lam))
33+
34+ (FPCore (u v cosrot sinrot u0)
35+ :name "omerc-forward-rot-x"
36+ (let* ((udiff (- u u0)))
37+ (+ (* v cosrot) (* udiff sinrot))))
38+
39+ (FPCore (u v cosrot sinrot u0)
40+ :name "omerc-forward-rot-y"
41+ (let* ((udiff (- u u0)))
42+ (- (* udiff cosrot) (* v sinrot))))
43+
44+ (FPCore (BrA v)
45+ :name "omerc-inverse-exp"
46+ (exp (- (* BrA v))))
3047
3148(FPCore (Qp)
32- :name "omerc-hard-sinh-sp"
33- :pre (> Qp 0)
34- (* 0.5
35- (- Qp
36- (/ 1 Qp))))
49+ :name "omerc-inverse-Sp"
50+ :pre (not (= Qp 0.0))
51+ (* 0.5 (- Qp (/ 1.0 Qp))))
3752
3853(FPCore (Qp)
39- :name "omerc-hard-cosh-tp"
40- :pre (> Qp 0)
41- (* 0.5
42- (+ Qp
43- (/ 1 Qp))))
44-
45- (FPCore (Vp Sp singam cosgam Tp)
46- :name "omerc-hard-up-frac"
47- :pre (and (> (fabs Tp) 1e-12)
48- (< (fabs singam) 1)
49- (< (fabs cosgam) 1)
50- (< (fabs Vp) 1))
51- (/ (+ (* Vp cosgam)
52- (* Sp singam))
53- Tp))
54-
55- (FPCore (Esc Up)
56- :name "omerc-hard-phi-scale"
57- :pre (and (> Esc 0)
58- (< (fabs Up) 0.999999))
59- (/ Esc
60- (sqrt (/ (+ 1 Up)
61- (- 1 Up)))))
62-
63- (FPCore (rB Sp Vp singam cosgam BrAu)
64- :name "omerc-hard-lambda-atan2"
65- :pre (and (< (fabs singam) 1)
66- (< (fabs cosgam) 1)
67- (< (fabs Vp) 1))
68- (* -1
69- (* rB
70- (atan2 (- (* Sp cosgam)
71- (* Vp singam))
72- (cos BrAu)))))
73-
74- (FPCore (B lamDiff denom)
75- :name "omerc-hard-gamma0-atan"
76- :pre (and (> (fabs denom) 1e-12)
77- (< (fabs lamDiff) 10))
78- (atan (/ (* 2 (sin (* B lamDiff)))
79- denom)))
80-
81- (FPCore (lamc F gamma0 B)
82- :name "omerc-hard-lam0-shift"
83- :pre (and (> (fabs B) 1e-12)
84- (> (fabs F) 1e-12)
85- (< (fabs (* (* 0.5 (- F (/ 1 F)))
86- (tan gamma0)))
87- 0.999999))
88- (let ((asinArg (* (* 0.5 (- F (/ 1 F)))
89- (tan gamma0))))
90- (- lamc
91- (/ (asin asinArg)
92- B))))
93-
94- (FPCore (ArB D alpha_c)
95- :name "omerc-hard-u0-atan"
96- :pre (and (> ArB 0)
97- (>= (- (* D D) 1) 0)
98- (> (fabs (cos alpha_c)) 1e-12))
99- (fabs (* ArB
100- (atan (/ (sqrt (- (* D D) 1))
101- (cos alpha_c))))))
102-
103- (FPCore (ArB gamma0 fortpi)
104- :name "omerc-hard-v-pole"
105- :pre (and (> ArB 0)
106- (< (fabs gamma0) 3)
107- (> (tan (- fortpi (* 0.5 gamma0))) 0))
108- (* ArB
109- (log (tan (- fortpi
110- (* 0.5 gamma0))))))
54+ :name "omerc-inverse-Tp"
55+ :pre (not (= Qp 0.0))
56+ (* 0.5 (+ Qp (/ 1.0 Qp))))
57+
58+ (FPCore (Sp Tp Vp singam cosgam)
59+ :name "omerc-inverse-Up"
60+ :pre (not (= Tp 0.0))
61+ (/ (+ (* Vp cosgam) (* Sp singam)) Tp))
62+
63+ (FPCore (Up Esc)
64+ :name "omerc-inverse-prephi"
65+ :pre (< (fabs Up) 1.0)
66+ (/ Esc (sqrt (/ (+ 1.0 Up) (- 1.0 Up)))))
67+
68+ (FPCore (Sp Vp cosgam singam BrA u rB)
69+ :name "omerc-inverse-lambda"
70+ (let* ((temp (cos (* BrA u)))
71+ (numer (- (* Sp cosgam) (* Vp singam))))
72+ (- (* rB (atan2 numer temp)))))
73+
74+ (FPCore (phi0 es)
75+ :name "omerc-init-con"
76+ :pre (and (>= es 0.0)
77+ (< es 1.0)
78+ (< (fabs phi0) (/ PI 2.0)))
79+ (let* ((sinphi0 (sin phi0)))
80+ (- 1.0 (* es (* sinphi0 sinphi0)))))
81+
82+ (FPCore (phi0 es one_es)
83+ :name "omerc-init-B"
84+ :pre (and (>= es 0.0)
85+ (< es 1.0)
86+ (> one_es 0.0)
87+ (< (fabs phi0) (/ PI 2.0)))
88+ (let* ((cosphi0 (cos phi0))
89+ (cos2 (* cosphi0 cosphi0))
90+ (cos4 (* cos2 cos2)))
91+ (sqrt (+ 1.0 (/ (* es cos4) one_es)))))
92+
93+ (FPCore (phi0 es one_es com)
94+ :name "omerc-init-D"
95+ :pre (and (>= es 0.0)
96+ (< es 1.0)
97+ (> one_es 0.0)
98+ (> com 0.0)
99+ (< (fabs phi0) (/ PI 2.0))
100+ (> (fabs (cos phi0)) 0.0)
101+ (> (- 1.0 (* es (* (sin phi0) (sin phi0)))) 0.0))
102+ (let* ((sinphi0 (sin phi0))
103+ (cosphi0 (cos phi0))
104+ (cos2 (* cosphi0 cosphi0))
105+ (cos4 (* cos2 cos2))
106+ (con (- 1.0 (* es (* sinphi0 sinphi0))))
107+ (B (sqrt (+ 1.0 (/ (* es cos4) one_es))))
108+ (root (sqrt con)))
109+ (/ (* B com) (* cosphi0 root))))
110+
111+ (FPCore (ArB D alpha_c phi0)
112+ :name "omerc-init-u0"
113+ :pre (and (>= (- (* D D) 1.0) 0.0)
114+ (not (= (cos alpha_c) 0.0)))
115+ (let* ((ratio (/ (sqrt (- (* D D) 1.0)) (cos alpha_c)))
116+ (angle (atan ratio))
117+ (scaled (* ArB angle))
118+ (mag (fabs scaled)))
119+ (if (< phi0 0.0)
120+ (- mag)
121+ mag)))
122+
123+ (FPCore (ArB gamma0)
124+ :name "omerc-init-v-pole-n"
125+ :pre (> (tan (- (/ PI 4.0) (* 0.5 gamma0))) 0.0)
126+ (* ArB (log (tan (- (/ PI 4.0) (* 0.5 gamma0))))))
127+
128+ (FPCore (ArB gamma0)
129+ :name "omerc-init-v-pole-s"
130+ :pre (> (tan (+ (/ PI 4.0) (* 0.5 gamma0))) 0.0)
131+ (* ArB (log (tan (+ (/ PI 4.0) (* 0.5 gamma0))))))
0 commit comments