JP5862418B2 - Common element extraction device, common element extraction method, and common element extraction program - Google Patents
Common element extraction device, common element extraction method, and common element extraction program Download PDFInfo
- Publication number
- JP5862418B2 JP5862418B2 JP2012077498A JP2012077498A JP5862418B2 JP 5862418 B2 JP5862418 B2 JP 5862418B2 JP 2012077498 A JP2012077498 A JP 2012077498A JP 2012077498 A JP2012077498 A JP 2012077498A JP 5862418 B2 JP5862418 B2 JP 5862418B2
- Authority
- JP
- Japan
- Prior art keywords
- comparison
- data source
- unit
- same
- operator
- 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
Description
開示の技術は共通要素抽出装置、共通要素抽出方法、及び共通要素抽出プログラムに関する。 The disclosed technology relates to a common element extraction apparatus, a common element extraction method, and a common element extraction program.
複数のイベントストリームからタイムスタンプ等が同じイベントを抽出するデータ分析として、例えばPOS(Point Of Sale)のバスケット分析、プローブデータの軌跡分析、感染症の分析、SNS(Social Networking Service)分析等がある。 Examples of data analysis for extracting events with the same time stamp from a plurality of event streams include POS (Point Of Sale) basket analysis, probe data trajectory analysis, infectious disease analysis, SNS (Social Networking Service) analysis, and the like. .
このようなデータ分析を行うには、分析対象である複数のデータ源を昇順又は降順に整列し、整列済みの複数のデータ源から同じ値のデータを抽出する。例えば2つのデータ源から同じ値のデータを抽出する場合、データ源の先頭から順に、2つのデータの大小比較を行い、同じ値のデータを出力する。 In order to perform such data analysis, a plurality of data sources to be analyzed are arranged in ascending or descending order, and data having the same value is extracted from the arranged data sources. For example, when data with the same value is extracted from two data sources, the two data are compared in size from the beginning of the data source, and the data with the same value is output.
具体的には、図38に示すような共通要素抽出処理によって2つのデータ源から同じデータを抽出することができる。同図は、データ源X={X[0]、X[1]、・・・、X[n]}とデータ源Y={Y[0]、Y[1]、・・・、Y[m]}を先頭から順次入力して大小比較を行い、同じ値のデータを出力する処理である。なお、n,mは自然数である。 Specifically, the same data can be extracted from the two data sources by the common element extraction process as shown in FIG. The figure shows a data source X = {X [0], X [1],..., X [n]} and a data source Y = {Y [0], Y [1],. m]} is sequentially input from the top, the size comparison is performed, and data of the same value is output. Note that n and m are natural numbers.
まず、ステップ200では、データ源X用のカウンタi、データ源Y用のカウンタjを‘0’に初期化する。
First, in
ステップ202では、カウンタiがnより小さく且つカウンタjがmより小さいか否かを判定する。そして、カウンタiがnより小さく且つカウンタjがmより小さい場合にはステップ204へ移行し、そうでない場合には本ルーチンを終了する。
In
ステップ204では、X[i]がY[j]より小さいか否かを判定し、X[i]がY[j]より小さい場合はステップ212へ移行してカウンタiをインクリメントする。一方、X[i]がY[j]より小さくない場合には、ステップ206へ移行する。
In
ステップ206では、X[i]がY[j]がより大きいか否かを判定し、X[i]がY[j]より大きい場合にはステップ214へ移行してカウンタjをインクリメントする。一方、X[i]がY[j]より大きくない場合、すなわちX[i]とY[j]が同一の場合には、ステップ208へ移行してデータX[i]を出力する。そして、ステップ210へ移行してカウンタiをインクリメントし、続いてステップ214へ移行してカウンタjをインクリメントする。
In
例えば図39に示すような整列済みのデータ源X、Yについて図38に示す処理を実行すると、データ源Xの要素とデータ源Yの要素とが同じ値となる{1、9、14、19}が出力される。 For example, when the processing shown in FIG. 38 is executed for the aligned data sources X and Y as shown in FIG. 39, the elements of the data source X and the data source Y have the same value {1, 9, 14, 19 } Is output.
このように、図38に示す処理は、データ源Xの要素とデータ源Yの要素との大小関係によって3通りの処理を実行する処理と言える。すなわち、データ源Xの要素がデータ源Yの要素より小さいか否かの比較判定処理を行い、データ源Xの要素がデータ源Yの要素よりも小さい場合には、データ源Xの次の要素を読み込む。また、データ源Xの要素がデータ源Yの要素よりも小さくない場合、データ源Xの要素がデータ源Yの要素より大きいか否かの比較判定処理を行い、データ源Xの要素がデータ源Yの要素よりも大きい場合には、データ源Yの次の要素を読み込む。一方、データ源Xの要素がデータ源Yの要素よりも大きくない場合、すなわちデータ源Xの要素とデータ源Yの要素とが同じである場合には、処理cを実行してデータ源Xの要素(=データ源Yの要素)を出力する。そして、データ源Xの次の要素及びデータ源Yの次の要素を読み込む。 Thus, the process shown in FIG. 38 can be said to be a process of executing three types of processes depending on the magnitude relationship between the elements of the data source X and the data source Y. That is, a comparison determination process is performed to determine whether or not the element of the data source X is smaller than the element of the data source Y, and if the element of the data source X is smaller than the element of the data source Y, the next element of the data source X Is read. If the element of the data source X is not smaller than the element of the data source Y, a comparison determination process is performed to determine whether or not the element of the data source X is larger than the element of the data source Y. If it is larger than the element Y, the next element of the data source Y is read. On the other hand, if the element of the data source X is not larger than the element of the data source Y, that is, if the element of the data source X and the element of the data source Y are the same, the process c is executed to The element (= element of data source Y) is output. Then, the next element of the data source X and the next element of the data source Y are read.
従って、データ源Xの要素がデータ源Yの要素よりも小さくない場合が連続する場合、ステップ204、206の2回の比較判定処理が繰り返されることとなり、処理時間が増加してしまう。例えば図40に示すように、データ源Xの要素がデータ源Yの要素よりも小さい範囲S1では、図38に示すステップ204の1回の比較判定処理だけでよい。一方、データ源Xの要素がデータ源Yの要素よりも小さくない範囲S2では、図38に示すステップ204、206の2回の比較判定処理が必要となる。
Therefore, when the case where the element of the data source X is not smaller than the element of the data source Y continues, the two comparison determination processes of
このように、従来の図38に示す処理では、データ源Xの要素がデータ源Yの要素よりも小さくない範囲が多くなるほど処理時間が増加する。このため、例えばデータの出現時刻に偏りがあるセンサーが出力したデータの出現時刻を要素とする整列済みの複数のデータ源の共通要素を出力したい場合、無駄な比較処理が多くなり処理時間が増大する、という問題があった。 Thus, in the conventional process shown in FIG. 38, the processing time increases as the range in which the element of the data source X is not smaller than the element of the data source Y increases. For this reason, for example, if it is desired to output common elements of a plurality of arranged data sources whose elements are the appearance times of data output by sensors with biased appearance times of data, the number of useless comparison processes increases and the processing time increases. There was a problem of doing.
開示の技術は、整列済みのデータ源から共通要素を抽出する際に処理時間が増大するのを抑制することが目的である。 It is an object of the disclosed technique to suppress an increase in processing time when a common element is extracted from an aligned data source.
開示の技術は、第1の比較部は、整列済みの複数の要素を含む第1のデータ源から読み出した第1の要素と、整列済みの複数の要素を含む第2のデータ源から読み出した第2の要素と、を第1の比較演算子及びこれと異なる第2の比較演算子により順次比較判定する。第2の比較部は、前記第1の要素と前記第2の要素とを前記第1の比較演算子及び前記第2の比較演算子により順次比較判定すると共に、前記第1の比較演算子及び前記第2の比較演算子による比較順序が前記第1の比較部と異なる。選択部は、第1の比較部及び第2の比較部の何れかにより第1の要素と第2の要素とが同一でないと判定された場合に、直前に実行した比較判定と同一の比較判定を先に行う比較部を第1の比較部及び第2の比較部から選択する。出力部は、前記第1の比較部及び前記第2の比較部の何れかにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、当該同一と判定された同一要素を出力する。読み出し部は、前記出力部が前記同一要素を出力した場合は、前記第1のデータ源及び前記第2のデータ源から次の要素を各々読み出す。また、出力部は、前記選択部により前記第1の比較部及び前記第2の比較部のうち一方の比較部が選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち一方のデータ源から次の要素を読み出す。また、出力部は、前記選択部により前記第1の比較部及び前記第2の比較部のうち他方の比較部が選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち他方のデータ源から次の要素を読み出す。 In the disclosed technique, the first comparison unit reads from a first data source including a plurality of aligned elements and a second data source including a plurality of aligned elements. The second element is sequentially compared and determined by the first comparison operator and a different second comparison operator. The second comparison unit sequentially compares and determines the first element and the second element by the first comparison operator and the second comparison operator, and the first comparison operator and The comparison order by the second comparison operator is different from that of the first comparison unit. Selection unit, when the first element by one of the first comparing portion and the second comparing portion and the second element is not determined to be identical, the comparison determination same comparison as just performed The comparison unit that performs the determination first is selected from the first comparison unit and the second comparison unit. The output unit is determined to be the same when it is determined by any one of the first comparison unit and the second comparison unit that the first element and the second element are the same. Output the same element. When the output unit outputs the same element, the reading unit reads the next element from the first data source and the second data source, respectively. In addition, when one of the first comparison unit and the second comparison unit is selected by the selection unit, the output unit selects the first data source and the second data source. Read the next element from one of the data sources. In addition, when the other comparison unit is selected from the first comparison unit and the second comparison unit by the selection unit, the output unit includes the first data source and the second data source. The next element is read from the other data source.
開示の技術は、整列済みのデータ源から共通要素を抽出する際に処理時間が増大するのを抑制することができる、という効果を有する。 The disclosed technique has an effect that processing time can be prevented from increasing when a common element is extracted from an aligned data source.
以下、図面を参照して開示の技術の実施形態の一例を詳細に説明する。 Hereinafter, an example of an embodiment of the disclosed technology will be described in detail with reference to the drawings.
(第1実施形態) (First embodiment)
図1には、本第1実施形態に係る共通要素抽出装置10が示されている。共通要素抽出装置10は、整列済みの2つのデータ源の各要素を順次比較して同一の要素を抽出する装置である。
FIG. 1 shows a common
図1に示すように、共通要素抽出装置10は、第1の比較部12、第2の比較部14、選択部16、出力部18、及び読み出し部20を備えている。
As shown in FIG. 1, the common
第1の比較部12は、整列済みの複数の要素を含む第1のデータ源Xから読み出した第1の要素X[i]と、整列済みの複数の要素を含む第2のデータ源Yから読み出した第2の要素Y[j]と、を第1の比較演算子及び第2の比較演算子により順次比較判定する。なお、i=0〜nでnは自然数、j=0〜mでmは自然数である。また、本実施形態では、第1の比較演算子及び第2の比較演算子は、大小比較を行う比較演算子であり、一例として“<”、“>”が用いられる。
The
第2の比較部14は、第1の要素X[i]と第2の要素Y[j]とを第1の比較演算子及び第2の比較演算子により順次比較判定する。また、第2の比較部14は、第1の比較演算子及び第2の比較演算子による比較順序が第1の比較部12と異なる。すなわち、第1の比較部12が、第1の比較演算子、第2の比較演算子の順に第1の要素X[i]と第2の要素Y[j]とを比較判定する場合、第2の比較部14は、第2の比較演算子、第1の比較演算子の順に第1の要素X[i]と第2の要素とを比較判定する。
The
選択部16は、第1の要素X[i]と第2の要素Y[j]とが同一であると判定されなかった場合に、直前に実行された比較判定と同一の比較判定を先に行う比較部を第1の比較部12及び第2の比較部14から選択する。
When it is not determined that the first element X [i] and the second element Y [j] are the same, the
出力部18は、第1の比較部12及び第2の比較部14の何れかにより第1の要素X[i]と第2の要素Y[j]とが同一であると判定された場合に、当該同一と判定された同一要素を出力する。
The
読み出し部20は、第1の読み出し部20X及び第2の読み出し部20Yを備えている。第1の読み出し部20Xは、出力部18が同一要素を出力した場合は第1のデータ源Xから次の要素を読み出すと共に、選択部16により第1の比較部12が選択された場合は、第1のデータ源Xから次の要素を読み出す。第2の読み出し部20Yは、出力部18が同一要素を出力した場合は第2のデータ源Yから次の要素を読み出すと共に、選択部16により第2の比較部14が選択された場合は、第2のデータ源Yから次の要素を読み出す。
The
共通要素抽出装置10は、例えば図2に示すコンピュータ60で実現することができる。コンピュータ60はCPU62、メモリ64、不揮発性の記憶部66を備え、これらはバス67を介して互いに接続されている。
The common
また、記憶部66はHDD(Hard Disk Drive)やフラッシュメモリ等によって実現できる。記録媒体としての記憶部66には、コンピュータ60を共通要素抽出装置10として機能させるための共通要素抽出プログラム68が記憶されている。CPU62は、共通要素抽出プログラム68を記憶部66から読み出してメモリ64に展開し、共通要素抽出プログラム68が有するプロセスを順次実行する。
The
共通要素抽出プログラム68は、第1の比較プロセス70、第2の比較プロセス72、選択プロセス74、出力プロセス76、第1の読み出しプロセス78、及び第2の読み出しプロセス80を有する。
The common
CPU62は、第1の比較プロセス70を実行することで、図1に示す第1の比較部12として動作する。また、CPU62は、第2の比較プロセス72を実行することで、図1に示す第2の比較部14として動作する。また、CPU62は、選択プロセス74を実行することで、図1に示す選択部16として動作する。またCPU62は、出力プロセス76を実行することで、図1に示す出力部18として動作する。またCPU62は、第1の読み出しプロセス78を実行することで、図1に示す第1の読み出し部20Xとして動作する。またCPU62は、第2の読み出しプロセス80を実行することで、図1に示す第2の読み出し部20Yとして動作する。
The
これにより、共通要素抽出プログラム68を実行したコンピュータ60が、共通要素抽出装置10として機能することになる。なお、共通要素抽出プログラム68は開示の技術における共通要素抽出プログラムの一例である。
As a result, the
なお、共通要素抽出装置10は、例えば半導体集積回路、より詳しくはASIC(Application Specific Integrated Circuit)等で実現することも可能である。
Note that the common
次に第1実施形態の作用を説明する。共通要素抽出装置10に対して共通要素抽出処理の実行が指示されると、図3に示す共通要素抽出処理が実行される。なお、本実施形態では、一例として第1の比較演算子を“<”、第2の比較演算子を“>”とする。
Next, the operation of the first embodiment will be described. When the common
図3に示す共通要素抽出処理は、データ源X={X[0]、X[1]、・・・、X[n]}とデータ源Y={Y[0]、Y[1]、・・・、Y[m]}を先頭から順次入力して大小比較を行い、共通要素、すなわち同一の要素を出力する処理である。 The common element extraction process shown in FIG. 3 includes data sources X = {X [0], X [1],..., X [n]} and data sources Y = {Y [0], Y [1], ..., Y [m]} are sequentially input from the top to compare the magnitudes, and output a common element, that is, the same element.
まず、ステップ100では、第1の読み出し部20Xが、データ源X用のカウンタiを‘0’に初期化すると共に、第2の読み出し部20Yが、データ源Y用のカウンタjを‘0’に初期化する。
First, in
ステップ102では、第1の読み出し部20Xが、カウンタiがnより小さいか否かを判定すると共に、第2の読み出し部20Yが、カウンタjがmより小さいか否かを判定する。そして、カウンタiがnより小さく且つカウンタjがmより小さい場合にはステップ104へ移行し、カウンタiがn以上又はカウンタjがm以上となった場合には、本ルーチンを終了する。すなわち、データ源X及びデータ源Yの少なくとも一方から全ての要素を読み出した場合には本ルーチンを終了する。
In
ステップ104では、第1の読み出し部20Xが、データ源Xから第1の要素X[i]を読み出すと共に、第2の読み出し部20Yが、データ源Yから第2の要素Y[j]を読み出す。そして、第1の比較部12が、第1の比較演算子“<”により、X[i]がY[j]より小さいか否かを判定し、第1の要素X[i]が第2の要素Y[j]より小さくない場合はステップ106へ移行する。一方、第1の要素X[i]が第2の要素Y[j]より小さい場合は、選択部16がステップ112へ移行させる。
In
ステップ112では、第1の読み出し部20Xが、カウンタiをインクリメントする。
In
ステップ106では、第1の比較部12が、第2の比較演算子“>”により、第1の要素X[i]が第2の要素Y[j]より大きいか否かを判定し、第1の要素X[i]が第2の要素Y[j]より大きくない場合はステップ108へ移行する。一方、第1の要素X[i]が第2の要素Y[j]より大きい場合は、選択部16がステップ114へ移行させる。
In
ステップ104で第1の要素X[i]が第2の要素Y[j]より小さくないと判定され、且つ、ステップ106で第1の要素X[i]が第2の要素Y[j]より大きくないと判定された場合、第1の要素X[i]と第2の要素Y[j]は同一である。
In
従って、ステップ108では、出力部18が、第1の要素X[i](=第2の要素Y[j])を出力する。
Accordingly, in
ステップ110では、第1の読み出し部20Xがカウンタiをインクリメントする。そして、選択部16がステップ114へ移行させる。
In
ステップ114では、第2の読み出し部20Yがカウンタjをインクリメントする。
In
ステップ116では、ステップ102と同様に、第1の読み出し部20Xが、カウンタiがnより小さいか否かを判定すると共に、第2の読み出し部20Yが、カウンタjがmより小さいか否かを判定する。そして、カウンタiがnより小さく且つカウンタjがmより小さい場合にはステップ118へ移行し、カウンタiがn以上又はカウンタjがm以上となった場合には、本ルーチンを終了する。
In
ステップ118では、第2の比較部14がステップ106と同様の比較判定を行う。すなわち、第2の比較部12が、第2の比較演算子“>”により、第1の要素X[i]が第2の要素Y[j]より大きいか否かを判定する。そして、第1の要素X[i]が第2の要素Y[j]より大きくない場合はステップ120へ移行する。一方、第1の要素X[i]が第2の要素Y[j]より大きい場合は、選択部16がステップ114へ移行させる。
In
ステップ120では、第2の比較部14がステップ104と同様の比較判定を行う。すなわち、第2の比較部14が、第1の比較演算子“<”により、第1の要素X[i]が第2の要素Y[j]より小さいか否かを判定する。そして、第1の要素X[i]が第2の要素Y[j]より小さくない場合はステップ122へ移行する。一方、第1の要素X[i]が第2の要素Y[j]より小さい場合は、選択部16がステップ112へ移行させる。
In
ステップ118で第1の要素X[i]が第2の要素Y[j]より大きくないと判定され、且つ、ステップ120で第1の要素X[i]が第2の要素Y[j]より小さくないと判定された場合、第1の要素X[i]と第2の要素Y[j]は同一である。
In
従って、ステップ122では、出力部18が、第1の要素X[i](=第2の要素[j])を出力する。
Accordingly, in
ステップ124では、第2の読み出し部20Yがカウンタjをインクリメントする。そして、選択部16がステップ112へ移行させる。
In
このように、ステップ104で第1の要素X[i]が第2の要素Y[j]より小さいと判定された場合は、選択部16は、その後再びステップ104の比較判定が行われるように、ステップ112へ移行させる。
As described above, when it is determined in
また、ステップ106で第1の要素X[i]が第2の要素Y[j]より大きいと判定された場合は、選択部16は、その後ステップ106と同様の比較判定を行うステップ118の比較判定が行われるように、ステップ114へ移行させる。
If it is determined in
また、ステップ118で第1の要素X[i]が第2の要素Y[j]より大きいと判定された場合は、選択部16は、その後再びステップ118の比較判定が行われるように、ステップ114へ移行させる。
If it is determined in
また、ステップ120で第1の要素X[i]が第2の要素Y[j]より小さいと判定された場合は、選択部16は、その後ステップ120と同様の比較判定を行うステップ104の比較判定が行われるように、ステップ112へ移行させる。
If it is determined in
すなわち、選択部16は、第1の比較部12及び第2の比較部14によって第1の要素X[i]が第2の要素Y[j]と同一でないと判定された場合は、直前に実行した比較判定と同一の比較判定を先に行う比較部を第1の比較部12及び第2の比較部14から選択する。
In other words, the
これにより、第1の要素X[i]が第2の要素Y[j]より小さい状態が続く場合は、第1の比較部12によりステップ104の比較判定が繰り返される。一方、第1の要素X[i]が第2の要素Y[j]より大きい状態が続く場合は、第2の比較部14によりステップ118の比較判定が繰り返される。すなわち、第1の比較部12によりステップ104、106の2回の比較判定が行われるのは、第1の要素X[i]と第2の要素Y[j]が同一の場合だけとなる。同様に、第2の比較部14によりステップ118、120の2回の比較判定が行われるのは、第1の要素X[i]と第2の要素Y[j]が同一の場合だけとなる。
As a result, when the state in which the first element X [i] is smaller than the second element Y [j] continues, the comparison determination in
次に、図4に示すようなデータ源X及びデータ源Yに対して図3の処理を実行した場合に、第1の比較部12及び第2の比較部14において比較判定処理が何回実行されるかについて説明する。
Next, when the process of FIG. 3 is executed for the data source X and the data source Y as shown in FIG. 4, how many times the comparison determination process is executed in the
まず、図5の四角で囲まれたデータ、すなわちデータ源Xから先頭のデータである第1の要素X[0]=1、データ源Yから先頭の要素である第2の要素Y[0]=1が読み出される。この場合、図6の矢印A1で示す処理順序で処理が実行される。この場合、ステップ104、106の2回の比較判定処理が実行されるため、第1の要素X[0]と第2の要素Y[0]が同一であると判定され、共通要素として第1の要素X[0]=1が出力される。
First, data surrounded by a square in FIG. 5, that is, a first element X [0] = 1 that is the first data from the data source X, and a second element Y [0] that is the first element from the data source Y. = 1 is read. In this case, processing is executed in the processing order indicated by arrow A1 in FIG. In this case, since the two comparison determination processes of
そして、図7に示すように、データ源Xの次の第1の要素X[1]=3、データ源Yの次の第2の要素Y[1]=8が読み出され、図8の矢印A2で示す処理順序で処理が実行される。この場合、ステップ118、120の2回の比較判定処理が実行され、第1の要素X[1]が第2の要素Y[1]よりも小さいと判定される。
Then, as shown in FIG. 7, the first element X [1] = 3 next to the data source X and the second element Y [1] = 8 next to the data source Y are read out, as shown in FIG. Processing is executed in the processing order indicated by arrow A2. In this case, the two comparison determination processes of
次に、図9に示すように、データ源Xの次の第1の要素X[2]=4が入力され、図10の矢印A3で示す処理順序で処理が実行される。この場合、ステップ104の1回の比較判定処理が実行され、第1の要素X[2]が第2の要素Y[1]よりも小さいと判定される。
Next, as shown in FIG. 9, the next first element X [2] = 4 of the data source X is input, and the processing is executed in the processing order indicated by the arrow A3 in FIG. In this case, one comparison determination process of
次に、図11に示すように、データ源Xの次の第1の要素X[3]=5が読み出され、図10の矢印A3で示す処理順序で処理が実行される。この場合、ステップ104の1回の比較判定処理が実行され、第1の要素X[3]が第2の要素Y[1]よりも小さいと判定される。
Next, as shown in FIG. 11, the next first element X [3] = 5 of the data source X is read, and the processing is executed in the processing order indicated by the arrow A3 in FIG. In this case, one comparison determination process of
次に、図12に示すように、データ源Xの次の第1の要素X[4]=7が読み出され、図10の矢印A3で示す処理順序で処理が実行される。この場合、ステップ104の1回の比較判定処理が実行され、データ源Xの要素がデータ源Yの要素よりも小さいと判定される。
Next, as shown in FIG. 12, the next first element X [4] = 7 of the data source X is read, and the processing is executed in the processing order indicated by the arrow A3 in FIG. In this case, one comparison determination process of
次に、図13に示すように、データ源Xの次の第1の要素X[5]=9が読み出され、図14の矢印A4で示す処理順序で処理が実行される。この場合、ステップ104、106の2回の比較判定処理が実行され、第1の要素X[5]が第2の要素Y[1]よりも大きいと判定される。
Next, as shown in FIG. 13, the next first element X [5] = 9 of the data source X is read, and the processing is executed in the processing order indicated by the arrow A4 in FIG. In this case, the two comparison determination processes of
次に、図15に示すように、データ源Yの次の第2の要素Y[2]=9が読み出され、図16の矢印A5で示す処理順序で処理が実行される。この場合、ステップ118、120の2回の比較判定処理が実行され、第1の要素X[5]が第2の要素Y[2]と同一であると判定され、共通要素としてX[5]=9が出力される。
Next, as shown in FIG. 15, the next second element Y [2] = 9 of the data source Y is read, and the processing is executed in the processing order indicated by the arrow A5 in FIG. In this case, the two comparison determination processes of
次に、図17に示すように、データ源Xの次の第1の要素X[6]=14、データ源Yの次の第2の要素Y[3]=10が読み出され、図14の矢印A4で示す処理順序で処理が実行される。この場合、ステップ104、106の2回の比較判定処理が実行され、第1の要素X[6]が第2の要素Y[3]よりも大きいと判定される。
Next, as shown in FIG. 17, the next first element X [6] = 14 of the data source X and the next second element Y [3] = 10 of the data source Y are read, and FIG. The processing is executed in the processing order indicated by arrow A4. In this case, the two comparison determination processes of
次に、図18に示すように、データ源Yの次の第2の要素Y[4]=11が読み出され、図19の矢印A6で示す処理順序で処理が実行される。この場合、ステップ118の1回の比較判定処理が実行され、第1の要素X[6]が第2の要素Y[4]よりも大きいと判定される。
Next, as shown in FIG. 18, the next second element Y [4] = 11 of the data source Y is read, and the processing is executed in the processing order indicated by the arrow A6 in FIG. In this case, one comparison determination process of
次に、図20に示すように、データ源Yの次の第2の要素Y[5]=12が読み出され、図19の矢印A6で示す処理順序で処理が実行される。この場合、ステップ118の1回の比較判定処理が実行され、第1の要素X[6]が第2の要素Y[5]よりも大きいと判定される。
Next, as shown in FIG. 20, the next second element Y [5] = 12 of the data source Y is read, and the processing is executed in the processing order indicated by the arrow A6 in FIG. In this case, one comparison determination process in
次に、図21に示すように、データ源Yの次の第2の要素Y[6]=14が読み出され、図16の矢印A5で示す処理順序で処理が実行される。この場合、ステップ118、120の2回の比較判定処理が実行され、第1の要素X[6]が第2の要素Y[6]と同一であると判定され、共通要素としてX[6]=14が出力される。
Next, as shown in FIG. 21, the next second element Y [6] = 14 of the data source Y is read, and the processing is executed in the processing order indicated by the arrow A5 in FIG. In this case, the two comparison determination processes of
以下同様の処理を繰り返すことにより、図22に示すように、データ源Xとデータ源Yの共通要素である{1,9,14,19}が出力される。 By repeating the same processing thereafter, {1, 9, 14, 19}, which is a common element of the data source X and the data source Y, is output as shown in FIG.
図3に示す処理のうち、ステップ102〜112の処理は、図23に示すように、データ源Xの第1の要素X[i]とデータ源Yの第2の要素Y[j]との大小関係によって3通りの処理a、b、cを実行する比較装置Sと言える。すなわち、データ源Xの第1の要素X[i]とデータ源Yの第2の要素Y[j]とを第1の比較演算子“<”により比較判定し、第1の要素X[i]が第2の要素Y[j]よりも小さい場合には、処理aとしてデータ源Xの次の第1の要素を読み込む。また、第1の要素X[i]が第2の要素Y[j]よりも小さくない場合、さらに第2の比較演算子“>”により第1の要素X[i]と第2の要素Y[j]とを比較判定する。そして、第1の要素X[i]が第2の要素Y[j]よりも大きい場合には、処理bとしてデータ源Yの次の第2の要素を読み込む。一方、第1の要素X[i]が第2の要素Y[j]よりも大きくない場合には、すなわち第1の要素X[i]が第2の要素Y[j]と同一である場合には、処理cとして第1の要素X[i](=第2の要素Y[j])を出力する。そして、データ源Xの次の第1の要素及びデータ源Yの次の第2の要素を読み込む。
Among the processes shown in FIG. 3, the processes in
また、図3に示す処理のうち、ステップ114〜124の処理は、図24に示すように、データ源Xの第1の要素X[i]とデータ源Yの第2の要素Y[j]との大小関係によって3通りの処理a、b、cを実行する比較装置Tと言える。すなわち、データ源Xの第1の要素X[i]とデータ源Yの第2の要素Y[j]とを第2の比較演算子“>”により比較判定し、第1の要素X[i]が第2の要素Y[j]よりも大きい場合には、処理bとしてデータ源Yの次の第2の要素を読み込む。また、第1の要素X[i]が第2の要素Y[j]よりも大きくない場合、さらに第1の比較演算子“<”により第1の要素X[i]と第2の要素Y[j]とを比較判定する。そして、第1の要素X[i]が第2の要素Y[j]よりも小さい場合には、処理aとしてデータ源Xの次の第1の要素を読み込む。一方、第1の要素X[i]が第2の要素Y[j]よりも小さくない場合には、すなわち第1の要素X[i]が第2の要素Y[j]と同一である場合には、処理cとして第1の要素X[i](=第2の要素Y[j])を出力する。そして、データ源Xの次の第1の要素及びデータ源Yの次の第2の要素を読み込む。
Also, among the processes shown in FIG. 3, the processes of
このように、第1の比較部12が実行するステップ104、106の比較判定処理と、第2の比較部14が実行するステップ118、120の比較判定処理は、第1の比較演算子“<”及び第2の比較演算子“>”による比較判定処理の順序が逆となっている。そして、第1の比較部12及び第2の比較部14によって第1の要素X[i]が第2の要素Y[j]と同一でないと判定された場合は、直前に実行した比較判定と同一の比較判定を行う比較部が第1の比較部12及び第2の比較部14から選択される。
As described above, the comparison determination process of
これにより、第1の要素X[i]が第2の要素Y[j]より小さい状態が続く場合は、第1の比較部12によりステップ104の比較判定処理が繰り返される。一方、第1の要素X[i]が第2の要素Y[j]より大きい状態が続く場合は、第2の比較部14によりステップ118の比較判定処理が繰り返される。そして、第1の比較部12によりステップ104、106の2回の比較判定が行われるのは、第1の要素X[i]と第2の要素Y[j]が同一の場合だけとなる。同様に、第2の比較部14によりステップ118、120の2回の比較判定が行われるのは、第1の要素X[i]と第2の要素Y[j]が同一の場合だけとなる。このため、図25に示すように、データ源Xの第1の要素がデータ源Yの第2の要素よりも小さい範囲S1では、図3に示すステップ104の1回の比較判定処理が実行される。また、データ源Xの要素がデータ源Yの要素よりも大きい場合が連続する範囲T1では、図3に示すステップ118の1回の比較判定処理が実行される。従って、例えば第1の要素が連続して出現した後、第2の要素が連続して出現するような、要素の出現に偏りがあるデータ源の共通要素を抽出する場合、無駄な比較判定処理を少なくすることができ、処理時間が増大するのを抑制することができる。
As a result, when the state in which the first element X [i] is smaller than the second element Y [j] continues, the comparison determination process in
(第2実施形態) (Second Embodiment)
次に開示の技術の第2実施形態について説明する。なお、第1実施形態と同一の部分には同一の符号を付して説明を省略し、第1実施形態と異なる部分についてのみ説明する。 Next, a second embodiment of the disclosed technique will be described. In addition, the same code | symbol is attached | subjected to the part same as 1st Embodiment, description is abbreviate | omitted, and only a different part from 1st Embodiment is demonstrated.
図26には、第2実施形態に係る共通要素抽出装置10Aが示されている。第2実施形態に係る共通要素抽出装置10Aは、第1実施形態に係る共通要素抽出装置10と異なるのは、第3の比較部22が設けられている点である。
FIG. 26 shows a common
第3の比較部22は、第1の要素X[i]と第2の要素Y[j]とが同一であるか否か又は同一でないか否かを比較判定する第3の比較演算子と、第1の比較演算子又は第2の比較演算子と、により第1の要素X[i]と第2の要素Y[j]とを順次比較判定する。例えば第1の比較演算子を“<”、第2の比較演算子を“>”とした場合、第3の比較演算子は“=”が用いられる。
The
選択部16は、第1の要素X[i]と第2の要素Y[j]とが同一であると判定されなかった場合に、第1の比較部12又は第2の比較部14を選択する。また、選択部16は、第3の比較部22により第1の要素X[i]と第2の要素Y[j]とが同一であると判定された場合に、第3の比較部22を選択する。
The
出力部18は、第1の比較部12、第2の比較部14、及び第3の比較部22から選択された比較部により第1の要素X[i]と第2の要素Y[j]とが同一であると判定された場合に、当該同一と判定された同一要素を出力する。
The
共通要素抽出装置10Aは、例えば図27に示すコンピュータ60Aで実現することができる。コンピュータ60Aが図2に示すコンピュータ60と異なるのは、記憶部66に記憶された共通要素抽出プログラム68Aが第3の比較プロセス73を有する点である。CPU62は、第3の比較プロセス73を実行することで、図26に示す第3の比較部22として動作する。これにより、共通要素抽出プログラム68Aを実行したコンピュータ60Aが、共通要素抽出装置10Aとして機能することになる。なお、共通要素抽出プログラム68Aは開示の技術における共通要素抽出プログラムの一例である。
The common
次に第2実施形態の作用として、第2実施形態に係る共通要素抽出処理について図28を参照して説明する。なお、第1実施形態で説明した共通要素抽出処理(図3参照)と異なる部分についてのみ説明する。 Next, as an operation of the second embodiment, common element extraction processing according to the second embodiment will be described with reference to FIG. Only parts different from the common element extraction process (see FIG. 3) described in the first embodiment will be described.
図28に示す共通要素抽出処理では、図3に示した共通要素抽出処理に対してステップ130〜134の処理が追加されている。
In the common element extraction process shown in FIG. 28,
ステップ130は、ステップ102、116と同様の処理である。すなわち、第1の読み出し部20Xが、カウンタiがnより小さいか否かを判定すると共に、第2の読み出し部20Yが、カウンタjがmより小さいか否かを判定する。そして、カウンタiがnより小さく且つカウンタjがmより小さい場合にはステップ132へ移行し、カウンタiがn以上又はカウンタjがm以上となった場合には、本ルーチンを終了する。すなわち、データ源X及びデータ源Yの少なくとも一方から全ての要素を読み出した場合には本ルーチンを終了する。
Step 130 is the same processing as
ステップ132では、第3の比較部22が、第3の比較演算子“=”により、X[i]がY[j]と同一であるか否かを判定する。そして、第1の要素X[i]が第2の要素Y[j]と同一である場合は、選択部16がステップ108へ移行させる。一方、第1の要素X[i]が第2の要素Y[j]と同一でない場合には、ステップ134へ移行する。
In
ステップ134では、第3の比較部22が、第1の比較演算子“<”により、第1の要素X[i]が第2の要素Y[j]より小さいか否かを判定する。そして、第1の要素X[i]が第2の要素Y[j]より小さい場合は、選択部16がステップ112へ移行させる。一方、第1の要素X[i]が第2の要素Y[j]より小さくない場合は、選択部16がステップ114へ移行させる。
In
これにより、第1の要素X[i]と第2の要素Y[j]とが同一の状態が続く場合は、第3の比較部22によりステップ132の比較判定処理が繰り返される。従って、第1の要素と第2の要素とが同一の状態が連続するものを含むデータ源の共通要素を抽出する場合に、無駄な比較判定処理を少なくすることができ、処理時間が増大するのを抑制することができる。
As a result, when the first element X [i] and the second element Y [j] continue to be in the same state, the comparison determination process in
なお、本実施形態では、第1の比較演算子を“<”、第2の比較演算子を“>”、第3の比較演算子を“=”とした場合について説明したが、図29に示すように、第1の比較演算子を“≦”、第2の比較演算子を“≧”、第3の比較演算子を“≠”としてもよい。この場合、図29に示すように、ステップ104、106、118、120の各比較判定の対象が図28と逆になり、ステップ104、106、118、120、132の各比較判定結果に応じた分岐先が図28と逆になる。
In the present embodiment, a case has been described in which the first comparison operator is “<”, the second comparison operator is “>”, and the third comparison operator is “=”. As shown, the first comparison operator may be “≦”, the second comparison operator may be “≧”, and the third comparison operator may be “≠”. In this case, as shown in FIG. 29, the objects of the comparison determinations in
(第3実施形態) (Third embodiment)
次に開示の技術の第3実施形態について説明する。第3実施形態では、複数の共通要素抽出装置を多段接続した共通要素抽出装置について説明する。 Next, a third embodiment of the disclosed technique will be described. In the third embodiment, a common element extraction device in which a plurality of common element extraction devices are connected in multiple stages will be described.
図30には、複数の共通要素抽出装置10を多段接続した共通要素抽出装置50を示した。同図では、一例として共通要素抽出装置10を3段接続した例を示した。同図に示すように、共通要素抽出装置50は、1段目の共通要素抽出装置には、データ源D1、D2の各要素が入力される。また、2段目の共通要素抽出装置10には、1段目の共通要素抽出装置10から出力されたデータ源D1、D2の共通要素(同一データ)と、データ源D3の要素が入力される。3段目の共通要素抽出装置10には、2段目の共通要素抽出装置10から出力されたデータ源D1〜D3の共通要素と、データ源D4の要素が入力される。
FIG. 30 shows a common
このように、共通要素抽出装置50は、2段目以降の共通要素抽出装置10に、前段の共通要素抽出装置10から出力された同一要素と、データ源から出力された要素と、が入力されるように、複数の共通要素抽出装置10を多段接続した構成となっている。このように、2段目以降の共通要素抽出装置10の一方の入力には、前段の共通要素抽出装置10から出力された同一要素が入力されるため、要素数が少ない。このため、2段目以降の共通要素抽出装置10で比較するデータ源の要素数が偏るため、無駄な比較判定処理を更に少なくすることができ、処理時間が増大するのを更に抑制することができる。
In this way, the common
また、図31には、複数の共通要素抽出装置10を多段接続した他の例を示した。同図に示す共通要素抽出装置52は、1段目の一方の共通要素抽出装置10には、データ源D1、D2の各要素が入力される。また、1段目の他方の共通要素抽出装置10には、データ源D3、D4の各要素が入力される。また、2段目の共通要素抽出装置10には、1段目の一方の共通要素抽出装置10から出力されたデータ源D1、D2の共通要素と、1段目の他方の共通要素抽出装置10から出力されたデータ源D3、D4の共通要素と、が入力される。
FIG. 31 shows another example in which a plurality of common
このように、共通要素抽出装置52は、1段目に2つのデータ源からの各要素が入力される共通要素抽出装置10が複数設けられている。そして、2段目の共通要素抽出装置10に、前段の2つの共通要素抽出装置10から各々出力された同一要素が各々入力されるように、複数の共通要素抽出装置10を多段接続した構成となっている。
Thus, the common
なお、上記では複数の共通要素抽出装置10を多段接続する場合について説明したが、複数の共通要素抽出装置10Aを多段接続した構成としてもよい。また、共通要素抽出装置10と共通要素抽出装置10Aが混在した構成としてもよい。
In the above description, a case where a plurality of common
また、上記各実施形態では、データ源の各要素が昇順に整列済みの場合について説明したが、データ源の各要素が降順に整列済みであってもよい。また、一つのデータ源に同じ値の要素が含まれていても良い。 In each of the above embodiments, the case where the elements of the data source are arranged in ascending order has been described. However, the elements of the data source may be arranged in descending order. One data source may contain elements having the same value.
また、上記では開示の技術に係る共通要素抽出プログラムの一例である共通要素抽出プログラムが記憶部66に予め記憶(インストール)されている態様を説明したが、これに限定されるものではない。開示の技術に係る画像処理プログラムは、CD−ROMやDVD−ROM等の記録媒体に記録されている形態で提供することも可能である。
In the above description, the common element extraction program, which is an example of the common element extraction program according to the disclosed technology, is stored (installed) in the
本明細書に記載された全ての文献、特許出願及び技術規格は、個々の文献、特許出願及び技術規格が参照により取り込まれることが具体的かつ個々に記された場合と同程度に、本明細書中に参照により取り込まれる。 All documents, patent applications and technical standards mentioned in this specification are to the same extent as if each individual document, patent application and technical standard were specifically and individually stated to be incorporated by reference. Incorporated by reference in the book.
以上の実施形態に関し、更に以下の付記を開示する。 Regarding the above embodiment, the following additional notes are disclosed.
(付記1)
コンピュータが、
整列済みの複数の要素を含む第1のデータ源から読み出した第1の要素と、整列済みの複数の要素を含む第2のデータ源から読み出した第2の要素と、を第1の比較演算子及び前記第1の比較演算子と異なる第2の比較演算子により順次比較判定する第1の比較ステップと、
前記第1の要素と前記第2の要素とを前記第1の比較演算子及び前記第2の比較演算子により順次比較判定すると共に、前記第1の比較演算子及び前記第2の比較演算子による比較順序が前記第1の比較ステップと異なる第2の比較ステップと、
前記第1の比較ステップ及び前記第2の比較ステップの何れかにより前記第1の要素と前記第2の要素とが同一であると判定されなかった場合に、前記第1の比較ステップ及び前記第2の比較ステップの何れかが直前に実行した比較判定と同一の比較判定を先に行う比較ステップを前記第1の比較ステップ及び前記第2の比較ステップから選択する選択ステップと、
前記第1の比較ステップ及び前記第2の比較ステップの何れかにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、当該同一と判定された同一要素を出力する出力ステップと、
前記出力ステップが前記同一要素を出力した場合は、前記第1のデータ源及び前記第2のデータ源から次の要素を各々読み出すと共に、前記選択ステップにより前記第1の比較ステップ及び前記第2の比較ステップのうち一方の比較ステップが選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち一方のデータ源から次の要素を読み出し、前記選択ステップにより前記第1の比較ステップ及び前記第2の比較ステップのうち他方の比較ステップが選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち他方のデータ源から次の要素を読み出す読み出しステップと、
を含む処理を実行する共通要素抽出方法。
(付記2)
前記第1の要素と前記第2の要素とが同一であるか否か又は同一でないか否かを比較判定する第3の比較演算子と、前記第1の比較演算子及び前記第2の比較演算子のうち一方の比較演算子と、により前記第1の要素と前記第2の要素とを順次比較判定する第3の比較ステップをさらに備え、
前記選択ステップは、前記第3の比較ステップにより前記第1の要素と前記第2の要素とが同一であると判定されなかった場合に、前記第1の比較ステップ又は前記第2の比較ステップを選択すると共に、前記第3の比較ステップにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、前記第3の比較ステップを選択し、
前記出力ステップは、前記第1の比較ステップ、前記第2の比較ステップ、及び前記第3の比較ステップから選択された比較ステップにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、当該同一と判定された同一要素を出力する
付記1記載の共通要素抽出方法。
(付記3)
コンピュータに、
整列済みの複数の要素を含む第1のデータ源から読み出した第1の要素と、整列済みの複数の要素を含む第2のデータ源から読み出した第2の要素と、を第1の比較演算子及び前記第1の比較演算子と異なる第2の比較演算子により順次比較判定する第1の比較ステップと、
前記第1の要素と前記第2の要素とを前記第1の比較演算子及び前記第2の比較演算子により順次比較判定すると共に、前記第1の比較演算子及び前記第2の比較演算子による比較順序が前記第1の比較ステップと異なる第2の比較ステップと、
前記第1の比較ステップ及び前記第2の比較ステップの何れかにより前記第1の要素と前記第2の要素とが同一であると判定されなかった場合に、前記第1の比較ステップ及び前記第2の比較ステップの何れかが直前に実行した比較判定と同一の比較判定を先に行う比較ステップを前記第1の比較ステップ及び前記第2の比較ステップから選択する選択ステップと、
前記第1の比較ステップ及び前記第2の比較ステップの何れかにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、当該同一と判定された同一要素を出力する出力ステップと、
前記出力ステップが前記同一要素を出力した場合は、前記第1のデータ源及び前記第2のデータ源から次の要素を各々読み出すと共に、前記選択ステップにより前記第1の比較ステップ及び前記第2の比較ステップのうち一方の比較ステップが選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち一方のデータ源から次の要素を読み出し、前記選択ステップにより前記第1の比較ステップ及び前記第2の比較ステップのうち他方の比較ステップが選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち他方のデータ源から次の要素を読み出す読み出しステップと、
を含む処理を実行させるための共通要素抽出プログラム。
(付記4)
前記第1の要素と前記第2の要素とが同一であるか否か又は同一でないか否かを比較判定する第3の比較演算子と、前記第1の比較演算子及び前記第2の比較演算子のうち一方の比較演算子と、により前記第1の要素と前記第2の要素とを順次比較判定する第3の比較ステップをさらに備え、
前記選択ステップは、前記第3の比較ステップにより前記第1の要素と前記第2の要素とが同一であると判定されなかった場合に、前記第1の比較ステップ又は前記第2の比較ステップを選択すると共に、前記第3の比較ステップにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、前記第3の比較ステップを選択し、
前記出力ステップは、前記第1の比較ステップ、前記第2の比較ステップ、及び前記第3の比較ステップから選択された比較ステップにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、当該同一と判定された同一要素を出力する
付記3記載の共通要素抽出プログラム。
(Appendix 1)
Computer
A first comparison operation of a first element read from a first data source including a plurality of aligned elements and a second element read from a second data source including a plurality of aligned elements A first comparison step of sequentially comparing and determining by a child and a second comparison operator different from the first comparison operator;
The first element and the second element are sequentially compared and determined by the first comparison operator and the second comparison operator, and the first comparison operator and the second comparison operator. A second comparison step in which the comparison order by is different from the first comparison step;
If the first element and the second element are not determined to be the same by either the first comparison step or the second comparison step, the first comparison step and the second comparison step A selection step for selecting, from the first comparison step and the second comparison step, a comparison step in which one of the two comparison steps performs the same comparison determination as that performed immediately before;
When the first element and the second element are determined to be the same in any of the first comparison step and the second comparison step, the same element determined to be the same is output. An output step to
When the output step outputs the same element, the next element is read from each of the first data source and the second data source, and the first comparison step and the second When one of the comparison steps is selected, the next element is read from one of the first data source and the second data source, and the first comparison is performed by the selection step. A step of reading the next element from the other data source of the first data source and the second data source when the other comparison step of the step and the second comparison step is selected;
Common element extraction method for executing processing including.
(Appendix 2)
A third comparison operator for determining whether or not the first element and the second element are the same or not, the first comparison operator, and the second comparison; A third comparison step of sequentially comparing and determining the first element and the second element by one of the comparison operators;
The selecting step includes the first comparing step or the second comparing step when the third comparing step does not determine that the first element and the second element are the same. And selecting the third comparison step when the third comparison step determines that the first element and the second element are the same,
In the output step, the first element and the second element are the same by a comparison step selected from the first comparison step, the second comparison step, and the third comparison step. The common element extraction method according to
(Appendix 3)
On the computer,
A first comparison operation of a first element read from a first data source including a plurality of aligned elements and a second element read from a second data source including a plurality of aligned elements A first comparison step of sequentially comparing and determining by a child and a second comparison operator different from the first comparison operator;
The first element and the second element are sequentially compared and determined by the first comparison operator and the second comparison operator, and the first comparison operator and the second comparison operator. A second comparison step in which the comparison order by is different from the first comparison step;
If the first element and the second element are not determined to be the same by either the first comparison step or the second comparison step, the first comparison step and the second comparison step A selection step for selecting, from the first comparison step and the second comparison step, a comparison step in which one of the two comparison steps performs the same comparison determination as that performed immediately before;
When the first element and the second element are determined to be the same in any of the first comparison step and the second comparison step, the same element determined to be the same is output. An output step to
When the output step outputs the same element, the next element is read from each of the first data source and the second data source, and the first comparison step and the second When one of the comparison steps is selected, the next element is read from one of the first data source and the second data source, and the first comparison is performed by the selection step. A step of reading the next element from the other data source of the first data source and the second data source when the other comparison step of the step and the second comparison step is selected;
Common element extraction program for executing processing including
(Appendix 4)
A third comparison operator for determining whether or not the first element and the second element are the same or not, the first comparison operator, and the second comparison; A third comparison step of sequentially comparing and determining the first element and the second element by one of the comparison operators;
The selecting step includes the first comparing step or the second comparing step when the third comparing step does not determine that the first element and the second element are the same. And selecting the third comparison step when the third comparison step determines that the first element and the second element are the same,
In the output step, the first element and the second element are the same by a comparison step selected from the first comparison step, the second comparison step, and the third comparison step. The common element extraction program according to
以下、開示の技術の効果を確認するために実施された実験の結果を説明する。この実験では、図32に示すように、2つのデータ源の要素の出現の仕方が異なる5パターンについて、図38に示す従来の共通要素抽出処理(従来)及び図3に示す共通要素抽出処理(開示の技術)を行い、1処理あたりの比較回数の期待値を求めた。 Hereinafter, the results of experiments conducted to confirm the effects of the disclosed technology will be described. In this experiment, as shown in FIG. 32, the conventional common element extraction process shown in FIG. 38 (conventional) and the common element extraction process shown in FIG. Disclosure technology) was performed, and an expected value of the number of comparisons per process was obtained.
まず、要素の出現が一様に密の2つのデータ源の場合(パターン1)、要素の出現が一様に疎の2つのデータ源の場合(パターン2)、従来及び開示の技術では期待値は変わらなかった。従って、従来に対する開示の技術の比較回数の比は1であった。 First, in the case of two data sources in which the appearance of elements is uniformly dense (Pattern 1), in the case of two data sources in which the appearance of elements is uniformly sparse (Pattern 2), the expected value in the conventional and disclosed techniques Did not change. Therefore, the ratio of the number of comparisons of the disclosed technique with respect to the prior art is 1.
また、要素の出現が非対称の2つのデータ源の場合(パターン3)、従来では、期待値が1又は2であり、開示の技術では期待値は1であった。従って、従来に対する開示の技術の比較回数の比は1又は0.5であった。 In the case of two data sources in which the appearance of elements is asymmetric (pattern 3), the expected value is 1 or 2 conventionally, and the expected value is 1 in the disclosed technique. Therefore, the ratio of the number of comparisons of the disclosed technique with respect to the prior art is 1 or 0.5.
また、連続した要素が交互に出現する2つのデータ源の場合(パターン4)、従来では、期待値が1.5であり、開示の技術では期待値は1であった。従って、従来に対する開示の技術の比較回数の比は0.66であった。 In the case of two data sources in which consecutive elements appear alternately (pattern 4), the expected value is 1.5 in the past, and the expected value is 1 in the disclosed technique. Therefore, the ratio of the number of comparisons of the disclosed technique with respect to the prior art was 0.66.
また、要素が交互に出現する2つのデータ源の場合(パターン5)、従来では、期待値が1.5であり、開示の技術では期待値は2であった。従って、従来に対する開示の技術の比較回数の比は1.33であった。 In the case of two data sources in which elements appear alternately (pattern 5), the expected value is 1.5 in the past, and the expected value is 2 in the disclosed technique. Therefore, the ratio of the number of comparisons of the disclosed technique with respect to the prior art was 1.33.
このように、パターン4が1処理あたりの比較回数の期待値が最も小さくなることが判った。
Thus, it was found that the expected value of the number of comparisons per process in
また、図33には、0以上で且つ100万未満の整数からランダムに予め定めた個数の数字を選択して作成した整列済みのデータ源X、Yに対し、従来及び開示の技術の共通要素抽出処理を実行した場合における計算時間の結果を示した。なお、用いたデータ源X、Yは、図34に示すように、データ源Yの要素数がデータ源Xの要素数よりも大きいデータ源である。また、データ源X、Yの何れかの要素数が1万以下の場合、計算時間が短いため、定数倍して表示している。同図では、データ源X、Yの要素数が共に1万の場合は10倍(*1)、データ源X、Yの要素数の一方が1万、他方が100の場合は100倍(*2)、データ源X、Yの要素数が共に100の場合は100倍(*3)している。 Also, FIG. 33 shows common elements of the conventional and disclosed techniques for the aligned data sources X and Y created by selecting a predetermined number of numbers randomly from integers greater than or equal to 0 and less than 1 million. The result of calculation time when the extraction process is executed is shown. The data sources X and Y used are data sources in which the number of elements of the data source Y is larger than the number of elements of the data source X as shown in FIG. In addition, when the number of elements of either of the data sources X and Y is 10,000 or less, the calculation time is short, and therefore, the data is displayed with a constant multiplication. In the figure, when the number of elements of the data sources X and Y is both 10,000, it is 10 times ( * 1) . 2) When the number of elements of the data sources X and Y is 100, it is multiplied by 100 ( * 3).
図33に示すように、データ源Yの要素数がデータ源Xの要素数よりも多い領域Rでは、開示の技術の方が従来よりも計算時間を大幅に短縮できることが判った。これは、データ源Yの要素数が多く、データ源Xの要素よりもデータ源Yの要素の方が小さい場合が多いため、図3のステップ118の比較処理が繰り返されるためである。
As shown in FIG. 33, it has been found that in the region R where the number of elements of the data source Y is larger than the number of elements of the data source X, the disclosed technique can significantly reduce the calculation time compared to the conventional technique. This is because the number of elements of the data source Y is large and the elements of the data source Y are often smaller than the elements of the data source X, so that the comparison process in
また、図35には、1から200万までの数字が、図36に示すように一定回数(ブロック長)毎に交互に出現する同一要素数のデータ源X、Yに対し、従来及び開示の技術の共通要素抽出処理を実行した場合における計算時間の結果を示した。また、図37には、図35のうち、ブロック長が1〜10の場合の拡大図を示した。図35に示すように、ブロック長が長くなるほど、開示の技術の方が従来と比較して計算時間が短くなるのが判る。このように、上記のパターン3やパターン4、特にパターン4の場合に、共通要素抽出処理の計算時間を従来と比較して大幅に短縮できることが判った。
FIG. 35 shows the conventional and disclosed data sources X and Y in which numbers from 1 to 2 million appear alternately every fixed number of times (block length) as shown in FIG. The result of calculation time when the common element extraction process of technology was executed was shown. FIG. 37 shows an enlarged view of FIG. 35 when the block length is 1-10. As shown in FIG. 35, it can be seen that the longer the block length, the shorter the calculation time of the disclosed technique compared to the conventional technique. As described above, it was found that the calculation time of the common element extraction process can be significantly shortened in the case of the above-described
10、10A、50、52 共通要素抽出装置
10A 共通要素抽出装置
12 第1の比較部
14 第2の比較部
16 選択部
18 出力部
20 読み出し部
22 第3の比較部
60、60A コンピュータ
68、68A 共通要素抽出プログラム
10, 10A, 50, 52 Common
Claims (7)
前記第1の要素と前記第2の要素とを前記第1の比較演算子及び前記第2の比較演算子により順次比較判定すると共に、前記第1の比較演算子及び前記第2の比較演算子による比較順序が前記第1の比較部と異なる第2の比較部と、
前記第1の比較部及び前記第2の比較部の何れかにより前記第1の要素と前記第2の要素とが同一でないと判定された場合に、前記第1の比較部及び前記第2の比較部の何れかが直前に実行した比較判定と同一の比較判定を先に行う比較部を前記第1の比較部及び前記第2の比較部から選択する選択部と、
前記第1の比較部及び前記第2の比較部の何れかにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、当該同一と判定された同一要素を出力する出力部と、
前記出力部が前記同一要素を出力した場合は、前記第1のデータ源及び前記第2のデータ源から次の要素を各々読み出すと共に、前記選択部により前記第1の比較部及び前記第2の比較部のうち一方の比較部が選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち一方のデータ源から次の要素を読み出し、前記選択部により前記第1の比較部及び前記第2の比較部のうち他方の比較部が選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち他方のデータ源から次の要素を読み出す読み出し部と、
を含む共通要素抽出装置。 A first comparison operation of a first element read from a first data source including a plurality of aligned elements and a second element read from a second data source including a plurality of aligned elements A first comparison unit for sequentially comparing and determining a child and a second comparison operator different from the first comparison operator;
The first element and the second element are sequentially compared and determined by the first comparison operator and the second comparison operator, and the first comparison operator and the second comparison operator. A second comparison unit having a comparison order different from that of the first comparison unit;
When the first comparison unit and of the first element by one of the second comparing portion and the second element is not determined to be identical, the first comparing portion and the second A selection unit that selects, from the first comparison unit and the second comparison unit, a comparison unit that performs the same comparison determination as the comparison determination performed immediately before by any of the comparison units;
When the first comparison unit and the second comparison unit determine that the first element and the second element are the same, the same element determined to be the same is output. An output unit to
When the output unit outputs the same element, the next element is read from each of the first data source and the second data source, and the first comparison unit and the second comparison unit are read by the selection unit. When one of the comparison units is selected, the next element is read from one of the first data source and the second data source, and the first comparison is performed by the selection unit. Read out the next element from the other data source of the first data source and the second data source, when the other comparison unit is selected from the first data source and the second comparison unit,
A common element extraction device.
前記選択部は、前記第3の比較部により前記第1の要素と前記第2の要素とが同一でないと判定された場合に、前記第1の比較部又は前記第2の比較部を選択すると共に、前記第3の比較部により前記第1の要素と前記第2の要素とが同一であると判定された場合に、前記第3の比較部を選択し、
前記出力部は、前記第1の比較部、前記第2の比較部、及び前記第3の比較部から選択された比較部により前記第1の要素と前記第2の要素とが同一であると判定された場合に、当該同一と判定された同一要素を出力する
請求項1記載の共通要素抽出装置。 A third comparison operator for determining whether or not the first element and the second element are the same or not, the first comparison operator, and the second comparison; A third comparison unit for sequentially comparing and comparing the first element and the second element by one of the operators;
The selection unit may select the when the third the first element by the comparison unit of the said second element is determined not to be identical, the first comparing portion or the second comparing unit And when the third comparison unit determines that the first element and the second element are the same, the third comparison unit is selected,
In the output unit, the first element and the second element are the same by a comparison unit selected from the first comparison unit, the second comparison unit, and the third comparison unit. The common element extraction device according to claim 1, wherein when it is determined, the same element determined to be the same is output.
請求項3記載の共通要素抽出装置。 The plurality of common element extractions so that the same element output from the previous common element extraction apparatus and the element output from the data source are input to the second and subsequent stages of the common element extraction apparatus The common element extraction device according to claim 3, wherein the devices are connected in multiple stages.
請求項3記載の共通要素抽出装置。 A plurality of the common element extraction devices to which elements from two data sources are input in the first stage are provided, and output from the two common element extraction apparatuses in the previous stage to the common element extraction apparatuses in the second and subsequent stages, respectively. The common element extraction device according to claim 3, wherein a plurality of the common element extraction devices are connected in a multi-stage so that the same element is input.
整列済みの複数の要素を含む第1のデータ源から読み出した第1の要素と、整列済みの複数の要素を含む第2のデータ源から読み出した第2の要素と、を第1の比較演算子及び前記第1の比較演算子と異なる第2の比較演算子により順次比較判定する第1の比較ステップと、
前記第1の要素と前記第2の要素とを前記第1の比較演算子及び前記第2の比較演算子により順次比較判定すると共に、前記第1の比較演算子及び前記第2の比較演算子による比較順序が前記第1の比較ステップと異なる第2の比較ステップと、
前記第1の比較ステップ及び前記第2の比較ステップの何れかにより前記第1の要素と前記第2の要素とが同一でないと判定された場合に、前記第1の比較ステップ及び前記第2の比較ステップの何れかが直前に実行した比較判定と同一の比較判定を先に行う比較ステップを前記第1の比較ステップ及び前記第2の比較ステップから選択する選択ステップと、
前記第1の比較ステップ及び前記第2の比較ステップの何れかにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、当該同一と判定された同一要素を出力する出力ステップと、
前記出力ステップが前記同一要素を出力した場合は、前記第1のデータ源及び前記第2のデータ源から次の要素を各々読み出すと共に、前記選択ステップにより前記第1の比較ステップ及び前記第2の比較ステップのうち一方の比較ステップが選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち一方のデータ源から次の要素を読み出し、前記選択ステップにより前記第1の比較ステップ及び前記第2の比較ステップのうち他方の比較ステップが選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち他方のデータ源から次の要素を読み出す読み出しステップと、
を含む処理を実行する共通要素抽出方法。 Computer
A first comparison operation of a first element read from a first data source including a plurality of aligned elements and a second element read from a second data source including a plurality of aligned elements A first comparison step of sequentially comparing and determining by a child and a second comparison operator different from the first comparison operator;
The first element and the second element are sequentially compared and determined by the first comparison operator and the second comparison operator, and the first comparison operator and the second comparison operator. A second comparison step in which the comparison order by is different from the first comparison step;
When the one of the first comparing step and the second comparing step and said first element and said second element is determined not to be identical, the first comparing step and the second A selection step for selecting, from the first comparison step and the second comparison step, a comparison step for performing the same comparison determination as the comparison determination performed immediately before any of the comparison steps;
When the first element and the second element are determined to be the same in any of the first comparison step and the second comparison step, the same element determined to be the same is output. An output step to
When the output step outputs the same element, the next element is read from each of the first data source and the second data source, and the first comparison step and the second When one of the comparison steps is selected, the next element is read from one of the first data source and the second data source, and the first comparison is performed by the selection step. A step of reading the next element from the other data source of the first data source and the second data source when the other comparison step of the step and the second comparison step is selected;
Common element extraction method for executing processing including.
整列済みの複数の要素を含む第1のデータ源から読み出した第1の要素と、整列済みの複数の要素を含む第2のデータ源から読み出した第2の要素と、を第1の比較演算子及び前記第1の比較演算子と異なる第2の比較演算子により順次比較判定する第1の比較ステップと、
前記第1の要素と前記第2の要素とを前記第1の比較演算子及び前記第2の比較演算子により順次比較判定すると共に、前記第1の比較演算子及び前記第2の比較演算子による比較順序が前記第1の比較ステップと異なる第2の比較ステップと、
前記第1の比較ステップ及び前記第2の比較ステップの何れかにより前記第1の要素と前記第2の要素とが同一でないと判定された場合に、前記第1の比較ステップ及び前記第2の比較ステップの何れかが直前に実行した比較判定と同一の比較判定を先に行う比較ステップを前記第1の比較ステップ及び前記第2の比較ステップから選択する選択ステップと、
前記第1の比較ステップ及び前記第2の比較ステップの何れかにより前記第1の要素と前記第2の要素とが同一であると判定された場合に、当該同一と判定された同一要素を出力する出力ステップと、
前記出力ステップが前記同一要素を出力した場合は、前記第1のデータ源及び前記第2のデータ源から次の要素を各々読み出すと共に、前記選択ステップにより前記第1の比較ステップ及び前記第2の比較ステップのうち一方の比較ステップが選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち一方のデータ源から次の要素を読み出し、前記選択ステップにより前記第1の比較ステップ及び前記第2の比較ステップのうち他方の比較ステップが選択された場合は、前記第1のデータ源及び前記第2のデータ源のうち他方のデータ源から次の要素を読み出す読み出しステップと、
を含む処理を実行させるための共通要素抽出プログラム。 On the computer,
A first comparison operation of a first element read from a first data source including a plurality of aligned elements and a second element read from a second data source including a plurality of aligned elements A first comparison step of sequentially comparing and determining by a child and a second comparison operator different from the first comparison operator;
The first element and the second element are sequentially compared and determined by the first comparison operator and the second comparison operator, and the first comparison operator and the second comparison operator. A second comparison step in which the comparison order by is different from the first comparison step;
When the one of the first comparing step and the second comparing step and said first element and said second element is determined not to be identical, the first comparing step and the second A selection step for selecting, from the first comparison step and the second comparison step, a comparison step for performing the same comparison determination as the comparison determination performed immediately before any of the comparison steps;
When the first element and the second element are determined to be the same in any of the first comparison step and the second comparison step, the same element determined to be the same is output. An output step to
When the output step outputs the same element, the next element is read from each of the first data source and the second data source, and the first comparison step and the second When one of the comparison steps is selected, the next element is read from one of the first data source and the second data source, and the first comparison is performed by the selection step. A step of reading the next element from the other data source of the first data source and the second data source when the other comparison step of the step and the second comparison step is selected;
Common element extraction program for executing processing including
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012077498A JP5862418B2 (en) | 2012-03-29 | 2012-03-29 | Common element extraction device, common element extraction method, and common element extraction program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012077498A JP5862418B2 (en) | 2012-03-29 | 2012-03-29 | Common element extraction device, common element extraction method, and common element extraction program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2013206364A JP2013206364A (en) | 2013-10-07 |
JP5862418B2 true JP5862418B2 (en) | 2016-02-16 |
Family
ID=49525331
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012077498A Active JP5862418B2 (en) | 2012-03-29 | 2012-03-29 | Common element extraction device, common element extraction method, and common element extraction program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5862418B2 (en) |
-
2012
- 2012-03-29 JP JP2012077498A patent/JP5862418B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2013206364A (en) | 2013-10-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9070048B2 (en) | Method and apparatus for automatically identifying a representative image for an image group | |
JP6300710B2 (en) | Change impact analysis apparatus, change impact analysis method and program | |
JP6245573B2 (en) | Method for obtaining execution frequency information of execution path on control flow graph, computer for obtaining the information, and computer program thereof | |
JP2006139427A (en) | Same subgraph detection device of data flow graph, high order synthesizer, method of detecting same subgraph of data flow graph, same subgraph detection control program of data flow graph and readable recording medium | |
US20200012250A1 (en) | Program editing device, program editing method, and computer readable medium | |
JP5862418B2 (en) | Common element extraction device, common element extraction method, and common element extraction program | |
JP2013156696A (en) | Clustering device, method and program | |
JP6648549B2 (en) | Mutation information processing apparatus, method and program | |
KR101660584B1 (en) | Method and apparatus for processing graph compression | |
JP2017151986A (en) | Data extraction device and method | |
JP2016091488A (en) | Data sorting method and program | |
JP5429164B2 (en) | Finite automaton generation system | |
Mróz | Effective nondeterministic positive definiteness test for unidiagonal integral matrices | |
CN110837372B (en) | Method, apparatus, medium, and device for clearing confusion of assembly code | |
JP7310908B2 (en) | Data expansion device, method and program | |
JP2007133576A (en) | Sorting method and program | |
JP7151515B2 (en) | Sorting method, sorting program and sorting device | |
WO2016013175A1 (en) | Text processing system, text processing method, and text processing program | |
CN110990349A (en) | Unbalanced log oversampling method in intelligent system security system | |
US20230401263A1 (en) | Secret grouping apparatus, secret grouping system, secret grouping method, and program | |
JP2013156698A (en) | Clustering device, method, and program | |
JP2009199439A (en) | Merge sort processing method, merge sort processing device, and merge sort processing program | |
KR102380437B1 (en) | Method for optimizing performance of algorithm using precision scaling | |
JP2012235289A (en) | Compression apparatus, compression method, compression program and decompression apparatus | |
KR101547019B1 (en) | Method and computer system for extracting longest common sub-sequence |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20150106 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20150824 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20150901 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20151102 |
|
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: 20151201 |
|
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: 5862418 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |