//
//  algorithms.mm
//  riftathon
//
//  Created by Robert Tubb on 26/11/2014.
//
//

#include <stdio.h>
#include "algorithms.h"
float euclideanDistance(vector<int> v1, vector<int> v2) {
    if (v1.size() != v2.size()){
        cout << "ERROR ERROR: vectors must be same length for Mr Euclid";
        return 0.;
    }
    vector<float> diff;
    
    std::transform(v1.begin(), v1.end(), v2.begin(), v1.begin(), difference<float>());
    // sqr diff
    
    std::transform(v1.begin(), v1.end(), v1.begin(),squared<float>());
    float ans = std::accumulate(v1.begin(),v1.end(),0.0);
    
    return sqrt(ans);
    
};