To Projects

Project 6

Goal: Compare the run times of non-vector vs. vector functions.

  1. Write a non-vector version of the cbind function, implemented with a double for loop. Call it mycbind.  Your function should input two n x n matrices and return an n x 2n matrix.
     
  2. Create n x n input matrices for cbind by filling them with random numbers like this:
  3. Use the system.time function to time the execution of mycbind on n x n matrices, where n takes on the values
     

    Adjust these values of n up or down as you see fit. My version of mycbind when run with 2000 x 2000 input matrices required 21.34 seconds of execution time.
     
  4. Also time the performance of the builtin cbind function with the same input matrices.
     
  5. You can graph the results on the same graph, but can use different graphs if this makes more sense. Your script should save the output from system.time and pass this data directly to the plot function. Don't recopy the data by hand.
     
  6. In addition to submitting your script and the output graphics file, submit two or three paragraphs describing the results of your experiment.