Skip to main content

Posts

Showing posts from November, 2017

Algorithim Selection (Lab 6)

When attempting to alter large amounts of data by a single value, the approach taken can have a significant impact on performance. In this lab example, we had the task of simulating sound and reducing the volume to 75% of the original. Limited by the variable type of int16_t means that the range must be between -32,768 to +32,767. To simulate sound the random function was used albeit with a fixed seed to predict the same results. The basic program had to work something like this: //make a 500 million digit array with random int16_t numbers //scale the values by 0.75 and see how long it takes //sum the result and display it Part 1 This part involves simply multiplying each value in the array by 0.75 and placing it back in the array. The code I made for that is here . This approach took the most amount of time, coming in at approximately 8 seconds. Part 2 This part was completed using a precalculated array of values scaled to 0.75 volume. The calculations during the ti