JP7560765B2 - Calculation method, calculation device and program - Google Patents
Calculation method, calculation device and program Download PDFInfo
- Publication number
- JP7560765B2 JP7560765B2 JP2022564862A JP2022564862A JP7560765B2 JP 7560765 B2 JP7560765 B2 JP 7560765B2 JP 2022564862 A JP2022564862 A JP 2022564862A JP 2022564862 A JP2022564862 A JP 2022564862A JP 7560765 B2 JP7560765 B2 JP 7560765B2
- Authority
- JP
- Japan
- Prior art keywords
- square root
- calculation
- result
- unit
- computer
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Computational Mathematics (AREA)
- Pure & Applied Mathematics (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Algebra (AREA)
- Complex Calculations (AREA)
Description
本発明は、計算方法、計算装置およびプログラムの技術に関する。 The present invention relates to a calculation method, a calculation device and a program technology.
ネットワークや地理情報学、画像工学などの諸分野において、埋め込みグラフというデータ構造が存在する。埋め込みグラフとは、複数の頂点とその頂点同士を結ぶ辺の集合であるグラフと、その頂点位置を合わせて定義したものである。例えばネットワークでは、ネットワークノードを頂点、ネットワークリンクを辺に対応させてグラフを構成できる。このとき、ネットワークノードの物理的な位置や、ネットワークを可視化する際のノード座標を頂点位置に対応させると、埋め込みグラフを見出すことができる。 A data structure called an embedded graph exists in various fields such as networks, geographic information science, and image engineering. An embedded graph is defined by combining a graph, which is a set of multiple vertices and the edges connecting those vertices, with the positions of those vertices. For example, in a network, a graph can be constructed by corresponding network nodes to vertices and network links to edges. In this case, an embedded graph can be found by matching the physical positions of the network nodes or the node coordinates when visualizing the network to the vertex positions.
また、地理情報学であれば、国境や県境、海岸線、湖岸線等の境界線データは一般に、埋め込みグラフとしてデータが保持されている。境界線上に密に頂点をプロットして辺を結ぶことで、境界線を表現している。また、画像工学分野であれば、形状や領域に関するデータの保持に埋め込みグラフが使用される。例えばベクター画像におけるオブジェクト形状、深度マップにおける深度境界線、自然画像の被写体形状やテクスチャ領域形状等のデータは、埋め込みグラフとして表現される。形状や領域の境界上に頂点をプロットすることで、境界線を辺により表現している。In geographic information science, boundary data such as national and prefectural borders, coastlines, and lake shorelines are generally stored as embedded graphs. Boundaries are represented by densely plotting vertices on the boundaries and connecting the edges. In the field of image engineering, embedded graphs are used to store data related to shapes and areas. For example, data such as object shapes in vector images, depth boundaries in depth maps, subject shapes and texture area shapes in natural images are represented as embedded graphs. Boundaries are represented by edges by plotting vertices on the boundaries of shapes and areas.
以上で例示した埋め込みグラフにおいては、埋め込みグラフの形状をできるだけ保ちつつ、頂点数や辺数を可能な限り削減して単純化すること(以下、埋め込みグラフの単純化、あるいは単に単純化と呼ぶ)に大きなメリットがある。 In the embedded graphs shown above, there is a great advantage to simplifying the embedded graph by reducing the number of vertices and edges as much as possible while preserving the shape of the embedded graph as much as possible (hereinafter referred to as simplifying the embedded graph, or simply simplification).
ネットワークにおいては、頂点数、辺数が多いほど詳細なデータを表現できる一方で、一見してネットワーク構成の概要を掴むことが困難になり、加えてデータ量が膨大になるため描画に大きな負荷がかかる。このネットワークについての埋め込みグラフを単純化できれば、ネットワーク構成を視覚的に分かりやすく提示でき、頂点数、辺数を減らしてデータ圧縮し、描画の負荷を低減することが可能になる。地理情報学においては、境界線上に密に頂点をプロットすることで正確に境界線を表現するが、データ量は膨大になってしまう。 In a network, the more vertices and edges there are, the more detailed the data can be expressed, but it also becomes difficult to grasp the overall network configuration at a glance, and the data volume becomes huge, placing a heavy load on drawing. If the embedded graph for this network could be simplified, the network configuration could be presented in a visually easy-to-understand manner, and it would be possible to reduce the number of vertices and edges, compress the data, and reduce the load on drawing. In geographic information studies, boundaries can be accurately represented by densely plotting vertices on the boundaries, but this results in a huge amount of data.
境界線データを単純化することで、データ量を削減して伝送や蓄積が可能な他、境界を簡略した視覚的に分かりやすい地理情報を生成することができる。また画像工学においては、頂点数、辺数が多いほど形状や領域のデータを詳細に保持して正確に表現可能である一方で、データ量が膨大になり、伝送や蓄積に要する符号量が増えてしまう。 By simplifying boundary data, it is possible to reduce the amount of data required for transmission and storage, and to generate geographic information with simplified boundaries that is visually easier to understand. In image engineering, the more vertices and edges there are, the more detailed shape and area data can be retained and more accurately represented, but the amount of data becomes enormous, and the amount of code required for transmission and storage increases.
この形状や領域を単純化できれば、表現の正確性を可能な限り保ちながら、頂点数、辺数を削減して符号量を削減できる。
以上の単純化を達成するための発明として、埋め込みグラフ単純化法が提案されている(特許文献2参照)。またこの高速処理法(2次元版)(特許文献3参照)と、高速処理法(多次元版)(特許文献4参照)とが提案されている。
If this shape and area can be simplified, the number of vertices and edges can be reduced, thereby reducing the amount of code, while maintaining the accuracy of the representation as much as possible.
As an invention for achieving the above simplification, an embedded graph simplification method has been proposed (see Patent Document 2). A high-speed processing method (two-dimensional version) (see Patent Document 3) and a high-speed processing method (multidimensional version) (see Patent Document 4) have also been proposed.
上記の高速処理法では特異値閾値処理(Singular Value Thresholding;SVT)(特許文献4参照)を多数並列に高速計算するFast Multiple SVT(非特許文献1参照)が採用されている。図16にアルゴリズムを掲載する。図16Aと図16Bに示されるアルゴリズムのうちの3行目g-1とh-1と4行目σ2においてはそれぞれ逆数平方根と平方根の差が計算されている。この逆数平方根は図16Aと図16Bに示されるアルゴリズムの計算速度のボトルネックとなっている。 The above high-speed processing method employs Fast Multiple SVT (see Non-Patent Document 1), which performs high-speed calculations of multiple Singular Value Thresholding (SVT) (see Patent Document 4) in parallel. The algorithm is shown in FIG. 16. In the algorithm shown in FIG. 16A and FIG. 16B, the reciprocal square root and the difference between square roots are calculated in the third line g -1 and h -1 and the fourth line σ 2, respectively. This reciprocal square root is the bottleneck in the calculation speed of the algorithm shown in FIG. 16A and FIG. 16B.
また平方根の差の計算は桁落ちが生じやすく、誤差が発生しやすい。さらに、図16Aと図16Bに示されるアルゴリズムのうちの4行目の平方根の差計算においてのみ、平方根の計算が必要であり、その他の個所では逆数平方根しか用いられていない。
In addition, the calculation of the difference between square roots is prone to cancellation of digits, which can easily lead to errors. Furthermore, in the algorithms shown in Figures 16A and 16B, only the square root calculation is required in the square root difference calculation on
さて、ある正の実数Aの逆数平方根a=1/√Aは、コンピュータグラフィクス(CG)分野における反射光および分散光シミュレーションにおいて、法線計算という形で多量に繰り返して計算される。Now, the reciprocal square root a = 1/√A of a positive real number A is calculated repeatedly and extensively in the form of normal calculations in reflected light and scattered light simulations in the field of computer graphics (CG).
この計算量を削減するために、高速逆数平方根法(Fast Inverse Square Root;FastInvSqrt法)が発明され、平方根の計算を回避することで、逆数平方根の計算は数倍程度高速化されている。この技術はCGを用いたゲームソフトウェアに実装されている(非特許文献2参照)。またFastInvSqrt法の高精度版として修正FastInvSqrt法が発明されている(非特許文献3参照)。 To reduce the amount of calculation, the Fast Inverse Square Root (FastInvSqrt) method was invented, which speeds up the calculation of the reciprocal square root by several times by avoiding the calculation of the square root. This technology is implemented in game software that uses CG (see Non-Patent Document 2). In addition, a modified FastInvSqrt method has been invented as a high-precision version of the FastInvSqrt method (see Non-Patent Document 3).
このFastInvSqrt法または修正FastInvSqrt法を、上述のFast Multiple SVTにおける逆数平方根の計算に採用することで計算速度の向上が見込まれる。 By adopting this FastInvSqrt method or the modified FastInvSqrt method to calculate the reciprocal square root in the Fast Multiple SVT described above, it is expected that the calculation speed will be improved.
しかしながら、Fast Multiple SVTでは平方根の差計算も必要であるため、結局のところ平方根が必要であり、さらに逆数演算を取る必要が発生する。このため、上記の速度向上は達成されない。However, Fast Multiple SVT requires square root difference calculations, so ultimately the square root is required, and then a reciprocal calculation is required. As a result, the speedup mentioned above is not achieved.
このように、Fast Multiple SVTを用いるグラフ単純化装置は高速に処理できず、グラフ描画やグラフ処理を高速に実行できない。 As such, a graph simplification device using Fast Multiple SVT cannot process quickly, and cannot perform graph drawing or graph processing quickly.
上記事情に鑑み、本発明は、平方根を含む計算をより速く行う技術の提供を目的としている。 In view of the above circumstances, the present invention aims to provide a technology for performing calculations including square roots more quickly.
本発明の一態様は、コンピュータが、正の実数Aの逆数平方根を高速逆数平方根法により計算する第1逆数平方根ステップと、コンピュータが、正の実数Bの逆数平方根を高速逆数平方根法により計算する第2逆数平方根ステップと、コンピュータが、AからBを減算する減算ステップと、コンピュータが、前記第1逆数平方根ステップでの計算結果と、前記第2逆数平方根ステップでの計算結果とを乗算する第1乗算ステップと、コンピュータが、前記第1乗算ステップでの計算結果と、前記減算ステップでの計算結果とを乗算する第2乗算ステップと、コンピュータが、前記第1逆数平方根ステップでの計算結果と、前記第2逆数平方根ステップでの計算結果とを加算する加算ステップと、コンピュータが、前記第2乗算ステップでの計算結果を、前記加算ステップでの計算結果で除算する除算ステップと、を備えた計算方法である。One aspect of the present invention is a calculation method including a first reciprocal square root step in which the computer calculates the reciprocal square root of a positive real number A using the fast reciprocal square root method, a second reciprocal square root step in which the computer calculates the reciprocal square root of a positive real number B using the fast reciprocal square root method, a subtraction step in which the computer subtracts B from A, a first multiplication step in which the computer multiplies the calculation result of the first reciprocal square root step by the calculation result of the second reciprocal square root step, a second multiplication step in which the computer multiplies the calculation result of the first multiplication step by the calculation result of the subtraction step, an addition step in which the computer adds the calculation result of the first reciprocal square root step by the calculation result of the second reciprocal square root step, and a division step in which the computer divides the calculation result of the second multiplication step by the calculation result of the addition step.
本発明の一態様は、上記の計算方法をコンピュータに実行させるためのプログラムである。 One aspect of the present invention is a program for causing a computer to execute the above calculation method.
本発明の一態様は、正の実数Aの逆数平方根を高速逆数平方根法により計算する第1逆数平方根部と、正の実数Bの逆数平方根を高速逆数平方根法により計算する第2逆数平方根部と、AからBを減算する減算部と、前記第1逆数平方根部での計算結果と、前記第2逆数平方根部での計算結果とを乗算する第1乗算部と、前記第1乗算部での計算結果と、前記減算部での計算結果とを乗算する第2乗算部と、前記第1逆数平方根部での計算結果と、前記第2逆数平方根部での計算結果とを加算する加算部と、前記第2乗算部での計算結果を、前記加算部での計算結果で除算する除算部と、を備えた計算装置である。One aspect of the present invention is a calculation device including a first reciprocal square root unit that calculates the reciprocal square root of a positive real number A using the fast reciprocal square root method, a second reciprocal square root unit that calculates the reciprocal square root of a positive real number B using the fast reciprocal square root method, a subtraction unit that subtracts B from A, a first multiplication unit that multiplies the calculation result of the first reciprocal square root unit by the calculation result of the second reciprocal square root unit, a second multiplication unit that multiplies the calculation result of the first multiplication unit by the calculation result of the subtraction unit, an addition unit that adds the calculation result of the first reciprocal square root unit to the calculation result of the second reciprocal square root unit, and a division unit that divides the calculation result of the second multiplication unit by the calculation result of the addition unit.
本発明により、平方根を含む計算をより速く行うことが可能となる。 The present invention makes it possible to perform calculations involving square roots faster.
本発明の実施形態について、図面を参照して詳細に説明する。
図1は、実施形態における計算装置10を含む情報処理装置1の構成を示す図である。情報処理装置1は、入力装置3、計算装置10、および出力装置5を備える。入力装置3は、計算装置10に数値等の入力データを入力する。計算装置10は、入力データを用いて計算を行い、計算結果を出力装置5に出力する。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described in detail with reference to the drawings.
1 is a diagram showing the configuration of an
計算装置10は、バスで接続されたCPU(Central Processing Unit)やメモリや補助記憶装置などを備え、計算プログラムに実行することによって計算処理を実行する。計算装置10の各機能の全て又は一部は、ASIC(Application Specific Integrated Circuit)やPLD(Programmable Logic Device)やFPGA(Field Programmable Gate Array)等のハードウェアを用いて実現されてもよい。計算プログラムは、コンピュータ読み取り可能な記録媒体に記録されてもよい。コンピュータ読み取り可能な記録媒体とは、例えばフレキシブルディスク、光磁気ディスク、ROM、CD-ROM、半導体記憶装置(例えばSSD:Solid State Drive)等の可搬媒体、コンピュータシステムに内蔵されるハードディスク等の記憶装置である。計算プログラムは、電気通信回線を介して送信されてもよい。The
以下、計算装置10の第1実施形態~第6実施形態について説明する。その後、計算装置10の適用例としてグラフの単純化処理について説明する。なお、各実施形態における「高速逆数平方根計算部」は、高速逆数平方根法により逆数平方根を計算する。
Below, the first to sixth embodiments of the
[第1実施形態]
以下、第1実施形態における計算装置10である計算装置10Aについて説明する。図2は、実施形態における逆数平方根、および平方根差を計算する計算装置10Aの構成を示すブロック図である。計算装置10Aは、入力装置3から正の実数A、Bが入力され、a=1/√A、b=1/√B、c=√A-√Bを出力装置5に出力する計算装置である。計算装置10Aは、高速逆数平方根計算部11、21、減算部12、乗算部17、117、加算部13、および除算部14を備える。
[First embodiment]
Hereinafter, a
計算装置10Aにおいて、正の実数Aが入力されると、Aは、高速逆数平方根計算部11および減算部12に入力される。正の実数Bが入力されると、Bは、高速逆数平方根計算部21および減算部12に入力される。高速逆数平方根計算部11は、減算部12、加算部13、および出力装置5にa=1/√Aを出力する。高速逆数平方根計算部21は、減算部12、加算部13、および出力装置5にb=1/√Bを出力する。減算部12は、A-Bを乗算部117に出力する。When a positive real number A is input to
乗算部17は、乗算部117にabを出力する。乗算部117は、除算部14に(A-B)abを出力する。加算部13は、a+bを除算部14に出力する。除算部14は、cとして(A-B)ab/(a+b)を出力装置5に出力する。
The
ここで、(A-B)ab/(a+b)=√A-√Bであることは、以下の通りである。
√A-√B=(√A-√B)(√A+√B)/(√A+√B)
=(A-B)/(√A+√B)
ここで、
√A+√B=(1/√A+1/√B)(√A√B)=(a+b)/(ab)
よって
(A-B)/(√A+√B)=(A-B)ab/(a+b)
Here, (A-B)ab/(a+b)=√A-√B as follows.
√A-√B=(√A-√B)(√A+√B)/(√A+√B)
=(A-B)/(√A+√B)
Where:
√A+√B=(1/√A+1/√B)(√A√B)=(a+b)/(ab)
Therefore, (A-B)/(√A+√B)=(A-B)ab/(a+b).
以上より、計算装置10Aは、a=1/√A、b=1/√B、およびc=√A-√Bを出力装置5に出力する。計算装置10Aは、逆数平方根を計算するが、√A、√Bは計算していない。よって、cを√A、√Bを計算することなく出力する。また、分子の有理化を行うことで、√A、√Bを計算する場合と比較して、√A-√Bの桁落ちを防止することができる。
From the above,
図3は、参考例として、従来通り、√A、√Bを計算してa,b,cを出力する計算装置20を示すブロック図である。計算装置20は、平方根計算部15、25、減算部22、および除算部24、34を備える。
Figure 3 is a block diagram showing a
計算装置20において、正の実数Aが入力されると、平方根計算部15は、減算部22、および除算部24に√Aを出力する。正の実数Bが入力されると、平方根計算部25は、減算部22、および除算部34に√Bを出力する。In the
除算部24は、a=1/√Aを出力する。除算部34は、b=1/√Bを出力する。減算部22は、c=√A-√Bを出力する。
The
ここで計算量を比較するために、図4を用いて各計算の計算量について説明する。図4は、C++言語で、各計算を1,000,000回計算するのに要した時間を、加算を1flopsとして示した図である。図4において、sqrt(x)は平方根,1/sqrt(x)は逆数平方根をC++言語の標準ライブラリ関数によって演算した場合の計算量を示している。また、fastInvSqrt(x)はニュートン法1回のFast Inverse Square Root法による計算量を示している。fastInvSqrt2(x)はニュートン法2回のFast Inverse Square Root法による計算量を示している。fastInvSqrt3(x)はニュートン法3回のFast Inverse Square Root法による計算量を示している。mFastInvSqrt(x)は修正Fast Inverse Square Root法による計算量を示している。 In order to compare the amount of calculations, the amount of calculations for each calculation will be explained using Figure 4. Figure 4 shows the time required to perform each calculation 1,000,000 times in C++, with addition being 1 flop. In Figure 4, sqrt(x) indicates the amount of calculation required to calculate the square root and 1/sqrt(x) indicates the amount of calculation required to calculate the reciprocal square root using standard library functions in C++. Also, fastInvSqrt(x) indicates the amount of calculation required by the Fast Inverse Square Root method using Newton's method once. fastInvSqrt2(x) indicates the amount of calculation required by the Fast Inverse Square Root method using Newton's method twice. fastInvSqrt3(x) indicates the amount of calculation required by the Fast Inverse Square Root method using Newton's method three times. mFastInvSqrt(x) indicates the amount of calculation required by the modified Fast Inverse Square Root method.
また、H.A. Thant, et. al., “Mobile Agents Based Load Balancing Method for Parallel Applications,” 6th Asia-Pacific Symposium on Information and Telecommunication Technologies, Yangon, 2005.によれば、浮動小数点型の加算1回の計算量を同じく1flopとすると、減算、乗算は1flop、除算および平方根計算は4flopsの計算量である。またFastInvSqrt法による逆数平方根演算は、図4に示すとおり、1flopsと見積もることができる。According to H.A. Thant, et. al., “Mobile Agents Based Load Balancing Method for Parallel Applications,” 6th Asia-Pacific Symposium on Information and Telecommunication Technologies, Yangon, 2005, if the computational effort of one floating-point addition is also 1 flop, then subtraction and multiplication require 1 flop, while division and square root calculations require 4 flops. Furthermore, the reciprocal square root calculation using the FastInvSqrt method can be estimated to be 1 flop, as shown in Figure 4.
a、b、cを従来の計算装置20で計算する場合、計算量の総計は17flopsである。一方、本実施形態に係る計算装置10Aで計算する場合、計算量の総計は10flopsである。よって、従来の計算装置20と比較して、本実施形態に係る計算装置10Aでは、7flops、およそ41.2%の浮動小数点演算を削減すると見積もることができる。
When a, b, and c are calculated using a
[第2実施形態]
以下、第2実施形態における計算装置10である計算装置10Bについて説明する。図5は、実施形態における、和と差の逆数平方根、および和と差の平方根差を計算する計算装置10Bの構成を示すブロック図である。計算装置10Bは、入力装置3から正の実数X、e(X>e>0)が入力され、a=1/√(X+e)、b=1/√(X-e)、c=√(X+e)-√(X-e)を出力装置5に出力する計算装置である。計算装置10Bは、高速逆数平方根計算部31、41、減算部32、乗算部27、37、47、加算部23、33、および除算部44を備える。
[Second embodiment]
Hereinafter, a
計算装置10Bにおいて、正の実数Xが入力されると、Xは、加算部23および減算部32に入力される。正の実数eが入力されると、eは、加算部23、減算部32、および乗算部27に入力される。加算部23は、X+eを高速逆数平方根計算部31に出力する。減算部32は、X-eを高速逆数平方根計算部41に出力する。乗算部27は、2eを乗算部47に出力する。
When a positive real number X is input to
高速逆数平方根計算部31は、乗算部37、加算部33、および出力装置5にa=1/√(X+e)を出力する。高速逆数平方根計算部41は、乗算部37、加算部33、および出力装置5にb=1/√(X-e)を出力する。乗算部37は、ab=(1/√(X+e))(1/√(X-e))を乗算部47に出力する。乗算部47は、2eabを除算部44に出力する。加算部33は、a+b=1/√(X+e)+1/√(X-e)を除算部44に出力する。除算部44は、cとして2eab/(a+b)を出力装置5に出力する。2eab/(a+b)=√(X+e)-√(X-e)であることは、第1実施形態におけるAをX+eとし、BをX-eとすることで示される。The fast reciprocal square
以上より、計算装置10Bは、a=1/√(X+e)、b=1/√(X-e)、およびc=√(X+e)-√(X-e)を出力装置5に出力する。計算装置10Bは、逆数平方根を計算するが、√(X+e)、√(X-e)は計算していない。よって、cを√(X+e)、√(X-e)を計算することなく出力する。
From the above,
図6は、参考例として、従来通り、√(X+e)、√(X-e)を計算してa,b,cを出力する計算装置40を示すブロック図である。計算装置40は、平方根計算部35、45、減算部42、52、加算部43、および除算部54、64を備える。
Figure 6 is a block diagram showing, as a reference example, a
計算装置40において、正の実数X、eが入力されると、加算部43は、平方根計算部35に、X+eを出力する。減算部42は、平方根計算部45に、X-eを出力する。平方根計算部35は、除算部54および減算部52に√(X+e)を出力する。平方根計算部45は、除算部64および減算部52に√(X-e)を出力する。
When positive real numbers X and e are input to
除算部54は、a=1/√(X+e)を出力する。除算部64は、b=1/√(X-e)を出力する。減算部52は、c=√(X+e)-√(X-e)を出力する。The
a、b、cを従来の計算装置40で計算する場合、計算量の総計は19flopsである。一方、本実施形態に係る計算装置10Bで計算する場合、計算量の総計は12flopsである。よって、従来の計算装置40と比較して、本実施形態に係る計算装置10Bでは、7flops、およそ36.8%の浮動小数点演算を削減すると見積もることができる。
When a, b, and c are calculated using a
[第3実施形態]
以下、第3実施形態における計算装置10である計算装置10Cについて説明する。図7は、実施形態における、M×2行列の第2特異値、特異値の和の逆数および特異値の差の逆数を計算する計算装置10Cの構成を示すブロック図である。本実施形態において、M≧3であり、M=2については第4実施形態で説明する。計算装置10Cは、入力装置3からM×2行列Y=[y1,y2]が入力され、第2特異値σ2、特異値の和の逆数1/(σ1+σ2)および特異値の差の逆数1/(σ1-σ2)を出力装置5に出力する計算装置である。
[Third embodiment]
Hereinafter, a
計算装置10Cは、第2実施形態で説明した計算装置10Bを備える。また、計算装置10Cは、分解部110、内積部16、26、36、減算部62、乗算部57、67、77、87、加算部53、および平方根計算部55を備える。The
計算装置10Cにおいて、M×2行列Y=[y1,y2]が入力されると、Yは、分解部110に入力される。分解部110は、M×2行列Yを列ベクトルy1,y2に分解する。分解部110は、y1を内積部16、36に出力する。分解部110は、y2を内積部26、36に出力する。
In the
内積部16は、y1とy1との内積aを計算し、aを加算部53、乗算部67、および出力装置5に出力する。内積部26は、y2とy2との内積cを計算し、cを加算部53、乗算部67、および出力装置5に出力する。内積部36は、y1とy2との内積bを計算し、bを乗算部77、および出力装置5に出力する。
The
加算部53は、f=a+cを計算装置10Bおよび出力装置5に出力する。乗算部67は、acを減算部62に出力する。乗算部77は、b2を減算部62に出力する。減算部62は、d=ac-b2を平方根計算部55および出力装置5に出力する。平方根計算部55は、e=√dを乗算部57および出力装置5に出力する。乗算部57は、2eを計算装置10Bに出力する。
計算装置10Bは、1/√(f+2e)を1/(σ1+σ2)として出力装置5に出力する。計算装置10Bは、1/√(f-2e)を1/(σ1-σ2)として出力装置5に出力する。計算装置10Bは、√(f+2e)-√(f-2e)を2σ2として乗算部87に出力する。乗算部87は、σ2を出力装置5に出力する。
ここで1/√(f±2e)が1/(σ1±σ2)であることは、以下の通りである。非特許文献1によれば、M×2行列の特異値σ1、σ2の和および差は、σ1±σ2=√(tr(YTY)±2√(det(YTY)))である。
Here, 1/√(f±2e) is 1/(σ 1 ±σ 2 ) as follows: According to
tr(YTY)=a(=y1とy1との内積)+c(=y2とy2との内積)=fである。det(YTY)=a(=y1とy1との内積)×c(=y2とy2との内積)-b2(=(y1とy2との内積b)2)=ac-b2=dある。よって、√(det(YTY))=√d=eである。 tr( YTY ) = a (= the dot product of y1 and y1 ) + c (= the dot product of y2 and y2 ) = f. det( YTY ) = a (= the dot product of y1 and y1 ) × c (= the dot product of y2 and y2 ) - b2 (= (the dot product b of y1 and y2 ) 2 ) = ac - b2 = d. Therefore, √(det( YTY )) = √d = e.
よって、√(tr(YTY)±2√(det(YTY)))=√(f±2e)である。したがって、1/√(f±2e)=1/(σ1±σ2)である。 Therefore, (tr( YTY )±2(det( YTY )))=(f±2e). Therefore, 1/(f±2e)=1/( σ1 ± σ2 ).
なお、図7に示されるように、計算装置10Cは、第2特異値σ2、特異値の和の逆数1/(σ1+σ2)および特異値の差の逆数1/(σ1-σ2)だけではなく、a、b、c、d、e、fも出力装置5に出力する。
As shown in FIG. 7, the
計算装置10Cの計算量について説明する。分解部110の処理は、行列を列ベクトルに分解するだけなので浮動小数点演算は行われない(0flop)。また内積部16、26、36による計算量は、M次列ベクトルの入力に対し、2M-1flopsの計算量である。またsqrtによる平方根計算は前述の通り4flopsである。よって、計算装置10Cによる計算量の総計は6M+19flopsである。上述したように、計算装置10Bにおいて、7flopsの削減効果があるため、計算装置10Cも計算装置10Bによって7flopsの削減効果がある。
[第4実施形態]
以下、第4実施形態における計算装置10である計算装置10Dについて説明する。図8は、実施形態における、2×2行列の第2特異値、特異値の和の逆数および特異値の差の逆数を計算する計算装置10Dの構成を示すブロック図である。計算装置10Dは、入力装置3から2×2行列Y=[y1,y2]が入力され、第2特異値σ2、特異値の和の逆数1/(σ1+σ2)および特異値の差の逆数1/(σ1-σ2)を出力装置5に出力する計算装置である。
The computational complexity of the
[Fourth embodiment]
Hereinafter, a
計算装置10Dは、第2実施形態で説明した計算装置10Bを備える。また、計算装置10Dは、分解部120、内積部46、56、行列式計算部19、絶対値計算部18、乗算部97、107、および加算部63を備える。The
計算装置10Dにおいて、2×2行列Y=[y1,y2]が入力されると、Yは、分解部120に入力される。分解部120は、2×2行列Yを列ベクトルy1,y2に分解する。分解部120は、y1を内積部46に出力する。分解部120は、y2を内積部56に出力する。
In the
内積部46は、y1とy1との内積aを計算し、aを加算部63に出力する。内積部56は、y2とy2との内積cを計算し、cを加算部63に出力する。行列式計算部19は、Yの行列式dを計算し、dを絶対値計算部18、および出力装置5に出力する。
The
加算部63は、f=a+cを計算装置10Bおよび出力装置5に出力する。絶対値計算部18は、dの絶対値eを乗算部97に出力する。乗算部97は、2eを計算装置10Bに出力する。The
計算装置10Bは、1/√(f+2e)を1/(σ1+σ2)として出力装置5に出力する。計算装置10Bは、1/√(f-2e)を1/(σ1-σ2)として出力装置5に出力する。計算装置10Bは、√(f+2e)-√(f-2e)を2σ2として乗算部107に出力する。乗算部107は、σ2を出力装置5に出力する。
ここで1/√(f±2e)が1/(σ1±σ2)であることは、第3実施形態で示した通りである。なお、図8に示されるように、計算装置10Dは、第2特異値σ2、特異値の和の逆数1/(σ1+σ2)および特異値の差の逆数1/(σ1-σ2)だけではなく、d、fも出力装置5に出力する。
Here, 1/√(f±2e) is 1/(σ 1 ±σ 2 ) as shown in the third embodiment. As shown in Fig. 8, the
計算装置10Dの計算量について説明する。行列式計算部19の計算量は3flopsである。絶対値計算部18は符号を評価し負の場合に反転させるだけなので浮動小数点演算は行われない(0flop)。計算装置10Dによる計算量の総計は24flopsである。上述したように、計算装置10Bにおいて、7flopsの削減効果があるため、計算装置10Dも計算装置10Bによって7flopsの削減効果がある。
[第5実施形態]
以下、第5実施形態における計算装置10である計算装置10Eについて説明する。図9は、実施形態における、M×2行列のSVTを計算する計算装置10Eの構成を示すブロック図である。本実施形態において、M≧3であり、M=2については第6実施形態で説明する。計算装置10Eは、入力装置3からM×2行列Y=[y1,y2]と正の実数μが入力され、特異値閾値処理(Singular Value Thresholding;SVT)を行い、その特異値閾値処理結果として、下記(1)に示される行列Zを計算する。
The calculation amount of the
[Fifth embodiment]
Hereinafter, a
(1)におけるI2は2×2の単位行列である。また、γ、δ、e、a、b、c、dについては後述する。 In (1), I2 is a 2 × 2 unit matrix. γ, δ, e, a, b, c, and d will be described later.
計算装置10Eは、第3実施形態で説明した計算装置10Cと、係数算出装置200と、M×2行列変換装置300とを備える。The
計算装置10Eにおいて、M×2行列Y=[y1,y2]が入力されると、Yは、計算装置10C、係数算出装置200、およびM×2行列変換装置300に入力される。また、計算装置10Eにおいて、実数μが入力されると、μは、係数算出装置200に入力される。計算装置10Cは、第3実施形態で説明したように、第2特異値σ2、特異値の和の逆数1/(σ1+σ2)、特異値の差の逆数1/(σ1-σ2)、a、b、c、d、e、fを出力する。ここで、図9に示されるように、g=1/(σ1+σ2)、h=1/(σ1-σ2)とする。
When an M×2 matrix Y=[y 1 , y 2 ] is input to the
計算装置10Cの出力のうち、d、f、σ2、g、hは、係数算出装置200に出力される。a、b、c、eは、M×2行列変換装置300に出力される。
Of the outputs of the
係数算出装置200は、d、f、σ2、g、h、μが入力される。係数算出装置200は、γ、δを出力する。このγ、δの算出方法について説明する。まず、十分に大きい実数をRとおく。具体的にRの大きさとして、単精度浮動小数点型の最大の数の10分の1程度の大きさが挙げられる。その上で、係数算出装置200は、下記(a)から(d)の4つの場合分けを行うことでγ、δを算出し、それらを出力する。
The
(a) Yが零行列の場合
(b) (a)に該当せず、d=0の場合
(c) (b)に該当せず、h>Rの場合
(d) (c)に該当しない場合
(a) When Y is a zero matrix. (b) When (a) does not apply and d = 0. (c) When (b) does not apply and h > R. (d) When (c) does not apply.
以下、各場合ごとに出力されるγ、δを示す。なお、高速逆数平方根法による逆数平方根をisqrt(・)と表現することがある。例えば、高速逆数平方根法により計算された正の実数Aの逆数平方根を、isqrt(A)と表現することがある。また、(・)+における右下添字の+は、ランプ関数を示す。ランプ関数は、入力が負の実数なら0を出力し、入力が非負の実数なら入力された実数をそのまま出力する。関数minは、入力された数値のうちで最も小さい値を出力する。
The following shows γ and δ output for each case. The reciprocal square root using the fast reciprocal square root method may be expressed as isqrt(·). For example, the reciprocal square root of a positive real number A calculated using the fast reciprocal square root method may be expressed as isqrt(A). The subscript + on the lower right of (·) + indicates a ramp function. The
(a):γ=0、δ=0
(b):γ=(1-μ×isqrt(f))+、δ=0
(c):γ=(1-(√2)×μ×isqrt(f))+、δ=0
(d):γ=(1-(μ-σ2)+×h)+、δ=min(μ、σ2)×g
(a): γ=0, δ=0
(b): γ=(1-μ×isqrt(f)) + , δ=0
(c): γ=(1-(√2)×μ×isqrt(f)) + , δ=0
(d): γ=(1-(μ-σ 2 ) + ×h) + , δ=min(μ, σ 2 )×g
係数算出装置200は、上記場合分けにより、γ、δをM×2行列変換装置300に出力する。これにより、M×2行列変換装置300には、上記(1)に含まれるパラメータが全て揃うため、それらを用いて(1)を出力装置5に出力する。なお、e=0の場合には、(1)におけるγδ/eを0とする。The
計算装置10Eの計算量について説明する。ランプ関数および関数minは実数値の比較が主な計算処理であり、浮動小数点演算は行われない(0flop)。図16Bに示されるアルゴリズムに従って計算する場合、計算量は12M+38flopsである。一方、計算装置10Eによる計算量の総計は12M+29flopsである。以上より9flopsの浮動小数点演算を削減すると見積もることができる。
[第6実施形態]
以下、第6実施形態における計算装置10である計算装置10Fについて説明する。図10は、実施形態における、2×2行列のSVTを計算する計算装置10Fの構成を示すブロック図である。計算装置10Fは、入力装置3から2×2行列Y=[y1,y2]と正の実数μが入力され、上述したSVTを行い、その特異値閾値処理結果として、下記(1)に示される行列Zを計算する。なお、yijは、Yのi行j列成分である。
The calculation amount of the
Sixth Embodiment
Hereinafter, a
(2)における関数sign(・)は符号関数であり、入力が負の場合には-1を出力し、入力が0の場合には0を出力し、入力が正の場合に+1を出力する。また、γ、δ、dについては後述する。 The function sign(.) in (2) is a sign function that outputs -1 when the input is negative, 0 when the input is 0, and +1 when the input is positive. γ, δ, and d will be explained later.
計算装置10Fは、第4実施形態で説明した計算装置10Dと、係数算出装置201と、2×2行列変換装置301とを備える。The
計算装置10Fにおいて、2×2行列Y=[y1,y2]が入力されると、Yは、計算装置10D、係数算出装置201、およびM×2行列変換装置301に入力される。また、計算装置10Fにおいて、実数μが入力されると、μは、係数算出装置201に入力される。計算装置10Dは、第3実施形態で説明したように、第2特異値σ2、特異値の和の逆数1/(σ1+σ2)、特異値の差の逆数1/(σ1-σ2)、d、fを出力する。ここで、図10に示されるように、g=1/(σ1+σ2)、h=1/(σ1-σ2)とする。
When a 2×2 matrix Y=[y 1 , y 2 ] is input to the
計算装置10Dの出力のうち、d、f、σ2、g、hは、係数算出装置201に出力される。dは、2×2行列変換装置300に出力される。
Of the outputs of the
係数算出装置201は、d、f、σ2、g、h、μが入力される。係数算出装置201は、γ、δを出力する。このγ、δの算出方法について説明する。まず、十分に大きい実数をRとおく。具体的にRの大きさとして、単精度浮動小数点型の最大の数の10分の1程度の大きさが挙げられる。その上で、係数算出装置200は、下記(a)から(d)の4つの場合分けを行うことでγ、δを算出し、それらを出力する。
The
(a) Yが零行列の場合
(b) (a)に該当せず、d=0の場合
(c) (b)に該当せず、h>Rの場合
(d) (c)に該当しない場合
(a) When Y is a zero matrix. (b) When (a) does not apply and d = 0. (c) When (b) does not apply and h > R. (d) When (c) does not apply.
以下、各場合ごとに出力されるγ、δを示す。
(a):γ=0、δ=0
(b):γ=(1-μ×isqrt(f))+、δ=0
(c):γ=(1-(√2)×μ×isqrt(f))+、δ=0
(d):γ=(1-(μ-σ2)+×h)+、δ=min(μ、σ2)×g
The following shows γ and δ that are output for each case.
(a): γ=0, δ=0
(b): γ=(1-μ×isqrt(f)) + , δ=0
(c): γ=(1-(√2)×μ×isqrt(f)) + , δ=0
(d): γ=(1-(μ-σ 2 ) + ×h) + , δ=min(μ, σ 2 )×g
係数算出装置200は、上記場合分けにより、γ、δを2×2行列変換装置301に出力する。これにより、2×2行列変換装置301には、上記(2)に含まれるパラメータが全て揃うため、それらを用いて(2)を出力装置5に出力する。The
計算装置10Fの計算量について説明する。図16Bに示されるアルゴリズムに従って計算する場合、計算量は41flopsである。一方、計算装置10Fによる計算量の総計は32flopsである。以上より9flopsの浮動小数点演算を削減すると見積もることができる。The calculation amount of the
次に、グラフの単純化処理について説明する。図11は、グラフの単純化処理の処理概要を示す図である。図11におけるG=(V,E,P)は、M次元空間に埋め込まれたグラフを示す。ここでV,Eはそれぞれ頂点、辺の集合とし、P∈R|V|×Mを頂点座標とする(ここでのRは実数全体の集合)。Pの各行ベクトル(p1)T、(p2)T、…、(p|v|)Tはグラフの各頂点の座標を表す。また、次数が2の頂点の集合をV~={v∈V|degv=2}とする。
Next, the graph simplification process will be described. Fig. 11 is a diagram showing an overview of the graph simplification process. In Fig. 11, G = (V, E, P) indicates a graph embedded in an M-dimensional space. Here, V and E are a set of vertices and edges, respectively, and P ∈ R |V| × M is the vertex coordinates (here, R is the set of all real numbers). Each row vector (p 1 ) T , (p 2 ) T , ..., (p |v| ) T of P represents the coordinates of each vertex of the graph. In addition, the set of vertices with
グラフ単純化処理では図11に示される通り、多くの頂点を持つ歪な形状の埋め込みグラフを入力とし、局所的に線形に整列した埋め込みグラフを中間生成し(S101)、最後に不要点を除去して(S102)、形状単純された所望のグラフを得る。In the graph simplification process, as shown in Figure 11, an embedded graph with a distorted shape and many vertices is input, and an embedded graph that is locally linearly aligned is intermediately generated (S101), and finally unnecessary points are removed (S102) to obtain the desired graph with a simplified shape.
図12は、グラフ単純化装置500の構成例を示す図である。グラフ単純化装置500は、閾値λとグラフGが入力され、単純化したグラフG’’を出力する。グラフ単純化装置500は、局所線形整列部510と、不要頂点除去部520とを備える。局所線形整列部510は、グラフGを閾値λを用いて局所線形整列させたG’を不要頂点除去部520に出力する。不要頂点除去部520は、入力したグラフG’の頂点のうち、不要な頂点を除去したG’’を出力する。
Figure 12 is a diagram showing an example configuration of a
図13は、図12における局所線形整列部510の構成例を示す図である。局所線形整列部510は、上述したように、グラフGを閾値λを用いて局所線形整列させたG’を不要頂点除去部520に出力する。局所線形整列部510は、凸最適化問題立式部511と、凸最適化問題求解部512と、座標情報置換部513とを備える。
Fig. 13 is a diagram showing an example of the configuration of the local
最初に凸最適化問題立式部511について説明する。図14は、隣接辺のベクトルを並べる操作を説明するための図である。図14に示される行列LVは、vから隣接する頂点へのベクトル並べるための行列である。図14に示される行列LVの要素について、「…」の箇所は全て0である。また、vの座標がPのk行目としたとき、図14に示されるLVにおける「-1」がk列目なっている。LVPにより、vを始点としてk-1行目の座標を終点とするベクトルと、vを始点としてk+1行目の座標を終点とするベクトルが得られる。このLVを作用させる操作は線形写像である。
First, the convex optimization
元の入力グラフの形を忠実に再現しながらも曲折回数が少なれば、グラフの局所線形整列化に成功したと言える。ここでは忠実再現の尺度をL1ノルムとし、辺の曲折回数の正則化を核型ノルム関数として、凸最適化問題立式部511は、下記(3)のとおり最適化問題を立式する。ここで核型ノルム関数とは入力行列の特異値の和を計算する関数である。
上記(3)の最適化問題を解くために、Primal-Dual Splitting(L. Condat, “A primal-dual splitting method for convex optimization involving lipschitzian, proximable and linear composite terms,” Journal of Optimization Theory and Applications, 2013.参照)を用いる。凸最適化問題求解部512が実行する具体的な手順を図15に示す。図15は、局所線形整列問題の解法を示すアルゴリズムを示す図である。なお、図15の4行目のproxτfにおけるfは、下記(4)である。
In order to solve the optimization problem of (3) above, Primal-Dual Splitting (see L. Condat, "A primal-dual splitting method for convex optimization involving lipschitzian, proximable and linear composite terms," Journal of Optimization Theory and Applications, 2013.) is used. FIG. 15 shows a specific procedure executed by the convex optimization
図15に示されるアルゴリズムでは、3行目から11行目までのn=1からrまでのr回のループの中に、上述したV~に属する元の全てに対して、6行目から10行目までループが行われることが示されている。
In the algorithm shown in Figure 15, in the r loops from n = 1 to r from
したがって、6行目から10行目までは、r×(V~に属する元の総数)回実行される。その6行目から10行目のうちの8行目で計算される下記(5)は、核型ノルムの近接写像である。Therefore,
上記(5)は、下記(6)の行列の閾値λによるSVTである。
この8行目の処理は、図15に示されるアルゴリズムの計算時間のうちの約53.8%を占める。そこで、上述した計算装置10E、10Fを用いて上記SVTを計算することで、従来と比較して、グラフ単純化処理を高速に実行することができる。The processing on
座標情報置換部513は、凸最適化問題求解部512により局所線形整列された頂点座標に座標情報を置換して、局所線形整列させたG’を出力する。The coordinate
本実施形態は、グラフの単純化だけではなく、SVTを行う全ての処理に適用可能である。例えば、画像偽色除去は、グラフの単純化と同様に、多数の小型行列を正則化する問題に分類される。This embodiment is applicable not only to graph simplification but also to all processes that perform SVT. For example, image false color removal, like graph simplification, is classified as a problem of regularizing a large number of small matrices.
以上説明したように、本実施形態によれば、核型ノルムを特異値を用いずに混合ノルムで表現することで、SVDが不要なSVT計算を実現することで、計算量を削減可能となる。さらに、アルゴリズムを容易にデータ並列化でき、多数の行列について同時処理が可能である。アルゴリズムをデータ並列化できれば、パソコンに搭載されるCPUの多くが採用しているSingle Instrucion Multiple Data(SIMD)等のデータ並列アーキテクチャを用いる実装で高速化できる。As described above, according to this embodiment, the nucleus norm is expressed by a mixed norm without using singular values, thereby realizing SVT calculations that do not require SVD, thereby reducing the amount of calculations. Furthermore, the algorithm can be easily data-parallelized, allowing simultaneous processing of multiple matrices. If the algorithm can be data-parallelized, it can be speeded up by implementing it using a data-parallel architecture such as Single Instruction Multiple Data (SIMD), which is used in many CPUs installed in personal computers.
以上説明した計算装置10A~10Fにおいて、加算部や内積部などの各種計算を行う構成が計算結果を一時的に記憶するメモリなどの記憶装置を設け、この記憶装置に計算結果を一時的に記憶してもよい。In the
以上、この発明の実施形態について図面を参照して詳述してきたが、具体的な構成はこの実施形態に限られるものではなく、この発明の要旨を逸脱しない範囲の設計等も含まれる。 Although an embodiment of the present invention has been described in detail above with reference to the drawings, the specific configuration is not limited to this embodiment and also includes designs that do not deviate from the gist of the present invention.
本発明は、平方根の計算を行う計算装置に適用可能である。 The present invention is applicable to a computing device that performs square root calculations.
10、10A、10B、10C、10D、10E、10F、20、40…計算装置、11、21、31、41…高速逆数平方根計算部、12、22、32、42、52…減算部、13、23、33、43、53、63…加算部、14、24、34、44、54、64…除算部、15、25、35、45、55…平方根計算部、16、26、36、46、56…内積部、17、27、37、47、57、67、77、87、97、107、117…乗算部、18…絶対値計算部、19…行列式計算部、110、120…分解部、200、201…係数算出装置、300、301…行列変換装置、500…グラフ単純化装置、510…局所線形整列部、511…凸最適化問題立式部、512…凸最適化問題求解部、513…座標情報置換部、520…不要頂点除去部10, 10A, 10B, 10C, 10D, 10E, 10F, 20, 40... Calculation device, 11, 21, 31, 41... High speed reciprocal square root calculation section, 12, 22, 32, 42, 52... Subtraction section, 13, 23, 33, 43, 53, 63... Addition section, 14, 24, 34, 44, 54, 64... Division section, 15, 25, 35, 45, 55... Square root calculation section, 16, 26, 36, 46, 56... Inner product part, 17, 27 , 37, 47, 57, 67, 77, 87, 97, 107, 117 ... multiplication unit, 18 ... absolute value calculation unit, 19 ... determinant calculation unit, 110, 120 ... decomposition unit, 200, 201 ... coefficient calculation device , 300, 301 ... matrix conversion device, 500 ... graph simplification device, 510 ... local linear alignment unit, 511 ... convex optimization problem formulation unit, 512 ... convex optimization problem solving unit, 513 ... coordinate information replacement unit, 520 …Unnecessary vertex removal section
Claims (7)
コンピュータが、正の実数Bの逆数平方根を高速逆数平方根法により計算する第2逆数平方根ステップと、
コンピュータが、AからBを減算する減算ステップと、
コンピュータが、前記第1逆数平方根ステップでの計算結果と、前記第2逆数平方根ステップでの計算結果とを乗算する第1乗算ステップと、
コンピュータが、前記第1乗算ステップでの計算結果と、前記減算ステップでの計算結果とを乗算する第2乗算ステップと、
コンピュータが、前記第1逆数平方根ステップでの計算結果と、前記第2逆数平方根ステップでの計算結果とを加算する加算ステップと、
コンピュータが、前記第2乗算ステップでの計算結果を、前記加算ステップでの計算結果で除算する除算ステップと、
を備えた計算方法。 a first reciprocal square root step in which the computer calculates the reciprocal square root of a positive real number A by a fast reciprocal square root method;
a second reciprocal square root step in which the computer calculates the reciprocal square root of the positive real number B using a fast reciprocal square root method;
A subtraction step in which the computer subtracts B from A;
a first multiplication step in which the computer multiplies a result of the first reciprocal square root step by a result of the second reciprocal square root step;
a second multiplication step in which the computer multiplies a result of the first multiplication step by a result of the subtraction step;
an addition step in which the computer adds a result of the calculation in the first reciprocal square root step and a result of the calculation in the second reciprocal square root step;
a division step in which the computer divides the result of the second multiplication step by the result of the addition step;
A calculation method that includes:
コンピュータが、Xからeを減算する減算ステップと、
コンピュータが、eを2倍する第1乗算ステップと、
コンピュータが、前記第1加算ステップでの計算結果の逆数平方根を高速逆数平方根法により計算する第1逆数平方根ステップと、
コンピュータが、前記減算ステップでの計算結果の逆数平方根を高速逆数平方根法により計算する第2逆数平方根ステップと、
コンピュータが、前記第1逆数平方根ステップでの計算結果と、前記第2逆数平方根ステップでの計算結果とを加算する第2加算ステップと、
コンピュータが、前記第1逆数平方根ステップでの計算結果と、前記第2逆数平方根ステップでの計算結果とを乗算する第2乗算ステップと、
コンピュータが、前記第2乗算ステップでの計算結果と、前記減算ステップでの計算結果とを乗算する第3乗算ステップと、
コンピュータが、前記第3乗算ステップでの計算結果を、前記第2加算ステップでの計算結果で除算する除算ステップと、
を備えた計算方法。 a first addition step in which a computer adds a positive real number X and a positive real number e smaller than the real number X;
A subtraction step in which the computer subtracts e from X;
a first multiplication step in which the computer doubles e;
a first reciprocal square root step in which the computer calculates a reciprocal square root of the calculation result in the first addition step by using a fast reciprocal square root method;
a second reciprocal square root step in which the computer calculates a reciprocal square root of the calculation result in the subtraction step by a fast reciprocal square root method;
a second addition step in which the computer adds a result of the calculation in the first reciprocal square root step and a result of the calculation in the second reciprocal square root step;
a second multiplication step in which the computer multiplies a result of the first reciprocal square root step by a result of the second reciprocal square root step;
a third multiplication step in which the computer multiplies a result of the second multiplication step by a result of the subtraction step;
a division step in which the computer divides a result of the third multiplication step by a result of the second addition step;
A calculation method that includes:
コンピュータが、前記第2列ベクトル同士の内積を計算する第2内積ステップと、
コンピュータが、第1列ベクトルと第2列ベクトルとの内積を計算する第3内積ステップと、
コンピュータが、前記第1内積ステップでの計算結果と、前記第2内積ステップでの計算結果とを加算する加算ステップと、
コンピュータが、前記第1内積ステップでの計算結果と、前記第2内積ステップでの計算結果とを乗算する第1乗算ステップと、
コンピュータが、前記第3内積ステップで計算された内積同士を乗算する第2乗算ステップと、
コンピュータが、前記第1乗算ステップでの計算結果から前記第2乗算ステップでの計算結果を減算する減算ステップと、
コンピュータが、前記減算ステップでの計算結果の平方根を計算する平方根計算ステップと、
コンピュータが、前記平方根計算ステップでの計算結果を2倍する第3乗算ステップと、
を備え、
前記加算ステップでの計算結果をXとし、第3乗算ステップでの計算結果をeとして、請求項2に記載の計算方法により、M×2行列の2つの特異値の和の逆数、2つの特異値の差の逆数、および1つの特異値を計算する計算方法。 a first inner product step in which the computer calculates an inner product between first column vectors among first column vectors and second column vectors that configure an M×2 matrix;
a second dot product step in which the computer calculates a dot product between the second column vectors;
a third dot product step in which the computer calculates an dot product of the first column vector and the second column vector;
an addition step in which a computer adds a calculation result in the first dot product step and a calculation result in the second dot product step;
a first multiplication step in which the computer multiplies a result of the first inner product step by a result of the second inner product step;
a second multiplication step in which the computer multiplies the inner products calculated in the third inner product step;
a subtraction step in which the computer subtracts the calculation result in the second multiplication step from the calculation result in the first multiplication step;
a square root calculation step in which the computer calculates the square root of the calculation result in the subtraction step;
a third multiplication step in which the computer doubles the result of the square root calculation step;
Equipped with
A method for calculating the inverse of the sum of two singular values of an M×2 matrix, the inverse of the difference between two singular values, and one singular value by the method according to claim 2, where the calculation result in the addition step is X and the calculation result in the third multiplication step is e.
コンピュータが、前記整列ステップにおいて線形に整列されたグラフの頂点のうち、頂点同士を結ぶ辺のなす角度に基づき、不要な辺と頂点とを除去する除去ステップと、
を備え、
前記整列ステップにおいて、特異値の和を計算する核型ノルム関数による特異値閾値処理を前記請求項4に記載の計算方法で行う計算方法。 An alignment step in which a computer locally linearly aligns vertices of a graph in an M-dimensional space;
a removing step in which the computer removes unnecessary edges and vertices from the vertices of the graph linearly arranged in the sorting step, based on angles between edges connecting the vertices;
Equipped with
The method according to claim 4, wherein in the alignment step, singular value threshold processing is performed using a kernicrotype norm function that calculates the sum of singular values.
正の実数Bの逆数平方根を高速逆数平方根法により計算する第2逆数平方根部と、
AからBを減算する減算部と、
前記第1逆数平方根部での計算結果と、前記第2逆数平方根部での計算結果とを乗算する第1乗算部と、
前記第1乗算部での計算結果と、前記減算部での計算結果とを乗算する第2乗算部と、
前記第1逆数平方根部での計算結果と、前記第2逆数平方根部での計算結果とを加算する加算部と、
前記第2乗算部での計算結果を、前記加算部での計算結果で除算する除算部と、
を備えた計算装置。 a first reciprocal square root unit that calculates a reciprocal square root of a positive real number A by a fast reciprocal square root method;
a second reciprocal square root unit that calculates the reciprocal square root of a positive real number B by a fast reciprocal square root method;
A subtraction unit that subtracts B from A;
a first multiplication unit that multiplies a calculation result in the first reciprocal square root unit by a calculation result in the second reciprocal square root unit;
a second multiplication unit that multiplies a result of the calculation in the first multiplication unit by a result of the calculation in the subtraction unit;
an adder that adds a calculation result of the first reciprocal square root unit and a calculation result of the second reciprocal square root unit;
a division unit that divides a calculation result in the second multiplication unit by a calculation result in the addition unit;
A computing device comprising:
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/JP2020/043722 WO2022113180A1 (en) | 2020-11-25 | 2020-11-25 | Calculation method, calculation device, and program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPWO2022113180A1 JPWO2022113180A1 (en) | 2022-06-02 |
| JP7560765B2 true JP7560765B2 (en) | 2024-10-03 |
Family
ID=81754217
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2022564862A Active JP7560765B2 (en) | 2020-11-25 | 2020-11-25 | Calculation method, calculation device and program |
Country Status (2)
| Country | Link |
|---|---|
| JP (1) | JP7560765B2 (en) |
| WO (1) | WO2022113180A1 (en) |
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020039454A1 (en) | 2000-06-15 | 2002-04-04 | Lifef/X Networks, Inc. And Auckland Uniservices Li | Basis functions of three-dimensional models for compression, transformation and streaming |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP6810003B2 (en) * | 2017-09-01 | 2021-01-06 | 日本電信電話株式会社 | Matrix simplification device, program, and matrix simplification method |
-
2020
- 2020-11-25 JP JP2022564862A patent/JP7560765B2/en active Active
- 2020-11-25 WO PCT/JP2020/043722 patent/WO2022113180A1/en not_active Ceased
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020039454A1 (en) | 2000-06-15 | 2002-04-04 | Lifef/X Networks, Inc. And Auckland Uniservices Li | Basis functions of three-dimensional models for compression, transformation and streaming |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2022113180A1 (en) | 2022-06-02 |
| JPWO2022113180A1 (en) | 2022-06-02 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Wang et al. | Rapid generation of optimal generalized Monkhorst-Pack grids | |
| JP7186797B2 (en) | Method and system for quantum computing | |
| Liang et al. | Solving partial differential equations on point clouds | |
| Passieux et al. | Classic and inverse compositional Gauss‐Newton in global DIC | |
| CN112634149B (en) | Point cloud denoising method based on graph convolution network | |
| EP3144805B1 (en) | Method and processing apparatus for performing arithmetic operation | |
| WO2020221583A1 (en) | System and method for molecular design on a quantum computer | |
| Xu et al. | Order-encoded quantum image model and parallel histogram specification: G. Xu et al. | |
| Peng et al. | MBFQuant: A multiplier-bitwidth-fixed, mixed-precision quantization method for mobile CNN-based applications | |
| CN113888697A (en) | A three-dimensional reconstruction method in the state of two-hand interaction | |
| JP2005535951A (en) | Image model based on n-pixel and defined by algebraic topology, and application based thereon | |
| Chen et al. | GPU-based polygonization and optimization for implicit surfaces | |
| US10936938B2 (en) | Method for visualizing neural network models | |
| JP7450220B2 (en) | Quantum computers, programs, quantum calculation methods and quantum circuits | |
| Chen et al. | Hrnet: Hamiltonian rescaling network for image downscaling | |
| CN103310216B (en) | Based on the mode identification method protecting inner product dimensionality reduction technology | |
| US20250013904A1 (en) | Quantum controlled operations in two-dimensional quantum computing systems | |
| JP7560765B2 (en) | Calculation method, calculation device and program | |
| JP6810003B2 (en) | Matrix simplification device, program, and matrix simplification method | |
| Zhou et al. | Quantum multidimensional color images similarity comparison | |
| CA3197435A1 (en) | Multi-dimensional logarithmic number system processor for inner product computations | |
| Cai et al. | Integer multiple quantum image scaling based on NEQR and bicubic interpolation | |
| CN106454382B (en) | A kind of quantum image preparation method | |
| Čomić et al. | Repairing binary images through the 2D diamond grid | |
| Nagai et al. | Simulation of Continuous-Variable Quantum Systems with Tensor Network |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20230222 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20240206 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20240228 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20240514 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20240709 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A821 Effective date: 20240709 |
|
| A911 | Transfer to examiner for re-examination before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20240731 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20240820 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20240902 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 7560765 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| S533 | Written request for registration of change of name |
Free format text: JAPANESE INTERMEDIATE CODE: R313533 |
|
| R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |