Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-1244

Add "cosAngle" method in "MathArrays"

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 4.0
    • None
    • None

    Description

      Similar to other utilities (e.g. "distance") that interprets a Java array as Cartesian coordinates, I propose to add the function that calculates the cosine of the angle between two vectors:

      public static double cosAngle(double[] v1, double[] v2) {
          return linearCombination(v1, v2) / (safeNorm(v1) * safeNorm(v2));
      

      Attachments

        Activity

          People

            erans Gilles Sadowski
            erans Gilles Sadowski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: