@@ -133,7 +133,6 @@ pub fn solve_odgp_with_parity(
133133 . map ( move |alpha| ( alpha * ZRootTwo :: new ( IBig :: ZERO , IBig :: ONE ) ) + & p)
134134}
135135
136-
137136pub fn solve_scaled_odgp ( i : Interval , j : Interval , k : i64 ) -> impl Iterator < Item = DRootTwo > {
138137 let scale = pow_sqrt2 ( k) ;
139138 let neg_scale = -scale. clone ( ) ;
@@ -142,22 +141,22 @@ pub fn solve_scaled_odgp(i: Interval, j: Interval, k: i64) -> impl Iterator<Item
142141 } else {
143142 j. scale ( & neg_scale)
144143 } ;
145- solve_odgp ( i. scale ( & scale) , scaled_j)
146- . map ( move |alpha| DRootTwo :: new ( alpha, k) )
144+ solve_odgp ( i. scale ( & scale) , scaled_j) . map ( move |alpha| DRootTwo :: new ( alpha, k) )
147145}
148146
149- pub fn solve_scaled_odgp_with_parity (
147+ pub fn solve_scaled_odgp_with_parity_k_ne_0 (
150148 i : Interval ,
151149 j : Interval ,
152150 k : i64 ,
153151 beta : & DRootTwo ,
154- ) -> Vec < DRootTwo > {
155- if k == 0 {
156- let base = beta. renew_denomexp ( 0 ) ;
157- return solve_odgp_with_parity ( i, j, & base)
158- . map ( DRootTwo :: from_zroottwo)
159- . collect ( ) ;
160- }
152+ ) -> impl Iterator < Item = DRootTwo > {
153+ // Can't do this because the iterators are not of the same type.
154+ // But this function is only called with k == 1. So we don't need the k == 0 branch.
155+ // if k == 0 {
156+ // let base = beta.renew_denomexp(0);
157+ // return solve_odgp_with_parity(i, j, &base)
158+ // .map(DRootTwo::from_zroottwo);
159+ // }
161160
162161 let p = beta. renew_denomexp ( k) . parity ( ) ;
163162 let offset = if p == IBig :: ZERO {
@@ -169,7 +168,7 @@ pub fn solve_scaled_odgp_with_parity(
169168 let sub_i = i - offset. to_real ( ) ;
170169 let sub_j = j - offset. conj_sq2 ( ) . to_real ( ) ;
171170 let sol = solve_scaled_odgp ( sub_i, sub_j, k - 1 ) ;
172- sol. into_iter ( ) . map ( |a| a + offset. clone ( ) ) . collect ( )
171+ sol. map ( move |a| a + offset. clone ( ) )
173172}
174173
175174#[ cfg( test) ]
0 commit comments