'''
module: utils.py 
use: contains functions associated with general functionality that are not unique to any particular part of the project
'''

import numpy as np
#from scipy.stats import mode #this isnt actually used i think

def getDifferenceArray(vector): 
	'''
	Purpose: 
	Takes an m by n vector and returns a symmetric array with elements representing the different between components in the vector
	array[i,j] = ||vector[i,:] - vector[j,:]||^2

	Inputs: 
	vector - m by n ndarray type representing a set of joint positions, for example 

	Outputs: 
	array - n by n ndarray with the i-jth element equal to the norm^2 difference between the ith and jth rows of vector

	'''
	vec_len = len(vector)
	array = np.zeros((vec_len,vec_len))
	for i in range(0,vec_len):
		for j in range(i,vec_len):
			array[i,j] = np.linalg.norm((vector[i,:]-vector[j,:]))
	array = symmetrize(array)
	return array

def getSimilarityArray(feature_array,similarity_method = 'exp',k_nn = 5):
	'''
	Purpose: 
	Computes the similarity array for a given feature set, similarity method, and k_nearest_neighbors value
	Part of the spectral clustering process

	Inputs: 