JP5634941B2 - Arithmetic apparatus, arithmetic method and arithmetic program - Google Patents

Arithmetic apparatus, arithmetic method and arithmetic program Download PDF

Info

Publication number
JP5634941B2
JP5634941B2 JP2011111812A JP2011111812A JP5634941B2 JP 5634941 B2 JP5634941 B2 JP 5634941B2 JP 2011111812 A JP2011111812 A JP 2011111812A JP 2011111812 A JP2011111812 A JP 2011111812A JP 5634941 B2 JP5634941 B2 JP 5634941B2
Authority
JP
Japan
Prior art keywords
matrix
data
zdd
unit
calculation
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
Application number
JP2011111812A
Other languages
Japanese (ja)
Other versions
JP2012243040A (en
Inventor
正彬 西野
正彬 西野
宜仁 安田
宜仁 安田
小林 透
透 小林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2011111812A priority Critical patent/JP5634941B2/en
Publication of JP2012243040A publication Critical patent/JP2012243040A/en
Application granted granted Critical
Publication of JP5634941B2 publication Critical patent/JP5634941B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Complex Calculations (AREA)

Description

本発明は、演算装置、演算方法および演算プログラムに関する。   The present invention relates to a calculation device, a calculation method, and a calculation program.

計算機上で動作させることにより、例えば、0(ゼロ)と、0(ゼロ)以外の数を要素に持つM行N列の2値行列と、N次元の実数ベクトルとの行列演算を行うライブラリが提案されている(非特許文献1参照)。例えば、このライブラリでは、行列が疎な場合、すなわち、非零である要素数をKとしたときにK≪MNである場合には、非零成分のみについて行列計算を行う。   By operating on a computer, for example, a library that performs a matrix operation of an M-row N-column binary matrix having elements other than 0 (zero) and a number other than 0 (zero) and an N-dimensional real vector is provided. It has been proposed (see Non-Patent Document 1). For example, in this library, when the matrix is sparse, that is, when K << MN when the number of non-zero elements is K, matrix calculation is performed only for non-zero components.

「SPARSKIT:a basic tool kit for sparse matrix computations(Version2)」.Datasheet.[Online].Youcef Saad,University of Minnesota,Department of Computer Science and Engineering,June 6 1994,pages 3-12.Retrieved from the Internet:<URL:http://www-users.cs.umn.edu/~saad/software/SPARSKIT/index.html>“SPARSKIT: a basic tool kit for sparse matrix computations (Version 2)”. Datasheet. [Online]. Youcef Saad, University of Minnesota, Department of Computer Science and Engineering, June 6 1994, pages 3-12. Retrieved from the Internet: <URL: http://www-users.cs.umn.edu/~saad/software/SPARSKIT/index.html>

一般に、M行N列の2値行列と、N次元の実数ベクトルとの行列演算を行う場合には、「O(MN)」の演算量に応じた計算時間および記憶容量とが必要となる。なお、「O(オー)」は行列演算のオーダーを示し、「MN」は要素数を示す。一方で、上述したライブラリでは、行列が疎な場合、すなわち、非零である要素数「K」がK≪MNである場合に、非零成分のみについて行列計算を行うので、「O(K)」の演算量に応じた計算時間および記憶容量が必要となる。このように、上述したライブラリにより行列演算を行う場合には、非零である要素数「K」に応じた計算時間および記憶容量が行列演算に必要となる。このため、上述したライブラリにより要素数が膨大な行列について演算を行う場合、演算量も膨大となる結果、演算に必要となる計算時間および記憶容量の規模が大きくなってしまうという問題がある。   In general, when performing a matrix operation of a binary matrix of M rows and N columns and an N-dimensional real vector, calculation time and storage capacity corresponding to the calculation amount of “O (MN)” are required. “O (O)” indicates the order of matrix operation, and “MN” indicates the number of elements. On the other hand, in the above-described library, when the matrix is sparse, that is, when the number of non-zero elements “K” is K << MN, matrix calculation is performed only for the non-zero component, so “O (K) The calculation time and the storage capacity according to the calculation amount of “are required. As described above, when performing matrix operation using the above-described library, calculation time and storage capacity corresponding to the non-zero number of elements “K” are required for matrix operation. For this reason, when a calculation is performed on a matrix with a large number of elements using the above-described library, there is a problem that the calculation amount and the storage capacity required for the calculation increase as a result of the large calculation amount.

本発明は、上記に鑑みてなされたものであって、2値行列と実数ベクトルとの行列演算を効率的に実行することが可能な演算装置、演算方法および演算プログラムを提供することを目的とする。   The present invention has been made in view of the above, and an object of the present invention is to provide an arithmetic device, an arithmetic method, and an arithmetic program capable of efficiently executing a matrix operation between a binary matrix and a real vector. To do.

上述した課題を解決し、目的を達成するために、本発明は、2値行列とN次元の実数ベクトルとの行列演算を行う演算装置であって、M行N列(M、Nは整数)の前記2値行列のデータを入力するデータ入力部と、N次元(Nは整数)の前記実数ベクトルを入力するベクトル入力部と、前記データ入力部により入力された前記2値行列のデータを、二分決定グラフのデータ構造に変換した変換データを構築する構築部と、前記構築部により構築された前記変換データと、前記ベクトル入力部により入力された前記実数ベクトルとの行列演算を実行する演算部と、前記演算部による演算結果を出力する出力部とを有することを特徴とする。   In order to solve the above-described problems and achieve the object, the present invention is an arithmetic device that performs a matrix operation of a binary matrix and an N-dimensional real vector, and has M rows and N columns (M and N are integers). A data input unit for inputting the binary matrix data, a vector input unit for inputting the N-dimensional (N is an integer) real vector, and the binary matrix data input by the data input unit, A construction unit that constructs transformation data converted into a data structure of a binary decision graph, and a computation unit that performs matrix computation of the transformation data constructed by the construction unit and the real vector input by the vector input unit And an output unit for outputting a calculation result by the calculation unit.

また、本発明は、2値行列とN次元の実数ベクトルとの行列演算をコンピュータにより実行される演算方法であって、M行N列(M、Nは整数)の前記2値行列のデータを入力するデータ入力工程と、N次元(Nは整数)の前記実数ベクトルを入力するベクトル入力工程と、前記データ入力工程により入力された前記2値行列のデータを、二分決定グラフのデータ構造に変換した変換データを構築する構築工程と、前記構築工程により構築された前記変換データと、前記ベクトル入力部により入力された前記実数ベクトルとの行列演算を実行する演算工程と、前記演算工程による演算結果を出力する出力工程とを実行することを特徴とする。   Further, the present invention is an operation method in which a matrix operation between a binary matrix and an N-dimensional real vector is executed by a computer, and the binary matrix data of M rows and N columns (M and N are integers) are obtained. A data input step for inputting, a vector input step for inputting the N-dimensional (N is an integer) real vector, and the binary matrix data input by the data input step are converted into a data structure of a binary decision graph. A construction step for constructing the converted data, a computation step for performing a matrix computation of the conversion data constructed by the construction step and the real vector input by the vector input unit, and a computation result by the computation step And an output step of outputting.

また、本発明は、2値行列とN次元の実数ベクトルとの行列演算を行うコンピュータに実行させるための演算プログラムであって、前記コンピュータに、M行N列(M、Nは整数)の前記2値行列のデータを入力するデータ入力手順と、N次元(Nは整数)の前記実数ベクトルを入力するベクトル入力手順と、前記データ入力手順により入力された前記2値行列のデータを、二分決定グラフのデータ構造に変換した変換データを構築する構築手順と、前記構築手順により構築された前記変換データと、前記ベクトル入力手順により入力された前記実数ベクトルとの行列演算を実行する演算手順と、前記演算手順による演算結果を出力する出力手順とを実行させることを特徴とする。   The present invention also provides an arithmetic program for causing a computer to perform a matrix operation of a binary matrix and an N-dimensional real vector, the computer having M rows and N columns (M and N are integers). Data input procedure for inputting binary matrix data, vector input procedure for inputting N-dimensional (N is an integer) real vector, and binary matrix data input by the data input procedure are determined in binary. A construction procedure for constructing transformation data converted into a data structure of a graph, a computation procedure for performing a matrix computation of the transformation data constructed by the construction procedure and the real vector input by the vector input procedure, An output procedure for outputting a calculation result according to the calculation procedure is executed.

本発明によれば、2値行列と実数ベクトルとの行列演算を効率的に実行できるという効果を奏する。   According to the present invention, there is an effect that a matrix operation between a binary matrix and a real vector can be efficiently executed.

図1は、実施例1に係る演算装置の構成を示す機能ブロック図である。FIG. 1 is a functional block diagram illustrating the configuration of the arithmetic device according to the first embodiment. 図2は、データ入力部が入力する2値行列の一例を示す図である。FIG. 2 is a diagram illustrating an example of a binary matrix input by the data input unit. 図3は、ZDDの一例を示す図である。FIG. 3 is a diagram illustrating an example of ZDD. 図4は、図3に示すZDDに対応するノード表の一例を示す図である。FIG. 4 is a diagram illustrating an example of a node table corresponding to the ZDD illustrated in FIG. 図5は、ZDD構築部120により構築されるZDDの一例を示す図である。FIG. 5 is a diagram illustrating an example of ZDD constructed by the ZDD constructing unit 120. 図6は、ZDD構築部120により構築されたZDDに対応するノード表の一例を示す図である。FIG. 6 is a diagram illustrating an example of a node table corresponding to the ZDD constructed by the ZDD constructing unit 120. 図7は、図2に示す行列の1行目のデータについて構築したZDDを示す図である。FIG. 7 is a diagram showing the ZDD constructed for the data in the first row of the matrix shown in FIG. 図8は、図7に対応するノード表を示す図である。FIG. 8 is a diagram showing a node table corresponding to FIG. 図9は、実施例1に係るZDD構築処理の流れを示す図である。FIG. 9 is a diagram illustrating the flow of the ZDD construction process according to the first embodiment. 図10は、実施例1に係る行列と実数ベクトルとの積の計算処理の流れを示す図である。FIG. 10 is a diagram illustrating a flow of calculation processing of the product of the matrix and the real vector according to the first embodiment. 図11は、行列演算処理の流れを示す図である。FIG. 11 is a diagram showing the flow of matrix calculation processing. 図12は、演算プログラムを実行する電子機器の一例を示す図である。FIG. 12 is a diagram illustrating an example of an electronic device that executes an arithmetic program.

以下に、図面を参照しつつ、本願に係る演算装置、演算方法および演算プログラムの各実施例について詳細に説明する。後述する実施例は一例にすぎず、本願に係る演算装置、演算方法および演算プログラムを限定するものではない。また、後述する各実施例は処理内容に矛盾を生じさせない範囲で適宜組み合わせることもできる。   Hereinafter, embodiments of a calculation device, a calculation method, and a calculation program according to the present application will be described in detail with reference to the drawings. The embodiment described below is merely an example, and does not limit the arithmetic device, the arithmetic method, and the arithmetic program according to the present application. In addition, the embodiments described later can be appropriately combined within a range that does not cause a contradiction in the processing contents.

[演算装置の概要と特徴(実施例1)]
実施例1に係る演算装置は、2値行列と実数ベクトルとの行列演算を行うことを概要とする。そして、実施例1に係る演算装置は、2値行列を所定のデータ構造を用いて圧縮し、圧縮した2値行列を対象として演算を実行する点に特徴がある。
[Outline and Features of Arithmetic Unit (Example 1)]
The arithmetic device according to the first embodiment is summarized as performing a matrix operation of a binary matrix and a real vector. The arithmetic device according to the first embodiment is characterized in that a binary matrix is compressed using a predetermined data structure, and an operation is performed on the compressed binary matrix.

具体的には、実施例1に係る演算装置は、M行N列(M、Nは正の整数)の2値行列を、ゼロサプレス型二分決定グラフ(Zero-Suppressed Binary Decision Diagram,以下、適宜ZDDと記載する)を用いたデータ構造に変換する。そして、実施例1に係る演算装置は、ZDDと実数ベクトルとの積の演算を、ZDD上で再帰的なアルゴリズムとして実行する。すなわち、実施例1に係る演算装置は、2値行列をZDDを用いたデータ構造に変換することにより2値行列のデータを圧縮して表現することができる。そして、実施例1に係る演算装置は、2値行列が有する非零の要素数「K」に応じた演算を実行するのではなく、2値行列をZDDを用いたデータ構造に変換したときのZDDのノード数「W」に応じた演算を実行できるようになる。このようなことから、実施例1に係る演算装置は、2値行列と実数ベクトルとの積の演算に必要となる計算時間や記憶容量を減らすことができ、行列演算を効率的に実行できる。   Specifically, the arithmetic device according to the first embodiment uses a binary matrix of M rows and N columns (M and N are positive integers) as a zero-suppressed binary decision diagram (hereinafter referred to as ZDD). To a data structure using Then, the arithmetic device according to the first embodiment executes the operation of the product of the ZDD and the real vector as a recursive algorithm on the ZDD. That is, the arithmetic device according to the first embodiment can compress and represent binary matrix data by converting the binary matrix into a data structure using ZDD. And the arithmetic unit which concerns on Example 1 does not perform the calculation according to the non-zero element number "K" which a binary matrix has, but when converting a binary matrix into the data structure using ZDD An operation corresponding to the number of nodes “W” of ZDD can be executed. For this reason, the arithmetic device according to the first embodiment can reduce the calculation time and the storage capacity necessary for calculating the product of the binary matrix and the real vector, and can efficiently execute the matrix operation.

[演算装置の構成(実施例1)]
図1は、実施例1に係る演算装置の構成を示す機能ブロック図である。実施例1に係る演算装置100は、例えば、所定のプログラムなどに記述された手順に従い、所定の演算処理を行うパーソナルコンピュータやワークステーション、オフコンなどに相当する。なお、図1では、演算装置100を説明する上で必要となる機能を図示し、中央演算装置や主記憶装置、補助記憶装置などの一般的な機能の図示は省略する。
[Configuration of Arithmetic Unit (Example 1)]
FIG. 1 is a functional block diagram illustrating the configuration of the arithmetic device according to the first embodiment. The arithmetic device 100 according to the first embodiment corresponds to, for example, a personal computer, a workstation, or an office computer that performs predetermined arithmetic processing according to a procedure described in a predetermined program. In FIG. 1, functions necessary for describing the arithmetic device 100 are illustrated, and general functions such as a central arithmetic device, a main storage device, and an auxiliary storage device are not shown.

図1に示すように、実施例1に係る演算装置100は、データ入力部110と、ZDD構築部120と、データ記憶部130と、ベクトル入力部140と、行列演算実行部150と、計算結果出力部160とを有する。   As illustrated in FIG. 1, the arithmetic device 100 according to the first embodiment includes a data input unit 110, a ZDD construction unit 120, a data storage unit 130, a vector input unit 140, a matrix operation execution unit 150, and a calculation result. And an output unit 160.

データ入力部110は、M行N列(M、Nは正の整数)の2値行列(要素が0もしくは1の値である行列)を入力する。図2は、データ入力部が入力する2値行列の一例を示す図である。図2に示すように、データ入力部110は、例えば、3行3列の2値行列を入力する。なお、データ入力部110は、例えば、キーボードやマウスなどのユーザインターフェースや、USB(Universal Serial Bus)やイーサネット(登録商標)などのハードウェアインターフェースなどを介して2値行列を入力する。   The data input unit 110 inputs a binary matrix (a matrix whose elements are values of 0 or 1) of M rows and N columns (M and N are positive integers). FIG. 2 is a diagram illustrating an example of a binary matrix input by the data input unit. As shown in FIG. 2, the data input unit 110 inputs, for example, a 3 × 3 binary matrix. The data input unit 110 inputs a binary matrix via, for example, a user interface such as a keyboard or a mouse, or a hardware interface such as USB (Universal Serial Bus) or Ethernet (registered trademark).

ZDD構築部120は、データ入力部110により入力されたM行N列の2値行列から、ZDD(Zero-Suppressed Binary Decision Diagram)を構築する。まず、ZDD構築部120によるZDDの構築手順の説明に先立ち、ZDDについて説明する。   The ZDD constructing unit 120 constructs a ZDD (Zero-Suppressed Binary Decision Diagram) from the binary matrix of M rows and N columns input by the data input unit 110. First, ZDD will be described prior to the description of the ZDD construction procedure by the ZDD construction unit 120.

ZDDは、組み合わせ集合を2分グラフの形で保持するデータ構造である。ここで、組み合わせ集合とは、あるアイテムの集合A={a,a,…,}に対して、e⊆Aであるようなeを要素とする集合である。一例を挙げれば、集合B={a,b,c}がある場合に、集合{{a,b},{b,c},{a,c}}は、集合Bの組み合わせ集合ということになる。図3は、ZDDの一例を示す図である。なお、図3は、組み合わせ集合{{a,b},{b},{c}}のZDDを表している。図3に示すように、ZDD「I」は指向性を持ったグラフ構造で構成される。また、図3に示すように、ZDD「I」は、「0または1」のラベルが貼り付けられた終端ノード(図3の四角いノード)と、「a,bまたはc」のラベルが貼り付けられた中間ノード(図3の丸いノード)との2種類のノードを有する。また、図3に示すように、中間ノードは、それぞれ、HIリンク(実線矢印)およびLOリンク(点線矢印)を有する。中間ノードが有する各リンクは、それぞれが別の子ノードを指す。また、図3に示すように、ZDDには、先頭ノードを表すポインタ「f」が設けられる。このように、ZDDは、終端ノード、中間ノード、HIリンク、LOリンクおよびポインタを有するグラフ構造によって組み合わせ集合を表現する。 ZDD is a data structure that holds a combination set in the form of a binary graph. Here, the combination set is a set whose element is e such that e⊆A with respect to a set A = {a 1 , a 2 ,... For example, when there is a set B = {a, b, c}, the set {{a, b}, {b, c}, {a, c}} is a combination set of the set B. Become. FIG. 3 is a diagram illustrating an example of ZDD. FIG. 3 represents the ZDD of the combination set {{a, b}, {b}, {c}}. As shown in FIG. 3, ZDD “I 1 ” has a graph structure having directivity. In addition, as shown in FIG. 3, the ZDD “I 1 ” has a terminal node (a square node in FIG. 3) labeled with “0 or 1” and a label “a, b, or c”. It has two types of nodes with attached intermediate nodes (round nodes in FIG. 3). Further, as shown in FIG. 3, each intermediate node has an HI link (solid arrow) and an LO link (dotted arrow). Each link that an intermediate node has points to a different child node. Also, as shown in FIG. 3, the ZDD is provided with a pointer “f” representing the head node. Thus, ZDD represents a combination set by a graph structure having terminal nodes, intermediate nodes, HI links, LO links, and pointers.

例えば、ある組み合わせeが、ZDDが表す組み合わせ集合に含まれるか否かは、以下に説明する手続きにより判明する。まず、ZDDの先頭ノードを表すポインタに沿って、先頭ノードに遷移する。そこで、先頭ノードのラベルが表すアイテムがeに含まれているならHIリンクが指すノードに遷移し、そうでないならLOリンクが指すノードに遷移する。以上の手続きを最終的に終端ノードにたどり着くまで実行し、最終的にラベル1をもつ終端ノードに遷移し、かつeに含まれるすべてのアイテムに対応するノードを遷移してきているなら、eは組み合わせ集合に含まれる。一方、以上の手続きを最終的に終端ノードにたどり着くまで実行し、最終的にラベル1をもつ終端ノードに遷移せず、かつeに含まれるすべてのアイテムに対応するノードを遷移してきていないなら、eは組み合わせ集合に含まれない。   For example, whether or not a certain combination e is included in the combination set represented by ZDD can be determined by the procedure described below. First, a transition is made to the head node along a pointer representing the head node of ZDD. Therefore, if the item represented by the label of the first node is included in e, the transition is made to the node pointed to by the HI link. If the above procedure is finally executed until the terminal node is reached, and finally the transition is made to the terminal node having label 1, and the nodes corresponding to all items included in e have been transitioned, e is combined. Included in the set. On the other hand, if the above procedure is finally executed until the terminal node is reached, and finally the terminal node having the label 1 is not changed, and the nodes corresponding to all items included in e have not been changed, e is not included in the combination set.

図4は、図3に示すZDDに対応するノード表の一例を示す図である。図4に示すように、ZDDは、コンピュータ上においては、ノードIDをインデックスとし、各要素を配列したノード表で表現される。図4に示すように、ノード表には、各要素として、ノードIDごとに、ノードのラベル、HIリンク先のノードID、LOリンク先のノードIDがそれぞれ格納されている。   FIG. 4 is a diagram illustrating an example of a node table corresponding to the ZDD illustrated in FIG. As shown in FIG. 4, on the computer, the ZDD is represented by a node table in which each element is arranged with a node ID as an index. As shown in FIG. 4, the node table stores a node label, a HI link destination node ID, and a LO link destination node ID for each node ID as each element.

ところで、ある組み合わせをZDDで表現するときには、アイテム間にあらかじめ順序が定められている。具体的には、あるノードのラベルであるアイテムとその子ノードのラベルであるアイテムとを比較したときに、必ず子ノードのアイテムの順序が後になるようにするという制約がある。例えば、上述したZDD「I」(図3)では、ラベル「a」、「b」、「c」が貼り付けられたアイテムの間に、「a」、「b」、「c」の順で順序が定められている。また、ノードIDがiであるノードのHIリンク先となるノードのノードIDをHI(i)、LOリンク先となるノードのノードIDをLO(i)とした場合に、上述したZDDの配列(図4)では、i>2のときに、常にHI(i)<i,LO(i)<iが成り立つように構成されている。以下、ノードIDがiであるノードのラベルをv(i)、HIリンク先のノードのノードIDをHI(i)、LOリンク先のノードのノードIDをLO(i)と記述する。 By the way, when a certain combination is expressed in ZDD, an order is determined in advance between items. Specifically, there is a restriction that when an item that is a label of a certain node is compared with an item that is a label of the child node, the order of the items of the child node is always later. For example, in the above-described ZDD “I 1 ” (FIG. 3), the items “a”, “b”, “c” are placed in the order of “a”, “b”, “c”. The order is determined. Further, when the node ID of the node that becomes the HI link destination of the node whose node ID is i is HI (i) and the node ID of the node that becomes the LO link destination is LO (i), the above ZDD array ( 4), when i> 2, HI (i) <i and LO (i) <i are always satisfied. Hereinafter, the label of the node whose node ID is i is described as v (i), the node ID of the HI link destination node as HI (i), and the node ID of the LO link destination node as LO (i).

ZDDの説明に続いて、ZDD構築部120が、M行N列の2値行列からZDDを構築する手順について説明する。ZDD構築部120は、データ入力部110からM行N列の2値行列を取得し、行列の各行について、1つの要素のみからなる集合を作成する。行列の各行について、ZDD構築部120により作成される1つの要素のみからなる集合は、例えば、以下に示す式(1)で表される。   Following the description of ZDD, a procedure in which the ZDD constructing unit 120 constructs a ZDD from a binary matrix of M rows and N columns will be described. The ZDD constructing unit 120 acquires a binary matrix of M rows and N columns from the data input unit 110, and creates a set composed of only one element for each row of the matrix. For each row of the matrix, a set consisting of only one element created by the ZDD constructing unit 120 is expressed by, for example, the following formula (1).

Figure 0005634941
Figure 0005634941

続いて、ZDD構築部120は、行列の各行について、1つの要素のみからなる集合を作成した後、それらの和集合を作成する。ZDD構築部120により作成される和集合は、例えば、以下に示す式(2)で表される。   Subsequently, the ZDD constructing unit 120 creates a set consisting of only one element for each row of the matrix, and then creates a union thereof. The union created by the ZDD constructing unit 120 is expressed by, for example, the following formula (2).

Figure 0005634941
Figure 0005634941

なお、上述した式(1)および(2)に示すa(i,j)は、行列のi行目のN個の要素のうち、値が「1」である列番号を並べたものである。例えば、データ入力部110から取得した2値行列が、図2に示すような3行3列の2値行列で与えられたとすると、a(1,1)=1,a(1,2)=3となる。また、上述した式(1)および(2)に示すb(i)は、行列のi行目のN個の要素のうち、値が「1」である要素の個数を示すものである。例えば、データ入力部110から取得した2値行列が、図2に示すような3行3列の2値行列で与えられたとすると、b(1)=2,b(2)=1,b(3)=1となる。また、上述した式(1)および(2)に示すRは、行列のi行目に対応するシンボルを示すものであり、上述した式(1)および(2)に示すCは、行列のi列目に対応するシンボルを示すものである。 Note that a (i, j) shown in the above-described equations (1) and (2) is an array of column numbers having a value of “1” among the N elements in the i-th row of the matrix. . For example, if the binary matrix acquired from the data input unit 110 is given by a binary matrix of 3 rows and 3 columns as shown in FIG. 2, a (1,1) = 1, a (1,2) = 3 Also, b (i) shown in the above equations (1) and (2) indicates the number of elements whose value is “1” among the N elements in the i-th row of the matrix. For example, if the binary matrix acquired from the data input unit 110 is given by a binary matrix of 3 rows and 3 columns as shown in FIG. 2, b (1) = 2, b (2) = 1, b ( 3) = 1. Further, R i shown in the above-described equations (1) and (2) indicates a symbol corresponding to the i-th row of the matrix, and C i shown in the above-described equations (1) and (2) is a matrix. The symbol corresponding to the i-th column is shown.

このように、ZDD構築部120は、データ入力部110により入力された2値行列を、上述した式(2)に示すようにして圧縮して表現できる。   As described above, the ZDD constructing unit 120 can express the binary matrix input by the data input unit 110 by compressing it as shown in the above equation (2).

続いて、ZDD構築部120は、上述の式(2)で表わされる和集合を組み合わせ集合Fとして、組み合わせ集合FのZDDを計算し、データ記憶部130に格納する。なお、組み合わせ集合と、その集合に出現するシンボルの順序とが与えられれば、既存の技術を利用して、ZDDを対象とした演算を行うことによりZDDを計算することができる。そこで、ZDD構築部120は、組み合わせ集合F(式(2))に出現するシンボルR,R,…,R,C,C,…,Cに対して、R<R<・・・<R<C<C<・・・<Cという順序を与え、既存の技術を利用した演算を行うことにより、組み合わせ集合FのZDDを計算する。なお、ZDDを対象とした演算を行う既存の技術としては、例えば、Shin-ichi Minato,「Zero-Suppressed BDDs for Set Manipulation in Combinatorial Problems」,DAC’93,pp.272-277などがある。 Subsequently, the ZDD constructing unit 120 calculates the ZDD of the combination set F using the union represented by the above formula (2) as the combination set F, and stores the ZDD in the data storage unit 130. If a combination set and the order of symbols appearing in the set are given, the ZDD can be calculated by performing an operation on the ZDD using an existing technique. Therefore, ZDD construction unit 120, the symbol R 1, R 2 appearing in the combined set F (equation (2)), ..., R M, C 1, C 2, ..., with respect to C N, R 1 <R 2 <... <R M <C 1 <C 2 <... <C N is given, and the ZDD of the combination set F is calculated by performing an operation using the existing technology. In addition, as an existing technique for performing an operation on ZDD, for example, there are Shin-ichi Minato, “Zero-Suppressed BDDs for Set Manipulation in Combinatorial Problems”, DAC '93, pp.272-277, and the like.

図5は、ZDD構築部120により構築されるZDDの一例を示す図である。図6は、ZDD構築部120により構築されたZDDに対応するノード表の一例を示す図である。なお、図5および図6は、上述した式(2)で表される組み合わせ集合から構築されるZDDである。ZDD構築部120は、組み合わせ集合Fと、組み合わせ集合Fに出現するシンボルの順序とが与えられると、既存技術を利用した演算を行うことにより、図5に示すようなZDD「I」を構築できる。図5に示すように、ZDD「I」は、ラベル「R」,「R」,「R」,「C」,「C」,「C」が貼り付けられた中間ノード(丸いノード)と、「0」または「1」のラベルが貼り付けられた終端ノード(四角いノード)とを有する。また、図5に示すように、ZDD「I」は、中間ノードのうち、ポインタ「f」が指すラベル「R」が貼り付けられたノードを先頭ノードとする。また、図6に示すように、ZDD「I」は、コンピュータ上において、ノードIDをインデックスとし、各要素を配列したノード表で表現される。ノード表のノードID「1」〜「8」は、図5に示すラベル「0」,「1」,「C」,「C」,「C」,「R」,「R」,「R」のノードにそれぞれ対応する。なお、ZDD構築部120により構築されるZDDは、組み合わせ集合を可能な限り圧縮した形で表現することが可能なデータ構造である。もし、ZDD構築部120が、組み合わせ集合を全く圧縮することなく、ZDDを構築したとする。この場合、ZDD構築部120は、2値行列の行数と、行列中の非零成分の個数分の中間ノードを有するZDDとして、組み合わせ集合を表現することとなる。一方、ZDD構築部120は、組み合わせ集合で表される2値行列の各行をベクトルとして行同士を比較し、共通部分を可能な限り圧縮した構造でZDDを構築したとする。この場合、ZDD構築部120は、共通部分を圧縮せずに構築したZDDよりも、中間ノードの数を減らしたZDDとして、組み合わせ集合を表現することができる。 FIG. 5 is a diagram illustrating an example of ZDD constructed by the ZDD constructing unit 120. FIG. 6 is a diagram illustrating an example of a node table corresponding to the ZDD constructed by the ZDD constructing unit 120. 5 and 6 are ZDDs constructed from the combination set represented by the above-described formula (2). When the combination set F and the order of symbols appearing in the combination set F are given, the ZDD construction unit 120 constructs a ZDD “I 2 ” as shown in FIG. 5 by performing an operation using the existing technology. it can. As shown in FIG. 5, the ZDD “I 2 ” is an intermediate where labels “R 1 ”, “R 2 ”, “R 3 ”, “C 1 ”, “C 2 ”, “C 3 ” are pasted. A node (round node) and a terminal node (square node) labeled “0” or “1”. As shown in FIG. 5, ZDD “I 2 ” has a node to which the label “R 1 ” indicated by the pointer “f” is pasted among the intermediate nodes as the first node. As shown in FIG. 6, ZDD “I 2 ” is represented on a computer as a node table in which each element is arranged with a node ID as an index. The node IDs “1” to “8” in the node table have labels “0”, “1”, “C 3 ”, “C 2 ”, “C 1 ”, “R 3 ”, “R 2 ” shown in FIG. ”And“ R 1 ”respectively. The ZDD constructed by the ZDD constructing unit 120 is a data structure that can express a combination set in a compressed form as much as possible. Assume that the ZDD constructing unit 120 constructs a ZDD without compressing the combination set at all. In this case, the ZDD constructing unit 120 represents the combination set as ZDD having the number of rows of the binary matrix and intermediate nodes corresponding to the number of non-zero components in the matrix. On the other hand, it is assumed that the ZDD constructing unit 120 constructs a ZDD with a structure in which each row of a binary matrix represented by a combination set is used as a vector and the common part is compressed as much as possible. In this case, the ZDD constructing unit 120 can express the combination set as a ZDD in which the number of intermediate nodes is reduced as compared to the ZDD constructed without compressing the common part.

ベクトル入力部140は、データ入力部110により入力された2値行列との積の計算対象であるN次元(Nは正の整数)の実数ベクトルを入力する。なお、ベクトル入力部140は、データ入力部110と同様に、ユーザインターフェースやハードウェアインターフェースなどを介してN次元の実数ベクトルを入力する。   The vector input unit 140 inputs an N-dimensional (N is a positive integer) real vector that is a calculation target of a product with the binary matrix input by the data input unit 110. Similar to the data input unit 110, the vector input unit 140 inputs an N-dimensional real vector via a user interface, a hardware interface, or the like.

行列演算実行部150は、ZDD構築部120により2値行列から構築されたZDDと、ベクトル入力部140により入力されたN次元の実数ベクトル(以下、適宜N次元ベクトルと記載する)とを用いて、行列演算を実行する。   The matrix calculation execution unit 150 uses the ZDD constructed from the binary matrix by the ZDD construction unit 120 and the N-dimensional real vector input by the vector input unit 140 (hereinafter referred to as an N-dimensional vector as appropriate). , Perform matrix operations.

具体的には、行列演算実行部150は、以下に説明するように、2値行列から構築されたZDDと、実数ベクトルとの積の演算を、ZDD上で再帰的なアルゴリズムとして実行する。まず、行列演算実行部150は、ベクトル入力部140からN次元ベクトルを取得し、取得したN次元ベクトルをq、i番目の要素をqと表す。続いて、行列演算実行部150は、データ記憶部130からZDDを取得し、N次元ベクトルとの積を演算する。なお、N次元ベクトル「q」と、ZDDとの演算結果を、M次元ベクトルpとする。行列演算実行部150は、まず、スコアを格納する要素数(W−M)の1次元配列scoreを用意し、すべての要素を0で初期化しておく。ここで、要素数(W−M)は、ZDDの中間ノードのうち、列に対応するラベルを持つものの数である。次に、行列演算実行部150は、インデックス(i)をi=3に初期化する。続いて、行列演算実行部150は、v(i)が、C1〜のいずれかに一致するか否かを判定する。v(i)は、ノードIDがiであるノードのラベルである。v(i)が、C1〜のいずれかに一致する場合には、行列演算実行部150は、1次元配列score[i]の値を、ノードIDがiであるノードの子ノードの1次元配列score[HI(i)]と、v(i)=Cとなるjに対応するパラメータqの和に更新する。HI(i)は、ノードIDがiであるノードのHIリンク先となるノードのノードIDである。なお、ノード表については、HI(i)<iが成り立っているので、score[i]の値の計算は更新されたscore[HI(i)]の値を利用して行うことができる。 Specifically, the matrix calculation execution unit 150 executes a calculation of the product of the ZDD constructed from the binary matrix and the real vector as a recursive algorithm on the ZDD, as will be described below. First, the matrix calculation execution unit 150 acquires an N-dimensional vector from the vector input unit 140, and represents the acquired N-dimensional vector as q and the i-th element as q i . Subsequently, the matrix calculation execution unit 150 acquires ZDD from the data storage unit 130 and calculates a product with the N-dimensional vector. The calculation result of the N-dimensional vector “q” and ZDD is an M-dimensional vector p. The matrix calculation execution unit 150 first prepares a one-dimensional array score of the number of elements (WM) for storing scores, and initializes all elements with zero. Here, the number of elements (W-M) is the number of ZDD intermediate nodes having labels corresponding to columns. Next, the matrix operation execution unit 150 initializes the index (i) to i = 3. Subsequently, the matrix operation execution unit 150 determines whether v (i) matches any of C 1 to C N. v (i) is the label of the node whose node ID is i. When v (i) matches one of C 1 to C N , the matrix operation execution unit 150 sets the value of the one-dimensional array score [i] to the child node of the node whose node ID is i. The one-dimensional array score [HI (i)] and the parameter q j corresponding to j where v (i) = C j are updated. HI (i) is the node ID of the node that is the HI link destination of the node whose node ID is i. Since HI (i) <i holds for the node table, the score [i] value can be calculated using the updated score [HI (i)] value.

一方、v(i)が、C1〜のいずれにも一致しない場合には、行列演算実行部150は、pにscore[HI(i)]の値を代入する。なお、kは、v(i)=Rとなるときの行番号のことである。つまり、v(i)が、C1〜のいずれにも一致しない場合、v(i)は、R1〜のいずれかに一致するためである。 On the other hand, v (i) is, when does not match any of the C. 1 to C N is a matrix operation executing unit 150 substitutes the value of the score [HI (i)] to p k. Note that k is a row number when v (i) = Rk . That, v (i) is, if not match any of C 1~ C N, v (i ) is to match any of the R. 1 to R M.

続いて、行列演算実行部150は、ZDDの全てのノードについて1次元配列scoreの計算を完了したか(i≦Wであるか)否かを判定する。全てのノードについて1次元配列scoreの計算を完了していない場合には、行列演算実行部150は、インデックス(i)を1インクリメントして、上述したのと同様の手順で1次元配列scoreの計算を行う。一方、全てのノードについて1次元配列scoreの計算を完了している場合には、行列演算実行部150は、行列演算の結果pを後述する計算結果出力部160に送出して処理を終了する。   Subsequently, the matrix calculation execution unit 150 determines whether or not the calculation of the one-dimensional array score has been completed for all the nodes of ZDD (i ≦ W). If the calculation of the one-dimensional array score has not been completed for all the nodes, the matrix operation execution unit 150 increments the index (i) by 1, and calculates the one-dimensional array score in the same procedure as described above. I do. On the other hand, if the calculation of the one-dimensional array score has been completed for all the nodes, the matrix calculation execution unit 150 sends the matrix calculation result p to the calculation result output unit 160 described later, and ends the processing.

上述してきたように、行列演算実行部150による行列演算は、以下に示す式(3)のように計算できることを利用し、各ノードに計算途中の値を記憶することによって、最終的な計算結果pを得るものである。   As described above, the matrix calculation performed by the matrix calculation execution unit 150 uses the fact that it can be calculated as shown in the following equation (3), and stores the value during calculation in each node to obtain the final calculation result. p is obtained.

Figure 0005634941
Figure 0005634941

以下、図7および図8を用いて、行列演算実行部150による行列演算について補足説明する。図7は、図2に示す行列の1行目のデータについて構築したZDDを示す図である。図8は、図7に対応するノード表を示す図である。行列演算実行部150は、図7に示すZDD「I」を構成するノードのうち、ノードIDが3であるノードについて、score[3]=qとする。続いて、行列演算実行部150は、図7に示すZDD「I」を構成するノードのうち、ノードIDが4であるノードについて、score[4]=q+qとし、最終的に、p=q+qを計算する。 Hereinafter, the matrix calculation performed by the matrix calculation execution unit 150 will be supplementarily described with reference to FIGS. 7 and 8. FIG. 7 is a diagram showing the ZDD constructed for the data in the first row of the matrix shown in FIG. FIG. 8 is a diagram showing a node table corresponding to FIG. The matrix calculation execution unit 150 sets score [3] = q 3 for the node having the node ID 3 among the nodes constituting the ZDD “I 3 ” illustrated in FIG. 7. Subsequently, the matrix calculation execution unit 150 sets score [4] = q 1 + q 3 for the node having the node ID 4 among the nodes constituting the ZDD “I 3 ” illustrated in FIG. Calculate p 1 = q 1 + q 3 .

上述してきたように、行列演算実行部150は、ZDDと実数ベクトルとの積の演算を、ZDDのノード数(W)に比例する時間で演算の処理を終了することができる。すなわち、行列演算実行部150は、演算量「O(W)」に応じた計算時間および記憶容量で処理を行うことができ、演算量「O(MN)」や演算量「O(K)」よりも、必要となる計算時間や記憶容量を削減できる。上述してきた方法により、ZDDと実数ベクトルとの積の演算量を、「O(W)」に減らすことができる理由は次のとおりである。再帰的計算において各中間ノードに対応して計算されるscoreの値は、行ベクトルと実数ベクトルqとの乗算の途中までの演算結果を保持している。このとき、ある行ベクトルに対する乗算と、別の行ベクトルに対する乗算において、途中までの計算が同一である場合、その結果が同一のノードに保持されることになるので、計算回数を削減することができる。その結果、ZDDと実数ベクトルとの積の演算量を「O(W)」に減らすことができる。   As described above, the matrix operation execution unit 150 can finish the operation of the product of the ZDD and the real vector in a time proportional to the number of nodes (W) of the ZDD. That is, the matrix calculation execution unit 150 can perform processing with a calculation time and a storage capacity corresponding to the calculation amount “O (W)”, and the calculation amount “O (MN)” or the calculation amount “O (K)”. Rather than the required calculation time and storage capacity. The reason why the amount of calculation of the product of ZDD and the real vector can be reduced to “O (W)” by the method described above is as follows. The score value calculated corresponding to each intermediate node in the recursive calculation holds the calculation result up to the middle of the multiplication of the row vector and the real vector q. At this time, in the case of multiplication for one row vector and multiplication for another row vector, if the calculation up to the middle is the same, the result is held in the same node, so the number of calculations can be reduced. it can. As a result, the amount of calculation of the product of ZDD and real vector can be reduced to “O (W)”.

計算結果出力部160は、行列演算実行部150による演算の結果を外部へ出力する。例えば、計算結果出力部160は、ディスプレイやモニタ、プリンタなどの周辺機器へ演算の結果を出力する。   The calculation result output unit 160 outputs the result of the calculation performed by the matrix calculation execution unit 150 to the outside. For example, the calculation result output unit 160 outputs the calculation result to peripheral devices such as a display, a monitor, and a printer.

なお、上述してきた演算装置100の各種処理機能は、例えば、電子回路や集積回路により実装することができる。電子回路としては、例えば、CPU(Central Processing Unit)やMPU(Micro Processing Unit)がある。また、集積回路としては、例えば、ASIC(Application Specific Integrated Circuit)やFPGA(Field Programmable Gate Array)などがある。また、データ記憶部130は、例えば、RAM(Random Access Memory)やフラッシュメモリ(flash memory)などの半導体メモリ素子を用いて実装することができる。   Note that the various processing functions of the arithmetic device 100 described above can be implemented by, for example, an electronic circuit or an integrated circuit. Examples of the electronic circuit include a CPU (Central Processing Unit) and an MPU (Micro Processing Unit). Examples of integrated circuits include ASIC (Application Specific Integrated Circuit) and FPGA (Field Programmable Gate Array). The data storage unit 130 can be mounted using a semiconductor memory element such as a RAM (Random Access Memory) or a flash memory.

[演算装置による処理(実施例1)]
図9〜図11を用いて、実施例1に係る演算装置による処理の流れを説明する。図9は、実施例1に係るZDD構築処理の流れを示す図である。図10は、実施例1に係る行列と実数ベクトルとの積の計算処理の流れを示す図である。図11は、行列演算処理の流れを示す図である。実施例1に係る演算装置100による処理は、図9に示すZDD構築処理と、図10および図11に示す行列と実数ベクトルとの積の計算処理とに2分される。
[Processing by Arithmetic Unit (Example 1)]
The flow of processing performed by the arithmetic device according to the first embodiment will be described with reference to FIGS. FIG. 9 is a diagram illustrating the flow of the ZDD construction process according to the first embodiment. FIG. 10 is a diagram illustrating a flow of calculation processing of the product of the matrix and the real vector according to the first embodiment. FIG. 11 is a diagram showing the flow of matrix calculation processing. The processing performed by the arithmetic device 100 according to the first embodiment is divided into two parts: a ZDD construction process shown in FIG. 9 and a matrix and real vector calculation process shown in FIGS. 10 and 11.

(ZDD構築処理)
図9に示すように、データ入力部110は、M行N列の2値行列を入力する(S101)。続いて、ZDD構築部120は、S101で入力した行列の各行を入力として、組み合わせ集合Fを計算する(S102)。そして、ZDD構築部120は、S102で計算した組み合わせ集合Fに対応するZDDを構築する(S103)。
(ZDD construction process)
As shown in FIG. 9, the data input unit 110 inputs a binary matrix of M rows and N columns (S101). Subsequently, the ZDD constructing unit 120 calculates a combination set F by using each row of the matrix input in S101 as an input (S102). Then, the ZDD constructing unit 120 constructs a ZDD corresponding to the combination set F calculated in S102 (S103).

具体的には、ZDD構築部120は、データ入力部110からM行N列の2値行列を取得し、行列の各行について、1つの要素のみからなる集合を作成する(式(1)参照)。続いて、ZDD構築部120は、行列の各行について、1つの要素のみからなる集合を作成した後、それらの和集合を作成し、組み合わせ集合Fを作成する(式(2)参照)。そして、ZDD構築部120は、組み合わせ集合F(式(2))に出現するシンボルR,R,…,R,C,C,…,Cに対して、R<R<・・・<R<C<C<・・・<Cという順序を与え、既存の技術を利用した演算を行うことにより、組み合わせ集合Fに対応するZDDを構築する。 Specifically, the ZDD constructing unit 120 acquires a binary matrix of M rows and N columns from the data input unit 110, and creates a set consisting of only one element for each row of the matrix (see Expression (1)). . Subsequently, the ZDD constructing unit 120 creates a set composed of only one element for each row of the matrix, creates a union of those sets, and creates a combination set F (see Expression (2)). Then, ZDD construction unit 120, the symbol R 1, R 2 appearing in the combined set F (equation (2)), ..., R M, C 1, C 2, ..., with respect to C N, R 1 <R 2 <... <given order of R M <C 1 <C 2 <··· <C N, by performing a calculation utilizing the existing technology, building a ZDD corresponding to the combination set F.

(行列と実数ベクトルとの積の計算処理)
図10に示すように、ベクトル入力部140は、N次元の実数ベクトルを入力する(S201)。続いて、行列演算実行部150は、ZDD構築部120により2値行列から構築されたZDDと、ベクトル入力部140により入力されたN次元の実数ベクトルとを用いて、行列演算を実行する(S202)。
(Calculation processing of product of matrix and real vector)
As shown in FIG. 10, the vector input unit 140 inputs an N-dimensional real vector (S201). Subsequently, the matrix calculation execution unit 150 executes matrix calculation using the ZDD constructed from the binary matrix by the ZDD construction unit 120 and the N-dimensional real vector input by the vector input unit 140 (S202). ).

(行列演算処理)
行列演算実行部150は、図11に示す処理を実行する前に、ベクトル入力部140からN次元ベクトルqを取得し、データ記憶部130からZDDを取得して、スコアを格納する要素数(W−M)の1次元配列scoreを用意し、すべての要素を0で初期化しておく。以上の準備が完了した後、行列演算実行部150は、インデックス(i)をi=3に初期化する(S301)。
(Matrix operation processing)
The matrix calculation execution unit 150 acquires the N-dimensional vector q from the vector input unit 140, acquires the ZDD from the data storage unit 130, and stores the score (W) before executing the processing shown in FIG. -M) 1-dimensional array score is prepared, and all elements are initialized with 0. After the above preparation is completed, the matrix calculation execution unit 150 initializes the index (i) to i = 3 (S301).

続いて、行列演算実行部150は、v(i)が、C1〜のいずれかに一致するか否か(v(i)=C(1≦j≦N)?)を判定する(S302)。判定の結果、v(i)が、C1〜のいずれかに一致する場合には(S302、Yes)、行列演算実行部150は、score[i]の値を、score(HI(i))+qに更新する(S303)。 Subsequently, the matrix operation execution unit 150 determines whether v (i) matches any of C 1 to C N (v (i) = C j (1 ≦ j ≦ N)?). (S302). As a result of the determination, when v (i) matches any of C 1 to C N (S302, Yes), the matrix operation execution unit 150 sets the value of score [i] to score (HI (i )) is updated to + q j (S303).

続いて、行列演算実行部150は、i≦Wであるか否かを判定する(S304)。判定の結果、i≦Wである場合には(S304、Yes)、行列演算実行部150は、ZDDの全てのノードについてscoreの計算を完了しているものとして、演算結果pを計算結果出力部150に送出して(S305)、行列演算処理を終了する。一方、判定の結果、i≦Wではない場合には(S304、No)、行列演算実行部150は、ZDDの全てのノードについてscoreの計算を完了していないものとして、iの値を1インクリメント(i←i+1)して(ステップS306)、上述のS302に戻る。   Subsequently, the matrix calculation execution unit 150 determines whether i ≦ W is satisfied (S304). If i ≦ W as a result of the determination (S304, Yes), the matrix calculation execution unit 150 assumes that the calculation of the score has been completed for all the nodes of the ZDD, and outputs the calculation result p to the calculation result output unit. 150 (S305), and the matrix calculation process is terminated. On the other hand, if i ≦ W is not satisfied as a result of the determination (S304, No), the matrix calculation execution unit 150 assumes that score calculation has not been completed for all the nodes of the ZDD, and increments the value of i by 1. (I ← i + 1) (step S306), the process returns to S302 described above.

上述したステップS302において、判定の結果、v(i)が、C1〜のいずれにも一致しない場合には(S302、No)、行列演算実行部150は、p←score(HI(i))として(S307)、上述のS305に移行する。 In step S302 described above, the result of the determination, v (i) is, in a case that does not match any of the C 1~ C N (S302, No ), the matrix operation executing unit 150, p k ← score (HI ( i)) (S307), the process proceeds to S305 described above.

[実施例1による効果]
上述してきたように、実施例1に係る演算装置100は、M行N列(M、Nは正の整数)の2値行列を、ZDDを用いたデータ構造に変換する(図5、6等)。そして、実施例1に係る演算装置は、ZDDと実数ベクトルとの積の演算を、ZDD上で再帰的なアルゴリズムとして実行する(図11等)。すなわち、実施例1に係る演算装置は、2値行列をZDDを用いたデータ構造に変換することにより2値行列のデータを圧縮して表現することができる。そして、実施例1に係る演算装置は、2値行列が有する非零の要素数「K」に応じた演算を実行するのではなく、2値行列をZDDを用いたデータ構造に変換したときのZDDのノード数「W」に応じた演算を実行できるようになる。このようなことから、実施例1に係る演算装置は、2値行列と実数ベクトルとの積の演算に必要となる計算時間を減らすことができ、行列演算を効率的に実行できる。
[Effects of Example 1]
As described above, the arithmetic device 100 according to the first embodiment converts a binary matrix of M rows and N columns (M and N are positive integers) into a data structure using ZDD (FIGS. 5 and 6, etc.). ). Then, the arithmetic device according to the first embodiment executes the operation of the product of the ZDD and the real vector as a recursive algorithm on the ZDD (FIG. 11 and the like). That is, the arithmetic device according to the first embodiment can compress and represent binary matrix data by converting the binary matrix into a data structure using ZDD. And the arithmetic unit which concerns on Example 1 does not perform the calculation according to the non-zero element number "K" which a binary matrix has, but when converting a binary matrix into the data structure using ZDD An operation corresponding to the number of nodes “W” of ZDD can be executed. For this reason, the arithmetic device according to the first embodiment can reduce the calculation time required for calculating the product of the binary matrix and the real vector, and can efficiently execute the matrix operation.

また、疎な2値行列のデータを圧縮するので、演算に必要となる記憶容量を削減することもできる。   In addition, since the data of a sparse binary matrix is compressed, the storage capacity required for computation can be reduced.

また、上述の実施例1では、図9に示すZDD構築処理と、図10および図11に示す行列と実数ベクトルとの積の計算処理とを2分して説明したが、図9に示すZDD構築処理と、図10および図11に示す行列と実数ベクトルとの積の計算処理とをシリアルに実行してもよい。   In the above-described first embodiment, the ZDD construction process illustrated in FIG. 9 and the calculation process of the product of the matrix and the real vector illustrated in FIGS. 10 and 11 are divided into two. However, the ZDD illustrated in FIG. The construction process and the calculation process of the product of the matrix and the real vector shown in FIGS. 10 and 11 may be executed serially.

なお、上述してきた実施例1に係る演算装置は、各種数値計算や物理的なシミュレーション、各種情報管理などに幅広く適用することができる。特に、ある特定の2値行列が繰り返し利用される状況においては、一旦ZDDによって2値行列を構築すれば、計算量削減の効果が見込まれる。   The arithmetic device according to the first embodiment described above can be widely applied to various numerical calculations, physical simulations, various information management, and the like. In particular, in a situation where a specific binary matrix is repeatedly used, once the binary matrix is constructed by ZDD, the effect of reducing the amount of calculation is expected.

以下、本発明にかかる演算装置、演算方法および演算プログラムの他の実施形態として実施例2を説明する。   Hereinafter, Example 2 will be described as another embodiment of the arithmetic device, the arithmetic method, and the arithmetic program according to the present invention.

(1)装置構成等
図1に示した演算装置100の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、演算装置100の分散または統合の具体的形態は図1に示すものに限られず、演算装置100のZDD構築部120、データ記憶部130および行列演算実行部150を機能的に統合されていてもよい。このように、演算装置100の各構成要素の全部または一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的または物理的に分散・統合して構成することができる。
(1) Device Configuration, etc. Each component of the arithmetic device 100 shown in FIG. 1 is functionally conceptual and does not necessarily need to be physically configured as illustrated. That is, the specific form of distribution or integration of the arithmetic device 100 is not limited to that shown in FIG. 1, and the ZDD constructing unit 120, the data storage unit 130, and the matrix arithmetic executing unit 150 of the arithmetic device 100 are functionally integrated. Also good. As described above, all or some of the components of the arithmetic device 100 can be configured to be functionally or physically distributed / integrated in arbitrary units according to various loads or usage conditions.

(2)演算プログラム
また、実施例1で説明した演算装置100の各種の処理(例えば、図9〜11等参照)は、あらかじめ用意されたプログラムをパーソナルコンピュータやワークステーションなどの電子機器で実行することによって実現することができる。そこで、以下では、図12を用いて、実施例1で説明した演算装置100と同様の機能を有する演算プログラムを実行する電子機器の一例を説明する。図12は、演算プログラムを実行する電子機器の一例を示す図である。
(2) Arithmetic Program The various types of processing of the arithmetic unit 100 described in the first embodiment (for example, see FIGS. 9 to 11 and the like) execute a program prepared in advance on an electronic device such as a personal computer or a workstation. Can be realized. Therefore, in the following, an example of an electronic device that executes an arithmetic program having the same function as the arithmetic device 100 described in the first embodiment will be described with reference to FIG. FIG. 12 is a diagram illustrating an example of an electronic device that executes an arithmetic program.

図12に示すように、演算装置100が有する機能と同様の機能を有する電子機器200は、CPU(Central Processing Unit)210、入力部220、出力部230、メモリ240およびハードディスク装置250を有する。そして、CPU210、入力部220、出力部230、メモリ240およびハードディスク装置250は、バス260を介して接続される。   As shown in FIG. 12, the electronic device 200 having the same function as that of the arithmetic device 100 includes a CPU (Central Processing Unit) 210, an input unit 220, an output unit 230, a memory 240, and a hard disk device 250. The CPU 210, the input unit 220, the output unit 230, the memory 240, and the hard disk device 250 are connected via the bus 260.

CPU210は、各種演算処理を実行する。なお、電子機器200は、CPU210の代わりに、例えば、MPU(Micro Processing Unit)などの電子回路、ASIC(Application Specific Integrated Circuit)やFPGA(Field Programmable Gate Array)などの集積回路を用いることもできる。   The CPU 210 executes various arithmetic processes. Note that the electronic device 200 may use, for example, an electronic circuit such as an MPU (Micro Processing Unit) or an integrated circuit such as an ASIC (Application Specific Integrated Circuit) or an FPGA (Field Programmable Gate Array) instead of the CPU 210.

入力部220は2値行列などの各種情報を入力する。また、出力部230は行列演算の結果などを出力する。また、メモリ240は、2値行列を変換したZDDなどの各種情報を一時的に記憶する。なお、メモリ240は、例えば、RAM(Random Access Memory)やフラッシュメモリ(flash memory)などの半導体メモリ素子を用いて実装できる。また、ハードディスク装置250は、CPU210による各種処理の実行に必要な情報を記憶する。   The input unit 220 inputs various information such as a binary matrix. Further, the output unit 230 outputs the result of the matrix operation. The memory 240 temporarily stores various information such as ZDD obtained by converting a binary matrix. The memory 240 can be mounted using a semiconductor memory element such as a RAM (Random Access Memory) or a flash memory. The hard disk device 250 stores information necessary for the CPU 210 to execute various processes.

ハードディスク装置250には、演算装置100が有する機能と同様の機能を発揮する演算プログラム251および演算用データ252が記憶されている。なお、この演算プログラム251を適宜分散させて、ネットワークを介して通信可能に接続された他のコンピュータの記憶部に記憶させておくこともできる。   The hard disk device 250 stores a calculation program 251 and calculation data 252 that exhibit functions similar to the functions of the calculation device 100. Note that the arithmetic program 251 may be appropriately distributed and stored in a storage unit of another computer that is communicably connected via a network.

そして、CPU210が、演算プログラム251をハードディスク装置250から読み出してメモリ240に展開することにより、図12に示すように、演算プログラム251は演算プロセス241として機能する。演算プロセス241は、ハードディスク装置250から読み出した演算用データ252等の各種データを適宜メモリ240上の自身に割当てられた領域に展開し、この展開した各種データに基づいて各種処理を実行する。   Then, the CPU 210 reads out the arithmetic program 251 from the hard disk device 250 and expands it in the memory 240, whereby the arithmetic program 251 functions as an arithmetic process 241 as shown in FIG. The calculation process 241 expands various data such as the calculation data 252 read from the hard disk device 250 in an area allocated to itself on the memory 240 as appropriate, and executes various processes based on the expanded data.

なお、演算プロセス241は、例えば、上述した演算装置100のZDD構築部120や行列演算実行部150などにより実行される処理、例えば、上述の図9〜11などを用いて説明した処理を含む。   Note that the arithmetic process 241 includes, for example, the processing executed by the ZDD constructing unit 120 and the matrix arithmetic execution unit 150 of the arithmetic device 100 described above, for example, the processing described with reference to FIGS.

なお、上述した演算プログラム251については、必ずしも最初からハードディスク装置250に記憶させておく必要はない。例えば、電子機器200が、フレキシブルディスク、CD−ROM、DVD、光磁気ディスク、ICカードなどの「可搬用の物理媒体」に予め記憶された演算プログラム251を読み出して実行するようにしてもよい。   Note that the above-described arithmetic program 251 is not necessarily stored in the hard disk device 250 from the beginning. For example, the electronic device 200 may read and execute the arithmetic program 251 stored in advance on a “portable physical medium” such as a flexible disk, a CD-ROM, a DVD, a magneto-optical disk, and an IC card.

さらには、電子機器200が、公衆回線、インターネット、LAN、WANなどを介して接続可能な「他のコンピュータ(またはサーバ)」などに格納された演算プログラム251を読み出して実行するようにしてもよい。   Furthermore, the electronic device 200 may read and execute the arithmetic program 251 stored in “another computer (or server)” that can be connected via a public line, the Internet, a LAN, a WAN, or the like. .

(3)演算方法
実施例1で説明した演算装置100により、以下のような演算方法が実現される。
(3) Calculation Method The following calculation method is realized by the calculation device 100 described in the first embodiment.

すなわち、2値行列とN次元の実数ベクトルとの行列演算を演算装置100としてのコンピュータが実行する演算方法であって、コンピュータは、M行N列(M、Nは整数)の2値行列のデータを入力するデータ入力工程と(図9、S101)、N次元(Nは整数)の実数ベクトルを入力するベクトル入力工程と(図10、S201)、データ入力工程により入力された2値行列のデータを、二分決定グラフのデータ構造に変換した変換データを構築する構築工程と(図9、S103)、構築工程により構築された変換データと、ベクトル入力部により入力された実数ベクトルとの行列演算を実行する演算工程と(図10、S202、図11)、演算工程による演算結果を出力する出力工程とを実行することを特徴とする演算方法が実現される。   That is, an arithmetic method in which a computer as the arithmetic device 100 executes a matrix operation between a binary matrix and an N-dimensional real vector, and the computer is an M-row N-column (M, N is an integer) binary matrix. A data input process for inputting data (FIG. 9, S101), a vector input process for inputting N-dimensional (N is an integer) real vector (FIG. 10, S201), and a binary matrix input by the data input process A construction step of constructing transformation data obtained by converting data into a data structure of a binary decision graph (FIG. 9, S103), a matrix operation of the transformation data constructed by the construction step and a real vector input by the vector input unit And a calculation method characterized in that the calculation method is executed (FIG. 10, S202, FIG. 11) and an output step for outputting a calculation result of the calculation step. .

100 演算装置
110 データ入力部
120 ZDD構築部
130 データ記憶部
140 ベクトル入力部
150 行列演算実行部
160 計算結果出力部
200 電子機器
210 CPU
220 入力部
230 出力部
240 メモリ
250 ハードディスク装置
260 バス
DESCRIPTION OF SYMBOLS 100 Arithmetic apparatus 110 Data input part 120 ZDD construction part 130 Data storage part 140 Vector input part 150 Matrix operation execution part 160 Calculation result output part 200 Electronic device 210 CPU
220 Input unit 230 Output unit 240 Memory 250 Hard disk device 260 Bus

Claims (3)

2値行列とN次元の実数ベクトルとの行列演算を行う演算装置であって、
M行N列(M、Nは整数)の前記2値行列のデータを入力するデータ入力部と、
N次元の前記実数ベクトルを入力するベクトル入力部と、
前記データ入力部により入力された前記2値行列のデータを、二分決定グラフのデータ構造に変換した変換データを構築する構築部と、
前記構築部により構築された前記変換データと、前記ベクトル入力部により入力された前記実数ベクトルとの行列演算を実行する演算部と、
前記演算部による演算結果を出力する出力部と
を有することを特徴とする演算装置。
An arithmetic device that performs a matrix operation between a binary matrix and an N-dimensional real vector,
A data input unit for inputting data of the binary matrix of M rows and N columns (M and N are integers);
A vector input unit for inputting the N-dimensional real vector;
A construction part for constructing conversion data obtained by converting the data of the binary matrix input by the data input part into a data structure of a binary decision graph;
An arithmetic unit that performs a matrix operation on the conversion data constructed by the construction unit and the real vector input by the vector input unit;
And an output unit that outputs a calculation result of the calculation unit.
2値行列とN次元の実数ベクトルとの行列演算を行うコンピュータにより実行される演算方法であって、
データ入力部が、M行N列(M、Nは整数)の前記2値行列のデータを入力するデータ入力工程と、
ベクトル入力部が、N次元の前記実数ベクトルを入力するベクトル入力工程と、
構築部が、前記データ入力工程により入力された前記2値行列のデータを、二分決定グラフのデータ構造に変換した変換データを構築する構築工程と、
演算部が、前記構築工程により構築された前記変換データと、前記ベクトル入力工程により入力された前記実数ベクトルとの行列演算を実行する演算工程と、
出力部が、前記演算工程による演算結果を出力する出力工程と
を含むことを特徴とする演算方法。
An arithmetic method executed by a computer that performs a matrix operation between a binary matrix and an N-dimensional real vector,
Data input unit, M rows and N columns (M, N are integers) and a data input step of inputting data of said binary matrix,
A vector input unit that inputs the N-dimensional real vector; and
Construction unit, the construction process of the data of the data inputted by the input step the binary matrix, to construct a conversion data converted into the data structure of BDD,
An operation step of performing a matrix operation between the conversion data constructed in the construction step and the real vector input in the vector input step ;
An output method includes: an output step of outputting a calculation result of the calculation step.
2値行列とN次元の実数ベクトルとの行列演算を行うコンピュータに実行させるための演算プログラムであって、
前記コンピュータ
M行N列(M、Nは整数)の前記2値行列のデータを入力するデータ入力手段と、
N次元の前記実数ベクトルを入力するベクトル入力手段と、
前記データ入力手段により入力された前記2値行列のデータを、二分決定グラフのデータ構造に変換した変換データを構築する構築手段と、
前記構築手段により構築された前記変換データと、前記ベクトル入力手段により入力された前記実数ベクトルとの行列演算を実行する演算手段と、
前記演算手段による演算結果を出力する出力手段
として機能させるための演算プログラム。
An arithmetic program for causing a computer to perform a matrix operation between a binary matrix and an N-dimensional real vector,
The computer,
Data input means for inputting data of the binary matrix of M rows and N columns (M and N are integers);
Vector input means for inputting the N-dimensional real vector;
Construction means for constructing conversion data obtained by converting the data of the binary matrix input by the data input means into a data structure of a binary decision graph;
Arithmetic means for performing a matrix operation between the conversion data constructed by the construction means and the real vector input by the vector input means ;
And output means for outputting a calculation result by the calculating means
Arithmetic program to function as
JP2011111812A 2011-05-18 2011-05-18 Arithmetic apparatus, arithmetic method and arithmetic program Expired - Fee Related JP5634941B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011111812A JP5634941B2 (en) 2011-05-18 2011-05-18 Arithmetic apparatus, arithmetic method and arithmetic program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011111812A JP5634941B2 (en) 2011-05-18 2011-05-18 Arithmetic apparatus, arithmetic method and arithmetic program

Publications (2)

Publication Number Publication Date
JP2012243040A JP2012243040A (en) 2012-12-10
JP5634941B2 true JP5634941B2 (en) 2014-12-03

Family

ID=47464698

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011111812A Expired - Fee Related JP5634941B2 (en) 2011-05-18 2011-05-18 Arithmetic apparatus, arithmetic method and arithmetic program

Country Status (1)

Country Link
JP (1) JP5634941B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7109106B2 (en) 2018-03-08 2022-07-29 有限会社神奈川技研 Construction of signposts, signposts and post structures

Families Citing this family (3)

* Cited by examiner, † Cited by third party
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
JP5860829B2 (en) * 2013-03-19 2016-02-16 日本電信電話株式会社 Product operation apparatus, method, and program
JP6709740B2 (en) * 2017-01-06 2020-06-17 日本電信電話株式会社 Strictly spread calculation device, method, and program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7109106B2 (en) 2018-03-08 2022-07-29 有限会社神奈川技研 Construction of signposts, signposts and post structures

Also Published As

Publication number Publication date
JP2012243040A (en) 2012-12-10

Similar Documents

Publication Publication Date Title
Tien et al. Algorithms for Bayesian network modeling and reliability assessment of infrastructure systems
Mo et al. Efficient analysis of multi-state k-out-of-n systems
US11182157B2 (en) Information processing device, arithmetic device, and information processing method
JP5634941B2 (en) Arithmetic apparatus, arithmetic method and arithmetic program
US20090235216A1 (en) Combinational Equivalence Checking for Threshold Logic Circuits
JP7007520B6 (en) Information processing device, arithmetic device, and information processing method
US11748645B2 (en) Optimization apparatus and control method thereof
CN112114776B (en) Quantum multiplication method, device, electronic device and storage medium
Xu et al. A novel polynomial-chaos-based Kalman filter
Gu et al. Model reduction via projection onto nonlinear manifolds, with applications to analog circuits and biochemical systems
US20190042543A1 (en) Matrix decomposition device and matrix decomposition method
Drake PyEDA: Data Structures and Algorithms for Electronic Design Automation.
Braccesi et al. Fast evaluation of stress state spectral moments
US11656787B2 (en) Calculation system, information processing device, and optimum solution search process method
WO2020196862A1 (en) Information processing device, information processing system, information processing method, storage medium, and program
González-Parra et al. Polynomial chaos for random fractional order differential equations
Tetteh et al. Evolution of complex combinational logic circuits using grammatical evolution with systemverilog
Kumar et al. Generalized forms of fractional Euler and Runge–Kutta methods using non-uniform grid
US20230289401A1 (en) Solution accuracy guaranteeing annealing calculation device, method, and program
Hindman et al. The First Nontrivial Hales-Jewett Number is Four.
WO2023169345A1 (en) Method and apparatus for processing data simulation task, electronic device, and storage medium
JP4233513B2 (en) Analysis device, analysis program, and computer-readable recording medium recording analysis program
US10333697B2 (en) Nondecreasing sequence determining device, method and program
CN114528996B (en) Method, device and medium for determining initial parameters of target system test state
Wang et al. Exact eigenfunctions of N-body system with quadratic pair potential

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130722

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140606

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140617

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140717

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: 20141014

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20141015

R150 Certificate of patent or registration of utility model

Ref document number: 5634941

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees