JP5856926B2 - Apparatus and method for calculating product of vector and matrix and program - Google Patents
Apparatus and method for calculating product of vector and matrix and program Download PDFInfo
- Publication number
- JP5856926B2 JP5856926B2 JP2012186039A JP2012186039A JP5856926B2 JP 5856926 B2 JP5856926 B2 JP 5856926B2 JP 2012186039 A JP2012186039 A JP 2012186039A JP 2012186039 A JP2012186039 A JP 2012186039A JP 5856926 B2 JP5856926 B2 JP 5856926B2
- Authority
- JP
- Japan
- Prior art keywords
- matrix
- zdd
- vector
- binary matrix
- binary
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Complex Calculations (AREA)
Description
本発明は、ベクトルと行列との積の計算装置及び方法及びプログラムに係り、特に、線形代数における一般的な演算であるベクトルと行列との積の計算を高速に行うためのベクトルと行列との積の計算装置及び方法及びプログラムに関する。 The present invention relates to an apparatus, method, and program for calculating a product of a vector and a matrix, and in particular, a vector and a matrix for performing high-speed calculation of a product of a vector and a matrix, which are general operations in linear algebra. The present invention relates to a product calculation apparatus, method, and program.
ベクトルと行列との積の計算は、様々な工学の分野で用いられる一般的な演算であり、その高速化が求められる。疎な二値行列をゼロサプレス型二分決定グラフ(ZDD)と呼ばれるデータ構造に変換して保持することによって、ベクトルとの積の演算を高速に行う手法が存在する(例えば、非特許文献1)。また、行列とベクトルの積を計算するためには疎な二値行列をZDDに変換する手続を実行する必要があるが、この手続を高速に実行するため、ZDDの簡約規約(削除・共有)がどのような場面で適用されるかを分析し、行列の各列を一度ずつ処理することで規則的用語の既約なZDDを得る方法も提案されている(例えば、非特許文献2)。 The calculation of a product of a vector and a matrix is a general operation used in various engineering fields, and its speed is required. There is a technique for performing a product operation with a vector at high speed by converting a sparse binary matrix into a data structure called a zero-suppressed binary decision graph (ZDD) and holding it (for example, Non-Patent Document 1). In addition, in order to calculate the product of a matrix and a vector, it is necessary to execute a procedure to convert a sparse binary matrix to ZDD, but in order to execute this procedure at high speed, ZDD's simplified rules (deletion / sharing) A method of obtaining an irreducible ZDD of a regular term by analyzing in which scene is applied and processing each column of the matrix once (for example, Non-Patent Document 2) has also been proposed.
しかしながら、非特許文献1のZDDを用いた行列の表によって高速に計算が実行できる場合とそうでない場合とがある。また、非特許文献2の手法によってZDDへの変換が高速にできるとは云え、それでも変換したZDDを何度も利用することがないような場合には、高速に計算が行えない場合がある。
However, there are cases where the calculation can be executed at high speed by the matrix table using ZDD of
本発明は、上記の点に鑑みなされたもので、常に高速に二値行列と実数ベクトルとの積を計算することが可能なベクトルと行列との積の計算装置及び方法及びプログラムを提供することを目的とする。 The present invention has been made in view of the above points, and provides a vector-matrix product calculation apparatus, method, and program capable of always calculating a product of a binary matrix and a real vector at high speed. With the goal.
上記の課題を解決するため、本発明(請求項1)は、線形代数におけるベクトルと行列との積を計算するベクトルと行列との積の計算装置であって、
二値行列を取得する二値行列入力手段と、
N次元実数ベクトルを取得するベクトル入力手段と、
前記二値行列をゼロサプレス型二分決定グラフ(ZDD)に変換するか、変換せずに該二値行列をそのまま二値行列として計算するかを、該二値行列の非ゼロ要素の密度が大きい程小さな値をとり、行列の階数が小さいほど小さな値をとる関数を用いて算出したスコアに基づいて判定する判定手段と、
前記判定手段でZDDに変換すると判定された場合には、前記二値行列をZDDに変換し、記憶手段に格納するZDD構築手段と、
前記ベクトル入力手段で取得した前記N次元実数ベクトルと前記記憶手段に格納されているZDD変換された二値行列との積を計算するZDD演算手段と、
前記判定手段でZDDに変換しないと判定された場合には、ZDDを用いない二値行列と前記N次元実数ベクトルの積を計算する行列演算手段と、を有する。
In order to solve the above problems, the present invention (Claim 1) is a vector-matrix product calculation device for calculating a product of a vector and a matrix in linear algebra,
A binary matrix input means for obtaining a binary matrix;
A vector input means for obtaining an N-dimensional real vector;
Whether the binary matrix is converted into a zero-suppressed binary decision graph (ZDD) or whether the binary matrix is directly calculated as a binary matrix without conversion, as the density of non-zero elements of the binary matrix increases. A determination means that takes a small value and makes a determination based on a score calculated using a function that takes a smaller value as the rank of the matrix is smaller;
If it is determined that the determination means converts to ZDD, the binary matrix is converted to ZDD, and stored in the storage means, ZDD construction means,
ZDD operation means for calculating a product of the N-dimensional real vector acquired by the vector input means and a ZDD-transformed binary matrix stored in the storage means;
When it is determined by the determination means that conversion to ZDD is not performed, matrix calculation means for calculating a product of a binary matrix not using ZDD and the N-dimensional real vector is included.
また、本発明(請求項2)は、前記判定手段において、
前記二値行列の非ゼロ要素の密度をσ、一つの二値行列を繰り返し演算用に用いる平均の計算回数をK、行列の階数をrank、実数パラメータをλ1、λ2、ZDDの構築にかかる時間をλ1MN、通常の二値行列とベクトルとの乗算にかかる時間をλ2MN、二値行列をZDDで表現したときに削減される計算される時間の割合を表す関数をh(σ,rank)とし、関数hは、σが大きい程小さな値をとる、及び、rankが小さいほど小さな値をとるものとし、
In the present invention (Claim 2), in the determination means,
The density of non-zero elements of the binary matrix is σ, the average number of calculations using one binary matrix for repeated operations is K, the rank of the matrix is rank, the real parameters are λ 1 , λ 2 , ZDD Λ 1 MN is the time required, λ 2 MN is the time required to multiply the normal binary matrix and the vector, and h ( σ, rank), and the function h assumes a smaller value as σ is larger, and a smaller value as rank is smaller.
上述のように本発明によれば、ZDDに変換するかどうかをスコア関数に基づいて判定することで、常に高速に二値行列と実数ベクトルの積を計算することができる。 As described above, according to the present invention, it is possible to always calculate a product of a binary matrix and a real vector at high speed by determining whether to convert to ZDD based on the score function.
以下、図面と共に本発明の実施の形態を説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings.
図1は、本発明の一実施の形態における計算装置の構成を示す。 FIG. 1 shows a configuration of a computing device according to an embodiment of the present invention.
同図に示すベクトルと行列との積の計算装置は、二値行列入力部1、判定処理部2、ZDD構築部3、ZDD演算部4、ベクトル入力部5、行列演算部6、演算結果出力部7を有する。
The vector-matrix product calculation apparatus shown in FIG. 1 includes a binary
二値行列入力部1は、M行N列の二値行列を入力として受け取る。図2に入力される二値行列の例を示す。
The binary
判定処理部2は、入力された二値行列について、非ゼロ成分の比率を求め、非ゼロの比率が大きい程コンパクトなZDDになり変換の効果が大きいと判定する。また、同じ行列を何回使いまわすかを判定する。これは、何度も使いまわすほど変換のオーバヘッド分を補うことができるためである。非ゼロの比率と使いまわす回数のスコア関数を設定し、所定の値と比較することでZDDに変換するか否かを判定する。
The
ZDD構築部3は、二値行列をZDDに変換する。例えば、図2の二値行列が入力として与えられたならば、図3に示すようなZDDに変換する。
The
ZDD演算部4は、ZDDに変換された二値行列と、ベクトル入力部5から与えられたN次元の実数ベクトルとの積を計算し、メモリ(図示せず)に格納する。
The
ベクトル入力部5は、二値行列入力部1から与えられたM行N列の二値行列と乗算を行いたい、N次元実数ベクトルの入力を受け付け、ZDD演算部4及び行列演算部6に出力する。
The
行列演算部6は、ZDDを用いない行列とベクトルとの積の計算を行い、メモリ(図示せず)に格納する。
The
演算結果出力部7は、メモリ(図示せず)からZDD演算部4、行列演算部6の演算結果読み出して出力する。
The calculation
図4は、本発明の一実施の形態における計算装置の処理のフローチャートである。 FIG. 4 is a flowchart of processing of the computing device according to the embodiment of the present invention.
ステップ1) 二値行列入力部1が二値行列を受け取る。
Step 1) The binary
ステップ2) 判定処理部2において、二値行列をZDDに変換するか、そうでないかを判定する。変換においては、以下の計算式でスコアθを計算し、メモリ(図示せず)に格納する。
Step 2) In the
・σが大きい程小さな値をとる;
・rankが小さいほど小さな値をとる;
関数として定義する。
・ The smaller the rank, the smaller the value;
Define as a function.
ステップ3) 判定処理部2は、ステップ2で計算したスコアθをメモリ(図示せず)から読み出して、当該スコアθが1より小さいかどうかを判定し、小さいならば構築条件を満たすとしてステップ4に移行する。大きい場合は、構築条件を満たさないとしてステップ6に移行する。
Step 3) The
ステップ4)ZDD構築部3で二値行列をZDDに変換し、図3(b)のようにメモリ(図示せず)に格納する。この処理については、非特許文献2の「4. に値行列を表すZDDの構築」の項に記載の処理を利用する。
Step 4) The binary matrix is converted into ZDD by the
ステップ5)ZDD演算部4で、ステップ4でメモリ(図示せず)に格納されたZDDとベクトル入力部5より与えられたN次元実数ベクトルとの積を計算し、演算結果出力部7より外部に出力する。ZDDの積の計算は、非特許文献1の「4. ZDDを用いた行列とベクトルの乗算」の項に記載の処理を利用する。
Step 5) The
ステップ6) ステップ3において、構築条件を満たさないと判定された場合は、ZDDへの変換を介さずに、二値行列入力部1から入力された行列とベクトル入力部5から入力されたベクトルとの積を計算する。計算結果は演算結果出力部7より出力される。
Step 6) If it is determined in
なお、上記の図1に示す計算装置の構成要素の動作をプログラムとして構築し、当該計算装置として利用されるコンピュータにインストールして実行させる、または、ネットワークを介して流通させることが可能である。 The operations of the components of the computing device shown in FIG. 1 can be constructed as a program and installed in a computer used as the computing device to be executed or distributed via a network.
本発明は、上記の実施の形態に限定されることなく、特許請求の範囲内において、種々変更・応用が可能である。 The present invention is not limited to the above-described embodiments, and various modifications and applications are possible within the scope of the claims.
1 二値行列入力部
2 判定処理部
3 ZDD構築部
4 ZDD演算部
5 ベクトル入力部
6 行列演算部
7 演算結果出力部
1 Binary
Claims (5)
N次元実数ベクトルを取得するベクトル入力手段と、
前記二値行列をゼロサプレス型二分決定グラフ(ZDD)に変換するか否かを、該二値行列の非ゼロ要素の密度が大きい程小さな値をとり、行列の階数が小さいほど小さな値をとる関数を用いて算出したスコアに基づいて判定する判定手段と、
前記判定手段でZDDに変換すると判定された場合に、前記二値行列をZDDに変換するZDD構築手段と、
前記ベクトル入力手段で取得した前記N次元実数ベクトルと前記ZDDとの積を計算するZDD演算手段と、
前記判定手段でZDDに変換しないと判定された場合に、前記二値行列と前記N次元実数ベクトルの積を計算する行列演算手段と、
を有することを特徴とするベクトルと行列との積の計算装置。 A binary matrix input means for obtaining a binary matrix;
A vector input means for obtaining an N-dimensional real vector;
Whether or not to convert the binary matrix into a zero-suppressed binary decision graph (ZDD), a function that takes a smaller value as the density of non-zero elements of the binary matrix is larger and takes a smaller value as the rank of the matrix is smaller Determining means for determining based on the score calculated using
And ZDD construction unit when it is determined that the conversion into ZDD, that converts the binary matrix ZDD by the determination means,
And ZDD calculating means for calculating the product of the previous SL Z DD and obtained the N-dimensional real vectors in the vector input unit,
A matrix calculation means for calculating a product of the binary matrix and the N-dimensional real vector when it is determined not to convert to ZDD by the determination means;
A device for calculating a product of a vector and a matrix, characterized by comprising:
によりスコアθを算出し、θ<1の場合には、ZDDに変換すると判定する、
請求項1記載のベクトルと行列との積の計算装置。 The determination means includes
To calculate the score θ, and if θ <1, it is determined to convert to ZDD .
The apparatus for calculating a product of a vector and a matrix according to claim 1.
二値行列を取得する二値行列入力ステップと、
N次元実数ベクトルを取得するベクトル入力ステップと、
前記二値行列をゼロサプレス型二分決定グラフ(ZDD)に変換するか否かを、該二値行列の非ゼロ要素の密度が大きい程小さな値をとり、行列の階数が小さいほど小さな値をとる関数を用いて算出したスコアに基づいて判定する判定ステップと、
前記判定ステップでZDDに変換すると判定された場合に、前記二値行列をZDDに変換するZDD構築ステップと、
前記ベクトル入力ステップで取得した前記N次元実数ベクトルと前記ZDDとの積を計算するZDD演算ステップと、
前記判定ステップでZDDに変換しないと判定された場合に、前記二値行列と前記N次元実数ベクトルの積を計算する行列演算ステップと、
を実行することを特徴とするベクトルと行列との積の計算方法。 Computer
A binary matrix input step for obtaining a binary matrix;
A vector input step for obtaining an N-dimensional real vector ;
Whether to convert the pre-Symbol binary matrix Zero-suppressed binary decision diagram (ZDD), as taking a small value density of non-zero elements of the binary matrix is large, takes a smaller value the rank of the matrix is small A determination step for determining based on a score calculated using a function;
If it is determined that converts the ZDD in the determination step, and ZDD construction step that converts the binary matrix ZDD,
And ZDD calculation step of calculating a product of said N-dimensional real vectors obtained in the previous SL vector input step and before Symbol Z DD,
If it is determined that no conversion before Symbol decision step ZDD, a matrix calculating step of calculating the product of the N-dimensional real vector and the binary matrix,
A method of calculating a product of a vector and a matrix, characterized in that
によりスコアθを算出し、θ<1の場合には、ZDDに変換すると判定する
請求項3記載のベクトルと行列との積の計算方法。 The determination step includes
4. The method of calculating a product of a vector and a matrix according to claim 3, wherein the score θ is calculated by the following equation, and when θ <1, it is determined to convert to ZDD.
請求項1または2に記載の各手段として機能させるための計算プログラム。 Computer
Calculation program for causing to function as each means as set forth in claim 1 or 2.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2012186039A JP5856926B2 (en) | 2012-08-27 | 2012-08-27 | Apparatus and method for calculating product of vector and matrix and program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2012186039A JP5856926B2 (en) | 2012-08-27 | 2012-08-27 | Apparatus and method for calculating product of vector and matrix and program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2014044540A JP2014044540A (en) | 2014-03-13 |
| JP5856926B2 true JP5856926B2 (en) | 2016-02-10 |
Family
ID=50395766
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2012186039A Expired - Fee Related JP5856926B2 (en) | 2012-08-27 | 2012-08-27 | Apparatus and method for calculating product of vector and matrix and program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5856926B2 (en) |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP5736336B2 (en) * | 2012-03-27 | 2015-06-17 | 日本電信電話株式会社 | Matrix vector product computing device, matrix vector product computing method, and matrix vector product computing program |
-
2012
- 2012-08-27 JP JP2012186039A patent/JP5856926B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2014044540A (en) | 2014-03-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Zhu et al. | Computational aspects of stochastic collocation with multifidelity models | |
| JP2021504836A5 (en) | ||
| US12228497B2 (en) | Determining material properties based on machine learning models | |
| JP2019537139A5 (en) | ||
| CN110874636A (en) | Neural network model compression method and device and computer equipment | |
| CN114424215A (en) | Multitasking adapter neural network | |
| JP6506360B2 (en) | Method of generating teacher data, method of generating learned model, learned model, computer and program | |
| WO2020223850A1 (en) | System and method for quantum circuit simulation | |
| KR20220158768A (en) | Power reduction for accelerating machine learning | |
| WO2020121378A1 (en) | Learning device and learning method | |
| JP5856926B2 (en) | Apparatus and method for calculating product of vector and matrix and program | |
| CN115146226A (en) | Stream data processing method, device and equipment based on tensor compression method | |
| JP6810003B2 (en) | Matrix simplification device, program, and matrix simplification method | |
| CN111782928A (en) | Information push method, device and computer-readable storage medium | |
| De Vuyst et al. | GPU-accelerated numerical simulations of the Knudsen gas on time-dependent domains | |
| JP2020181318A (en) | Optimization device, optimization method, and program | |
| Yuan et al. | Comparison of GPU and FPGA based hardware platforms for ultrasonic flaw detection using support vector machines | |
| Wisniewski et al. | Safety analysis of Petri nets based on the SM-cover computed with the linear algebra technique | |
| Larimore et al. | ADAPT-LPV software for identification of nonlinear parameter-varying systems | |
| JP7494940B2 (en) | Integration device, integration method, and integration program | |
| JP7310884B2 (en) | Parameter estimation device, parameter estimation method, and parameter estimation program | |
| Patil et al. | GPU computing of special mathematical functions used in fractional calculus | |
| JP7384279B2 (en) | Data processing method, data processing device and data processing program | |
| Nagai et al. | Simulation of Continuous-Variable Quantum Systems with Tensor Network | |
| JP5325072B2 (en) | Matrix decomposition apparatus, matrix decomposition method and program |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20141020 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20150611 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20150616 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20150729 |
|
| 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: 20151208 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20151214 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5856926 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| LAPS | Cancellation because of no payment of annual fees |