Added vector class optimization

The vector class now uses expression templates to avoid allocating
objects in intermediate calculations.