/** * @param Clustering * The array of clusters * @param posi * The index of the merged cluster * @param posj * The index of the cluster that will be eliminated from the * clustering * @param distance * The distance matrix that will be updated */ void UpdateDistances(List <SpeakerCluster> clustering, int posi, int posj, Array2DRowRealMatrix distance) { int clusterCount = clustering.Count; for (int i = 0; i < clusterCount; i++) { distance.setEntry(i, posi, ComputeDistance(clustering[i], clustering[posi])); distance.setEntry(posi, i, distance.getEntry(i, posi)); } for (int i = posj; i < clusterCount - 1; i++) { for (int j = 0; j < clusterCount; j++) { distance.setEntry(i, j, distance.getEntry(i + 1, j)); } } for (int i = 0; i < clusterCount; i++) { for (int j = posj; j < clusterCount - 1; j++) { distance.setEntry(i, j, distance.getEntry(i, j + 1)); } } }
internal virtual Array2DRowRealMatrix updateDistances(ArrayList arrayList) { int num = arrayList.size(); Array2DRowRealMatrix array2DRowRealMatrix = new Array2DRowRealMatrix(num, num); for (int i = 0; i < num; i++) { for (int j = 0; j <= i; j++) { array2DRowRealMatrix.setEntry(i, j, this.computeDistance((SpeakerCluster)arrayList.get(i), (SpeakerCluster)arrayList.get(j))); array2DRowRealMatrix.setEntry(j, i, array2DRowRealMatrix.getEntry(i, j)); } } return(array2DRowRealMatrix); }
/** * @param Clustering * The array of clusters */ Array2DRowRealMatrix UpdateDistances(List <SpeakerCluster> clustering) { int clusterCount = clustering.Count; Array2DRowRealMatrix distance = new Array2DRowRealMatrix(clusterCount, clusterCount); for (int i = 0; i < clusterCount; i++) { for (int j = 0; j <= i; j++) { distance.setEntry(i, j, ComputeDistance(clustering[i], clustering[j])); distance.setEntry(j, i, distance.getEntry(i, j)); } } return(distance); }
internal virtual void updateDistances(ArrayList arrayList, int num, int num2, Array2DRowRealMatrix array2DRowRealMatrix) { int num3 = arrayList.size(); for (int i = 0; i < num3; i++) { array2DRowRealMatrix.setEntry(i, num, this.computeDistance((SpeakerCluster)arrayList.get(i), (SpeakerCluster)arrayList.get(num))); array2DRowRealMatrix.setEntry(num, i, array2DRowRealMatrix.getEntry(i, num)); } for (int i = num2; i < num3 - 1; i++) { for (int j = 0; j < num3; j++) { array2DRowRealMatrix.setEntry(i, j, array2DRowRealMatrix.getEntry(i + 1, j)); } } for (int i = 0; i < num3; i++) { for (int j = num2; j < num3 - 1; j++) { array2DRowRealMatrix.setEntry(i, j, array2DRowRealMatrix.getEntry(i, j + 1)); } } }