private SourceTargetPair[] vocalizationF0DistanceComputer(VocalizationCandidate[] suitableCandidates,VocalizationCandidate[] suitableF0Candidates,Element domElement){
  int noPossibleImpositions=suitableCandidates.length * suitableF0Candidates.length;
  SourceTargetPair[] imposeF0Data=new SourceTargetPair[noPossibleImpositions];
  int count=0;
  for (int i=0; i < suitableCandidates.length; i++) {
    for (int j=0; j < suitableF0Candidates.length; j++) {
      int sourceIndex=suitableCandidates[i].unitIndex;
      int targetIndex=suitableF0Candidates[j].unitIndex;
      double contourCost=getContourCostDistance(sourceIndex,targetIndex);
      double mergeCost=getMergeCost(sourceIndex,targetIndex,domElement);
      double cost=(contourCost * contourCostWeight) + (mergeCost * (1 - contourCostWeight));
      Log.d(Mary.LOG,"Unit Index " + sourceIndex + " & Contour Index "+ targetIndex+ " :: Countour cost: "+ df.format(contourCost)+ " + Merge Cost: "+ df.format(mergeCost)+ " --> TotalCost: "+ df.format(cost));
      imposeF0Data[count++]=new SourceTargetPair(sourceIndex,targetIndex,cost);
    }
  }
  Arrays.sort(imposeF0Data);
  return imposeF0Data;
}

private SourceTargetPair [ ] vocalizationF0DistanceComputer ( VocalizationCandidate [ ] suitableCandidates , VocalizationCandidate [ ] suitableF0Candidates , Element domElement ) { int noPossibleImpositions = suitableCandidates . length * suitableF0Candidates . length ; SourceTargetPair [ ] imposeF0Data = new SourceTargetPair [ noPossibleImpositions ] ; int count = 0 ; for ( int i = 0 ; i < suitableCandidates . length ; i ++ ) { for ( int j = 0 ; j < suitableF0Candidates . length ; j ++ ) { int sourceIndex = suitableCandidates [ i ] . unitIndex ; int targetIndex = suitableF0Candidates [ j ] . unitIndex ; double contourCost = getContourCostDistance ( sourceIndex , targetIndex ) ; double mergeCost = getMergeCost ( sourceIndex , targetIndex , domElement ) ; double cost = ( contourCost * contourCostWeight ) + ( mergeCost * ( 1 - contourCostWeight ) ) ; Log . d ( Mary . LOG , "Unit Index " + sourceIndex + " & Contour Index " + targetIndex + " :: Countour cost: " + df . format ( contourCost ) + " + Merge Cost: " + df . format ( mergeCost ) + " --> TotalCost: " + df . format ( cost ) ) ; imposeF0Data [ count ++ ] = new SourceTargetPair ( sourceIndex , targetIndex , cost ) ; } } Arrays . sort ( imposeF0Data ) ; return imposeF0Data ; }
polynomial distance computer between two units
