Example usage for org.apache.commons.math3.linear RealVector getL1Distance

List of usage examples for org.apache.commons.math3.linear RealVector getL1Distance

Introduction

In this page you can find the example usage for org.apache.commons.math3.linear RealVector getL1Distance.

Prototype

public double getL1Distance(RealVector v) throws DimensionMismatchException 

Source Link

Document

Distance between two vectors.

Usage

From source file:game.utils.Utils.java

public static double getDistance(String type, RealVector v1, RealVector v2) {
    switch (type.toLowerCase()) {
    case "l1":
        return v1.getL1Distance(v2);
    case "l2":
        return v1.getDistance(v2);
    case "linf":
        return v1.getLInfDistance(v2);
    }/* w w w  . java  2  s.  c om*/
    return -1;
}