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

Add "cosAngle" method in "MathArrays"

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Labels:
      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

            • Assignee:
              erans Gilles
              Reporter:
              erans Gilles
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: