jscience
  1. jscience
  2. JSCIENCE-1

Vector.dot( Vector) produces incorrect results

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: Version 6.0
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      1

      Description

      I have an issue using JScience v 1.0.4. The method dot for class Vector fails
      some times.

      Reproducing the problem.
      The following code produces 0.5 instead of 0.25:

      Vector v1 = Vector.valueOf( new Float64[] {
      Float64.valueOf( - 0.5 ), Float64.ZERO
      });

      System.out.println( "v1 . v1 = " + v1.dot( v1) );

        Activity

        Hide
        dix_ans added a comment -

        I have verified the CVS code, the problem is in the for loop, as you can see,
        the i index is not used:

        for (int i = 1; i < n; i++)

        { sum = sum.plus(this.o[0].times(that.o[0])); }
        Show
        dix_ans added a comment - I have verified the CVS code, the problem is in the for loop, as you can see, the i index is not used: for (int i = 1; i < n; i++) { sum = sum.plus(this.o[0].times(that.o[0])); }
        Hide
        dautelle added a comment -

        Fixed in 2.0.0

        Show
        dautelle added a comment - Fixed in 2.0.0

          People

          • Assignee:
            jscience-issues
            Reporter:
            dix_ans
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: