Permalink
Browse files

Implemented combined aggregates (computing all the values at once).

This shares memory and CPU so if you need more of the values this
is much more efficient than computing them separately.

The version got bumped to 1.2.0, the META.json and README were
updated to match this.
  • Loading branch information...
tvondra committed Apr 3, 2012
1 parent 0ddfcf8 commit b746f261fcaa6f66b871a9fa849dc163d97e844f
Showing with 713 additions and 10 deletions.
  1. +4 −7 META.json
  2. +20 −2 README.md
  3. +381 −0 sql/trimmed_aggregates--1.2.sql
  4. +308 −1 src/trimmed.c
View
@@ -2,7 +2,7 @@
"name": "trimmed_aggregates",
"abstract": "Aggregate for computing trimmed avg/stddev/var (with outliers removed).",
"description": "An extension written in C that allows you to remove outliers before computing the basic statistical aggregates (AVG/STDDEV/VARIANCE).",
- "version": "1.1.0",
+ "version": "1.2.0",
"maintainer": "Tomas Vondra <tv@fuzzy.cz>",
"license": "gpl_3",
"prereqs": {
@@ -14,12 +14,9 @@
},
"provides": {
"quantile": {
- "file": "sql/trimmed_aggregates--1.0.sql",
- "version": "1.0.0"
- },
- "quantile": {
- "file": "sql/trimmed_aggregates--1.1.sql",
- "version": "1.1.0"
+ "file": "sql/trimmed_aggregates--1.2.sql",
+ "docfile": "README.md",
+ "version": "1.2.0"
}
},
"resources": {
View
@@ -33,8 +33,12 @@ AVG, VARIANCE, VAR_POP, VAR_SAMP, STDDEV, STDDEV_POP and STDDEV_SAMP
stddev_pop_trimmed(value, low_cut, high_cut)
stddev_samp_trimmed(value, low_cut, high_cut)
-All those functions are overloaded for double precision, int32 and
-int64 data types.
+* combined aggregate (computes all seven values at once)
+
+ trimmed(value, low_cut, high_cut)
+
+All those functions are overloaded for numeric, double precision, int32
+and int64 data types.
Using the aggregates
--------------------
@@ -51,6 +55,20 @@ will be computed using the middle 80%. On the other hand this
means 20% of the lowest and 10% of the highest values will be removed,
so the average will be computed using the remaining 70% of values.
+The combined aggregate computes and returns all values at once as an
+array. The values are stored in this order
+
+* average
+* var_pop
+* var_samp
+* variance
+* stddev_pop
+* stddev_samp
+* stddev
+
+If you need more of the values at once this may be much more efficient
+as it shares the memory and can compute the values with only two passes
+through the data (to compute exact variance and stddev).
Installation
------------
Oops, something went wrong.

0 comments on commit b746f26

Please sign in to comment.