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

SimplexTableau's arrayCopy could be wrong

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.1
    • None
    • None
    • Java 1.6.0_13 on Windows XP 32-bit

    Description

      The private method copyArray in file SimplexTableau at line 329 takes 3 parameters src, dest and destPos but the last one is never used/read.

      private void copyArray(final double[] src, final double[] dest, final int destPos) {
      System.arraycopy(src, 0, dest, getNumObjectiveFunctions(), src.length);
      }

      The behavior of this method doesn't reflect its JavaDoc description, and "misleads" createTableau at line 157 that passes 1 as destPos.

      I don't think this leads to a wrong result, but the method signature/implementation is misleading for a future reuse.

      I suggest either to remove the destPos argument or use it in the method body.

      Attachments

        1. SimplexTableau.patch
          5 kB
          Benjamin McCann

        Activity

          People

            Unassigned Unassigned
            ciaccia Andrea
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: