used eigen functions for mean calc