CORDIC(英語:Coordinate rotation digital computer),也稱為Volder演算法(英語:Volder's algorithm),是一個可以計算三角函數,簡單且有效率的演算法,可以在任意進制下運算,一般會每次計算一位數字。因此CORDIC屬於逐位計算(Digit-by-digit)方法中的一個例子。
CORDIC演算法還有其他的名稱,像是圓形CORDIC (Jack E. Volder)[1][2]、線性CORDIC、雙曲線CORDIC(John Stephen Walther)[3][4]、及泛用雙曲線CORDIC(GH CORDIC, Yuanyong Luo et al.)[5][6]。用類似的方式也可以計算雙曲函數、平方根、乘法、除法、指數及對數等。
他的研究最後產生了一個內部的技術報告,提到用CORDIC演算法來求解正弦及餘弦函數,以及一個實現此功能的原型電腦[10][11]。報告中也提到用修改版的CORDIC演算法計算雙曲函數、座標旋轉、對數及指數的可能性[10][11]。用CORDIC來進行乘法和除法運算的想法也是在此時形成[11]。依照CORDIC演算法的原則,Volder的同事Dan H. Daggett發展了在二進位以及二進碼十進數(BCD)之間轉換的演算法[11][14]。
frommathimportatan2,sqrt,sin,cos,radiansITERS=16theta_table=[atan2(1,2**i)foriinrange(ITERS)]defcompute_K(n):""" Compute K(n) for n = ITERS. This could also be stored as an explicit constant if ITERS above is fixed. """k=1.0foriinrange(n):k*=1/sqrt(1+2**(-2*i))returnkdefCORDIC(alpha,n):K_n=compute_K(n)theta=0.0x=1.0y=0.0P2i=1# This will be 2**(-i) in the loop belowforarc_tangentintheta_table:sigma=+1iftheta<alphaelse-1theta+=sigma*arc_tangentx,y=x-sigma*y*P2i,sigma*P2i*x+yP2i/=2returnx*K_n,y*K_nif__name__=="__main__":# Print a table of computed sines and cosines, from -90° to +90°, in steps of 15°,# comparing against the available math routines.print(" x sin(x) diff. sine cos(x) diff. cosine ")forxinrange(-90,91,15):cos_x,sin_x=CORDIC(radians(x),ITERS)print(f"{x:+05.1f}° {sin_x:+.8f} ({sin_x-sin(radians(x)):+.8f}) {cos_x:+.8f} ({cos_x-cos(radians(x)):+.8f})")
實現CORDIC需要的邏輯閘大約和乘法器相當,兩者都是用位元移位和加法所組合的。要選擇乘法器或是CORDIC會隨應用而定。若複數以其實部和虛部表示(直角座標),複數乘法會需要進行四次的乘法。但若複數以極座標表示,只要一個CORDIC即可處理,這更適合用在其乘積的量值不重要的應用(例如將向量和單位圓上的向量相乘的情形)。在數位下轉換器(英语:digital down converter)之類的通訊相關電路中,常會用到CORDIC。
^Volder, Jack E. The CORDIC Computing Technique(PDF). Proceedings of the Western Joint Computer Conference (WJCC) (presentation) (San Francisco, California, USA: National Joint Computer Committee (NJCC)). 1959-03-03: 257–261 [2016-01-02]. (原始内容存档(PDF)于2018-06-12).
^Volder, Jack E. The CORDIC Trigonometric Computing Technique(PDF). IRE Transactions on Electronic Computers (The Institute of Radio Engineers, Inc. (IRE)). 1959-05-25, 8 (3): 330–334 (reprint: 226–230) (September 1959) [2016-01-01]. EC-8(3):330–334. (原始内容(PDF)存档于2021-06-12).请检查|publication-date=中的日期值 (帮助)
^Walther, John Stephen. 写于Palo Alto, California, USA. A unified algorithm for elementary functions(PDF). Proceedings of the Spring Joint Computer Conference (Atlantic City, New Jersey, USA: Hewlett-Packard Company). May 1971, 38: 379–385 [2016-01-01]. (原始内容(PDF)存档于2021-06-12) –通过American Federation of Information Processing Societies (AFIPS).
^Luo, Yuanyong; Wang, Yuxuan; Ha, Yajun; Wang, Zhongfeng; Chen, Siyuan; Pan, Hongbing. Generalized Hyperbolic CORDIC and Its Logarithmic and Exponential Computation With Arbitrary Fixed Base. IEEE Transactions on Very Large Scale Integration (VLSI) Systems. September 2019, 27 (9): 2156–2169. S2CID 196171166. doi:10.1109/TVLSI.2019.2919557.
^Luo, Yuanyong; Wang, Yuxuan; Ha, Yajun; Wang, Zhongfeng; Chen, Siyuan; Pan, Hongbing. Corrections to "Generalized Hyperbolic CORDIC and Its Logarithmic and Exponential Computation With Arbitrary Fixed Base". IEEE Transactions on Very Large Scale Integration (VLSI) Systems. September 2019, 27 (9): 2222. S2CID 201711001. doi:10.1109/TVLSI.2019.2932174.
^Briggs, Henry. Arithmetica Logarithmica. London. 1624. (Translation: [1]互联网档案馆的存檔,存档日期4 March 2016.)
^ 10.010.110.2Volder, Jack E., Binary Computation Algorithms for Coordinate Rotation and Function Generation (internal report), Convair, Aeroelectronics group, 1956-06-15, IAR-1.148
^Perle, Michael D., CORDIC Technique Reduces Trigonometric Function Look-Up, Computer Design (Boston, MA, USA: Computer Design Publishing Corp.), June 1971: 72–78 (NB. Some sources erroneously refer to this as by P. Z. Perle or in Component Design.)
^Schmid, Hermann. Decimal Computation 1 (reprint). Malabar, Florida, USA: Robert E. Krieger Publishing Company. 1983: 162, 165–176, 181–193 [2016-01-03]. ISBN 0-89874-318-4. (NB. At least some batches of this reprint edition were misprints with defective pages 115–146.)
^Meher, Pramod Kumar; Park, Sang Yoon. Low Complexity Generic VLSI Architecture Design Methodology for Nth Root and Nth Power Computations. IEEE Transactions on Very Large Scale Integration (VLSI) Systems. February 2013, 21 (2): 217–228. S2CID 7059383. doi:10.1109/TVLSI.2012.2187080.