dot_product() Sample Clauses

dot_product(). This function receives as input two equal-length vectors x and y and outputs a single number which denotes the dot product of the two vectors. A dot product is defined as the sum of the products of the corresponding entries of the two sequences of numbers. Moreover, in the SVM algorithm these vectors x and y represent data instances or in other words rows of the input file. In software, computing the dot product of two vectors of size 22 implies a 22x22 double loop i.e. 484 iterations. However computing the product of two entries is independent of computing the product of two other entries. Therefore the multiplication task could be performed in parallel and as a result we would have 22 dot products produced simultaneously. Once we have produced the products we can add them in pairs. In particular, dot products 1 and 2 could be added together, dot products 3 and 4 could be added together and so on. Note that in our 22 length vectors for example 11 addition pairs are formed, so that 11 additions are produced. Again, computing one addition is independent of computing another addition and this allows parallelization. Therefore, the 11 first additions can be performed in parallel. Then, the outcomes that are produced can also be added in pairs and simultaneously and this procedure continues until we are left with a single number, which is the dot product result. For example, given A = [ A1, A2, … , An] and B = [B1, B2, … ,Bn] the dot product is defined as: = · = = + + + + ⋯ +