Series of articles-Introduction to maxcompute-Advanced Computing)

Source: Internet
Author: User

Abstract: this series of articles will explore various algorithms and implementations for the calculation of big number factorial, from the simplest algorithm that is most likely to come up with, to the use of various versions of big number multiplication, these include hard multiplication, divide and conquer, fast number theory Transformation (fnt), and fast Fourier Transformation (FFT) versions, and even a mini version written in assembly language, using the speedy version of the sterling formula. These series of articles not only analyze and describe the algorithm ideas, but also provide some or all of the Code versions, and explore the code optimization methods. In addition to focusing on self-written programs, this series of articles will also focus on some online programs and papers for the calculation of big data factorial and some academic publications. Maxcompute is an interesting topic. From middle school students to university professors, many people have devoted themselves to the exploration and research of this issue and published their own research results. If you use factorial as a keyword to search on Google, you will find many such articles. In addition, if you use Google academic search, you can also find some academic papers that calculate Big Data factorial. However, these articles and papers have limited depth and do not provide a high-speed algorithm or program.

Like many people interested in big data factorial, I started programming large data factorial very early on. Since the first big data factorial program was written in 2000, it has been around 6-7 years. During this period, I wrote several versions of the factorial calculator, I spent a lot of time and energy on the algorithm discussion and program compilation and optimization of the factorial calculator, and tasted the joys and sorrows of this process, I was excited by the speed improvement brought by the implementation of a new algorithm, and I was annoyed by the effort of the old version, but the speed was not as high as that of the old version, there have also been situations where overnight nights have been used to solve a bug. Some code snippets of the big data factorial I wrote are scattered in the Internet, and algorithms and ideas are often lingering in my mind. I think that I am advanced in the depth and breadth of the algorithm exploration of the big data factorial calculator. I often think that I should write a series of articles on Big Data factorial computing. I want to organize my own Labor achievements. More importantly, I can share my knowledge and experience with my peers, make a contribution to the IT industry.

 

My first big data factorial calculator started in 2000. In that region, I bought a computer and started to study VC at home. At the same time, I wrote my first VC program, A computer that imitates the Windows interface. This calculator is characterized by high precision and high speed. It can make the results of the four arithmetic operations less than 60 thousand bits, and the results of the triangle, logarithm, and exponent functions are accurate to less than 300 bits, you can also calculate the square and factorial. At that time, I happened to see a software called a utility. It is commendable that Jiang Bian, creator of the calculator, is a high school student. His calculator is powerful and has won high comments from all parties. One of the functions of this computation is that it can calculate the exact value of a factorial of less than 9000, and the speed is very fast. My admiration also aroused my determination to write a better and faster program. After several improvements, my calculator was finally used for exact factorial calculation (to 9000! For example, it is 10 times faster than the calculator. When it is accurate to more than 30 valid digits, It is 7500 times faster than the calculator provided by windows. In January 2001, I saw a post on csdn entitled "who can use four lines of code to calculate the factorial of 1000000". I replied to this post, A relatively concise code is provided, which is the first big data factorial program I published online. This period can be seen as the first period in which I wrote the factorial calculator.

 

The second period in which I wrote the factorial calculator began in September 2003. At that time, I wrote a group of programs dedicated to factorial calculation, which were divided into three levels based on the running speed, basic, intermediate, and advanced. Many people can think of the algorithm of the preliminary version. The intermediate version uses the hard multiplication of large numbers multiplied by large numbers. The advanced version introduces the division and control method when calculating the multiplication of large numbers. During this period, two posts were posted in the csdn community, "Competition: computing n! The exact value of the (factorial). The shortest speed is 2000 minutes. "and" round: calculate n! The exact value of (factorial). The shortest speed is 2000 Sub-sent (continued )". Its Advanced Computing version was completed on July 15, November 2003. After that, Guo xianqiang Yu May 10, 2004 Also published series of posts, "Platform: ultra-large integer high-precision fast algorithm", "Platform: ultra-large integer High-Precision Fast Algorithm (continued)" and "Platform: ultra-large integer High-Precision Fast Algorithm (Continued 2) ", which highlights the speed of the big data factorial calculator. This post is a hot topic discussion once published. And Guo xianqiang Mr. Guo xionghui also wrote a program with the same function. At that time, everyone was constantly improving their own program to see who's program faster. In the early stage, Guo xianqiang was slightly ahead. In the middle, Guo Zi applied the apfloat code to the factorial calculator to win his program. Later (after August 2004) after I made further improvements to the program, it was faster than they were. In this post,AryaWhen it comes to an open-source program, its multiplication of large numbers usesFnt+CRT (Fast number theory transformation + Chinese Remainder Theorem). Guo xionghui was the first to adoptApflotThen Guo xianqiang and I joinedLearning and improving apfloat. At this point, Guo xianqiang did a very good job. Based on apfloat, he successfully optimized and changed the time-based algorithm and applied it to the big data factorial calculator, at the same time, he also applied the fnt algorithm to his <ultra-large integer High-Precision Fast Algorithm Library>, and officially launched V in 2004.10.18. 3.0.2 . 1. After that September 9, 2004 It also completed a version using the fnt algorithm, but it was not as fast as Guo xianqiang's factorial calculator. At that time, Guo xianqiang's program was the fastest factorial calculator we knew, and it was faster than the well-known mathematical software Mathematica and Maple, as well as the general high-precision Algorithm Library GMP.

  

The third time I wrote the factorial calculator was about to begin on July 15, 2006. On July 15, August 2005, I received a message from Peking University. Liu Chuxiong An e-mail from the teacher mentioned that a program he wrote is faster than ours in the calculation of factorial. This surprised me very much. After asking, I learned that the core part of the function is the FFT function written by ooura. Ooura's FFT code is completely open, and is one of the fastest running FFT Programs in the world. From this point, we again see the gap between us and the world's advanced level. In addition, I decided to study the FFT Algorithm in depth to see if I could write a program that is equivalent to ooura or faster. At the same time, a larger plan began to form, that is, write a set of factorial calculators that include more algorithms, including the ultimate version of the FFT algorithm and the extreme version that uses the Stirling formula of infinite series to calculate partial precision. In addition, I will rewrite and optimize previous versions, and strive to make the speed faster and the Code better. The plan was not progressing fast and was once stopped.

  

At present, the number of blogs on csdn is rapidly increasing. I have also developed a blog writing plan to take this opportunity to sort out the calculation of big data factorial, I use text and code to describe the algorithms and implementations of each of my versions. At the same time, I may analyze some programs written by others I have seen on the Internet. Of course, in this process, I will continue to write unfinished versions or rewrite previously implemented versions, and strive to make the first piece of code publicly available excellent. This process may be long, but I will try my best to do it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.