// Path: src/treecmp/metric/NodalL2Metric.java
// public class NodalL2Metric extends BaseMetric implements Metric {
// 
//     //This seems to be faster than old implementation
//     public double getDistance(Tree t1, Tree t2, int... indexes) {
//         double dist, diff;
// 
//         IdGroup id1 = TreeUtils.getLeafIdGroup(t1);
//         int[][] nsMatrix1 = TreeCmpUtils.calcNodalSplittedMatrix(t1, null);
//         int[][] nsMatrix2 = TreeCmpUtils.calcNodalSplittedMatrix(t2, id1);
// 
//         dist = 0.0;
//         for (int i = 0; i < id1.getIdCount(); i++) {
//             for (int j = i + 1; j < id1.getIdCount(); j++) {
//                 diff = nsMatrix1[i][j] + nsMatrix1[j][i] - nsMatrix2[i][j] - nsMatrix2[j][i];
//                 dist += diff * diff;
//             }
//         }
//         return Math.sqrt(dist);
//     }
// 
//     public double getDistanceOld(Tree t1, Tree t2) {
//         double dist, diff;
// 
// 
//         IdGroup id1 = TreeUtils.getLeafIdGroup(t1);
//         TreeDistanceMatrix tr1 = new TreeDistanceMatrix(t1, true, 0);
//         TreeDistanceMatrix tr2 = new TreeDistanceMatrix(t2, id1, true, 0);
// 
//         dist = 0.0;
//         for (int i = 0; i < id1.getIdCount(); i++) {
//             for (int j = i + 1; j < id1.getIdCount(); j++) {
//                 diff = tr1.getDistance(i, j) - tr2.getDistance(i, j);
//                 dist += diff * diff;
//             }
//         }
//         return Math.sqrt(dist);
//     }
// }
// 
// Path: src/treecmp/metric/RFMetric.java
// public class RFMetric extends BaseMetric implements Metric{
// 
//     public static double getRFDistance(Tree t1, Tree t2) {
// 
//         int n = t1.getExternalNodeCount();
//         if (n <= 3)
//             return 0;
// 
//         IdGroup idGroup = TreeUtils.getLeafIdGroup(t1);
//         BitSet[] s_t1=SplitDist.getSplits(t1, idGroup);
//         BitSet[] s_t2=SplitDist.getSplits(t2, idGroup);
//         int N1=s_t1.length;
//         int N2=s_t2.length;
//         int hashSetSize=(4*(N1+1))/3;
// 
//         HashSet<BitSet> s_t1_hs=new HashSet<BitSet>(hashSetSize);
// 
//         int i;
//         for(i=0;i<N1;i++){
//             s_t1_hs.add(s_t1[i]);
//         }
// 
//         int common=0;
//         for(i=0;i<N2;i++){
//              if (s_t1_hs.contains(s_t2[i])){
//                 common++;
//             }
//         }
// 
//         double dist=((double)N1+(double)N2)*0.5-(double)common;
//         return dist;
// 
//     }
// 
//     
// 
//     public double getDistance(Tree t1, Tree t2, int... indexes) {
// 
//         return RFMetric.getRFDistance(t1, t2);
// 
//     }
// }


import treecmp.metric.NodalL2Metric;
import treecmp.metric.RFMetric;
import treecmp.metric.Metric;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package treecmp.spr;


/**
 *
 * @author Damian
 */
public class UsprHeuristicPDMetric extends UsprHeuristicBaseMetric {

    @Override
// Path: src/treecmp/metric/NodalL2Metric.java
// public class NodalL2Metric extends BaseMetric implements Metric {
// 
//     //This seems to be faster than old implementation
//     public double getDistance(Tree t1, Tree t2, int... indexes) {
//         double dist, diff;
// 
//         IdGroup id1 = TreeUtils.getLeafIdGroup(t1);
//         int[][] nsMatrix1 = TreeCmpUtils.calcNodalSplittedMatrix(t1, null);
//         int[][] nsMatrix2 = TreeCmpUtils.calcNodalSplittedMatrix(t2, id1);
// 
//         dist = 0.0;
//         for (int i = 0; i < id1.getIdCount(); i++) {
//             for (int j = i + 1; j < id1.getIdCount(); j++) {
//                 diff = nsMatrix1[i][j] + nsMatrix1[j][i] - nsMatrix2[i][j] - nsMatrix2[j][i];
//                 dist += diff * diff;
//             }
//         }
//         return Math.sqrt(dist);
//     }
// 
//     public double getDistanceOld(Tree t1, Tree t2) {
//         double dist, diff;
// 
// 
//         IdGroup id1 = TreeUtils.getLeafIdGroup(t1);
//         TreeDistanceMatrix tr1 = new TreeDistanceMatrix(t1, true, 0);
//         TreeDistanceMatrix tr2 = new TreeDistanceMatrix(t2, id1, true, 0);
// 
//         dist = 0.0;
//         for (int i = 0; i < id1.getIdCount(); i++) {
//             for (int j = i + 1; j < id1.getIdCount(); j++) {
//                 diff = tr1.getDistance(i, j) - tr2.getDistance(i, j);
//                 dist += diff * diff;
//             }
//         }
//         return Math.sqrt(dist);
//     }
// }
// 
// Path: src/treecmp/metric/RFMetric.java
// public class RFMetric extends BaseMetric implements Metric{
// 
//     public static double getRFDistance(Tree t1, Tree t2) {
// 
//         int n = t1.getExternalNodeCount();
//         if (n <= 3)
//             return 0;
// 
//         IdGroup idGroup = TreeUtils.getLeafIdGroup(t1);
//         BitSet[] s_t1=SplitDist.getSplits(t1, idGroup);
//         BitSet[] s_t2=SplitDist.getSplits(t2, idGroup);
//         int N1=s_t1.length;
//         int N2=s_t2.length;
//         int hashSetSize=(4*(N1+1))/3;
// 
//         HashSet<BitSet> s_t1_hs=new HashSet<BitSet>(hashSetSize);
// 
//         int i;
//         for(i=0;i<N1;i++){
//             s_t1_hs.add(s_t1[i]);
//         }
// 
//         int common=0;
//         for(i=0;i<N2;i++){
//              if (s_t1_hs.contains(s_t2[i])){
//                 common++;
//             }
//         }
// 
//         double dist=((double)N1+(double)N2)*0.5-(double)common;
//         return dist;
// 
//     }
// 
//     
// 
//     public double getDistance(Tree t1, Tree t2, int... indexes) {
// 
//         return RFMetric.getRFDistance(t1, t2);
// 
//     }
// }


// Path: src/treecmp/spr/UsprHeuristicPDMetric.java
import treecmp.metric.NodalL2Metric;
import treecmp.metric.RFMetric;
import treecmp.metric.Metric;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package treecmp.spr;


/**
 *
 * @author Damian
 */
public class UsprHeuristicPDMetric extends UsprHeuristicBaseMetric {

    @Override
    protected Metric getMetric() { return new NodalL2Metric(); }