Files
secondo/Algebras/Histogram/Histogram.examples

349 lines
14 KiB
Plaintext
Raw Normal View History

2026-01-23 17:03:45 +08:00
Database: opt
Restore: NO
Operator : set_histogram1d
Number : 1
Signature: (stream real) -> histogram1d
Example : query realstream(-1.0, 2.0, 1.0) set_histogram1d
Result : (histogram1d((-1.0 0.0 1.0 2.0)(0.0 0.0 0.0)))
Operator : set_histogram2d
Number : 1
Signature: (stream real) x (stream real) -> histogram2d
Example : query realstream(-1.0, 2.0, 1.0) realstream(8.0, 9.0, 0.5) set_histogram2d
Result : (histogram2d((-1.0 0.0 1.0 2.0)(8.0 8.5 9.0)(0.0 0.0 0.0 0.0 0.0 0.0)))
Operator : create_histogram1d
Number : 1
Signature: (stream(tuple((a1 t1) ... (an tn))) x (ai real) x histogram1d -> histogram1d
Example : query realstream(0.0, 4.0, 1.0) transformstream create_histogram1d[Elem, realstream(0.0, 10.0, 2.0) set_histogram1d];
Result : (histogram1d ((0.0 2.0 4.0 6.0 8.0 10.0)(2.0 2.0 1.0 0.0 0.0)))
Operator : create_histogram2d
Number : 1
Signature: (stream(tuple((a1 t1) ... (an tn))) x (ai real) x (aj real) x histogram2d -> histogram2d
Example : query realstream(0.0, 2.0, 1.0) transformstream {a} realstream(6.0, 8.0, 1.0) transformstream {b} symmproduct create_histogram2d[Elem_a, Elem_b, [const histogram2d value ((0.0 0.5 2.5)(6.0 7.8 10.0)(0.0 0.0 0.0 0.0))]];
Result : (histogram2d((0.0 0.5 2.5)(6.0 7.8 10.0)(2.0 1.0 4.0 2.0)))
Operator : create_histogram1d_equiwidth
Number : 1
Signature: (stream(tuple((a1 t1) ... (an tn))) x (ai real) x int -> histogram1d
Example : query realstream(0.0, 10.0, 0.1) transformstream create_histogram1d_equiwidth[Elem, 4];
Result : (histogram1d((0.0 2.5 5.0 7.5 10.0000001)(25.0 25.0 25.0 26.0)))
Operator : create_histogram2d_equiwidth
Number : 1
Signature: (stream(tuple((a1 t1) ... (an tn))) x (ai real) x (aj real) x int x int -> histogram2d
Example : query realstream(0.0, 15.0, 0.1) transformstream {a} realstream(6.0, 18.0, 1.0) transformstream {b} symmproduct create_histogram2d_equiwidth[Elem_a, Elem_b, 3, 4];
Result : (histogram2d((0.0 5.0 10.0 15.0000001)(6.0 9.0 12.0 15.0 18.0000001)(150.0 150.0 150.0 200.0 150.0 150.0 150.0 200.0 153.0 153.0 153.0 204.0)))
Operator : create_histogram1d_equicount
Number : 1
Signature: (stream(tuple((a1 t1) ... (an tn))) x (ai real) x int -> histogram1d
Example : query realstream(0.0, 10.0, 0.1) transformstream create_histogram1d_equicount[Elem, 4];
Result : (histogram1d((0.0 2.6 5.1 7.6 10.00000001)(26.0 25.0 25.0 25.0)))
Operator : create_histogram2d_equicount
Number : 1
Signature: (stream(tuple((a1 t1) ... (an tn))) x (ai real) x (aj real) x int x int -> histogram2d
Example : query realstream(0.0, 15.0, 0.1) transformstream {a} realstream(6.0, 18.0, 1.0) transformstream {b} symmproduct create_histogram2d_equicount[Elem_a, Elem_b, 3, 4];
Result : (histogram2d((0.0 5.1 10.2 15.00000001)(6.0 10.0 14.0 18.0 18.00000001)(204.0 204.0 204.0 51.0 204.0 204.0 204.0 51.0 196.0 196.0 196.0 49.0)))
Operator : no_components
Number : 1
Signature: histogram1d -> int
Example : query no_components ([const histogram1d value ((-1.5 0.4 1.9 2.0)(5.0 7.8 5.5))]);
Result : 3
Operator : binsX
Number : 1
Signature: histogram2d -> int
Example : query binsX ([const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(0.0 5.0))]);
Result : 2
Operator : binsY
Number : 1
Signature: histogram2d -> int
Example : query binsY ([const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(0.0 5.0))]);
Result : 1
Operator : binrange_min
Number : 1
Signature: histogram1d x int -> real
Example : query binrange_min ([const histogram1d value ((0.0 1.0 2.0) (5.0 5.5))], 1);
Result : 1.0
Operator : binrange_max
Number : 1
Signature: histogram1d x int -> real
Example : query binrange_max ([const histogram1d value ((0.0 1.0 2.0) (5.0 5.5))], 1);
Result : 2.0
Operator : binrange_minX
Number : 1
Signature: histogram2d x int -> real
Example : query binrange_minX ([const histogram2d value ((0.0 1.0 2.0 3.0) (5.0 5.5) (2.0 2.5 2.4))], 2);
Result : 2.0
Operator : binrange_maxX
Number : 1
Signature: histogram2d x int -> real
Example : query binrange_maxX ([const histogram2d value ((0.0 1.0 2.0 3.0) (5.0 5.5) (2.0 2.5 2.4))], 2);
Result : 3.0
Operator : binrange_minY
Number : 1
Signature: histogram2d x int -> real
Example : query binrange_minY ([const histogram2d value ((0.0 1.0 2.0 3.0) (5.0 5.5) (2.0 2.5 2.4))], 0);
Result : 5.0
Operator : binrange_maxY
Number : 1
Signature: histogram2d x int -> real
Example : query binrange_maxY ([const histogram2d value ((0.0 1.0 2.0 3.0) (5.0 5.5) (2.0 2.5 2.4))], 0);
Result : 5.5
Operator : getcount1d
Number : 1
Signature: histogram1d x int -> real
Example : query getcount1d ([const histogram1d value ((0.0 1.0 2.0)(5.0 5.5))], 1);
Result : 5.5
Operator : getcount2d
Number : 2
Signature: histogram2d x int x int -> real
Example : query getcount2d ([const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(0.0 5.0))], 1, 0);
Result : 5.0
Operator : findbin
Number : 1
Signature: histogram1d x real -> int
Example : query findbin ([const histogram1d value ((0.0 1.0 2.0)(5.0 5.5))], 1.1);
Result : 1
Operator : findbinX
Number : 1
Signature: histogram2d x real -> int
Example : query findbinX ([const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(0.0 5.0))], -0.5);
Result : 0
Operator : findbinY
Number : 1
Signature: histogram2d x real -> int
Example : query findbinY ([const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(0.0 5.0))], 0.5);
Result : 0
Operator : is_refinement
Number : 1
Signature: histogram1d x histogram1d -> bool
Example : query is_refinement ([const histogram1d value ((-1.4 0.0 1.0 2.0)(5.0 0.0 5.5))], [const histogram1d value ((-1.4 2.0)(10.5))]);
Result : TRUE
Operator : is_refinement
Number : 2
Signature: histogram2d x histogram2d -> bool
Example : query is_refinement ([const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(0.0 5.0))], [const histogram2d value ((-0.8 1.0)(0.0 1.0)(5.0))]);
Result : TRUE
Operator : <
Number : 1
Signature: histogram1d x histogram1d -> bool
Example : query [const histogram1d value ((0.0 1.0 2.0)(4.9 5.4))] < [const histogram1d value ((0.0 1.0 2.0)(5.0 5.5))];
Result : TRUE
Operator : <
Number : 2
Signature: histogram2d x histogram2d -> bool
Example : query [const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(-1.5 3.7))] < [const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(-1.0 4.0))];
Result : TRUE
Operator : =
Number : 1
Signature: histogram1d x histogram1d -> bool
Example : query [const histogram1d value ((0.0 1.0 2.0)(4.9 5.4))] = [const histogram1d value ((0.0 1.0 2.0)(4.9 5.4))]
Result : TRUE
Operator : =
Number : 2
Signature: histogram2d x histogram2d -> bool
Example : query [const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(0.0 5.0))] = [const histogram2d value ((-0.8 0.0 1.0)(0.0 1.0)(0.0 5.0))];
Result : TRUE
Operator : find_minbin
Number : 1
Signature: histogram1d -> (stream int)
Example : query [const histogram1d value ((-1.4 0.0 1.0 2.0)(5.0 4.0 5.5))] find_minbin aggregateS[ fun(i1:int, i2:int) i1+i2 ; 0];
Result : 1
Operator : find_minbin
Number : 2
Signature: histogram2d -> (stream(tuple((X int)(Y int))))
Example : query [const histogram2d value ((0.0 1.0 2.0 3.0) (5.0 5.5) (2.0 2.5 1.4))] find_minbin consume;
Result : ((rel(tuple((X int)(Y int))))((2 0)))
Operator : find_maxbin
Number : 1
Signature: histogram1d -> (stream int)
Example : query [const histogram1d value ((-1.4 0.0 1.0 2.0)(5.0 4.0 5.5))] find_maxbin aggregateS[ fun(i1:int, i2:int) i1+i2 ; 0];
Result : 2
Operator : find_maxbin
Number : 2
Signature: histogram2d -> (stream(tuple((X int)(Y int))))
Example : query [const histogram2d value ((0.0 1.0 2.0 3.0) (5.0 5.5) (2.0 2.5 2.4))] find_maxbin consume;
Result : ((rel(tuple((X int)(Y int))))((1 0)))
Operator : mean
Number : 1
Signature: histogram1d -> real
Example : query [const histogram1d value ((0.5 1.5 2.5 3.5)(1.0 1.0 1.0))] mean;
Result : 2.0
Operator : meanX
Number : 1
Signature: histogram2d -> real
Example : query [const histogram2d value ((0.5 1.5 2.5 3.5) (1.0 2.0 3.0) (1.0 1.0 1.0 1.0 1.0 1.0))] meanX;
Result : 2.0
Operator : meanY
Number : 1
Signature: histogram2d -> real
Example : query [const histogram2d value ((0.5 1.5 2.5 3.5) (1.0 2.0 3.0) (1.0 1.0 1.0 1.0 1.0 1.0))] meanY;
Result : 2.0
Operator : variance
Number : 1
Signature: histogram1d -> real
Example : query [const histogram1d value ((0.5 1.5 2.5 3.5)(1.0 2.0 1.0))] variance;
Result : (real 0.5)
Operator : varianceX
Number : 1
Signature: histogram2d -> real
Example : query [const histogram2d value ((0.5 1.5 2.5 3.5) (1.0 2.0 3.0) (0.0 0.0 0.0 0.0 0.0 0.0))] varianceX;
Result : (real 0.0)
Operator : varianceY
Number : 1
Signature: histogram2d -> real
Example : query [const histogram2d value ((0.5 1.5 2.5 3.5) (1.0 2.0 3.0) (1.0 1.0 1.0 1.0 1.0 1.0))] varianceY;
Result : (real 0.25)
Operator : covariance
Number : 1
Signature: histogram2d -> real
Example : query [const histogram2d value ((0.5 1.5 2.5 3.5) (1.0 2.0 3.0) (1.0 1.0 1.0 1.0 1.0 1.0))] covariance < 0.0001;
Result : TRUE
Operator : distance
Number : 1
Signature: histogram1d x histogram1d -> real
Example : query distance([const histogram1d value((0.0 2.4 3.9)(2.0 3.0))], [const histogram1d value((0.0 2.4 3.9)(0.0 10.0))]);
Result : (real 53.0)
Operator : distance
Number : 2
Signature: histogram2d x histogram2d -> real
Example : query distance([const histogram2d value((0.0 2.4 3.9)(0.0 5.0 10.0)(2.0 3.0 5.0 0.0))], [const histogram2d value((0.0 2.4 3.9)(0.0 5.0 10.0)(0.0 3.0 5.0 0.0))]);
Result : (real 4.0)
Operator : translatehistogram
Number : 1
Signature: histogram1d x histogram1d -> histogram1d
Example : query [const histogram1d value ((-1.4 0.0 1.0 2.0)(1.0 4.0 2.0))] translatehistogram[ [const histogram1d value ((-1.4 2.0)(0.0))] ];
Result : (histogram1d((-1.4 2.0)(7.0)))
Operator : translatehistogram
Number : 2
Signature: histogram2d x histogram2d -> histogram2d
Example : query [const histogram2d value ((-1.4 0.0 1.0)(1.0 2.0 4.0)(7.0 0.0 3.0 4.0))] translatehistogram[ [const histogram2d value ((-1.4 1.0)(1.0 4.0)(0.0))] ];
Result : (histogram2d((-1.4 1.0)(1.0 4.0)(14.0)))
Operator : usehistogram
Number : 1
Signature: histogram1d x (real x T* -> real) -> histogram1d
Example : query [const histogram1d value ((-1.4 0.0 1.0 2.0)(1.0 4.0 2.0))] usehistogram[ 2.0; fun(r1: real, r2: real) r1 * r2];
Result : (histogram1d((-1.4 0.0 1.0 2.0)(2.0 8.0 4.0)))
Operator : usehistogram
Number : 2
Signature: histogram2d x (real x T* -> real) -> histogram2d
Example : query [const histogram2d value ((-1.4 0.0 1.0)(1.0 2.0 4.0)(7.0 0.0 3.0 4.0))] usehistogram[ 2.0; fun(r1: real, r2: real) r1 * r2];
Result : (histogram2d((-1.4 0.0 1.0)(1.0 2.0 4.0)(14.0 0.0 6.0 8.0)))
Operator : usehistogram2
Number : 1
Signature: histogram1d x histogram1d x (real x real x T* -> real) -> histogram1d
Example : query [const histogram1d value ((-1.4 0.0 1.0 2.0)(1.0 4.0 2.0))] [const histogram1d value ((-1.4 1.0 2.0)(10.0 8.0))] usehistogram2[ ; fun(r1: real, r2: real) r1 + r2];
Result : (histogram1d((-1.4 1.0 2.0)(15.0 10.0)))
Operator : usehistogram2
Number : 2
Signature: histogram2d x histogram2d x (real x real x T* -> real) -> histogram2d
Example : query [const histogram2d value ((-1.4 0.0 1.0)(1.0 2.0 4.0)(7.0 0.0 3.0 4.0))] [const histogram2d value ((-1.4 1.0)(1.0 4.0)(6.0))] usehistogram2[ 2.0; fun(r1: real, r2: real, r3: real) (r1 + r2)/r3];
Result : (histogram2d((-1.4 1.0)(1.0 4.0)(10.0)))
Operator : fold
Number : 1
Signature: histogram1d x (T x real -> T) x T -> T
Example : query [const histogram1d value ((-1.4 0.0 1.0 2.0)(1.0 4.0 2.0))] fold[ fun(r1: real, r2: real) r1 + r2; 0.0 ];
Result : (real 7.0)
Operator : fold
Number : 2
Signature: histogram2d x (T x real -> T) x T -> T
Example : query [const histogram2d value ((-1.4 0.0 1.0)(1.0 2.0 4.0)(7.0 0.0 3.0 4.0))] fold[ fun(r1: real, r2: real) r1 + r2; 10.0 ];
Result : (real 24.0)
Operator : shrink_eager
Number : 1
Signature: histogram1d x real x real -> histogram1d
Example : query shrink_eager( [const histogram1d value ((-1.4 0.0 1.0 2.0)(1.0 4.0 2.0))], -2.0, 1.5 );
Result : (histogram1d((-1.4 0.0 1.0)(1.0 4.0)))
Operator : shrink_eager2
Number : 1
Signature: histogram2d x real x real x real x real -> histogram2d
Example : query shrink_eager2( [const histogram2d value ((-1.4 0.0 1.0)(1.0 2.0 4.0)(7.0 0.0 3.0 4.0))], -2.0, 0.5, 1.5, 4.0);
Result : (histogram2d((-1.4 0.0)(2.0 4.0)(0.0)))
Operator : shrink_lazy
Number : 1
Signature: histogram1d x real x real -> histogram1d
Example : query shrink_lazy( [const histogram1d value ((-1.4 0.0 1.0 2.0)(1.0 4.0 2.0))], 0.5, 2.0 );
Result : (histogram1d((0.0 1.0 2.0)(4.0 2.0)))
Operator : shrink_lazy2
Number : 1
Signature: histogram2d x real x real x real x real -> histogram2d
Example : query shrink_lazy2( [const histogram2d value ((-1.4 0.0 1.0)(1.0 2.0 4.0)(7.0 0.0 3.0 4.0))], -2.0, 0.5, 1.5, 4.0);
Result : (histogram2d((-1.4 0.0 1.0)(1.0 2.0 4.0)(7.0 0.0 3.0 4.0)))
Operator : insert1dvalue
Number : 1
Signature: histogram1d x real x real -> histogram1d
Example : query insert1dvalue( [const histogram1d value ((-1.4 0.0 1.0 2.0)(1.0 4.0 2.0))], 0.2, 2.0 );
Result : (histogram1d((-1.4 0.0 1.0 2.0)(1.0 6.0 2.0)))
Operator : insert1d
Number : 1
Signature: histogram1d x real -> histogram1d
Example : query insert1d( [const histogram1d value ((-1.4 0.0 1.0 2.0)(1.0 4.0 2.0))], 0.2 );
Result : (histogram1d((-1.4 0.0 1.0 2.0)(1.0 5.0 2.0)))
Operator : insert2dvalue
Number : 1
Signature: histogram2d x real x real x real -> histogram2d
Example : query insert2dvalue( [const histogram2d value ((-1.4 0.0 1.0)(1.0 2.0 4.0)(7.0 0.0 3.0 4.0))], -1.0, 1.5, 3.0 );
Result : (histogram2d((-1.4 0.0 1.0)(1.0 2.0 4.0)(10.0 0.0 3.0 4.0)))
Operator : insert2d
Number : 1
Signature: histogram2d x real x real -> histogram2d
Example : query insert2d( [const histogram2d value ((-1.4 0.0 1.0)(1.0 2.0 4.0)(7.0 0.0 3.0 4.0))], -1.0, 1.5 );
Result : (histogram2d((-1.4 0.0 1.0)(1.0 2.0 4.0)(8.0 0.0 3.0 4.0)))