Merge pull request #209 from jeffdonahue/loss-in-forward-pass

Compute loss in the forward pass
loss in forward pass fix for window data layer
Merge pull request #247 from jeffdonahue/loss-in-forward-window-data-layer

Loss in forward pass fix for window data layer
compile caffe without MKL (dependency replaced by boost::random, Eigen3)

- examples, test and pycaffe compile without problem (matcaffe not tested)
- tests show some errors (on cpu gradient tests), to be investigated
- random generators need to be double checked
- mkl commented code needs to be removed
Fixed uniform distribution upper bound to be inclusive
Fixed FlattenLayer Backward_cpu/gpu have no return value
Fix test stochastic pooling stepsize/threshold to be same as max pooling
Fix math funcs, add tests, change Eigen Map to unaligned for lrn_layer

[shelhamer: removed math function tests, since they were merged via
other branches]
relax precision of MultinomialLogisticLossLayer test
nextafter templates off one type
mean_bound and sample_mean need referencing with this
make uniform distribution usage compatible with boost 1.46
use boost variate_generator to pass tests w/ boost 1.46 (Gaussian filler
previously filled in all NaNs for me, making many tests fail)
change all Rng's to use variate_generator for consistency
add bernoulli rng test to demonstrate bug (generates all 0s unless p ==
1)
fix bernoulli generator bug
Replace atlas with multithreaded OpenBLAS to speed-up on multi-core CPU

issue: #79
major refactoring allow coexistence of MKL and non-MKL cases
rewrite MKL flag note, polish makefile

add MKL dirs conditioned on USE_MKL
include libraries before making LD_FLAGS
make MKL switch surprise-proof