@@ -1111,6 +1111,8 @@ impl Grid {
11111111 let mut scales0 = [ None , None ] ;
11121112 // factorization and fragmentation slices we use
11131113 let mut op_scales1 = [ Vec :: new ( ) , Vec :: new ( ) ] ;
1114+ // names for the scales in the same ordering
1115+ let names = [ "fac" , "frg" ] ;
11141116
11151117 let EvolveInfo {
11161118 fac1 : grid_fac1,
@@ -1140,6 +1142,7 @@ impl Grid {
11401142
11411143 let mut scales1 = [ None , None ] ;
11421144
1145+ // check that all operators are compatible with each other
11431146 for ( info, operator) in infos. iter ( ) . zip ( & operators) {
11441147 let dim_op_info = (
11451148 info. pids1 . len ( ) ,
@@ -1155,34 +1158,25 @@ impl Grid {
11551158 ) ) ) ;
11561159 }
11571160
1158- let ( scale0, name, scale1) = if info. conv_type . is_pdf ( ) {
1159- ( & mut scales0[ 0 ] , "fac" , & mut scales1[ 0 ] )
1160- } else {
1161- ( & mut scales0[ 1 ] , "frg" , & mut scales1[ 1 ] )
1162- } ;
1163-
1164- if let & mut Some ( scale0) = scale0 {
1165- // check that the initial scale of all EKOs in this slice agree with each other
1166- if !approx_eq ! ( f64 , scale0, info. fac0, ulps = 8 ) {
1167- return Err ( Error :: General ( format ! (
1168- "EKO slice's {name}0 = '{}' is incompatible with previous slices' {name}0 = '{scale0}'" ,
1169- info. fac0
1170- ) ) ) ;
1171- }
1172- } else {
1173- * scale0 = Some ( info. fac0 ) ;
1174- }
1175-
1176- if let & mut Some ( scale1) = scale1 {
1177- // check that the initial scale of all EKOs in this slice agree with each other
1178- if !approx_eq ! ( f64 , scale1, info. fac1, ulps = 8 ) {
1179- return Err ( Error :: General ( format ! (
1180- "EKO slice's {name}1 = '{}' is incompatible with previous slices' {name}1 = '{scale1}'" ,
1181- info. fac1
1182- ) ) ) ;
1161+ let idx = if info. conv_type . is_pdf ( ) { 0 } else { 1 } ;
1162+
1163+ // check that both initial- and process-level scales agree among all operators of
1164+ // the same convolution type
1165+ for ( scale, op_scale) in [
1166+ ( & mut scales0[ idx] , info. fac0 ) ,
1167+ ( & mut scales1[ idx] , info. fac1 ) ,
1168+ ] {
1169+ if let & mut Some ( scale) = scale {
1170+ // check that the initial scale of all EKOs in this slice agree with each other
1171+ if !approx_eq ! ( f64 , scale, op_scale, ulps = 8 ) {
1172+ return Err ( Error :: General ( format ! (
1173+ "EKO slice's {0}{idx} = '{op_scale}' is incompatible with previous slices' {0}{idx} = '{scale}'" ,
1174+ names[ idx] ,
1175+ ) ) ) ;
1176+ }
1177+ } else {
1178+ * scale = Some ( op_scale) ;
11831179 }
1184- } else {
1185- * scale1 = Some ( info. fac1 ) ;
11861180 }
11871181 }
11881182
0 commit comments