Add support for mapping primary production

* new attribute and optional argument: E_bar
* new method generate_mainproduct_matrix(), generating E_bar, which:

	Makes a best guess at the primary production flow of each
	industry. If a supply flow is found on the diagonal of the
	supply matrix pick this one.  Otherwise, by default, give the
	preference to any product that is exclusive to this industry,
	i.e. a product that is not produced by any other industry. For
	all the rest, pick the biggest supply flows of each industry.

* simple unit tests

 On branch constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
add private method _remove_empty_diagonal(), not yet unittested

If a diagonal entry is null, and the product is never produced, and the
industry does not produce anything, just completely remove rows and
columns

Could make public if judged useful and unittested

 On branch constructs
 Changes to be committed:
	modified:   pySUT.py
add (private) function to aggregation regions in vectorized manner

 * sut._aggregate_regions_vectorised(self, AV, axis=None, inplace=True)

	Takes aggregation vector, indicating which region to be
	aggregated to which position. Can aggregate only rows or only
	columns, and apply it to the tables of the SUT object (inplace),
	or return the aggregated matrices.

	+ As of now, only aggregates U and V, NOT Y, F, etc.

	+ No checks if dimensions match or not, probably crashes if
	dimensions mis-specified, though not tested

 * unittest for the present functionality

 On branch constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
add gitignore and stop tracking compiled binary
make aggregate_regions_vectorised() generic, aggregating any matrix

Instead of passing U, V, etc., make this function generic. It accepts a
function, aggregates it, and returns the aggregated matrix.

This function therefore has one new argument (the matrix) and one fewer
(the "inplace" flag). This function can potentially be employed as part
of a broader function to aggregate a whole supply and use inventory.

 On branch constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
Filter primary/secondary supply (V_bar/V_tild) + support negatives

 New functions: depend on attribute E_bar

	* V_bar(): Returns supply table with only primary products
	* V_tild(): Returns supply table with only secondary...

 Modification: support for negatives in generate_mainproduct_matrix()
	* look for the flows with the greatest _magnitude_ to determine
	  primary product, not necessarily the largest number, as
	  negatives in supply table may represent acceptance of waste,
	  for example.

 Unit tests

 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
new aggregate_within_regions() function + variable names

 * Switched to neutral variable names in _aggregate_regions_vectorised()

 * new function aggregate_within_regions():
	Aggregate the products or industries within each regions for
	mrSUT For multi-regional SUT, aggregate rows, columns or both
	such that there remains only one entry per region along chosen
	axis. The number of regions is specified by self.regions.

 * unittest

 On branch constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
Add primary_market_shares_of_regions()

  Calculate a region's share in each product's global primary supply

  For each object type, calculate the fraction that each region
  represents in its primary supply (secondary supply, as defined by
  E_tild, is excluded)

  Depends on import of math_tools.py. Need to find solution for this on
  the long term

 On branch constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
multiregion_Xi(), a region-aware substitution matrix

 Define Product subtitutability matrix for multiregional system

* By default, products displace identica products produced in the same
  region. If all products were produced as primary product in all regions,
  the Xi matrix would be an identity matrix. Otherwise, if a product is
  only produced as a secondary product in a region, make this product
  substitute average primary production mix.

* minimal unittest

 On branch constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
build_multiregion_Gamma + helper functions + tweaks/bug fixes

New Functions:
--------------
* build_multiregion_Gamma()
* matrix_norm()
* ddiag()
* diaginv()

Tweaks:
* Make aggregation vector (AV) argument optional for
  _aggregate_greions_vectorised. If none, use self.regions and assume
  all regions get aggregated.

* new default: self.regions=1 #region
* use diaginv in a few places instead of np.diag(np.linalg.inv())
add all aggregation constructs + improved V_bar / V_tild

Added constructs:

aPC
aPSC
aAAC
LSC
ITC
BTC
CTC

If no Ebar defined and V square, assumed primary production on diagonal
for Vbar and Vtild, and log this assumption (allows for BTC without
E_bar)

Also, more unit testing for automatic definition of Xi and Gamma

 On branch dev_constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
Add option to not remove empty rows/cols in matrix_norm [default]

* As default argument to all constructs in pySUT, these constructs
  preserve all rows and columns by default, even when none

* Adapt and regroup unit tests

 On branch dev_constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
Double speed of alternate_tech when extensions present by avoiding redundancy

* reflects commit 33d501ec9738d516e7156a6d7a07dd51cf34f1be in
  allocation_construct.py

* alternate_tech responsible for producing A_gamma and S_gamma
  simultaneously, which avoids repeating the long while loop responsible
  for the "theSum" calculation

* also, more efficient build_multiregion_Gamma

 On branch dev_constructs
 Changes to be committed:
	modified:   pySUT.py
rename functions + make some private; harmonize notation

private functions:
	__pa_coeff()
	__alternate_tech()

renamed functions:
	build_E_bar
	build_mr_Xi
	build_mr_Gamma

 On branch dev_constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
Give priority to A and S in constructs + faster matrix_norm

* Change order of returning arguments:
	A, S, nn_in, nn_out, Z, F_con

  This is the case because, for psc_agg and lsc, Z and F_con are now
  optional, and by default not returned (not really meaningful).

* Redundancies removed in matrix_norm, aligning with "upstream" commit
  8265f81d25bd785948606523b20449e746245e4a in allocation_construct

 On branch dev_constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
move functions out of class; documentation; pylint

* aggregate_regions_vectorized did not benefit from being inside object
* same with aggregate_within_regions

* further improvement to matrix_norm + alway return same number of
  variables

* pylint/pep8
* Documentation

 On branch dev_constructs
 Changes to be committed:
	modified:   pySUT.py
	modified:   pySUT_UnitTest.py
Add European System Construct

  On branch dev_constructs
  Changes to be committed:
 	modified:   pySUT.py
 	modified:   pySUT_UnitTest.py
Merge branch 'dev_constructs'

Add support of aggregation partition construct, industry technology construct,
European system construct, product substitution construct, byproduct technology
construct, alternate activity construct, commodity technology construct.

Autogeneration of primary production matrix (E_bar), substitution matrix (Xi),
and alternate activity matrix (Gamma) in a multi-regional IO context.
Renamed files to facilitate merge with mutel/pysut

 On branch master
 Your branch is ahead of 'origin/master' by 18 commits.
   (use "git push" to publish your local commits)

 Changes to be committed:
	renamed:    pysut/pySUT.py -> pysut/pysut.py
	renamed:    pysut/pySUT_UnitTest.py -> pysut/tests/known_results.py
Merge cmutel/pySUT with majeaubettez/pySUT

Conflicts:
	pysut/pysut.py
	pysut/tests/known_results.py

 Changes to be committed:
	new file:   .gitignore
	new file:   MANIFEST.in
	modified:   README.md
	deleted:    __pycache__/__init__.cpython-34.pyc
	deleted:    __pycache__/pySUT.cpython-34.pyc
	modified:   pysut/__init__.py
	modified:   pysut/pysut.py
	new file:   pysut/tests/__init__.py
	modified:   pysut/tests/known_results.py
	renamed:    pysut/tests/known_results.py -> pysut/tests/test_allocations_constructs.py
	new file:   setup.py