Uploaded image for project: 'SystemDS'
  1. SystemDS
  2. SYSTEMDS-619

Same usage of same random matrix leads to different results

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • SystemML 0.9, SystemML 0.10
    • SystemML 0.9, SystemML 0.10
    • None
    • None

    Description

      Interesting bug, as of commit e16fe1d :

      Start by creating a random matrix X, multiplying it by 2 and assigning to a variable dX, and then print the results:

      # Generate data
      N = 3
      D = 2
      X = rand(rows=N, cols=D)
      
      # Function
      dX = 2 * X
      
      # Print elements of dX
      for (i in 1:nrow(dX)) {
        for (j in 1:ncol(dX)) {
          print("dX["+i+","+j+"]: " + as.scalar(dX[i,j]))
        }
      }
      print("")
      
      print("")
      print("")
      print("")
      

      Output:

      dX[1,1]: 1.0743268190621265
      dX[1,2]: 1.403590780383033
      dX[2,1]: 1.9404746268735837
      dX[2,2]: 0.8689030633611705
      dX[3,1]: 0.2589227727050818
      dX[3,2]: 0.342402157694327
      

      Now, copy and paste the assignment to dX and the print statement, thus literally repeating the same code again.

      # Generate data
      N = 3
      D = 2
      X = rand(rows=N, cols=D)
      
      # Function
      dX = 2 * X
      
      # Print elements of dX
      for (i in 1:nrow(dX)) {
        for (j in 1:ncol(dX)) {
          print("dX["+i+","+j+"]: " + as.scalar(dX[i,j]))
        }
      }
      print("")
      
      # Function
      dX = 2 * X
      
      # Print elements of dX
      for (i in 1:nrow(dX)) {
        for (j in 1:ncol(dX)) {
          print("dX["+i+","+j+"]: " + as.scalar(dX[i,j]))
        }
      }
      print("")
      
      print("")
      print("")
      print("")
      

      Output:

      dX[1,1]: 1.5299997333070705
      dX[1,2]: 1.951679510186853
      dX[2,1]: 0.9372371721327426
      dX[2,2]: 0.11462997451231827
      dX[3,1]: 0.3913879515630596
      dX[3,2]: 0.4411374996556454
      
      dX[1,1]: 0.15757825641372136
      dX[1,2]: 1.6331143898957619
      dX[2,1]: 0.7271506546939133
      dX[2,2]: 0.648694276576909
      dX[3,1]: 1.4763697903577369
      dX[3,2]: 1.2645782773949483
      

      Notice that the outputs are different... magic!

      Attachments

        Issue Links

          Activity

            People

              mboehm7 Matthias Boehm
              dusenberrymw Mike Dusenberry
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: