@@ -28,17 +28,7 @@ pub fn solve_tdgp(
2828) -> Vec < DOmega > {
2929 let mut sol_sufficient = Vec :: with_capacity ( 100 ) ; // Pre-allocate reasonable capacity
3030
31- let mut sol_x = solve_scaled_odgp ( bbox_a. x . clone ( ) , bbox_b. x . clone ( ) , k + 1 ) ;
32-
33- let sol_y = solve_scaled_odgp (
34- bbox_a
35- . y
36- . fatten ( & ( bbox_a. y . width ( ) / ib_to_bf_prec ( IBig :: from ( 10000 ) ) ) ) ,
37- bbox_b
38- . y
39- . fatten ( & ( bbox_b. y . width ( ) / ib_to_bf_prec ( IBig :: from ( 10000 ) ) ) ) ,
40- k + 1 ,
41- ) ;
31+ let mut sol_x = solve_scaled_odgp ( & bbox_a. x , & bbox_b. x , k + 1 ) ;
4232
4333 let alpha0 = match sol_x. next ( ) {
4434 Some ( val) => val,
@@ -49,17 +39,26 @@ pub fn solve_tdgp(
4939 let _k_ibig = IBig :: from ( k) ;
5040 let dx = DRootTwo :: power_of_inv_sqrt2 ( k) ;
5141 let op_g_inv_result = op_g. inv ( ) ;
52- let op_g_inv = op_g_inv_result. as_ref ( ) . unwrap ( ) ;
42+
43+ let op_g_inv = op_g_inv_result. unwrap ( ) ;
5344 let zero_droottwo = DRootTwo :: from_int ( IBig :: ZERO ) ;
45+ let v = op_g_inv * DOmega :: from_droottwo_vector ( & dx, & zero_droottwo, k) ;
5446
55- let v = op_g_inv. clone ( ) * DOmega :: from_droottwo_vector ( & dx, & zero_droottwo, k) ;
5647 let v_conj_sq2 = v. conj_sq2 ( ) ;
48+
49+ let bbox_a_new = bbox_a
50+ . y
51+ . fatten ( & ( bbox_a. y . width ( ) / ib_to_bf_prec ( IBig :: from ( 10000 ) ) ) ) ;
52+ let bbox_b_new = bbox_b
53+ . y
54+ . fatten ( & ( bbox_b. y . width ( ) / ib_to_bf_prec ( IBig :: from ( 10000 ) ) ) ) ;
55+ let sol_y = solve_scaled_odgp ( & bbox_a_new, & bbox_b_new, k + 1 ) ;
56+
5757 for beta in sol_y {
5858 let dx = DRootTwo :: power_of_inv_sqrt2 ( k) ;
59- let z0 = op_g. inv ( ) . as_ref ( ) . unwrap ( ) . clone ( )
60- * DOmega :: from_droottwo_vector ( & alpha0, & beta, k + 1 ) ;
61- let v = op_g. inv ( ) . as_ref ( ) . unwrap ( ) . clone ( )
62- * DOmega :: from_droottwo_vector ( & dx, & droot_zero, k) ;
59+ let z0 = op_g. inv ( ) . unwrap ( ) * DOmega :: from_droottwo_vector ( & alpha0, & beta, k + 1 ) ;
60+ let v = op_g. inv ( ) . unwrap ( ) * DOmega :: from_droottwo_vector ( & dx, & droot_zero, k) ;
61+
6362 let t_a = set_a. intersect ( & z0, & v) ;
6463 let t_b = set_b. intersect ( z0. conj_sq2 ( ) , v_conj_sq2) ;
6564 if t_a. is_none ( ) || t_b. is_none ( ) {
@@ -71,29 +70,30 @@ pub fn solve_tdgp(
7170 let ( mut int_a, mut int_b) = ( Interval :: new ( t_a. 0 , t_a. 1 ) , Interval :: new ( t_b. 0 , t_b. 1 ) ) ;
7271 let dt_a = {
7372 let ten = ib_to_bf_prec ( IBig :: from ( 10 ) ) ;
73+
74+ let shift_k = IBig :: ONE << ( k as usize ) ;
75+ let width_product = shift_k * int_b. width ( ) ;
7476 let max_val = {
75- let shift_k = IBig :: ONE << ( k as usize ) ;
76- let width_product = shift_k * int_b. width ( ) ;
7777 if ten > width_product {
78- ten. clone ( )
78+ & ten
7979 } else {
80- width_product
80+ & width_product
8181 }
8282 } ;
83- fb_with_prec ( & ten / & max_val)
83+ fb_with_prec ( & ten / max_val)
8484 } ;
8585 let dt_b = {
8686 let ten = ib_to_bf_prec ( IBig :: from ( 10 ) ) ;
87+ let shift_k = IBig :: from ( 1 ) << ( k as usize ) ;
88+ let width_product = shift_k * int_a. width ( ) ;
8789 let max_val = {
88- let shift_k = IBig :: from ( 1 ) << ( k as usize ) ;
89- let width_product = shift_k * int_a. width ( ) ;
9090 if ten > width_product {
91- ten. clone ( )
91+ & ten
9292 } else {
93- width_product
93+ & width_product
9494 }
9595 } ;
96- fb_with_prec ( & ten / & max_val)
96+ fb_with_prec ( & ten / max_val)
9797 } ;
9898
9999 int_a = int_a. fatten ( & dt_a) ;
0 commit comments