All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.actelion.research.chem.descriptor.SimilarityCalculatorDoubleArray Maven / Gradle / Ivy

There is a newer version: 2024.11.2
Show newest version
package com.actelion.research.chem.descriptor;

import com.actelion.research.calc.distance.DistanceMetrics;

/**
 * SimilarityCalculatorDoubleArray
 * Created by korffmo1 on 12.07.18.
 */
public class SimilarityCalculatorDoubleArray implements ISimilarityCalculator{

    public static final String NAME = "SimilarityCalculatorDoubleArray";
    public static final String SHORT_NAME = "SimCalcDblArray";


    @Override
    public float getSimilarity(double[] d1, double[] d2) {

        if (d1 == null || d2 == null)
            return Float.NaN;

        return (float) DistanceMetrics.getCosine(d1, d2);

    }

    @Override
    public SimilarityCalculatorInfo getInfo() {
        return new SimilarityCalculatorInfo(NAME, SHORT_NAME);
    }

    @Override
    public ISimilarityCalculator getThreadSafeCopy() {
        return new SimilarityCalculatorDoubleArray();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy