Add function and test for computing feature vector