Java Code Examples for org.apache.commons.math.linear.RealVector#getNorm()

The following examples show how to use org.apache.commons.math.linear.RealVector#getNorm() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 2
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return the cosine of the angle between {@code v} and {@code w}.
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 3
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 4
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return the cosine of the angle between {@code v} and {@code w}.
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 5
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 6
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 7
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 8
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 9
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 10
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 11
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return the cosine of the angle between {@code v} and {@code w}.
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 12
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 13
Source File: MicrosphereInterpolatingFunction.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Compute the cosine of the angle between 2 vectors.
 *
 * @param v Vector.
 * @param w Vector.
 * @return cosine of the angle
 */
private double cosAngle(final RealVector v, final RealVector w) {
    return v.dotProduct(w) / (v.getNorm() * w.getNorm());
}
 
Example 14
Source File: Cosine.java    From datafu with Apache License 2.0 2 votes vote down vote up
/**
 * Cosine similarity.
 * @param v1 first vector
 * @param v2 second vector
 * @return The cosine of the angle between the vectors
 */
public static double distance(RealVector v1, RealVector v2) {
  return (v1.dotProduct(v2)) / (v1.getNorm() * v2.getNorm());
}