Generic Convex Module: matrix factorization

JIRA: MADLIB-578 MADLIB-522

First model - low-rank matrix factorization, and
First algorithm - incremental gradient
Made use of a new python driver for iterations - the MADlibSchema is
changed to schema_madlib, but we keep the old variable name due to
the compatibility in other modules for now.
Design doc: Add Newton's to convex
Compatibility: Fix exec_sql_using.c in several database versions.

Jira: MADLIB-585

SearchSysCache1 was not available in PG 8.4, and GPDB 4.2 had some
header file issues around USE_CONNECTEMC.  The workaround was implemented
by Florian.
Compatibility: INSERT INTO ... SELECT

Removed temp table for storing returned id, use
plpgsql local variable instead.
Decision Tree: Enhance the encoding method

Jira: MADLIB-592

In MADlib 0.4 version, as we encoded the training table column by column,
the scalability was not good and the encoding time was very long for some
datasets with a large number of columns, such as internet_ads (it has about
1600 columns).  Now, we encode all the columns of training table in parallel.
Decision Tree: Replace agg functions with C

Jira: MADLIB-605

Write some C aggregate functions to improve the performance of C4.5/RF.
Decision Tree: Performance Improvement on Tree Growing Engine

Jira: MADLIB-607

This file implements the tree growing engine for C4.5 and RF, which includes
training, classification, scoring and displaying.  There are few changes on
classification/scoring/displaying/cleaning.  Most of changes are in training
process.

The steps of training:
0. Encoding the training table.
1. Generating ACC (a group by statement).
2. Generating ACS and calculating SCVs and finding the best SCVs (in a single
SQL statement).
3. creating the child nodes (a sigle SQL statement).
4. Iterate the step 1 to step 3 until we met the stop condition.
Decision Tree: Peformance Improvement on APIs of C4.5 and RF

Jira: MADLIB-608

For C4.5, there is no changes for the training/classification/scoring/
genrules/displaying/cleaning.  For RF, we remove the max_split_points parameter
in the training API, since we don't need it any more as we observed better
performance now.  Another change is that for both C4.5 and RF, we now can use
an encoded table as training table.
Decision Tree: Fix RLE column compression version check.

4.2.0. was a bit too early to use RLE_TYPE for the column compression.
C++ Abstraction Layer: Added an initial revision of "modular transition states"

Jira: MADLIB-499

List of changes:
- Initial revision of transition states that allow recursion and reusability: A
  transition state can consist of other transition states. No serialization
  takes place, instead we operate directly on the byte stream.
- Adapted linear regression to the new programming model.
- Added a new type 'blob' within the database that is 8-byte aligned. (The
  PostgreSQL default for bytea is only 4-byte alignment, which is not enough.)
C++ Abstraction Layer: Reorganized the new modular-transition states code

Jira: MADLIB-499

Changes:
- Made "dynamic structs" an integral platform-independent part of the
  abstraction layer.
- Dynamic structs now can be initialized even with ByteStreams that are not long
  enough. E.g., this could happen in the merge function, when one segment did
  not have any rows.
- Started minor modifications to the existing platform-specific part of the AL:
  E.g., MutableTransparentHandle<typename T> is gone in favor of
  TranspararentHandle<typename T, bool IsMutable>. This needs to be continue
  for other platform-specific classes.
New k-means implementation, rewritten as an iteratively called aggregate function

Jira: MADLIB-522, MADLIB-585

k-Means:
- Complete redesign and rewrite. Main new features: 1) The new implementation is nothing more but an iteratively called aggregate function. No conversion between temporary tables and iteration states takes place. 2) The distance metric is fully pluggable. 3) Clear separation between the seeding algorithm and Lloyd's local search heuristic 4) The new code should be much easier to read and maintain
- Uses C++ AL
- First incarnation of general Python abstraction layer (currently still in kmeans.py, though). Main feature: No data movement between backend and PL/Python.

Utilities:
- Implemented a C function exec_sql_using() that can be used to emulate the EXECUTE ... USING command that is not available before PostgreSQL 8.4. This seems to be the only "guaranteed lossless" way to write function arguments into a table.
k-Means: Modularized recentering

Jira: MADLIB-522, MADLIB-586

Linear Algebra:
- Added the avg_vector UDA that computes the average of a set of vectors

k-means:
- Removed the internal kmeans_step aggregate. Instead, kmeans now asks for an aggregate function that calculates the mean, given a set of vectors.
- Added UDFs for simulating default arguments

Other changes:
- Renamed C file containing code for exec_sql_using()
- Added verbose mode to Python IterationController
k-means: Minor changes in SQL/Python code to reflect changes in design document

Jira: None

Changes:
- In the k-means SQL/Python code, replaced "col_" by "expr_", because users are
  not limited to passing column names but any expression that has the correct
  type.
- Fixed a compiler warning in avg_vector.cpp.
Vector operations: Added "distances" and normalized average

Jira: MADLIB-522, MADLIB-532

List of changes:

Vector operations:
- New functions: "sqaured_angle" and "squared_tanimoto"
- Added a UDA "normalized_avg"
- Changed UDA "avg_vector" to "avg".
- New unit tests

k-Means:
- Parameters "fn_squared_dist" and "agg_mean" now of type TEXT, so that
  specifying overloaded functions is easier and does not require passing a
  regprocedure value any more
k-Means: Verify that function parameters have correct signature

Jira: MADLIB-522
Revert "Temporarily deactivate random-sampling module for gppkg release [...]"

Jira: None

This reverts commit 15bfc3d and activates again the random-sampling module.
k-means: objective_fn in output, random seeding. Primitive unit test.

Jira: MADLIB-522

Changes:
- k-means now reports the value of the objective function (sum of squared
  distances, over all points) in the output.
- Random seeding is now included.
- Replace the old primitive unit test by a new primitive unit tests. The result
  is not checked for sanity.
k-means: Some tuning of the kmeans SQL

Jira: MADLIB-522

Performance tuning:
- It turns out that the inter-iteration state should better be accessed via
subqueries instead of joining the state table and adding a WHERE clause.
If there are multiple subqueries in a subquery, adding an OFFSET 0 can give
PostgreSQL/GP a hint that the outer query should not be flattened.
- Replaced all occurrences of the kmeans module by kmeans_new.
C++ AL: Directly call FunctionHandle without detour through the backend

Performance improvements. However, memory allocation/deallocation for boost any type
and boost function type are still expensive. Probably should resort to just a
pointer, even if it is less elegant and type safe.