Example 1: Square the elements of a vector
In this example, we will compare vectorized vs unvectorized code for squaring the elements of the vector. We will also see the performance of apply family of functions.
Example 2: Classification in discriminant analysis
In this example, we will consider the classification rule in classical discriminant analysis, and see whether the rule can be vectorized for faster performance.