Fixed calculation of mean.

Changes to CalAvgLib mean() method. Should now return correct
arithmatic means. Also some small refactorings to use more elegant
iteration constructs.
StatOMat refactoring

changed function of scanner to read in values. Should have solved input
bug; further testing needed.