added balanced resampling and unitvector functions
improved save2pdf and fixed Etensor_hex and Dang