@Test public void test8(){ int[] v1 = new int[]{1141454369, 589096141, 922770477, 822465917, 423607600}; int[] v2 = new int[]{247243949, 375221325, 851955869, 530827397, 1139764455}; Asserts.assertEqualLength(v1, v2); Asserts.assertPositiveValues(v1); Asserts.assertPositiveValues(v2); double res = IntervalRatio.distance(v1, v2); Asserts.assertEquals(res, 5.989448427075609); }
public static double distance(int t1[],int t2[]){ double res = 0; Asserts.assertHasNoZero(t1); Asserts.assertHasNoZero(t2); double v1[] = rhythmDifferenceVector(t1); double v2[] = rhythmDifferenceVector(t2); for(int i=0;i<v1.length;i++){ res += CommonStats.max(v1[i], v2[i])/CommonStats.min(v1[i], v2[i]); } return res + 1 - t1.length; }
IntervalRatio { public static double distance(int t1[],int t2[]){ double res = 0; Asserts.assertHasNoZero(t1); Asserts.assertHasNoZero(t2); double v1[] = rhythmDifferenceVector(t1); double v2[] = rhythmDifferenceVector(t2); for(int i=0;i<v1.length;i++){ res += CommonStats.max(v1[i], v2[i])/CommonStats.min(v1[i], v2[i]); } return res + 1 - t1.length; } }
IntervalRatio { public static double distance(int t1[],int t2[]){ double res = 0; Asserts.assertHasNoZero(t1); Asserts.assertHasNoZero(t2); double v1[] = rhythmDifferenceVector(t1); double v2[] = rhythmDifferenceVector(t2); for(int i=0;i<v1.length;i++){ res += CommonStats.max(v1[i], v2[i])/CommonStats.min(v1[i], v2[i]); } return res + 1 - t1.length; }  }
IntervalRatio { public static double distance(int t1[],int t2[]){ double res = 0; Asserts.assertHasNoZero(t1); Asserts.assertHasNoZero(t2); double v1[] = rhythmDifferenceVector(t1); double v2[] = rhythmDifferenceVector(t2); for(int i=0;i<v1.length;i++){ res += CommonStats.max(v1[i], v2[i])/CommonStats.min(v1[i], v2[i]); } return res + 1 - t1.length; }  static double[] rhythmDifferenceVector(int t[]); static double distance(int t1[],int t2[]); }
IntervalRatio { public static double distance(int t1[],int t2[]){ double res = 0; Asserts.assertHasNoZero(t1); Asserts.assertHasNoZero(t2); double v1[] = rhythmDifferenceVector(t1); double v2[] = rhythmDifferenceVector(t2); for(int i=0;i<v1.length;i++){ res += CommonStats.max(v1[i], v2[i])/CommonStats.min(v1[i], v2[i]); } return res + 1 - t1.length; }  static double[] rhythmDifferenceVector(int t[]); static double distance(int t1[],int t2[]);  }