JP2020166661A - Division device, division method and program - Google Patents
Division device, division method and program Download PDFInfo
- Publication number
- JP2020166661A JP2020166661A JP2019067538A JP2019067538A JP2020166661A JP 2020166661 A JP2020166661 A JP 2020166661A JP 2019067538 A JP2019067538 A JP 2019067538A JP 2019067538 A JP2019067538 A JP 2019067538A JP 2020166661 A JP2020166661 A JP 2020166661A
- Authority
- JP
- Japan
- Prior art keywords
- calculation unit
- multiplication
- divisor
- elements
- division
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 13
- 238000004364 calculation method Methods 0.000 claims abstract description 102
- 230000006870 function Effects 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 9
- 238000004891 communication Methods 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000007667 floating Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
Images
Abstract
Description
本発明は、除算装置、除算方法及びプログラムに関する。 The present invention relates to a division device, a division method and a program.
特許文献1及び特許文献2は、演算プログラムにより、繰り返し演算が行われるループ処理内に、固定値である除数による除算を含んでいる場合に、除数の逆数をループ処理の外で先に演算し、ループ処理内では、除算を、除数の逆数との乗算に置き換えて演算することにより、演算プログラムの演算速度を向上させる技術について開示している。
In
特許文献3は、演算プログラムにより、固定値である被除数を、固定値である除数で除算する演算を行う場合に、除数の逆数を演算し、被除数と乗算した後、乗算後の値を補正する技術について開示している。
しかし、特許文献1及び特許文献2では、浮動小数点数である除数の逆数を演算する際に、誤差が生じるおそれがあり、また、除算結果について補正を行ったとしても、最下位の1ビットに誤差が生じるおそれがあった。
また、特許文献3では、複数回の除算を行う場合には、複数回の除算ごとに、除数の逆数を演算してから、被除数と乗算を行う必要があり、複数回の除算を行う場合には、演算速度が低下するおそれがあった。
そのため、特許文献1〜3では、配列である被除数を、スカラ変数である除数で除算する演算を行う場合に、複数の除算演算を高速化すると同時に、演算精度を向上させることはできなかった。
However, in
Further, in
Therefore, in
そこで、この発明は、上述の課題を解決する除算装置、除算方法及びプログラムを提供することを目的としている。 Therefore, an object of the present invention is to provide a division device, a division method, and a program that solve the above-mentioned problems.
本発明のいくつかの態様は、上述の課題を解決すべくなされたもので、本発明の第1の態様による除算装置は、
スカラ変数である除数の逆数を、被除数である配列に含まれる複数の要素ごとに乗算することにより、前記複数の要素ごとの乗算値を演算する乗算値演算部と、
前記乗算値演算部が演算した前記乗算値のそれぞれに対して、複数回の積和演算を行うことにより、前記乗算値演算部が演算した前記乗算値の補正値であって、前記複数の要素ごとの前記補正値を演算する補正値演算部と、
を備える。
Some aspects of the present invention have been made to solve the above-mentioned problems, and the division apparatus according to the first aspect of the present invention is
A multiplication value calculation unit that calculates the multiplication value for each of the plurality of elements by multiplying the reciprocal of the divisor, which is a scalar variable, for each of a plurality of elements included in the array that is the divisor.
A correction value of the multiplication value calculated by the multiplication value calculation unit by performing a product-sum operation a plurality of times for each of the multiplication values calculated by the multiplication value calculation unit, and the plurality of elements. A correction value calculation unit that calculates the correction value for each
To be equipped.
また、本発明の第2の態様による除算方法は、
スカラ変数である除数の逆数を、被除数である配列に含まれる複数の要素ごとに乗算することにより、前記複数の要素ごとの乗算値を演算し、
演算した前記乗算値のそれぞれに対して、複数回の積和演算を行うことにより、前記乗算値の補正値であって、前記複数の要素ごとの前記補正値を演算する。
Further, the division method according to the second aspect of the present invention is
By multiplying the reciprocal of the divisor, which is a scalar variable, for each of a plurality of elements included in the array that is a divisor, the multiplication value for each of the plurality of elements is calculated.
By performing a product-sum operation a plurality of times for each of the calculated multiplication values, the correction value of the multiplication value is calculated for each of the plurality of elements.
また、本発明の第3の態様によるプログラムは、
除算装置のコンピュータを、
スカラ変数である除数の逆数を、被除数である配列に含まれる複数の要素ごとに乗算することにより、前記複数の要素ごとの乗算値を演算する乗算値演算手段、
前記乗算値演算手段が演算した前記乗算値のそれぞれに対して、複数回の積和演算を行うことにより、前記乗算値演算手段が演算した前記乗算値の補正値であって、前記複数の要素ごとの前記補正値を演算する補正値演算手段、
として機能させる。
Further, the program according to the third aspect of the present invention is
The computer of the divider,
A multiplication value calculation means that calculates the multiplication value for each of the plurality of elements by multiplying the reciprocal of the divisor, which is a scalar variable, for each of a plurality of elements included in the array that is the divisor.
A correction value of the multiplication value calculated by the multiplication value calculation means by performing a product-sum operation a plurality of times for each of the multiplication values calculated by the multiplication value calculation means, and the plurality of elements. Correction value calculation means for calculating the correction value for each
To function as.
本発明のいくつかの態様によれば、配列である被除数を、スカラ変数である除数で除算する演算を行う場合に、複数の除算演算を高速化すると同時に、演算精度を向上させることができる。 According to some aspects of the present invention, when performing an operation of dividing an array divisor by a scalar variable divisor, it is possible to speed up a plurality of division operations and at the same time improve the calculation accuracy.
以下、本発明の実施形態について説明する。
図1〜図4は、本発明の実施形態による除算装置10a(図5)で行われる処理の概要を説明する図である。
除算装置10aは、シミュレーションやデータ解析などを行う計算機などである。除算装置10aには、図1の符号(a)で示すような、除算演算を含んだ演算命令が入力される。
Hereinafter, embodiments of the present invention will be described.
1 to 4 are diagrams illustrating an outline of processing performed by the
The
図1の符号(a)に示す演算では、実数(REAL)の複数(N個)の要素を含む配列A(N)、実数の複数(N個)の要素を含む配列B(N)、実数Sが用いられる。
図1の符号(a)では、値iを、1からNまで増加させながら(ループ処理)、A(i)=B(i)/Sの演算が行われる。なお、iは、1からNまでの整数のうち、いずれかの整数を示す。また、本願において、記号“/”や記号“÷”は、除算の演算子を示す。
なお、実数Sは、ループ処理が行われる間、一定であり、変化しない。
In the operation shown by the reference numeral (a) in FIG. 1, an array A (N) containing a plurality of (N) elements of a real number (REAL), an array B (N) containing a plurality of (N) elements of a real number, and a real number. S is used.
In the reference numeral (a) of FIG. 1, the calculation of A (i) = B (i) / S is performed while increasing the value i from 1 to N (loop processing). In addition, i represents any integer among integers from 1 to N. Further, in the present application, the symbol “/” and the symbol “÷” indicate division operators.
The real number S is constant and does not change while the loop processing is performed.
除算装置10aは、図1の符号(a)で示される演算命令を、図1の符号(b)で示される演算命令に置き換える。
図1の符号(b)に示す演算では、実数の複数(N個)の要素を含む配列A(N)、実数の複数(N個)の要素を含む配列B(N)、実数S、実数Tが用いられる。
図1の符号(b)に示す演算では、始めに、実数Sの逆数である実数Tが、T=1.0/Sの式により、ループ処理が行われる前に、演算される。
The dividing
In the operation shown by the reference numeral (b) in FIG. 1, an array A (N) containing a plurality of (N) elements of a real number, an array B (N) containing a plurality of (N) elements of a real number, a real number S, and a real number. T is used.
In the operation shown by the reference numeral (b) in FIG. 1, first, the real number T, which is the reciprocal of the real number S, is calculated by the formula T = 1.0 / S before the loop processing is performed.
次に、ループ処理が行われる。つまり、値iを、1からNまで増加させながら(ループ処理)、A(i)=B(i)*Tの演算が行われる。なお、本願において、記号“*”や記号“×”は、乗算の演算子を示す。
図1の符号(a)の演算では、実数Sによる除算が行われるが、図1の符号(b)の演算では、実数Tによる乗算が行われる。
Next, loop processing is performed. That is, the calculation of A (i) = B (i) * T is performed while increasing the value i from 1 to N (loop processing). In the present application, the symbol "*" and the symbol "x" indicate multiplication operators.
In the operation of the code (a) of FIG. 1, division by the real number S is performed, but in the operation of the code (b) of FIG. 1, multiplication by the real number T is performed.
図1の符号(a)で示す演算命令によれば、図2(a)に示すような演算が、配列Bを構成する要素B(i)に対して行われ、レジスタにマッピングされる。
つまり、配列Bのi番目の要素B(i)について、実数Sによる除算が行われることにより、配列Aのi番目の要素A(i)が演算される。例えば、始めに、配列Bの1番目の要素B(1)について、実数Sによる除算が行われることにより、配列Aの1番目の要素A(1)が演算される。同様の処理が、iを、1ずつ増加させながら行われ、最後に、配列BのN番目の要素B(N)について、実数Sによる除算が行われることにより、配列AのN番目の要素A(N)が演算される。
According to the operation instruction shown by the reference numeral (a) in FIG. 1, the operation shown in FIG. 2A is performed on the element B (i) constituting the array B and mapped to the register.
That is, the i-th element A (i) of the array B is calculated by dividing the i-th element B (i) of the array B by the real number S. For example, first, the first element B (1) of the array B is divided by the real number S, so that the first element A (1) of the array A is calculated. The same processing is performed while increasing i by one, and finally, the Nth element B (N) of the array B is divided by the real number S, so that the Nth element A of the array A is performed. (N) is calculated.
一方、図1の符号(b)で示す演算命令によれば、図2(b)に示すような演算が、配列Bを構成する要素B(i)に対して行われる。
つまり、配列Bのi番目の要素B(i)について、実数Tによる乗算が行われることにより、配列Aのi番目の要素A(i)が演算される。例えば、始めに、配列Bの1番目の要素B(1)について、実数Tによる乗算が行われることにより、配列Aの1番目の要素A(1)が演算される。同様の処理が、iを、1ずつ増加させながら行われ、最後に、配列BのN番目の要素B(N)について、実数Tによる乗算が行われることにより、配列AのN番目の要素A(N)が演算される。
On the other hand, according to the operation instruction shown by the reference numeral (b) in FIG. 1, the operation as shown in FIG.
That is, the i-th element B (i) of the array B is multiplied by the real number T to calculate the i-th element A (i) of the array A. For example, first, the first element B (1) of the array B is multiplied by a real number T to calculate the first element A (1) of the array A. The same processing is performed while increasing i by one, and finally, the Nth element B (N) of the array B is multiplied by the real number T, so that the Nth element A of the array A is performed. (N) is calculated.
図3は、本発明の実施形態による除算装置10aにより実行される演算命令を示している。
図3に示す演算では、実数の複数(N個)の要素を含む配列A(N)、実数の複数(N個)の要素を含む配列B(N)、実数S、実数T、実数Rが用いられる。
図3では、図1の符号(b)で説明したように、始めに、実数Sの逆数である実数Tが、T=1.0/Sの式により、ループ処理が行われる前に、演算される。
FIG. 3 shows an arithmetic instruction executed by the
In the operation shown in FIG. 3, the array A (N) including a plurality of (N) elements of a real number, the array B (N) containing a plurality of (N) elements of a real number, the real number S, the real number T, and the real number R are Used.
In FIG. 3, as described with reference numeral (b) in FIG. 1, first, the real number T, which is the reciprocal of the real number S, is calculated by the formula T = 1.0 / S before the loop processing is performed. Will be done.
次に、ループ処理が行われる。つまり、図1の符号(b)で説明したように、値iを、1からNまで増加させながら(ループ処理)、A(i)=B(i)*Tの演算が行われる。
そして、R=FMA(B(i)−A(i)*S)の式を用いた1回目のFMA(Fused Multiply and Add)演算が行われる。
そして、A’(i)=FMA(A(i)+T*R)の式を用いた2回目のFMA演算が行われる。
Next, loop processing is performed. That is, as described with reference numeral (b) in FIG. 1, the calculation of A (i) = B (i) * T is performed while increasing the value i from 1 to N (loop processing).
Then, the first FMA (Fused Multiply and Add) operation using the equation R = FMA (B (i) -A (i) * S) is performed.
Then, the second FMA calculation is performed using the formula A'(i) = FMA (A (i) + T * R).
図3で示す演算命令によれば、図4に示すような演算が、配列Bを構成する要素B(i)に対して行われ、レジスタにマッピングされる。
つまり、始めに、図4の符号(a)で示すように、配列Bのi番目の要素B(i)について、実数Tによる乗算が行われ、配列Aのi番目の要素A(i)が演算される。例えば、始めに、配列Bの1番目の要素B(1)について、実数Tによる乗算が行われることにより、配列Aの1番目の要素A(1)が演算される。同様の処理が、iを、1ずつ増加させながら行われ、最後に、配列BのN番目の要素B(N)について、実数Tによる乗算が行われることにより、配列AのN番目の要素A(N)が演算される。
According to the operation instruction shown in FIG. 3, the operation as shown in FIG. 4 is performed on the element B (i) constituting the array B and mapped to the register.
That is, first, as shown by the reference numeral (a) in FIG. 4, the i-th element B (i) of the array B is multiplied by the real number T, and the i-th element A (i) of the array A is It is calculated. For example, first, the first element B (1) of the array B is multiplied by a real number T to calculate the first element A (1) of the array A. The same processing is performed while increasing i by one, and finally, the Nth element B (N) of the array B is multiplied by the real number T, so that the Nth element A of the array A is performed. (N) is calculated.
次に、図4の符号(b)で示すように、図4の符号(a)の演算結果を用いて、Ri=B(i)−A(i)*Sの演算が行われる。例えば、始めに、R1=B(1)−A(1)*Sの演算が行われることにより、所定値R1が演算される。同様の処理が、iを、1ずつ増加させながら行われ、最後に、RN=B(N)−A(N)*Sの演算が行われることにより、所定値RNが演算される。
次に、図4の符号(c)で示すように、図4の符号(b)の演算結果を用いて、A’(i)=A(i)+T*Riの演算が行われる。例えば、始めに、A’(1)=A(1)+T*R1の演算が行われることにより、補正値A’(1)が演算される。同様の処理が、iを、1ずつ増加させながら行われ、最後に、A’(N)=A(N)+T*RNの演算が行われることにより、補正値A’(N)が演算される。
Next, as shown by the reference numeral (b) in FIG. 4, the calculation of Ri = B (i) −A (i) * S is performed using the calculation result of the reference numeral (a) in FIG. For example, the predetermined value R 1 is calculated by first performing the calculation of R 1 = B (1) -A (1) * S. Similar processing is the i, carried out while increasing by one, and finally, by calculating the R N = B (N) -A (N) * S is performed, the predetermined value R N is calculated.
Next, as shown by the reference numeral (c) in FIG. 4, the calculation of A'(i) = A (i) + T * R i is performed using the calculation result of the reference numeral (b) in FIG. For example, the correction value A'(1) is calculated by first performing the calculation of A'(1) = A (1) + T * R 1 . Similar processing is the i, carried out while increasing by one, and finally, A '(N) = by A (N) of the + T * R N operation is performed, the correction value A' (N) is operational Will be done.
次に、上述の図1〜図4を参照して説明した処理であって、本発明の実施形態による除算装置10aで行われる処理を実現するための具体的な構成及び処理について説明する。
Next, a specific configuration and processing for realizing the processing performed by the
図5は、本発明の実施形態による除算装置10aの構成を示すブロック図である。除算装置10aは、被除数取得部11、除数取得部12、逆数演算部13、乗算値演算部14a、補正値演算部15aを備える。
補正値演算部15aは、第1の演算部151、第2の演算部152を備える。
FIG. 5 is a block diagram showing a configuration of a
The correction
被除数取得部11は、PC(Pesrsonal Computer)のキーボードなどから入力される複数(N個)の要素であって、実数の要素を含む配列B={B(1)、B(2)、B(3)、・・・、B(N)}(Nは、正の整数)を取得し、その配列Bを、乗算値演算部14a、第1の演算部151に出力する。
除数取得部12は、PCのキーボードなどから入力されるスカラ変数であって、実数である除数Sを取得し、その除数Sを、逆数演算部13、第1の演算部151に出力する。
The division
The
逆数演算部13は、除数取得部12から出力される除数Sの逆数を用いて、T=1.0/Sの式により、逆数Tを演算し、その逆数Tを、乗算値演算部14a、第2の演算部152に出力する。
乗算値演算部14aは、被除数取得部11から出力される配列Bと、逆数演算部13から出力される逆数Tとを用いて、A(i)=B(i)*Tの式により、乗算値Aを演算し、その乗算値Aを、第1の演算部151、第2の演算部152に出力する。
The
The multiplication
第1の演算部151は、被除数取得部11から出力される被除数B(i)と、除数取得部12から出力される除数Sと、乗算値演算部14aから出力される乗算値A(i)とを用いて、Ri=FMA(B(i)−A(i)*S)の式により、所定値Riを演算し、その所定値Riを、第2の演算部152に出力する。なお、FMA()は、FMA(Fused Multiply and Add)演算を行うことを示す。
The
第2の演算部152は、逆数演算部13から出力される逆数Tと、乗算値演算部14aから出力される乗算値A(i)と、第1の演算部151から出力される所定値Riを用いて、A’(i)=FMA(A(i)+T*Ri)の式により、補正値A’(i)を演算し、その補正値A’を、除算装置10aの外部に出力する。
The
図6は、本発明の実施形態による除算装置10aの処理を示すフローチャートである。
始めに、除数取得部12は、スカラ変数であり、実数である除数Sを取得する(ステップS101)。
次に、被除数取得部11は、実数の要素B(1)、・・・、B(N)を含む配列Bであって、被除数である配列Bを取得する(ステップS102)。
FIG. 6 is a flowchart showing the processing of the
First, the
Next, the division
次に、逆数演算部13は、ステップS101で取得した除数Sの逆数を用いて、T=1.0/Sの式により、逆数Tを演算する(ステップS103)。
次に、乗算値演算部14aは、変数iを、1に設定する(ステップS104)。
次に、乗算値演算部14aは、ステップS102で取得した配列Bの要素B(i)と、ステップS103で取得した逆数Tとを用いて、A(i)=B(i)*Tの式により、乗算値Aのi番目の要素A(i)を演算する(ステップS105)。
Next, the
Next, the multiplication
Next, the multiplication
次に、第1の演算部151は、ステップS102で取得した配列Bの要素B(i)と、ステップS101で取得した除数Sと、ステップS105で演算した乗算値A(i)とを用いて、Ri=FMA(B(i)−A(i)*S)の式により、所定値Riを演算する(ステップS106)。
次に、第2の演算部152は、ステップS103て演算された逆数Tと、ステップS105で演算された乗算値A(i)と、ステップS106で演算された所定値Riを用いて、A’(i)=FMA(A(i)+T*Ri)の式により、補正値A’(i)を演算する(ステップS107)。
Next, the
Next, the
次に、乗算値演算部14aは、変数iが、配列Bに含まれる要素の数である整数Nと等しいか否かについて判定する(ステップS108)。
乗算値演算部14aが、変数iが、整数Nと等しくないと判定した場合には(ステップS108でNO)、乗算値演算部14aは、変数iに、1を加算し(ステップS109)、再度、上述したステップS105の処理を行う(ループ処理)。
一方、乗算値演算部14aが、変数iが、整数Nと等しいと判定した場合には(ステップS108でYES)、第2の演算部152は、それまでに、演算したN個の補正値A’(i)を、配列である補正値A’として、除算装置10aの外部に出力する(ステップS110)。
Next, the multiplication
When the multiplication
On the other hand, when the multiplication
本発明の実施形態によれば、ループ処理中に不変な除数Sによる除算を、除数Sの逆数との乗算に置き換えることにより、ループ処理中は、配列の各要素ごとに、除数Sの逆数を演算する必要がない。つまり、乗算値A(i)を演算する処理については、配列Bの要素の数であるN回行われるが、除数Sの逆数を演算する処理については、1回のみ行われる。そのため、演算速度の高速性を損なうことなく演算誤差を解消することができる。 According to an embodiment of the present invention, the reciprocal of the divisor S is calculated for each element of the array during the loop processing by replacing the division by the invariant divisor S during the loop processing with the multiplication of the reciprocal of the divisor S. No need to calculate. That is, the process of calculating the multiplication value A (i) is performed N times, which is the number of elements in the array B, but the process of calculating the reciprocal of the divisor S is performed only once. Therefore, the calculation error can be eliminated without impairing the high speed of the calculation speed.
また、FMAを用いた演算を行うことにより、除算を実行した場合と同じ値を得ることができ、更に、除算を乗算に置き換えた時に生じる演算誤差を解消することができる。なお、FMAを用いた演算を行うことにより、演算時間は、増加するものの、FMA演算は高速であるため、除算を行う場合と比較すると、演算時間を短縮することができる。 Further, by performing the calculation using FMA, the same value as when the division is executed can be obtained, and further, the calculation error that occurs when the division is replaced with the multiplication can be eliminated. Although the calculation time is increased by performing the calculation using FMA, since the FMA calculation is high speed, the calculation time can be shortened as compared with the case of performing division.
図7は、最小構成を有する除算装置10bの構成を示すブロック図である。除算装置10bは、乗算値演算部14b、補正値演算部15bを備える。
FIG. 7 is a block diagram showing the configuration of the
図8は、最小構成を有する除算装置10bの処理を示すフローチャートである。
始めに、乗算値演算部14bは、スカラ変数である除数Sの逆数T(=1.0/S)を、被除数である配列Bに含まれる複数の要素B(i)ごとに乗算することにより、複数の要素B(i)ごとの乗算値A(i)を演算する(ステップS201)。
次に、補正値演算部15bは、乗算値演算部14bが演算した乗算値A(i)のそれぞれに対して、複数回(例えば、2回)の積和演算(例えば、FMA演算)を行うことにより、乗算値演算部14bが演算した乗算値A(i)の補正値A’(i)であって、複数の要素B(i)ごとの補正値A’(i)を演算する(ステップS202)。
FIG. 8 is a flowchart showing the processing of the
First, the multiplication
Next, the correction
なお、図5における各部の機能を実現するためのプログラムをコンピュータ読み取り可能な記録媒体に記録して、この記録媒体に記録されたプログラムをコンピュータシステムに読み込ませ、実行することにより図5における各部の処理を行ってもよい。なお、ここでいう「コンピュータシステム」とは、OSや周辺機器等のハードウェアを含むものとする。また、「コンピュータシステム」は、ホームページ提供環境(あるいは表示環境)を備えたWWWシステムも含むものとする。また、「コンピュータ読み取り可能な記録媒体」とは、フレキシブルディスク、光磁気ディスク、ROM、CD−ROM等の可搬媒体、コンピュータシステムに内蔵されるハードディスク等の記憶装置のことをいう。さらに「コンピュータ読み取り可能な記録媒体」とは、インターネット等のネットワークや電話回線等の通信回線を介してプログラムが送信された場合のサーバやクライアントとなるコンピュータシステム内部の揮発性メモリ(RAM)のように、一定時間プログラムを保持しているものも含むものとする。 A program for realizing the functions of each part in FIG. 5 is recorded on a computer-readable recording medium, and the program recorded on the recording medium is read into a computer system and executed to obtain the parts in FIG. Processing may be performed. The term "computer system" as used herein includes hardware such as an OS and peripheral devices. Further, the "computer system" shall also include a WWW system provided with a homepage providing environment (or display environment). Further, the "computer-readable recording medium" refers to a portable medium such as a flexible disk, a magneto-optical disk, a ROM, or a CD-ROM, or a storage device such as a hard disk built in a computer system. Furthermore, a "computer-readable recording medium" is a volatile memory (RAM) inside a computer system that serves as a server or client when a program is transmitted via a network such as the Internet or a communication line such as a telephone line. In addition, it shall include those that hold the program for a certain period of time.
本発明のいくつかの態様は、配列である被除数を、スカラ変数である除数で除算する演算を行う場合に、複数の除算演算を高速化すると同時に、演算精度を向上させることが必要な除算装置、除算方法及びプログラムなどに適用することができる。 In some aspects of the present invention, when a division that is an array is divided by a divisor that is a scalar variable, it is necessary to speed up a plurality of division operations and at the same time improve the calculation accuracy. , Dividing methods and programs, etc.
10a、10b・・・除算装置
11・・・被除数取得部
12・・・除数取得部
13・・・逆数演算部
14a、14b・・・乗算値演算部(乗算値演算手段)
15a、15b・・・補正値演算部(補正値演算手段)
151・・・第1の演算部
152・・・第2の演算部
10a, 10b ...
15a, 15b ... Correction value calculation unit (correction value calculation means)
151 ... 1st
Claims (10)
前記乗算値演算部が演算した前記乗算値のそれぞれに対して、複数回の積和演算を行うことにより、前記乗算値演算部が演算した前記乗算値の補正値であって、前記複数の要素ごとの前記補正値を演算する補正値演算部と、
を備える除算装置。 A multiplication value calculation unit that calculates the multiplication value for each of the plurality of elements by multiplying the reciprocal of the divisor, which is a scalar variable, for each of a plurality of elements included in the array that is the divisor.
A correction value of the multiplication value calculated by the multiplication value calculation unit by performing a product-sum operation a plurality of times for each of the multiplication values calculated by the multiplication value calculation unit, and the plurality of elements. A correction value calculation unit that calculates the correction value for each
Dividing device with.
請求項1に記載の除算装置。 The division device according to claim 1, wherein the correction value calculation unit performs two product-sum operations as the plurality of product-sum operations.
請求項1又は2に記載の除算装置。 The division device according to claim 1 or 2, wherein the correction value calculation unit performs the product-sum calculation a plurality of times by using an FMA (Fused Multiply and Add) calculation.
前記除数と、前記被除数と、前記乗算値演算部が演算した前記乗算値とに基づいて、前記複数の要素ごとに、所定値を演算する第1の演算部を更に備える
請求項1から3のいずれかに記載の除算装置。 The correction value calculation unit
Claims 1 to 3 further include a first calculation unit that calculates a predetermined value for each of the plurality of elements based on the divisor, the divisor, and the multiplication value calculated by the multiplication value calculation unit. The dividing device described in either.
前記逆数と、前記乗算値演算部が演算した前記乗算値と、前記第1の演算部が演算した前記所定値とに基づいて、前記複数の要素ごとに、前記乗算値の前記補正値を演算する第2の演算部と、
を備える
請求項4に記載の除算装置。 The correction value calculation unit
Based on the reciprocal, the multiplication value calculated by the multiplication value calculation unit, and the predetermined value calculated by the first calculation unit, the correction value of the multiplication value is calculated for each of the plurality of elements. The second arithmetic unit to do
The division device according to claim 4.
前記被除数のi番目の要素をB(i)とし、
前記乗算値のi番目の要素をA(i)とし、
前記除数をSとした場合に、
前記第1の演算部は、Ri=FMA(B(i)−A(i)*S)の式により、前記複数の要素ごとに、前記所定値を演算する
請求項4又は5に記載の除算装置。 I th said predetermined value (i is any integer from 1 to N) elements of the R i,
Let B (i) be the i-th element of the divisor.
Let A (i) be the i-th element of the multiplication value.
When the divisor is S,
Said first operation unit, the equation R i = FMA (B (i ) -A (i) * S), for each of the plurality of elements, according to claim 4 or 5 for calculating a predetermined value Divider.
前記第2の演算部は、A’(i)=FMA(A(i)+T*Ri)の式により、前記複数の要素ごとに、前記補正値を演算する
請求項5に記載の除算装置。 When the i-th element of the correction value is A'(i),
The division apparatus according to claim 5, wherein the second calculation unit calculates the correction value for each of the plurality of elements by the formula A'(i) = FMA (A (i) + T * R i ). ..
前記乗算値演算部は、前記乗算値を演算する処理を、前記複数の要素の数だけ行う
請求項1から7のいずれかに記載の除算装置。 Further provided with a reciprocal calculation unit that performs the reciprocal calculation of the divisor only once.
The division device according to any one of claims 1 to 7, wherein the multiplication value calculation unit performs a process of calculating the multiplication value by the number of the plurality of elements.
演算した前記乗算値のそれぞれに対して、複数回の積和演算を行うことにより、前記乗算値の補正値であって、前記複数の要素ごとの前記補正値を演算する
除算方法。 By multiplying the reciprocal of the divisor, which is a scalar variable, for each of a plurality of elements included in the array that is a divisor, the multiplication value for each of the plurality of elements is calculated.
A division method for calculating a correction value of the multiplication value for each of the plurality of elements by performing a product-sum operation a plurality of times for each of the calculated multiplication values.
スカラ変数である除数の逆数を、被除数である配列に含まれる複数の要素ごとに乗算することにより、前記複数の要素ごとの乗算値を演算する乗算値演算手段、
前記乗算値演算手段が演算した前記乗算値のそれぞれに対して、複数回の積和演算を行うことにより、前記乗算値演算手段が演算した前記乗算値の補正値であって、前記複数の要素ごとの前記補正値を演算する補正値演算手段、
として機能させるプログラム。 The computer of the divider,
A multiplication value calculation means that calculates the multiplication value for each of the plurality of elements by multiplying the reciprocal of the divisor, which is a scalar variable, for each of a plurality of elements included in the array that is the divisor.
A correction value of the multiplication value calculated by the multiplication value calculation means by performing a product-sum operation a plurality of times for each of the multiplication values calculated by the multiplication value calculation means, and the plurality of elements. Correction value calculation means for calculating the correction value for each
A program that functions as.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019067538A JP2020166661A (en) | 2019-03-29 | 2019-03-29 | Division device, division method and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019067538A JP2020166661A (en) | 2019-03-29 | 2019-03-29 | Division device, division method and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2020166661A true JP2020166661A (en) | 2020-10-08 |
Family
ID=72716354
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2019067538A Pending JP2020166661A (en) | 2019-03-29 | 2019-03-29 | Division device, division method and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2020166661A (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02227726A (en) * | 1989-01-13 | 1990-09-10 | Internatl Business Mach Corp <Ibm> | Apparatus and method for executing floating point division |
-
2019
- 2019-03-29 JP JP2019067538A patent/JP2020166661A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02227726A (en) * | 1989-01-13 | 1990-09-10 | Internatl Business Mach Corp <Ibm> | Apparatus and method for executing floating point division |
Non-Patent Citations (1)
Title |
---|
"除算の乗算への変換", ACOS ソフトウェア ACOS−4/NPX FORTRAN77 プログラミングの手引 初版, JPN6022048887, 30 April 1998 (1998-04-30), pages 124 - 125, ISSN: 0005038197 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10657442B2 (en) | Deep learning accelerator architecture with chunking GEMM | |
WO2020150678A1 (en) | Oblivious binary neural networks | |
Slevinsky | On the use of Hahn’s asymptotic formula and stabilized recurrence for a fast, simple and stable Chebyshev–Jacobi transform | |
Dai et al. | Area-time efficient architecture of FFT-based montgomery multiplication | |
EP3769208A1 (en) | Stochastic rounding logic | |
Nagar | Introduction to Python for Engineers and Scientists: Open Source Solutions for Numerical Computation | |
de Lassus Saint-Geniès et al. | Exact lookup tables for the evaluation of trigonometric and hyperbolic functions | |
US7895252B2 (en) | Single-channel convolution in a vector processing computer system | |
Martin-Dorel et al. | Some issues related to double rounding | |
JP2502836B2 (en) | Preprocessing device for division circuit | |
EP3079056B1 (en) | Systems and methods for computing mathematical functions | |
US9933999B2 (en) | Apparatus, method and program for calculating the result of a repeating iterative sum | |
Anastasia et al. | Linear image processing operations with operational tight packing | |
JP2020166661A (en) | Division device, division method and program | |
JP5193358B2 (en) | Polynomial data processing operations | |
Pegoraro et al. | On the evaluation of the complex-valued exponential integral | |
Mora et al. | Mathematical model and implementation of rational processing | |
EP3239833B1 (en) | Calculating trigonometric functions using a four input dot product circuit | |
US20030182339A1 (en) | Emod a fast modulus calculation for computer systems | |
US20190197084A1 (en) | Data compression apparatus and data compression method and storage medium | |
US7539715B2 (en) | Method and system for saturating a left shift result using a standard shifter | |
TWI753668B (en) | Information processing apparatus, computer program, recording medium and information processing method | |
EP3923132B1 (en) | Device for performing multiply/accumulate operations | |
US7277908B2 (en) | Numeric processor, a numeric processing method, and a data processing apparatus or computer program incorporating a numeric processing mechanism | |
CN117270813A (en) | Arithmetic unit, processor, and electronic apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20220207 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20221109 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20221122 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20230120 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20230418 |