changed representation of vector from n * 3 to 3n * 1