Lab 5 - Algorithm Selection Lab

In this lab, I wrote a set of programs that generates sound samples in a data array. It generates 5000000 samples as specified in the provided "vol.h" file, then scales the samples by a factor of 0.75 and returns them to the array. As a result, the program generates and displays a sum from the output array.

To test the run time for each program, we'll use the command "time./programName," which will run the program and output the results as well as the time it took to run it. The program's real time is the sum of two sections: "user time" and "system time."

Task 1: I obtained the base run time data we will work with when I ran the initial program, "vol1." This program runs with the volume factor unchanged.

This allows us to test the other programs and observe any significant changes in run time data. Running the same program will not always produce the same results; there may be slight differences. This could be due to initial run times, server speed, or any number of other factors.

Task 2: Using the "vol2" program, we had to compute an array of all possible samples ranging from -32768 to 32767.

Task 3: In this alternative approach, I ran "vol3" with the code modified to use a fix-point integer volume factor of 0.75*256.

The first test yielded a result of 94, the second yielded a result of 316, and the third yielded a result of -824.Overall, we can conclude from the data generated by these tests that while the run time data was unaffected, the output array result did change and produced drastically different results depending on the alternative approaches to the code.


Comments

Popular posts from this blog

SPO600 - Project Stage 2

Auto Vectorization