11// 2D stats are based on the Youngs-Cramer implementation in PG here:
22// https://github.com/postgres/postgres/blob/472e518a44eacd9caac7d618f1b6451672ca4481/src/backend/utils/adt/float.c#L3260
3- use crate :: { FloatLike , StatsError , XYPair , INV_FLOATING_ERROR_THRESHOLD , M3 , M4 } ;
3+ use crate :: { m3 , m4 , FloatLike , StatsError , XYPair , INV_FLOATING_ERROR_THRESHOLD } ;
44use serde:: { Deserialize , Serialize } ;
55use twofloat:: TwoFloat ;
66
@@ -88,11 +88,11 @@ impl<T: FloatLike> StatsSummary2D<T> {
8888 let tmpy = p. y * self . n64 ( ) - self . sy ;
8989 let scale = ( self . n64 ( ) * old. n64 ( ) ) . recip ( ) ;
9090 self . sx2 += tmpx * tmpx * scale;
91- self . sx3 = M3 :: accum ( old. n64 ( ) , old. sx , old. sx2 , old. sx3 , p. x ) ;
92- self . sx4 = M4 :: accum ( old. n64 ( ) , old. sx , old. sx2 , old. sx3 , old. sx4 , p. x ) ;
91+ self . sx3 = m3 :: accum ( old. n64 ( ) , old. sx , old. sx2 , old. sx3 , p. x ) ;
92+ self . sx4 = m4 :: accum ( old. n64 ( ) , old. sx , old. sx2 , old. sx3 , old. sx4 , p. x ) ;
9393 self . sy2 += tmpy * tmpy * scale;
94- self . sy3 = M3 :: accum ( old. n64 ( ) , old. sy , old. sy2 , old. sy3 , p. y ) ;
95- self . sy4 = M4 :: accum ( old. n64 ( ) , old. sy , old. sy2 , old. sy3 , old. sy4 , p. y ) ;
94+ self . sy3 = m3 :: accum ( old. n64 ( ) , old. sy , old. sy2 , old. sy3 , p. y ) ;
95+ self . sy4 = m4 :: accum ( old. n64 ( ) , old. sy , old. sy2 , old. sy3 , old. sy4 , p. y ) ;
9696 self . sxy += tmpx * tmpy * scale;
9797 if self . has_infinite ( ) {
9898 if self . check_overflow ( & old, p) {
@@ -230,11 +230,11 @@ impl<T: FloatLike> StatsSummary2D<T> {
230230 let tmpy = p. y * self . n64 ( ) - self . sy ;
231231 let scale = ( self . n64 ( ) * new. n64 ( ) ) . recip ( ) ;
232232 new. sx2 = self . sx2 - tmpx * tmpx * scale;
233- new. sx3 = M3 :: remove ( new. n64 ( ) , new. sx , new. sx2 , self . sx3 , p. x ) ;
234- new. sx4 = M4 :: remove ( new. n64 ( ) , new. sx , new. sx2 , new. sx3 , self . sx4 , p. x ) ;
233+ new. sx3 = m3 :: remove ( new. n64 ( ) , new. sx , new. sx2 , self . sx3 , p. x ) ;
234+ new. sx4 = m4 :: remove ( new. n64 ( ) , new. sx , new. sx2 , new. sx3 , self . sx4 , p. x ) ;
235235 new. sy2 = self . sy2 - tmpy * tmpy * scale;
236- new. sy3 = M3 :: remove ( new. n64 ( ) , new. sy , new. sy2 , self . sy3 , p. y ) ;
237- new. sy4 = M4 :: remove ( new. n64 ( ) , new. sy , new. sy2 , new. sy3 , self . sy4 , p. y ) ;
236+ new. sy3 = m3 :: remove ( new. n64 ( ) , new. sy , new. sy2 , self . sy3 , p. y ) ;
237+ new. sy4 = m4 :: remove ( new. n64 ( ) , new. sy , new. sy2 , new. sy3 , self . sy4 , p. y ) ;
238238 new. sxy = self . sxy - tmpx * tmpy * scale;
239239 Some ( new)
240240 }
@@ -293,7 +293,7 @@ impl<T: FloatLike> StatsSummary2D<T> {
293293 n,
294294 sx : self . sx + other. sx ,
295295 sx2 : self . sx2 + other. sx2 + self . n64 ( ) * other. n64 ( ) * tmpx * tmpx / T :: from_u64 ( n) ,
296- sx3 : M3 :: combine (
296+ sx3 : m3 :: combine (
297297 self . n64 ( ) ,
298298 other. n64 ( ) ,
299299 self . sx ,
@@ -303,7 +303,7 @@ impl<T: FloatLike> StatsSummary2D<T> {
303303 self . sx3 ,
304304 other. sx3 ,
305305 ) ,
306- sx4 : M4 :: combine (
306+ sx4 : m4 :: combine (
307307 self . n64 ( ) ,
308308 other. n64 ( ) ,
309309 self . sx ,
@@ -317,7 +317,7 @@ impl<T: FloatLike> StatsSummary2D<T> {
317317 ) ,
318318 sy : self . sy + other. sy ,
319319 sy2 : self . sy2 + other. sy2 + self . n64 ( ) * other. n64 ( ) * tmpy * tmpy / T :: from_u64 ( n) ,
320- sy3 : M3 :: combine (
320+ sy3 : m3 :: combine (
321321 self . n64 ( ) ,
322322 other. n64 ( ) ,
323323 self . sy ,
@@ -327,7 +327,7 @@ impl<T: FloatLike> StatsSummary2D<T> {
327327 self . sy3 ,
328328 other. sy3 ,
329329 ) ,
330- sy4 : M4 :: combine (
330+ sy4 : m4 :: combine (
331331 self . n64 ( ) ,
332332 other. n64 ( ) ,
333333 self . sy ,
@@ -382,7 +382,7 @@ impl<T: FloatLike> StatsSummary2D<T> {
382382 let tmpy = part. sy / part. n64 ( ) - remove. sy / remove. n64 ( ) ;
383383 part. sx2 =
384384 combined. sx2 - remove. sx2 - part. n64 ( ) * remove. n64 ( ) * tmpx * tmpx / combined. n64 ( ) ;
385- part. sx3 = M3 :: remove_combined (
385+ part. sx3 = m3 :: remove_combined (
386386 part. n64 ( ) ,
387387 remove. n64 ( ) ,
388388 part. sx ,
@@ -392,7 +392,7 @@ impl<T: FloatLike> StatsSummary2D<T> {
392392 self . sx3 ,
393393 remove. sx3 ,
394394 ) ;
395- part. sx4 = M4 :: remove_combined (
395+ part. sx4 = m4 :: remove_combined (
396396 part. n64 ( ) ,
397397 remove. n64 ( ) ,
398398 part. sx ,
@@ -406,7 +406,7 @@ impl<T: FloatLike> StatsSummary2D<T> {
406406 ) ;
407407 part. sy2 =
408408 combined. sy2 - remove. sy2 - part. n64 ( ) * remove. n64 ( ) * tmpy * tmpy / combined. n64 ( ) ;
409- part. sy3 = M3 :: remove_combined (
409+ part. sy3 = m3 :: remove_combined (
410410 part. n64 ( ) ,
411411 remove. n64 ( ) ,
412412 part. sy ,
@@ -416,7 +416,7 @@ impl<T: FloatLike> StatsSummary2D<T> {
416416 self . sy3 ,
417417 remove. sy3 ,
418418 ) ;
419- part. sy4 = M4 :: remove_combined (
419+ part. sy4 = m4 :: remove_combined (
420420 part. n64 ( ) ,
421421 remove. n64 ( ) ,
422422 part. sy ,
0 commit comments