JPH04177461A - High speed technical calculation method - Google Patents

High speed technical calculation method

Info

Publication number
JPH04177461A
JPH04177461A JP2305035A JP30503590A JPH04177461A JP H04177461 A JPH04177461 A JP H04177461A JP 2305035 A JP2305035 A JP 2305035A JP 30503590 A JP30503590 A JP 30503590A JP H04177461 A JPH04177461 A JP H04177461A
Authority
JP
Japan
Prior art keywords
point
integer
arithmetic
complex
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2305035A
Other languages
Japanese (ja)
Inventor
Mitsuyoshi Kegasa
光容 毛笠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2305035A priority Critical patent/JPH04177461A/en
Publication of JPH04177461A publication Critical patent/JPH04177461A/en
Pending legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)

Abstract

PURPOSE:To perform a technical calculation at a high speed without using any expensive numerical arithmetic processor and at the same time to reduce the necessary capacity of a memory byperforming a numerical operation through an integer arithmetic and in a block floating point format. CONSTITUTION:A fixed floating point arithmetic using an integer arithmetic is expressed in a block floating point number that showed the data in an exponent part or a coefficient part common to all data and a fixed decimal point of each data. Then a block floating point arithmetic applying an integer arithmetic is carried out. It is supposed that a decimal, point is set at the 13th bit of an integer and then that 8192=2<13> of an integer is equivalent to 1.01 of a fixed decimal point. In this fixed decimal point format, the value covering -4.0 (minimum) through about 3.9999 (maximum) can be expressed. The expressible number most approximate to 0 is about 0.000122 and a number approximate to 1.0 has the decimal accuracy equivalent to about 4 digits. The diagram shows a program used for calculation of a complex number end applying a fixed decimal point in a C language.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 、1:(7)発明は、コンピュータによる技術計算の高
速化に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application], 1: (7) The invention relates to speeding up technical calculations by a computer.

〔従来の技術〕[Conventional technology]

第5図(a)、(b)は、CQ出版の[Cによる科学技
術計算」小池慎−著の209ページ〜211ページに掲
載されていたC言語による複素数演算プログラムである
FIGS. 5(a) and 5(b) are complex number arithmetic programs in the C language published on pages 209 to 211 of "Scientific and Technical Computation in C" by Shin Koike, published by CQ Publishing.

(1)は複素数を表現する形式complexを定義し
ており、複素数の実数部を倍精度浮動小数点(以降do
ubleと略す)のreであられし、虚部をdoubl
eの1mであられしている。(2)は(1)で定義した
complex型の加算用の関数caddであり、(3
)はcomplex型の減算用の関数csul、(4)
はcomplex型の乗算用の関数cmulであり、(
5)はcomplex型の除算用の関数cdivである
。(6)はcomplex型の数の絶対値を求める関数
cabsであり、 (7)はdouble型の数2つを
各成分とするcomplex型の数を求める関数to−
complexである。
(1) defines the format complex that represents complex numbers, and converts the real part of complex numbers into double-precision floating point (hereinafter referred to as do
(abbreviated as uble), the imaginary part is double
It is raining at 1m of e. (2) is the complex type addition function cadd defined in (1), and (3
) is a complex type subtraction function csul, (4)
is a function cmul for multiplication of complex type, and (
5) is a complex type division function cdiv. (6) is a function cabs that calculates the absolute value of a complex type number, and (7) is a function to- that calculates a complex type number where each component is two double type numbers.
It is complex.

第6図は同じ< rcによる科学技術計算」の218ペ
ージに掲載されていた複素数演算を用いたFFTプログ
ラムである。(10)はサブルーチン名cfftの宣言
部、(11)はピットリバーサル操作部の先頭、(12
)はバタフライ棟部の先頭を示している。
Figure 6 is an FFT program using complex number operations that was published on page 218 of the same book, ``Scientific and Technical Calculations Using rc''. (10) is the declaration part of the subroutine name cfft, (11) is the beginning of the pit reversal operation part, (12
) indicates the beginning of the butterfly ridge.

第7図(a)、(b)は第6図を元にして図6のプログ
ラムで省略されていたFFT演算後の割り翼部を付加し
た実用的な複素数FFTプログラムである。(10)〜
(12)は第6図と同じものであり、(13)はFFT
演算後の配列Zの要素をnで割る割り翼部を示している
。第8図は、ピットリバーサル部のフローチャート、第
9図はバタフライ稜部のフローチャート、第10図は割
り翼部のフローチャートである。
FIGS. 7(a) and 7(b) are practical complex FFT programs based on FIG. 6, with the addition of the split wing section after FFT calculation, which was omitted in the program of FIG. (10)~
(12) is the same as in Figure 6, and (13) is the FFT
It shows the division part that divides the elements of the array Z after the calculation by n. FIG. 8 is a flowchart of the pit reversal section, FIG. 9 is a flowchart of the butterfly ridge section, and FIG. 10 is a flowchart of the split wing section.

次に動作について説明する。Next, the operation will be explained.

第5図の(2)の関数caddは複素数の変数a。The function cadd in (2) of FIG. 5 is a complex variable a.

bを引き数として受は取り、その和である複素数Zを返
すもので、 Z、re(Zの実部)= a 、re(aの実部)+ 
b 、 re(bの実部)Z、im(Zの虚部)= a
 、im(aの虚部)+ b 、 im(bの虚部)を
計算している。
The receiver takes b as an argument and returns the complex number Z, which is the sum, Z, re (real part of Z) = a, re (real part of a) +
b, re (real part of b) Z, im (imaginary part of Z) = a
, im (imaginary part of a) + b, im (imaginary part of b) are calculated.

第5図の(3)の関数csubは同様に複素数の差を返
すもので、X、re=a、re−b、re、 X、im
=a、im−b、imを計算している。
The function csub in (3) in Figure 5 similarly returns the difference of complex numbers, and X, re = a, re - b, re, X, im
=a, im-b, im is being calculated.

第5図の(4)の関数cmulは同様に複素数の積を返
すもので、 X、re=a、reX b、re −a、imX b、
imX、im=a、reX b、1m −a、imX 
b、reを計算している。
The function cmul in (4) in Figure 5 similarly returns the product of complex numbers: X, re=a, reX b, re -a, imX b,
imX, im=a, reX b, 1m -a, imX
b, re are being calculated.

第5図の(5)の関数cdivは同様に複素数の商を返
すもので、 を計算している。又、分母がOの時はエラー表示をする
ようになっている。
The function cdiv in (5) of FIG. 5 similarly returns the quotient of a complex number, and calculates the following. Also, when the denominator is O, an error is displayed.

第5図の(6)の関数cabsはaの絶対値をdoub
leで返す関数でl a l = (a、re) ”十
(a、im)  を計算している。
The function cabs in (6) in Figure 5 doubles the absolute value of a.
The function returned by le calculates l a l = (a, re) ``10 (a, im).

第5図の(7)の関数tocolIlplexはdou
bleの変数Xとyを引き数として受は取り、これを複
素数Zに変換して返す関数でZ、re=x、Z、im=
yを実行している。
The function tocolIlplex in (7) in Figure 5 is dou
A function that takes the variables X and y of ble as arguments, converts them to a complex number Z, and returns Z, re=x, Z, im=
Executing y.

第6図、第7図は複素数演算を用いたFFTのプログラ
ムの例である。
FIGS. 6 and 7 are examples of FFT programs using complex number operations.

第8図は前記のプログラムのピットリバーサル部のフロ
ーチャートであり、第7図の(11)の部分を説明して
いる。
FIG. 8 is a flowchart of the pit reversal portion of the above program, and explains the part (11) in FIG.

第9図は前記プログラムのバタフライ演算部のフローチ
ャートであり、第7図の(12)の部分を説明している
FIG. 9 is a flowchart of the butterfly calculation section of the program, and explains the part (12) in FIG. 7.

第10図は第7図の(13)(第6図では省略されてい
る)の割り翼部のフローチャートである。
FIG. 10 is a flowchart of the split wing section (13) in FIG. 7 (omitted in FIG. 6).

第7図のFFTプログラムcfftに複素数データの配
列Z、FFTの次数を表わす整数1.FFTとRFTを
選択する整数の変数f (f=1ならRFT、f−−1
ならFFTが実行される)を引数として与えて実行させ
ると、f−1なら配列Zのデータをフーリエ逆変換した
データが配列Zに求められる。f=−1なら、配列Zの
データをフーリエ変換したデータが配列Zに求められる
In the FFT program cfft shown in FIG. 7, an array Z of complex number data, an integer 1 . An integer variable f that selects FFT and RFT (if f = 1, RFT, f--1
If f-1, then FFT is executed) is given as an argument and executed, and if f-1, data obtained by inverse Fourier transform of the data in array Z is obtained in array Z. If f=-1, data obtained by Fourier transforming the data in array Z is obtained in array Z.

FFTプログラムは、離数フーリエ変換を高速で行なう
プログラムで時間的に変化する離数データg (k)の
周波数スペクトルG (n)を、という関係を用いて求
めるプログラムである。但し、Nはデータ数で通常Zの
ベキ乗で表わされる数(2,4,8,・・・、128,
256,512,1024.・・・)とし、WNは6−
JMで表わされる数である。
The FFT program is a program that performs a discrete Fourier transform at high speed, and is a program that calculates the frequency spectrum G (n) of the discrete number data g (k) that changes over time using the following relationship. However, N is the number of data and is usually expressed as a power of Z (2, 4, 8, ..., 128,
256,512,1024. ), and WN is 6-
It is a number expressed by JM.

FFTプログラムは主に電気信号や機械的信号などがど
のような周波数成分を持つかを求めるのに使われており
、古くは大型コンピュータでしか使われていなかったが
、近年ではパソコン上や測定器上でも使われるようにな
っている。
FFT programs are mainly used to determine the frequency components of electrical and mechanical signals, and in the past were only used on large computers, but in recent years they have been used on personal computers and measuring instruments. It is also used above.

第5図の(2)〜(7)の複素数演算を使用して複素数
FFTを記述すると、第7図のように短いプログラムと
なる。
If a complex number FFT is described using the complex number operations (2) to (7) in FIG. 5, a short program as shown in FIG. 7 will be obtained.

第7図のプログラムをパソコンPC9801RX2上で
ボーランド社のCコンパイラTurbo−Cを用いて実
行させると、データ数N = 1024の時、数値演算
プロセッサがない場合で約13秒必要であった。
When the program shown in FIG. 7 was executed on a personal computer PC9801RX2 using Borland's C compiler Turbo-C, it took about 13 seconds when the number of data N = 1024 and without a numerical calculation processor.

数値演算プロセッサ180287−10を付けると、同
じ演算が約3秒で実行できる。但し180287−10
は現状では4万円から6万円程度と高価である。
If a numerical calculation processor 180287-10 is attached, the same calculation can be executed in about 3 seconds. However, 180287-10
Currently, it is expensive at about 40,000 to 60,000 yen.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

従来の技術計算方法は、以上のようにC言語でサポート
されている倍精度浮動小数点演算で行なわれていた。倍
精度浮動小数点演算では各データを64ビツトの指数方
式で表現している為、10進数では15桁もの高精度が
得られるが、その反面、加減乗除等の基本的な演算でも
整数演算の100〜1000倍の時間を要し1データで
8バイトのメモリを要する。この為、従来の技術計算プ
ログラムでは長時間を要しかつ多くのメモリを必要とし
た。浮動小数点演算を高速化する為、数値演算プロセッ
サが存在するが、かなり高価である為、汎用のパーソナ
ルコンピュータ等では実装されていないものが多い。
Conventional technical calculation methods have been performed using double-precision floating point arithmetic supported by the C language, as described above. In double-precision floating-point operations, each data is expressed using a 64-bit exponent system, so a high precision of 15 digits can be obtained with decimal numbers, but on the other hand, even basic operations such as addition, subtraction, multiplication, and division can be performed using 100 digits of integer operations. It takes ~1000 times as much time and requires 8 bytes of memory for 1 data. For this reason, conventional technical calculation programs take a long time and require a large amount of memory. Numerical arithmetic processors exist to speed up floating point arithmetic operations, but they are quite expensive and are therefore not often implemented in general-purpose personal computers.

この発明は、上記のような問題点を解消するためになさ
れたもので、高価な数値演算プロセッサを使わずに、短
時間で結果を求めることができ、かつ必要なメモリの容
量も少ない高速技術計算プログラムを得ることを目的と
する。
This invention was made to solve the above problems, and is a high-speed technology that can obtain results in a short time without using an expensive numerical processor and requires less memory. The purpose is to obtain a calculation program.

〔課題を解決するための手段〕[Means to solve the problem]

この発明に係る高速技術計算方法は、データを固定小数
点またはブロック浮動小数点で表わし、整数演算を利用
した固定小数点演算もしくは、ブロック浮動小数点で計
算を行なうものである。
The high-speed technical calculation method according to the present invention represents data in fixed point or block floating point, and performs calculations in fixed point arithmetic using integer arithmetic or block floating point.

〔作用〕[Effect]

この発明における高速技術計算方法は、必要以上に高精
度であり多くのメモリを必要とし、演算に長い時間を要
する倍精度浮動小数点演算のかわりに整数演算を利用し
た固定小数点演算又は、データを全データ共通の指数部
又は係数部と各データごとの固定小数点で表わしたブロ
ック浮動小数点で表わし、整数演算を利用したブロック
の浮動小数点演算で行なうことで技術計算を高速化しか
つデータを格納するのに必要なメモリー容量を削減して
いる。
The high-speed technical computation method of this invention uses fixed-point arithmetic using integer arithmetic instead of double-precision floating-point arithmetic, which has higher precision than necessary, requires a large amount of memory, and takes a long time, or The exponent part or coefficient part common to the data and blocks expressed as fixed point numbers for each piece of data are expressed in floating point numbers, and by performing block floating point operations using integer operations, it is possible to speed up technical calculations and to store data. Reducing the amount of memory required.

〔実施例〕〔Example〕

以下この発明の一実施例を説明する。 An embodiment of this invention will be described below.

本実施例では、固定小数点を整数を使って表現している
。整数はコンピュータによって表現が異なるが、例えば
パーソナルコンピュータPC:9801シリーズ用のC
コンパイラTurbo−Cver2.0 (ボーランド
社)では、整数は16ビツトの符号付き整数型(以降i
ntと略す)を標準としている。16ビツトの符号付き
整数では21″通りの数が表現でき最小−32768〜
最大32767が表現できる。
In this embodiment, fixed-point numbers are expressed using integers. The representation of integers differs depending on the computer, but for example, the C for personal computer PC: 9801 series
In the compiler Turbo-Cver 2.0 (Borland), integers are 16-bit signed integer types (hereafter i
(abbreviated as nt) is the standard. A 16-bit signed integer can represent 21'' numbers, with a minimum of -32768~
A maximum of 32767 can be expressed.

本実施例ではこの整数の13ビツト目に小数点があるも
のと仮定して整数の8192= 213が固定小数点の
1.01に相当するものと設定した。この固定小数点フ
ォーマットでは、最小−4,0〜最大約3.9999が
表現できる。表現できるOに最も近い数は約0、000
122であり1.0付近の数なら10進で約4桁分の精
度がある。
In this embodiment, it is assumed that there is a decimal point at the 13th bit of this integer, and the integer 8192=213 is set to correspond to the fixed decimal point 1.01. This fixed-point format can represent a minimum of -4.0 to a maximum of about 3.9999. The closest number to O that can be represented is approximately 0,000
122, and a number around 1.0 has an accuracy of about 4 digits in decimal.

この固定小数点での演算は、加減算なら整数と全く同じ
演算で実行できるが、乗算では1.OXl、0=1.0
となる様に調整する必要がある。又、16ビツトの整数
の積は、最大約10億となり16ビツト符号付整数では
表現できなくなる。そこで乗算では、各整数を32ビッ
ト符号付整数型(以降long intと略す)に直し
て計算する必要がある。
This fixed-point operation can be performed in exactly the same way as an integer in the case of addition and subtraction, but in the case of multiplication, 1. OXl, 0=1.0
It is necessary to adjust so that Furthermore, the product of 16-bit integers reaches a maximum of about 1 billion, which cannot be expressed by 16-bit signed integers. Therefore, in multiplication, it is necessary to convert each integer into a 32-bit signed integer type (hereinafter abbreviated as long int).

32ビット符号付整数では最小約−2億〜最大約21億
までの数が表現できる。long intで乗算後81
92で割り、int型に戻してやれば乗算ができる。例
えば、固定小数点数a =2.0. b =0.5の積
を固定小数点のCに代入する演算をC言語で表記すると
、 tnt  a、b、c; a=(fnt) (2,0m8192.0) ;b=(
fnt)(0,518192,0);c=(int)(
(long  int)as(long  1nt)b
/8192);となる。但しく1nt)はintへの型
変換を指示するキャスト演算子である。又(long 
1nt)はlong intへの型変換を指示するキャ
スト演算子である。固定小数点の割り算も同様にlon
g intで計算する必要がある9例えばa =1.0
.  b =2.0で8割るbをCに代入するには int a、b、c; a=(int)(1,O*8192.O);b=(in
t)(2,0零8192.O);c=(int)((l
ong  1nt)a本8192/(long  1n
t)b)HとC言語で記述できる。
A 32-bit signed integer can represent numbers from a minimum of about -200 million to a maximum of about 2.1 billion. 81 after multiplication by long int
Multiplication is possible by dividing by 92 and converting it back to int type. For example, fixed-point number a = 2.0. The operation of assigning the product of b = 0.5 to fixed point C is expressed in C language as follows: tnt a, b, c; a=(fnt) (2,0m8192.0) ;b=(
fnt)(0,518192,0);c=(int)(
(long int)as(long 1nt)b
/8192); However, 1nt) is a cast operator that instructs type conversion to int. Also (long
1nt) is a cast operator that instructs type conversion to long int. Fixed-point division is also lon
Need to calculate with g int 9 For example a = 1.0
.. To assign b divided by 8 by b = 2.0 to C, int a, b, c; a = (int) (1, O * 8192.O); b = (in
t) (2,0 zero 8192.O);c=(int)((l
long 1nt) a book 8192/(long 1n
t) b) Can be written in H and C languages.

このように固定小数点の演算を整数演算の組み合わせで
実行することが可能である。
In this way, fixed-point operations can be performed using a combination of integer operations.

さらに複素数を2つの固定小数点数で表現することも可
能である。つまり複素数の実部を1つの固定小数点数で
、虚部をもう1つの固定小数点数で表現することができ
る。これをC言語でbcotnp型と定義すると以下の
ようになる。
Furthermore, it is also possible to represent a complex number with two fixed point numbers. In other words, the real part of a complex number can be represented by one fixed-point number, and the imaginary part by another fixed-point number. If this is defined as bcotnp type in C language, it will be as follows.

typedef 5truct(int x; int
 y;)bcompHbcomp Zl、Z2.Z3; この場合複素数Z1の実部がZl、xに、虚部がzi、
yに対応する。Z1冨0,7+J0.7. Z2=0.
5+J O,8の和をZ3に代入するには上の定義式に
て宣言した後 Zl、 x=(int) (0,7零8192.0) 
;zl、y=(int)(0,7本8192.0);Z
2.x=(int)(0,5零8192,0)iZ2.
y=(int)(0,8本8192.0):Z3. x
=Z1.x+Z2. x; Z3. y=Z1. y+Z2. y;と書けば良い。
typedef 5truct(int x; int
y;)bcompHbcomp Zl, Z2. Z3; In this case, the real part of the complex number Z1 is Zl, x, and the imaginary part is zi,
Corresponds to y. Z1 Tomi 0.7 + J0.7. Z2=0.
To assign the sum of 5+J O,8 to Z3, declare it using the above definition formula, then Zl, x=(int) (0,7 zero 8192.0)
;zl,y=(int)(0,7 8192.0);Z
2. x=(int)(0,5 zero 8192,0)iZ2.
y=(int) (0,8 lines 8192.0): Z3. x
=Z1. x+Z2. x; Z3. y=Z1. y+Z2. You can write it as y;

ここで、わかるように浮動小数点型数から固定小数点数
を利用した複素数への変換や、複素数の計算をそのまま
記述すると大変見にくくかつ書くのも大変であるので、
C言語の関数としてやることが好ましい。
As you can see, it would be difficult to read and write the conversion from a floating point number to a complex number using a fixed point number or the calculation of a complex number as it is, so
It is preferable to do this as a C language function.

第1図(a)、(b)はC言語で固定小数点を利用した
複素数計算用のプログラムである。最初の宣言部は上記
説明のものと全く同じである。
FIGS. 1(a) and 1(b) are programs for complex number calculations using fixed point numbers in C language. The first declaration section is exactly the same as described above.

(2)の関数bcaddは加算用の関数であり、従来の
実施例の関数caddのcomplexの部分をbco
mpに変えたものである。
The function bcadd in (2) is an addition function, and the complex part of the function cadd in the conventional embodiment is
It has been changed to mp.

(3)の関数bcsubは減算用の関数であり、これも
従来の実施例の関数cs ubのcomplexの部分
をbcompに変えたものである。
The function bcsub in (3) is a subtraction function, and this is also a function in which the complex part of the function csub in the conventional embodiment is changed to bcomp.

(4)の関数bcmulは積を求める関数であり、従来
の実施例の関数cmulのcomplexの部分をbc
ompに変え、さらに実部、虚部各部の乗算を求める左
辺で整数の型をintからlong intに変換して
から乗算を行ない固定小数点に戻す為、8192で割っ
てから型をint型に戻すように書き変えている。
The function bcmul in (4) is a function that calculates a product, and the complex part of the function cmul in the conventional embodiment is
omp, and then calculate the multiplication of the real and imaginary parts. On the left side, convert the integer type from int to long int, perform the multiplication, and return it to a fixed point, so divide by 8192 and change the type back to int. It is rewritten as follows.

(5)の関数bcdivは商を求める関数であり、従来
の実施例の関数cdivのcoo+plexをbcom
pに変え、整数の型変換を行なっている。固定小数点の
商であるので被除数へ8192を乗じてから、除数で割
れば良いのであるが、分子は2つの固定小数点数の積の
和であり、例えば(2,O+J0.0)/ (2,0+
J O。
The function bcdiv in (5) is a function that calculates the quotient, and coo+plex of the function cdiv of the conventional embodiment is
p and performs integer type conversion. Since it is a fixed-point quotient, you can multiply the dividend by 8192 and then divide by the divisor, but the numerator is the sum of the products of two fixed-point numbers, for example (2, O + J0.0) / (2, 0+
J.O.

0)を計算する場合分子の実部は整数で書けば(163
84) 2+0=268435456であり、これに8
192を乗すると約2.2X10”となりlong i
ntでは表現できなくなる。long 1ntの最大値
は約2X10”であり、先の例の268435456の
8倍であるので商の計算ではたとえば、被除数及び除数
の絶対値が2以下という条件付きで、分子は8倍までが
可能である。そこで、分子8倍して分母は8192÷8
−1024で割ってから割り算を実行し、その後lon
g 1ntからint型へ戻すように変更した。この為
、除数の絶対値が整数でfi=32固定小数点で0.0
04より小さいとエラーとなる。この時は、エラー表示
をするようにした。
0), the real part of the numerator can be written as an integer (163
84) 2+0=268435456, and 8
When multiplied by 192, it becomes approximately 2.2X10” long i
It cannot be expressed using nt. The maximum value of long 1nt is approximately 2X10", which is 8 times the 268435456 in the previous example, so when calculating the quotient, for example, the numerator can be up to 8 times as long as the absolute value of the dividend and divisor is 2 or less. Therefore, the numerator is multiplied by 8 and the denominator is 8192÷8.
Divide by -1024, then perform the division, then lon
g Changed from 1nt back to int type. Therefore, the absolute value of the divisor is an integer and fi = 32, and the fixed point is 0.0.
If it is smaller than 04, an error will occur. At this time, an error message is displayed.

除算をさらに高速化するには、分子への積をやめて分母
を8192で割れば良いが、この場合は除数の絶対値が
整数でfi#90固定小数点で0.01より小さいとエ
ラーとなる。
To further speed up the division, it is possible to stop multiplying the numerator and divide the denominator by 8192, but in this case, if the absolute value of the divisor is an integer and is less than 0.01 in fi#90 fixed point, an error will occur.

除算の精度を上げるには、たとえば被除数及び除数の絶
対値を1以下という条件にしてやり、231÷(819
2) ”=32の余裕にして分子を32倍し、分母を2
56で割ってから割り算を行なえば良い。
To increase the precision of division, for example, set the absolute value of the dividend and divisor to be less than or equal to 1, and calculate 231÷(819
2) Multiply the numerator by 32 with a margin of ”=32, and the denominator by 2.
All you have to do is divide by 56 and then do the division.

この場合、除数の絶対値が整数で4r256=16.固
定小数点で0.002より小さい時エラーとなる。
In this case, the absolute value of the divisor is an integer, 4r256=16. An error occurs when the value is less than 0.002 in a fixed point number.

第1図において(6)は、複素数の絶対値を求める関数
bcabsである。従来の実施例のcabsのC0lD
−plexの部分をbcompにおき変えたものである
In FIG. 1, (6) is a function bcabs for calculating the absolute value of a complex number. C01D of cabs in conventional embodiment
-plex is replaced with bcomp.

第2図において(7)は、絶対値が2以下のdoubl
eの数2つをそれぞれ実部、虚部とするbcompの数
を求める関数tabcoa+pであり、従来の実施例の
tocomplexとほぼ同じであるが、固定小数点フ
ォーマットに直す為に8192を掛けている。
In Figure 2, (7) is a double whose absolute value is 2 or less.
This is a function tabcoa+p that calculates the number of bcomp whose real and imaginary parts are the two numbers of e, and is almost the same as tocomplex in the conventional embodiment, but is multiplied by 8192 to convert it to a fixed-point format.

(8)は複素数bcompO数の配列Z[)のn個の要
素を2で割るサブルーチンbcnormであり、後で述
べるFFTプログラムで使用している。
(8) is a subroutine bcnorm that divides the n elements of the array Z[) of complex numbers bcompO by 2, and is used in the FFT program described later.

(9)は同じ(bcompの配列Z()のn個1要素を
その各成分(実部、虚部)の絶対値の最大が1以下にな
るように調整するサブルーチンbcnorm2である。
(9) is a subroutine bcnorm2 that adjusts n elements of the array Z() of bcomp so that the maximum absolute value of each component (real part, imaginary part) is 1 or less.

M対価の最大値を1以下にする為にZ()の全要素を変
数con8tで割り、配列Z[]の共通の指数部に相当
する変数ampをcanst倍している。このサブルー
チンでは、Zとampよりなるブロック浮動小数点フォ
ーマットをサポートシている。
In order to make the maximum value of M consideration less than or equal to 1, all elements of Z() are divided by the variable con8t, and the variable amp corresponding to the common exponent part of the array Z[] is multiplied by canst. This subroutine supports the block floating point format consisting of Z and amp.

(10)は、上で述べた複素演算を利用した複素FFT
プログラムである。従来の実施例とほぼ同じアルゴリズ
ムであるが、従来の実施例ではデータ数Nでの割り算を
プログラムの最後でまとめて行なっていたが、本プログ
ラムではバタフライ積演算を1組行なう度にデータをサ
ブルーチンbcnormを使って2で割ることにより、
Nでの割り算を実行している。 FFTプログラムでは
、バタフライ積を1組行なう度にデータの最大値が約2
倍に増える性質があるので固定小数点が途中でオーバー
フローすることがないように毎回2で割ることにより、
Nでの割り算を実行させている。
(10) is a complex FFT using the complex operations mentioned above.
It is a program. The algorithm is almost the same as the conventional example, but in the conventional example, the division by the number of data N was performed all at once at the end of the program, but in this program, the data is divided into a subroutine each time a set of butterfly product operations is performed. By dividing by 2 using bcnorm,
Executing division by N. In the FFT program, each time a set of butterfly products is performed, the maximum value of the data is approximately 2.
Since it has the property of multiplying, by dividing by 2 each time to prevent the fixed point from overflowing midway,
A division by N is executed.

この複素FFTプログラムのアルゴリズムの異なる部分
を説明しているフローチャートを第11図、第12図に
示す。第11図において(13)は追加されたbcno
rmサブルーチンの実行位置を示している。第9図の従
来のプログラムで■で示すNでの割り算プログラムへ移
行するかわりに、第11図ではサブルーチンを終了して
メインプログラムへ戻っている。
Flowcharts explaining different parts of the algorithm of this complex FFT program are shown in FIGS. 11 and 12. In Figure 11, (13) is the added bcno
This shows the execution position of the rm subroutine. Instead of proceeding to the division by N program indicated by ■ in the conventional program of FIG. 9, in FIG. 11 the subroutine is ended and the program returns to the main program.

図12はbcnormサブルーチンのアルゴリズムを示
すフローチャートで、配列Zの各要素を2で割っている
。この様に固点小数点フォーマットの複素数bcmpを
使って加減乗除算や、複素数FFTが実現できる。
FIG. 12 is a flowchart showing the algorithm of the bcnorm subroutine, in which each element of array Z is divided by two. In this way, addition, subtraction, multiplication, division, and complex number FFT can be realized using complex number bcmp in fixed-point decimal format.

第4図は、上記の複素数FFTプログラムをテストする
為に作られたC言語のメインプログラムであり、102
4個のデータの実部がサインカーブを描くよう設定し、
虚部は全て0になるよう設定し、複素数FFTプログラ
ムを実行している。
Figure 4 shows the main program in C language created to test the above complex number FFT program.
Set the real parts of the four data to draw a sine curve,
The imaginary parts are all set to 0, and a complex number FFT program is executed.

つまり、時間軸で正弦振動をしているようなデータを入
力した時の周波数スペクトラムを求めいている。
In other words, we are looking for the frequency spectrum when inputting data that appears to be oscillating sinusoidally on the time axis.

prJimeというサブルーチンは時刻を表示するプロ
グラムで二〇FFTプログラムで消費した時間を求めさ
せている。
The subroutine prJime is a program that displays the time, and is used to calculate the time consumed by the 20FFT program.

このメインプログラムを実行させて時間を測った結果1
024点のFFTが約2秒で完了した。
Results of running this main program and measuring the time 1
FFT of 024 points was completed in about 2 seconds.

従来の実施例に比べて約6倍の高速化が実現できた。数
値演算プロセッサを使用したものよりも少し速い、但し
精度は2桁〜3桁程度である。例えば、8ビツトのA/
Dコンバータ等で入力されたデータの処理用としてはこ
の精度は充分な値であると思われる。又結果を画面(4
00ドツト×640ドツト)にグラフィック表示するよ
うなアプリケーションプログラムでも、これだけの精度
があれば十分である。
Approximately 6 times faster speed than the conventional example was achieved. It is a little faster than one using a numerical processor, but the accuracy is about 2 to 3 digits. For example, 8-bit A/
This accuracy seems to be sufficient for processing data input by a D converter or the like. Also, the results are shown on the screen (4
This level of accuracy is sufficient even for an application program that displays a graphic (00 dots x 640 dots).

なお、上記実施例ではC言語上でプログラムを記述した
がPASCAL等の他の構造化した高級言語でも同様の
プログラムが作成できる。
Although the program was written in the C language in the above embodiment, a similar program can be created in other structured high-level languages such as PASCAL.

又、上記実施例ではFFTを実行するプログラムを記述
したが、同じような複数個のデータを処理する技術計算
プログラムなら同様の手法で高速化が可能である。
Further, in the above embodiment, a program for executing FFT was written, but any technical calculation program that processes a plurality of similar data can be speeded up using the same method.

又、上記実施例ではFFTを複素数演算を用いて計算し
ているが、複素数の実数部と虚数部のデータを分けてそ
れぞれ別の配列にして、通常の実数演算を用いて計算す
ることも可能である。
Also, in the above example, the FFT is calculated using complex number calculations, but it is also possible to separate the data of the real part and imaginary part of the complex number, arrange them in separate arrays, and calculate them using normal real number calculations. It is.

又、上記実施例で使用したデータの複素数表現、複素数
演算を用いて各種の技術計算を行なうことも可能である
が、技術計算の種類によっては固定小数点の精度が10
進数で約4桁である為、演算中に大きな誤差を生じる場
合があるので注意が必要である。
It is also possible to perform various technical calculations using the complex number representation and complex number operations of the data used in the above example, but depending on the type of technical calculation, the precision of the fixed point may be 10.
Since it is approximately 4 digits in base, care must be taken as a large error may occur during calculation.

〔発明の効果〕〔Effect of the invention〕

以上のようにこの発明によれば、数値演算を整数演算を
利用してブロック浮動小数点フォーマットで行なったの
で、高価な数値演算プロセッサを使うことなく、高速で
技術計算を行なうことができ、かつ必要とするメモリ容
量も削減することができる。
As described above, according to the present invention, numerical calculations are performed in block floating point format using integer calculations, making it possible to perform technical calculations at high speed without using an expensive numerical calculation processor. The memory capacity can also be reduced.

【図面の簡単な説明】[Brief explanation of drawings]

第1図はこの発明の一実施例による複素数の加減乗除と
絶対値を求める関数の方法を示す図、第2図はこの発明
の一実施例による複素数の処理方法を示す図、第3図は
この発明の一実施例による複素FFTを示す図、第4図
はこの発明の一実施例による図、第5図は従来の複素数
演算用関数の図、第6図は従来の複素数演算を用いたF
FT図、第7図は従来の実用的な複素数FFT図、第8
図は従来及びこの発明の一実施例共通の複素数FFTプ
ログラムのピットリバーサル部のフローチャート、第9
図は従来の複素数FFTプログラムのバタフライ種部の
フローチャート、第10図は従来の複素数FFTプログ
ラムの割り算部のフローチャート、第11図はこの発明
の一実施例による複素数FFTプログラムのバタフライ
種部のフローチャート、第12図はこの発明の一実施例
による複素数FFTプログラムのサブルーチンBCNO
RHのフローチャートである。 (1)は複素数の構造体宣言、(2)は複素数の加算用
関数、(3)は複素数の減算用関数、(4)は複素数の
乗算用関数、(5)は複素数の除算用関数、(6)は複
素数の絶対値を求める関数、 (7)は実数2つから複
素数を作る関数、(8)は複素数の配列のn個の要素を
2で割るサブルーチン、(9)は複素数の配列の要素の
各成分の最大値を1より小さくするサブルーチン、(1
0)は複素数FFTサブルーチン、(11)はピットリ
バーサル部、(12)はバタフライ種部、(13)は割
り算部を示す。 なお、図中、同一符号は同一もしくは相当部分を示す。
FIG. 1 is a diagram showing a function method for adding, subtracting, multiplying, and dividing complex numbers and determining the absolute value according to an embodiment of the present invention, FIG. 2 is a diagram showing a method for processing complex numbers according to an embodiment of the present invention, and FIG. FIG. 4 is a diagram showing a complex FFT according to an embodiment of the present invention, FIG. 5 is a diagram of a conventional complex FFT function, and FIG. 6 is a diagram showing a conventional complex FFT function. F
FT diagram, Figure 7 is a conventional practical complex FFT diagram, Figure 8
FIG. 9 is a flowchart of the pit reversal part of the complex number FFT program common to the conventional and one embodiment of the present invention.
10 is a flowchart of the division section of a conventional complex number FFT program. FIG. 11 is a flowchart of the butterfly seed section of a complex number FFT program according to an embodiment of the present invention. FIG. 12 shows the subroutine BCNO of a complex number FFT program according to an embodiment of the present invention.
It is a flowchart of RH. (1) is a complex number structure declaration, (2) is a complex number addition function, (3) is a complex number subtraction function, (4) is a complex number multiplication function, (5) is a complex number division function, (6) is a function that calculates the absolute value of a complex number, (7) is a function that creates a complex number from two real numbers, (8) is a subroutine that divides n elements of an array of complex numbers by 2, and (9) is an array of complex numbers. A subroutine that makes the maximum value of each component of the elements smaller than 1, (1
0) is a complex number FFT subroutine, (11) is a pit reversal section, (12) is a butterfly seed section, and (13) is a division section. In addition, in the figures, the same reference numerals indicate the same or corresponding parts.

Claims (1)

【特許請求の範囲】[Claims] 構造化された汎用の高級言語上で、複数個のデータを処
理する技術計算において、整数演算を利用したブロック
化浮動小数点演算もしくは固定小数点演算を用いたこと
を特徴とする、高速技術計算方法。
A high-speed technical computation method characterized by using blocked floating-point arithmetic or fixed-point arithmetic using integer arithmetic in technical computation that processes multiple pieces of data on a structured general-purpose high-level language.
JP2305035A 1990-11-07 1990-11-07 High speed technical calculation method Pending JPH04177461A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2305035A JPH04177461A (en) 1990-11-07 1990-11-07 High speed technical calculation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2305035A JPH04177461A (en) 1990-11-07 1990-11-07 High speed technical calculation method

Publications (1)

Publication Number Publication Date
JPH04177461A true JPH04177461A (en) 1992-06-24

Family

ID=17940317

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2305035A Pending JPH04177461A (en) 1990-11-07 1990-11-07 High speed technical calculation method

Country Status (1)

Country Link
JP (1) JPH04177461A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07325710A (en) * 1994-05-31 1995-12-12 Nec Corp Production of high-level language program simulated from assembler of fixed point arithmetic and arithmetic accuracy studying method
US6889240B2 (en) 1995-10-09 2005-05-03 Renesas Technology Corp. Data processing device having a central processing unit and digital signal processing unit

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07325710A (en) * 1994-05-31 1995-12-12 Nec Corp Production of high-level language program simulated from assembler of fixed point arithmetic and arithmetic accuracy studying method
US6889240B2 (en) 1995-10-09 2005-05-03 Renesas Technology Corp. Data processing device having a central processing unit and digital signal processing unit

Similar Documents

Publication Publication Date Title
KR980010751A (en) Method and apparatus for performing microprocessor integer division operations using floating point hardware
JPH0612229A (en) Multiplication and accumulation circuit
Joldes Rigorous polynomial approximations and applications
JPS62297984A (en) Visual display generator for curved image
JP2011501310A (en) Apparatus and method for performing magnitude detection for arithmetic operations
JP4199100B2 (en) Function calculation method and function calculation circuit
JPH04177461A (en) High speed technical calculation method
Corless et al. Blends in MAPLE
Mora et al. Mathematical model and implementation of rational processing
Eberly A fast and accurate algorithm for computing slerp
US3654437A (en) Octal/decimal calculator
Isupov et al. Parallel computation of normalized legendre polynomials using graphics processors
Risse Towards a mathematical library for UNUMs, an alternative to IEEE 754 floating point numbers
JPH03192429A (en) Square root arithmetic unit
RU2276805C2 (en) Method and device for separating integer and fractional components from floating point data
Kubica et al. Interval software, libraries and standards
JP2764975B2 (en) Precision floating point arithmetic processing unit
Baudendistel An improved method of scaling for real-time signal processing applications
JP3691538B2 (en) Vector data addition method and vector data multiplication method
JP2508286B2 (en) Square root calculator
Andrews et al. Evaluation of functions on microcomputers: square root
Lenders et al. pySLEQP: A sequential linear quadratic programming method implemented in Python
JPH06105421B2 (en) Inverse trigonometric function calculator
Smith et al. Multiplication, Division, and Floating Point
JP2972326B2 (en) Square root calculator