Java List Product dotProductValue(List oper1, List oper2)

Here you can find the source of dotProductValue(List oper1, List oper2)

Description

dot Product Value

License

Open Source License

Declaration

public static Number dotProductValue(List<? extends Number> oper1, List<? extends Number> oper2) 

Method Source Code


//package com.java2s;
import java.util.List;

public class Main {

    public static Number dotProductValue(List<? extends Number> oper1, List<? extends Number> oper2) {
        return adjuestedDotProductValue(oper1, 0.0, oper2, 0.0);
    }//ww  w  .  j  a  v  a  2s  . c  o m

    public static Number adjuestedDotProductValue(List<? extends Number> oper1, Number adjustedOper1,
            List<? extends Number> oper2, Number adjustedOper2) {
        double dot = 0.0;
        for (int i = 0, j = oper1.size(); i < j; i++) {
            dot += (oper1.get(i).doubleValue() - adjustedOper1.doubleValue())
                    * (oper2.get(i).doubleValue() - adjustedOper2.doubleValue());
        }

        return dot;
    }
}

Related

  1. dotProduct(List v1, List v2)
  2. getProductsFromString(List projects)
  3. product(List> lists)
  4. scalarProduct(List a, List b)
  5. scalerProduct(final List doubleList, final double scalerFactor)