Available online at www.sciencedirect.com ScienceDirect Procedia - Social and Behavioral Sciences 195 ( 2015 ) 1959 1965 World Conference on Technology, Innovation and Entrepreneurship Investigation of the Performance of Nikhilam Multiplication Algorithm Can Eyupoglu a * a Istanbul Commerce University, Faculty of Engineering and Design, Department of Computer Engineering, Istanbul, 34840, Turkey Abstract Multiplication is one of the most important operations in computer arithmetic. Multiplication is used in many operations such as squaring, division and computing reciprocal. Moreover, multiplication is a very significant arithmetic operation for lots of signal processing applications which are convolution, correlation, frequency analysis, image processing etc. The efficiency of multiplication operation is crucial for the process time of these applications. Nikhilam algorithm is one of the algorithms developed for increasing the efficiency and reducing the cost in order to simplify multiplication. In this work, the performance of Nikhilam multiplication algorithm is analyzed in terms of the number of multiplication and the total process time for different bit lengths. 2015 The The Authors. Authors. Published Published by by Elsevier Elsevier Ltd. Ltd. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/). Peer-review under responsibility of Istanbul University. Peer-review under responsibility of Istanbul Univeristy. Keywords: Computer Arithmetic, Multiplication, Nikhilam Algorithm 1. Introduction In computer arithmetic, multiplication is one of the most significant operations. There are a lot of operations (i.e., squaring, division and computing reciprocal) using multiplication (Dwivedi, 2013). Furthermore, the efficiency of multiplication operation is vital owing to the use of digital signal processing applications such as correlation, frequency analysis, filtering and image processing (Patil et al., 2014). * Corresponding author. Tel.: 444-0413/3235; fax: +90-216-489-0269. E-mail address: ceyupoglu@ticaret.edu.tr 1877-0428 2015 The Authors. Published by Elsevier Ltd. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/). Peer-review under responsibility of Istanbul Univeristy. doi:10.1016/j.sbspro.2015.06.208
1960 Can Eyupoglu / Procedia - Social and Behavioral Sciences 195 ( 2015 ) 1959 1965 Multiplication is an important arithmetic operation used frequently in hardware level in digital filtering (Madke and Zafar, 2014). In order to implement modulators, cryptosystems, ALU (Arithmetic Logic Unit) and many other systems, the efficiency of multiplication operation is a basis (Mishra and Pradhan, 2012). Adding two integers of n-bits takes O(n) bit operations and multiplying two integers of n-bits takes O(n 2 ) bit operations in classical method or long multiplication method. In terms of the number of bit operations, complexity of addition operation is optimum, but it is not optimal for integers (Dwivedi, 2013). In order for improving O(n 2 ) multiplication bound, several algorithms are explored such as Karatsuba multiplication algorithm (Karatsuba and Ofman, 1963), Toom-Cook algorithm (Cook and Aanderaa, 1969), Schonhage-Strassen interger multiplication algorithm (Schonhage et al., 1971) and Furer algorithm (Furer, 2007). Nikhilam multiplication algorithm is one of these algorithms. Nikhilam algorithm is a sutra or method coming from Vedic mathematics (Tirthaji, 1992). In addition, it is used to perform efficient multiplication for small inputs. Moreover, Nikhilam algorithm performs multiplication operation by converting large multiplication to small multiplication along with some addition, subtraction and shifting operations (Dwivedi, 2013). In this study, it is thought that multiplication is performed by multiplicand and multiplier having equal length. The rest of the paper is organized as follows. In section 2, Nikhilam multiplication algorithm is explained. Section 3 investigates the performance of Nikhilam algorithm for different bit lengths. Finally, conclusions being under study are summarized in section 4. 2. Method Vedic mathematics is an ancient math and it was discovered by Shri Bharati Krishna Tirthaji. Furthermore, Vedic mathematics includes all mental calculations interested in mathematics and covers geometry and trigonometry. Shri Bharati Krishna Tirthaji who is a mathematician and philosopher rediscovered a 1500BC Vedic math between 1911 and 1918 (Sriskandarajah, 2003). The mental calculations of Vedic mathematics are organized as 16 simple sutras (Madke and Zafar, 2014). a*b A = (Nearest base) a B = (Nearest base) b C=A*B D=a B=b A Result =100*D+C Result of multiplication operation Fig. 1. Flowchart of Nikhilam algorithm (Multiplication of two 2-digit numbers which are smaller than the nearest base).
Can Eyupoglu / Procedia - Social and Behavioral Sciences 195 ( 2015 ) 1959 1965 1961 In Vedic mathematics, Nikhilam sutra is one of these 16 sutras. Moreover, it is used to convert large-digits multiplication to small-digits multiplication with some additional subtraction, addition and shifting operations. Classical multiplication method needs four multiplications in order to perform 2-digit multiplication operation. In Nikhilam algorithm, 2-digit multiplication operation can be performed with one multiplication (Dwivedi, 2013). The multiplication of two 2-digit decimal numbers which are smaller than the nearest base is calculated as shown in Fig. 1. 96 * 97 A = 100 96 =4 B = 100 97 =3 C=4*3=12 D=96 3=97 4=93 Result = 100 * 93 + 12 9312 Fig. 2. Calculation of 96*97 multiplication operation using Nikhilam algorithm. The cost of addition and subtraction operations is less than the cost of multiplication operation (Dwivedi, 2013). For example, the calculation of 96*97 multiplication operation using Nikhilam algorithm is shown in Fig. 2. This multiplication operation is calculated with four 1-digit multiplication along with some addition and shift operations in classical multiplication method. As it is seen in flowchart, Nikhilam algorithm requires one multiplication, one addition, three subtraction and one shift operations in order to perform this multiplication operation. Therefore, Nikhilam algorithm is more efficient than classical multiplication method. The multiplication of two 3-digit decimal numbers which are greater than the nearest base is calculated as shown in Fig. 3. As it is different from the multiplication of two 2-digit decimal numbers which are smaller than the nearest base, the nearest base is subtracted from the multiplicand and multiplier. The calculation of 106*107 multiplication operation using Nikhilam algorithm is shown in Fig. 4. According the flowchart, the result of 3-digit multiplication operation is calculated with only one 1-digit multiplication. In addition, 3-digit multiplication operation requires nine multiplications in classical multiplication method.
1962 Can Eyupoglu / Procedia - Social and Behavioral Sciences 195 ( 2015 ) 1959 1965 a*b A=a (Nearest base) B=b (Nearest base) C=A*B D=a+B=b+A Result =100*D+C Result of multiplication operation Fig. 3. Flowchart of Nikhilam algorithm (Multiplication of two 2-digit numbers which are greater than the nearest base). 106 * 107 A=106 100=6 B=107 100=7 C=6*7=42 D=106+7=107+6=113 Result = 100 * 113 + 42 11342 Fig. 4. Calculation of 106*107 multiplication operation using Nikhilam algorithm.
Can Eyupoglu / Procedia - Social and Behavioral Sciences 195 ( 2015 ) 1959 1965 1963 3. Results and Discussion In this study, the performance of Nikhilam algorithm is analyzed for multiplicand and multiplier having 4, 8, 16 and 32 bit length. Furthermore, the performance of Nikhilam algorithm is investigated in terms of the number of multiplication and the total process time. The applications used for performance analysis are implemented using MATLAB R2014a and the computer used for testing has these features: Windows 7 64 bit Operating System, Intel Core i5-3317u CPU @ 1.70 GHz Processor and 4 GB RAM. The performance analysis of Nikhilam algorithm in terms of the number of multiplication for different bit lengths is given in Fig. 5. As shown in the graph, the number of multiplication is one and the same for different bit lengths because Nikhilam algorithm performs multiplication operation by converting large multiplication to small multiplication with some extra addition, subtraction and shifting operations. In addition, the number of multiplication increases along with the amount of hardware and thus the cost required for performing multiplication operation raises. Moreover, the cost of multiplication operation is greater than the cost of addition, subtraction and shifting operations. The number of multiplication of Nikhilam algorithm is less than classical multiplication method. The performance of Nikhilam algorithm in terms of the total process time for different bit lengths is analyzed as shown in Fig. 6. As seen in the graph, the more the bit length raises, the more the total process time increases. This is because the number of required addition, subtraction and shifting operations increases along with the bit length. Besides, the total process time is inversely proportional to the processing speed. The increase of the total process time decreases the processing speed of multiplication. When compared to each other, Nikhilam algorithm gives better results than classical multiplication method in terms of the total process time because the number of multiplication required for performing the operation is less than the requirement in classical multiplication method. Fig. 5. Performance analysis of Nikhilam algorithm in terms of the number of multiplication for different bit lengths.
1964 Can Eyupoglu / Procedia - Social and Behavioral Sciences 195 ( 2015 ) 1959 1965 4. Conclusion Fig. 6. Performance analysis of Nikhilam algorithm in terms of the total process time for different bit lengths. In this work, the performance of Nikhilam multiplication algorithm is investigated. The performance analysis is carried out for different bit lengths. The number of multiplication and the total process time are used as analysis parameters. According to the study results, the number of multiplication is one and the same for different bit lengths in Nikhilam algorithm. The more the bit length rises, the more the total process time increases. Furthermore, Nikhilam algorithm has better results than classical multiplication method in terms of the number of multiplication and the total process time. The reason is that the number of multiplication and the cost required to perform multiplication operation are less than classical multiplication method. As a next step, the performance of Nikhilam algorithm can be compared with the performance of the other algorithms developed in order for performing multiplication operation. Besides, an algorithm can be developed for increasing the efficiency of multiplication operation and reducing the processing cost. References Cook, S. A., & Aanderaa, S. O. (1969). On the minimum computation time of the functions. Transactions of the American Mathematical Society. Dwivedi, S. P. (2013). An efficient multiplication algorithm using Nikhilam method. Fifth International Conference on Advances in Recent Technologies in Communication and Computing (ARTCom), 20-21 Sept, Bangalore, IET, ISBN: 978-1-84919-842-4, 223-228. Furer, M. (2007). Faster integer multiplication. Proc. of the ACM Symposium on Theory of Computing. Karatsuba, A., & Ofman, Y. (1963). Multiplication of multidigit numbers on automata. English Translation in Soviet Physics Doklady. Madke, D., & Zafar, S. (2014). Polynomial multiplication using Karatsuba and Nikhilam Sutra. International Journal of Advanced Research in Computer Science and Software Engineering, 4 (6), 1423-1428. Mishra, S., & Pradhan, M. (2012). Synthesis comparison of Karatsuba multiplierusing polynomial multiplication, vedic multiplier and classical multiplier. International Journal of Computer Applications, 41 (9), 13-17. Patil, S., Manjunatha, D. V., & Kiran, D. (2014). Design of speed and power efficient multipliers using vedic mathematics with VLSI implementation. International Conference on Advances in Electronics, Computers and Communications (ICAECC), 10-11 Oct., Bangalore, IEEE, DOI: 10.1109/ICAECC.2014. 7002484, 1-6.
Can Eyupoglu / Procedia - Social and Behavioral Sciences 195 ( 2015 ) 1959 1965 1965 Schonhage, A., Strassen, V., & Zanichelli, F. (1971). Schnelle Multiplikation grosser Zahlen. Computing 7. Sriskandarajah, J. (2003). Secrets of Ancient Maths: Vedic Mathematics. Journal of Indic Studies Foundation, 15-16. Tirthaji, B. K. M. (1992). Vedic mathematics. Motilal Banarsidass Publication.