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 PDF

Info

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
Application number
JP2012077498A
Other languages
Japanese (ja)
Other versions
JP2013206364A (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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2012077498A priority Critical patent/JP5862418B2/en
Publication of JP2013206364A publication Critical patent/JP2013206364A/en
Application granted granted Critical
Publication of JP5862418B2 publication Critical patent/JP5862418B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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 step 200, the counter i for the data source X and the counter j for the data source Y are initialized to ‘0’.

ステップ202では、カウンタiがnより小さく且つカウンタjがmより小さいか否かを判定する。そして、カウンタiがnより小さく且つカウンタjがmより小さい場合にはステップ204へ移行し、そうでない場合には本ルーチンを終了する。   In step 202, it is determined whether the counter i is smaller than n and the counter j is smaller than m. If the counter i is smaller than n and the counter j is smaller than m, the routine proceeds to step 204. Otherwise, the routine is terminated.

ステップ204では、X[i]がY[j]より小さいか否かを判定し、X[i]がY[j]より小さい場合はステップ212へ移行してカウンタiをインクリメントする。一方、X[i]がY[j]より小さくない場合には、ステップ206へ移行する。   In step 204, it is determined whether X [i] is smaller than Y [j]. If X [i] is smaller than Y [j], the process proceeds to step 212 and the counter i is incremented. On the other hand, if X [i] is not smaller than Y [j], the process proceeds to step 206.

ステップ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 step 206, it is determined whether X [i] is larger than Y [j]. If X [i] is larger than Y [j], the process proceeds to step 214 and the counter j is incremented. On the other hand, when X [i] is not larger than Y [j], that is, when X [i] and Y [j] are the same, the process proceeds to step 208 to output data X [i]. Then, the process proceeds to step 210 to increment the counter i, and then proceeds to step 214 to increment the counter j.

例えば図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 steps 204 and 206 are repeated, and the processing time increases. For example, as shown in FIG. 40, in the range S1 in which the element of the data source X is smaller than the element of the data source Y, only one comparison determination process in step 204 shown in FIG. On the other hand, in the range S2 in which the element of the data source X is not smaller than the element of the data source Y, two comparison determination processes in steps 204 and 206 shown in FIG.

特表2007−531948号公報Special table 2007-53948 publication

"Fast Sorted-Set Intersection using SIMD Instructions.", B.Schlegel,T.Willhalm,W.Lehner, In Proceedings of the Second International Workshop on Accelerating Data Management Systems Using Modern Processor and Storage Architectures (ADMS 2011), September, 2011, Seattle, WA, USA"Fast Sorted-Set Intersection using SIMD Instructions.", B. Schlegel, T. Willhalm, W. Lehner, In Proceedings of the Second International Workshop on Accelerating Data Management Systems Using Modern Processor and Storage Architectures (ADMS 2011), September, 2011 , Seattle, WA, USA

このように、従来の図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.

第1実施形態に係る共通要素抽出装置の機能ブロック図である。It is a functional block diagram of the common element extraction device concerning a 1st embodiment. 第1実施形態に係る共通要素抽出装置として機能するコンピュータの概略ブロック図である。It is a schematic block diagram of the computer which functions as a common element extraction device concerning a 1st embodiment. 第1実施形態に係る共通要素抽出処理の一例を示すフローチャートである。It is a flowchart which shows an example of the common element extraction process which concerns on 1st Embodiment. データ源の一例を示す図である。It is a figure which shows an example of a data source. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. 共通要素抽出処理の比較処理の処理順序について説明するための図である。It is a figure for demonstrating the process order of the comparison process of a common element extraction process. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. 共通要素抽出処理の比較処理の処理順序について説明するための図である。It is a figure for demonstrating the process order of the comparison process of a common element extraction process. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. 共通要素抽出処理の比較処理の処理順序について説明するための図である。It is a figure for demonstrating the process order of the comparison process of a common element extraction process. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. 共通要素抽出処理の比較処理の処理順序について説明するための図である。It is a figure for demonstrating the process order of the comparison process of a common element extraction process. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. 共通要素抽出処理の比較処理の処理順序について説明するための図である。It is a figure for demonstrating the process order of the comparison process of a common element extraction process. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. 共通要素抽出処理の比較処理の処理順序について説明するための図である。It is a figure for demonstrating the process order of the comparison process of a common element extraction process. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. データ源の各要素の比較結果について説明するための図である。It is a figure for demonstrating the comparison result of each element of a data source. データ源の共通要素の抽出結果について説明するための図である。It is a figure for demonstrating the extraction result of the common element of a data source. 比較装置Sの概念図である。2 is a conceptual diagram of a comparison device S. FIG. 比較装置Tの概念図である。2 is a conceptual diagram of a comparison device T. FIG. データ源の各要素の比較回数について説明するための図である。It is a figure for demonstrating the frequency | count of comparison of each element of a data source. 第2実施形態に係る共通要素抽出装置の機能ブロック図である。It is a functional block diagram of the common element extraction device concerning a 2nd embodiment. 第2実施形態に係る共通要素抽出装置として機能するコンピュータの概略ブロック図である。It is a schematic block diagram of the computer which functions as a common element extraction device concerning a 2nd embodiment. 第2実施形態に係る共通要素抽出処理の一例を示すフローチャートである。It is a flowchart which shows an example of the common element extraction process which concerns on 2nd Embodiment. 第2実施形態に係る共通要素抽出処理の一例を示すフローチャートである。It is a flowchart which shows an example of the common element extraction process which concerns on 2nd Embodiment. 第3実施形態に係る共通要素抽出装置の機能ブロック図である。It is a functional block diagram of the common element extraction apparatus which concerns on 3rd Embodiment. 第3実施形態に係る共通要素抽出装置の機能ブロック図である。It is a functional block diagram of the common element extraction apparatus which concerns on 3rd Embodiment. データ源の各要素の1処理当たりの比較回数の期待値の実験結果を示す図である。It is a figure which shows the experimental result of the expected value of the frequency | count of comparison per process of each element of a data source. データ源の各要素の要素数と共通要素抽出処理の計算時間との関係を示す図である。It is a figure which shows the relationship between the element number of each element of a data source, and the calculation time of a common element extraction process. 実験に用いたデータ源の一例を示す図である。It is a figure which shows an example of the data source used for experiment. データ源の各要素のブロック長と共通要素抽出処理の計算時間との関係を示す図である。It is a figure which shows the relationship between the block length of each element of a data source, and the calculation time of a common element extraction process. データ源の各要素のブロック長について説明するための図である。It is a figure for demonstrating the block length of each element of a data source. 図35の一部拡大図である。FIG. 36 is a partially enlarged view of FIG. 35. 従来例に係る共通要素抽出処理の一例を示すフローチャートである。It is a flowchart which shows an example of the common element extraction process which concerns on a prior art example. 従来例に係るデータ源の共通要素の抽出結果について説明するための図である。It is a figure for demonstrating the extraction result of the common element of the data source which concerns on a prior art example. 従来例に係るデータ源の各要素の比較回数について説明するための図である。It is a figure for demonstrating the frequency | count of comparison of each element of the data source which concerns on a prior art example.

以下、図面を参照して開示の技術の実施形態の一例を詳細に説明する。   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 element extraction apparatus 10 according to the first embodiment. The common element extraction apparatus 10 is an apparatus that extracts the same element by sequentially comparing each element of two arranged data sources.

図1に示すように、共通要素抽出装置10は、第1の比較部12、第2の比較部14、選択部16、出力部18、及び読み出し部20を備えている。   As shown in FIG. 1, the common element extraction apparatus 10 includes a first comparison unit 12, a second comparison unit 14, a selection unit 16, an output unit 18, and a reading unit 20.

第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 first comparison unit 12 includes a first element X [i] read from a first data source X including a plurality of aligned elements and a second data source Y including a plurality of aligned elements. The read second element Y [j] is sequentially compared and determined by the first comparison operator and the second comparison operator. Note that i = 0 to n, n is a natural number, j = 0 to m, and m is a natural number. In the present embodiment, the first comparison operator and the second comparison operator are comparison operators that perform magnitude comparison, and “<” and “>” are used as an example.

第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 second comparison unit 14 sequentially compares and determines the first element X [i] and the second element Y [j] using the first comparison operator and the second comparison operator. The second comparison unit 14 is different from the first comparison unit 12 in the comparison order by the first comparison operator and the second comparison operator. That is, when the first comparison unit 12 compares and determines the first element X [i] and the second element Y [j] in the order of the first comparison operator and the second comparison operator, The second comparison unit 14 compares and determines the first element X [i] and the second element in the order of the second comparison operator and the first comparison operator.

選択部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 selection unit 16 first performs the same comparison determination as the comparison determination performed immediately before. The comparison unit to be performed is selected from the first comparison unit 12 and the second comparison unit 14.

出力部18は、第1の比較部12及び第2の比較部14の何れかにより第1の要素X[i]と第2の要素Y[j]とが同一であると判定された場合に、当該同一と判定された同一要素を出力する。   The output unit 18 determines that the first element X [i] and the second element Y [j] are the same by either the first comparison unit 12 or the second comparison unit 14. The same element determined to be the same is output.

読み出し部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 reading unit 20 includes a first reading unit 20X and a second reading unit 20Y. When the output unit 18 outputs the same element, the first reading unit 20X reads the next element from the first data source X, and when the first comparison unit 12 is selected by the selection unit 16, The next element is read from the first data source X. When the output unit 18 outputs the same element, the second reading unit 20Y reads the next element from the second data source Y, and when the second comparison unit 14 is selected by the selection unit 16, The next element is read from the second data source Y.

共通要素抽出装置10は、例えば図2に示すコンピュータ60で実現することができる。コンピュータ60はCPU62、メモリ64、不揮発性の記憶部66を備え、これらはバス67を介して互いに接続されている。   The common element extraction apparatus 10 can be realized by, for example, a computer 60 shown in FIG. The computer 60 includes a CPU 62, a memory 64, and a nonvolatile storage unit 66, and these are connected to each other via a bus 67.

また、記憶部66はHDD(Hard Disk Drive)やフラッシュメモリ等によって実現できる。記録媒体としての記憶部66には、コンピュータ60を共通要素抽出装置10として機能させるための共通要素抽出プログラム68が記憶されている。CPU62は、共通要素抽出プログラム68を記憶部66から読み出してメモリ64に展開し、共通要素抽出プログラム68が有するプロセスを順次実行する。   The storage unit 66 can be realized by an HDD (Hard Disk Drive), a flash memory, or the like. A storage unit 66 as a recording medium stores a common element extraction program 68 for causing the computer 60 to function as the common element extraction device 10. The CPU 62 reads the common element extraction program 68 from the storage unit 66 and expands it in the memory 64, and sequentially executes the processes of the common element extraction program 68.

共通要素抽出プログラム68は、第1の比較プロセス70、第2の比較プロセス72、選択プロセス74、出力プロセス76、第1の読み出しプロセス78、及び第2の読み出しプロセス80を有する。   The common element extraction program 68 includes a first comparison process 70, a second comparison process 72, a selection process 74, an output process 76, a first read process 78, and a second read process 80.

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 CPU 62 operates as the first comparison unit 12 illustrated in FIG. 1 by executing the first comparison process 70. Further, the CPU 62 operates as the second comparison unit 14 illustrated in FIG. 1 by executing the second comparison process 72. Further, the CPU 62 operates as the selection unit 16 illustrated in FIG. 1 by executing the selection process 74. The CPU 62 operates as the output unit 18 illustrated in FIG. 1 by executing the output process 76. The CPU 62 operates as the first reading unit 20X illustrated in FIG. 1 by executing the first reading process 78. The CPU 62 operates as the second reading unit 20Y illustrated in FIG. 1 by executing the second reading process 80.

これにより、共通要素抽出プログラム68を実行したコンピュータ60が、共通要素抽出装置10として機能することになる。なお、共通要素抽出プログラム68は開示の技術における共通要素抽出プログラムの一例である。   As a result, the computer 60 that has executed the common element extraction program 68 functions as the common element extraction apparatus 10. The common element extraction program 68 is an example of a common element extraction program in the disclosed technology.

なお、共通要素抽出装置10は、例えば半導体集積回路、より詳しくはASIC(Application Specific Integrated Circuit)等で実現することも可能である。   Note that the common element extraction apparatus 10 can be realized by, for example, a semiconductor integrated circuit, more specifically, an ASIC (Application Specific Integrated Circuit) or the like.

次に第1実施形態の作用を説明する。共通要素抽出装置10に対して共通要素抽出処理の実行が指示されると、図3に示す共通要素抽出処理が実行される。なお、本実施形態では、一例として第1の比較演算子を“<”、第2の比較演算子を“>”とする。   Next, the operation of the first embodiment will be described. When the common element extraction apparatus 10 is instructed to execute the common element extraction process, the common element extraction process shown in FIG. 3 is executed. In the present embodiment, as an example, the first comparison operator is “<” and the second comparison operator is “>”.

図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 step 100, the first reading unit 20X initializes the counter i for the data source X to “0”, and the second reading unit 20Y sets the counter j for the data source Y to “0”. Initialize to.

ステップ102では、第1の読み出し部20Xが、カウンタiがnより小さいか否かを判定すると共に、第2の読み出し部20Yが、カウンタjがmより小さいか否かを判定する。そして、カウンタiがnより小さく且つカウンタjがmより小さい場合にはステップ104へ移行し、カウンタiがn以上又はカウンタjがm以上となった場合には、本ルーチンを終了する。すなわち、データ源X及びデータ源Yの少なくとも一方から全ての要素を読み出した場合には本ルーチンを終了する。   In step 102, the first reading unit 20X determines whether or not the counter i is smaller than n, and the second reading unit 20Y determines whether or not the counter j is smaller than m. If the counter i is smaller than n and the counter j is smaller than m, the routine proceeds to step 104. If the counter i is n or more or the counter j is m or more, this routine is terminated. That is, when all the elements are read from at least one of the data source X and the data source Y, this routine is finished.

ステップ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 step 104, the first reading unit 20X reads the first element X [i] from the data source X, and the second reading unit 20Y reads the second element Y [j] from the data source Y. . Then, the first comparison unit 12 determines whether or not X [i] is smaller than Y [j] by the first comparison operator “<”, and the first element X [i] is the second If it is not smaller than the element Y [j], the routine proceeds to step 106. On the other hand, when the first element X [i] is smaller than the second element Y [j], the selection unit 16 proceeds to Step 112.

ステップ112では、第1の読み出し部20Xが、カウンタiをインクリメントする。   In step 112, the first reading unit 20X increments the counter i.

ステップ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 step 106, the first comparison unit 12 determines whether or not the first element X [i] is greater than the second element Y [j] by the second comparison operator “>”, If the first element X [i] is not larger than the second element Y [j], the process proceeds to step 108. On the other hand, when the first element X [i] is larger than the second element Y [j], the selection unit 16 proceeds to Step 114.

ステップ104で第1の要素X[i]が第2の要素Y[j]より小さくないと判定され、且つ、ステップ106で第1の要素X[i]が第2の要素Y[j]より大きくないと判定された場合、第1の要素X[i]と第2の要素Y[j]は同一である。   In step 104, it is determined that the first element X [i] is not smaller than the second element Y [j], and in step 106, the first element X [i] is greater than the second element Y [j]. When it is determined that it is not large, the first element X [i] and the second element Y [j] are the same.

従って、ステップ108では、出力部18が、第1の要素X[i](=第2の要素Y[j])を出力する。   Accordingly, in step 108, the output unit 18 outputs the first element X [i] (= second element Y [j]).

ステップ110では、第1の読み出し部20Xがカウンタiをインクリメントする。そして、選択部16がステップ114へ移行させる。   In step 110, the first reading unit 20X increments the counter i. Then, the selection unit 16 shifts to step 114.

ステップ114では、第2の読み出し部20Yがカウンタjをインクリメントする。   In step 114, the second reading unit 20Y increments the counter j.

ステップ116では、ステップ102と同様に、第1の読み出し部20Xが、カウンタiがnより小さいか否かを判定すると共に、第2の読み出し部20Yが、カウンタjがmより小さいか否かを判定する。そして、カウンタiがnより小さく且つカウンタjがmより小さい場合にはステップ118へ移行し、カウンタiがn以上又はカウンタjがm以上となった場合には、本ルーチンを終了する。   In step 116, as in step 102, the first reading unit 20X determines whether or not the counter i is smaller than n, and the second reading unit 20Y determines whether or not the counter j is smaller than m. judge. When the counter i is smaller than n and the counter j is smaller than m, the routine proceeds to step 118, and when the counter i is n or more or the counter j is m or more, this routine is finished.

ステップ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 step 118, the second comparison unit 14 performs the same comparison determination as in step 106. That is, the second comparison unit 12 determines whether or not the first element X [i] is greater than the second element Y [j] by the second comparison operator “>”. If the first element X [i] is not larger than the second element Y [j], the process proceeds to step 120. On the other hand, when the first element X [i] is larger than the second element Y [j], the selection unit 16 proceeds to Step 114.

ステップ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 step 120, the second comparison unit 14 performs the same comparison determination as in step 104. That is, the second comparison unit 14 determines whether the first element X [i] is smaller than the second element Y [j] by the first comparison operator “<”. If the first element X [i] is not smaller than the second element Y [j], the process proceeds to step 122. On the other hand, when the first element X [i] is smaller than the second element Y [j], the selection unit 16 proceeds to Step 112.

ステップ118で第1の要素X[i]が第2の要素Y[j]より大きくないと判定され、且つ、ステップ120で第1の要素X[i]が第2の要素Y[j]より小さくないと判定された場合、第1の要素X[i]と第2の要素Y[j]は同一である。   In step 118, it is determined that the first element X [i] is not greater than the second element Y [j], and in step 120, the first element X [i] is greater than the second element Y [j]. When it is determined that it is not small, the first element X [i] and the second element Y [j] are the same.

従って、ステップ122では、出力部18が、第1の要素X[i](=第2の要素[j])を出力する。   Accordingly, in step 122, the output unit 18 outputs the first element X [i] (= second element [j]).

ステップ124では、第2の読み出し部20Yがカウンタjをインクリメントする。そして、選択部16がステップ112へ移行させる。   In step 124, the second reading unit 20Y increments the counter j. Then, the selection unit 16 shifts to step 112.

このように、ステップ104で第1の要素X[i]が第2の要素Y[j]より小さいと判定された場合は、選択部16は、その後再びステップ104の比較判定が行われるように、ステップ112へ移行させる。   As described above, when it is determined in step 104 that the first element X [i] is smaller than the second element Y [j], the selection unit 16 performs the comparison determination in step 104 again thereafter. , The process proceeds to step 112.

また、ステップ106で第1の要素X[i]が第2の要素Y[j]より大きいと判定された場合は、選択部16は、その後ステップ106と同様の比較判定を行うステップ118の比較判定が行われるように、ステップ114へ移行させる。   If it is determined in step 106 that the first element X [i] is greater than the second element Y [j], the selection unit 16 performs the comparison determination similar to step 106 after that. The process proceeds to step 114 so that the determination is made.

また、ステップ118で第1の要素X[i]が第2の要素Y[j]より大きいと判定された場合は、選択部16は、その後再びステップ118の比較判定が行われるように、ステップ114へ移行させる。   If it is determined in step 118 that the first element X [i] is greater than the second element Y [j], the selection unit 16 performs the step 118 so that the comparison determination in step 118 is performed again thereafter. 114.

また、ステップ120で第1の要素X[i]が第2の要素Y[j]より小さいと判定された場合は、選択部16は、その後ステップ120と同様の比較判定を行うステップ104の比較判定が行われるように、ステップ112へ移行させる。   If it is determined in step 120 that the first element X [i] is smaller than the second element Y [j], the selection unit 16 performs a comparison determination similar to step 120 thereafter. The process proceeds to step 112 so that the determination is made.

すなわち、選択部16は、第1の比較部12及び第2の比較部14によって第1の要素X[i]が第2の要素Y[j]と同一でないと判定された場合は、直前に実行した比較判定と同一の比較判定を先に行う比較部を第1の比較部12及び第2の比較部14から選択する。   In other words, the selection unit 16 immediately before the first comparison unit 12 and the second comparison unit 14 determines that the first element X [i] is not the same as the second element Y [j]. The first comparison unit 12 and the second comparison unit 14 select a comparison unit that performs the same comparison determination as the executed comparison determination first.

これにより、第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 step 104 is repeated by the first comparison unit 12. On the other hand, when the state where the first element X [i] is larger than the second element Y [j] continues, the comparison determination in step 118 is repeated by the second comparison unit 14. That is, the first comparison unit 12 performs the comparison determination twice in steps 104 and 106 only when the first element X [i] and the second element Y [j] are the same. Similarly, the second comparison unit 14 performs the comparison comparison twice in steps 118 and 120 only when the first element X [i] and the second element Y [j] are the same. .

次に、図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 first comparison unit 12 and the second comparison unit 14. Explain what will be done.

まず、図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 steps 104 and 106 are executed, it is determined that the first element X [0] and the second element Y [0] are the same, and the first element is the common element. Element X [0] = 1 is output.

そして、図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 steps 118 and 120 are executed, and it is determined that the first element X [1] is smaller than the second element Y [1].

次に、図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 step 104 is executed, and it is determined that the first element X [2] is smaller than the second element Y [1].

次に、図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 step 104 is executed, and it is determined that the first element X [3] is smaller than the second element Y [1].

次に、図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 step 104 is executed, and it is determined that the element of the data source X is smaller than the element of the data source Y.

次に、図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 steps 104 and 106 are executed, and it is determined that the first element X [5] is larger than the second element Y [1].

次に、図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 steps 118 and 120 are executed, it is determined that the first element X [5] is the same as the second element Y [2], and X [5] is used as a common element. = 9 is output.

次に、図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 steps 104 and 106 are executed, and it is determined that the first element X [6] is larger than the second element Y [3].

次に、図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 step 118 is executed, and it is determined that the first element X [6] is larger than the second element Y [4].

次に、図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 step 118 is executed, and it is determined that the first element X [6] is larger than the second element Y [5].

次に、図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 steps 118 and 120 are executed, it is determined that the first element X [6] is the same as the second element Y [6], and X [6] is used as a common element. = 14 is output.

以下同様の処理を繰り返すことにより、図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 steps 102 to 112 are performed between the first element X [i] of the data source X and the second element Y [j] of the data source Y as shown in FIG. 23. It can be said that the comparison apparatus S executes three types of processing a, b, and c depending on the magnitude relationship. That is, the first element X [i] of the data source X and the second element Y [j] of the data source Y are compared and determined by the first comparison operator “<”, and the first element X [i ] Is smaller than the second element Y [j], the next first element of the data source X is read as process a. If the first element X [i] is not smaller than the second element Y [j], the first element X [i] and the second element Y are further determined by the second comparison operator “>”. [J] is compared and determined. If the first element X [i] is larger than the second element Y [j], the next second element of the data source Y is read as a process b. On the other hand, when the first element X [i] is not larger than the second element Y [j], that is, when the first element X [i] is the same as the second element Y [j]. The first element X [i] (= second element Y [j]) is output as the process c. Then, the first element next to the data source X and the second element next to the data source Y are read.

また、図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 steps 114 to 124 include the first element X [i] of the data source X and the second element Y [j] of the data source Y as shown in FIG. 24. It can be said that the comparison device T executes three types of processing a, b, and c depending on the magnitude relationship. That is, the first element X [i] of the data source X and the second element Y [j] of the data source Y are compared and determined by the second comparison operator “>”, and the first element X [i ] Is larger than the second element Y [j], the next second element of the data source Y is read as a process b. If the first element X [i] is not larger than the second element Y [j], the first element X [i] and the second element Y are further determined by the first comparison operator “<”. [J] is compared and determined. Then, when the first element X [i] is smaller than the second element Y [j], the next first element of the data source X is read as the process a. On the other hand, when the first element X [i] is not smaller than the second element Y [j], that is, when the first element X [i] is the same as the second element Y [j]. The first element X [i] (= second element Y [j]) is output as the process c. Then, the first element next to the data source X and the second element next to the data source Y are read.

このように、第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 steps 104 and 106 executed by the first comparison unit 12 and the comparison determination process of steps 118 and 120 executed by the second comparison unit 14 are the first comparison operator “< "And the second comparison operator"> "are compared in the order of comparison determination processing. When the first comparison unit 12 and the second comparison unit 14 determine that the first element X [i] is not the same as the second element Y [j], the comparison determination performed immediately before A comparison unit that performs the same comparison determination is selected from the first comparison unit 12 and the second comparison unit 14.

これにより、第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 step 104 is repeated by the first comparison unit 12. On the other hand, when the state where the first element X [i] is larger than the second element Y [j] continues, the comparison determination process in step 118 is repeated by the second comparison unit 14. The first comparison unit 12 performs the comparison determination twice in steps 104 and 106 only when the first element X [i] and the second element Y [j] are the same. Similarly, the second comparison unit 14 performs the comparison comparison twice in steps 118 and 120 only when the first element X [i] and the second element Y [j] are the same. . For this reason, as shown in FIG. 25, in the range S1 in which the first element of the data source X is smaller than the second element of the data source Y, one comparison determination process of step 104 shown in FIG. The Further, in the continuous range T1 in which the element of the data source X is larger than the element of the data source Y, one comparison determination process of step 118 shown in FIG. 3 is executed. Therefore, for example, when extracting common elements of data sources that are biased in the appearance of elements such as the first element appears continuously and then the second element appears, useless comparison determination processing Can be reduced, and an increase in processing time can be suppressed.

(第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 element extraction device 10A according to the second embodiment. The common element extraction device 10A according to the second embodiment is different from the common element extraction device 10 according to the first embodiment in that a third comparison unit 22 is provided.

第3の比較部22は、第1の要素X[i]と第2の要素Y[j]とが同一であるか否か又は同一でないか否かを比較判定する第3の比較演算子と、第1の比較演算子又は第2の比較演算子と、により第1の要素X[i]と第2の要素Y[j]とを順次比較判定する。例えば第1の比較演算子を“<”、第2の比較演算子を“>”とした場合、第3の比較演算子は“=”が用いられる。   The third comparison unit 22 includes a third comparison operator that makes a comparison to determine whether or not the first element X [i] and the second element Y [j] are the same or not. The first element X [i] and the second element Y [j] are sequentially compared and determined by the first comparison operator or the second comparison operator. For example, when the first comparison operator is “<” and the second comparison operator is “>”, “=” is used as the third comparison operator.

選択部16は、第1の要素X[i]と第2の要素Y[j]とが同一であると判定されなかった場合に、第1の比較部12又は第2の比較部14を選択する。また、選択部16は、第3の比較部22により第1の要素X[i]と第2の要素Y[j]とが同一であると判定された場合に、第3の比較部22を選択する。   The selection unit 16 selects the first comparison unit 12 or the second comparison unit 14 when it is not determined that the first element X [i] and the second element Y [j] are the same. To do. In addition, when the third comparison unit 22 determines that the first element X [i] and the second element Y [j] are the same, the selection unit 16 selects the third comparison unit 22. select.

出力部18は、第1の比較部12、第2の比較部14、及び第3の比較部22から選択された比較部により第1の要素X[i]と第2の要素Y[j]とが同一であると判定された場合に、当該同一と判定された同一要素を出力する。   The output unit 18 outputs the first element X [i] and the second element Y [j] by the comparison unit selected from the first comparison unit 12, the second comparison unit 14, and the third comparison unit 22. Are determined to be the same, the same element determined to be the same is output.

共通要素抽出装置10Aは、例えば図27に示すコンピュータ60Aで実現することができる。コンピュータ60Aが図2に示すコンピュータ60と異なるのは、記憶部66に記憶された共通要素抽出プログラム68Aが第3の比較プロセス73を有する点である。CPU62は、第3の比較プロセス73を実行することで、図26に示す第3の比較部22として動作する。これにより、共通要素抽出プログラム68Aを実行したコンピュータ60Aが、共通要素抽出装置10Aとして機能することになる。なお、共通要素抽出プログラム68Aは開示の技術における共通要素抽出プログラムの一例である。   The common element extraction device 10A can be realized by, for example, a computer 60A shown in FIG. The computer 60A is different from the computer 60 shown in FIG. 2 in that the common element extraction program 68A stored in the storage unit 66 has a third comparison process 73. The CPU 62 operates as the third comparison unit 22 illustrated in FIG. 26 by executing the third comparison process 73. As a result, the computer 60A that has executed the common element extraction program 68A functions as the common element extraction apparatus 10A. The common element extraction program 68A is an example of a common element extraction program in the disclosed technology.

次に第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, steps 130 to 134 are added to the common element extraction process shown in FIG.

ステップ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 steps 102 and 116. That is, the first reading unit 20X determines whether the counter i is smaller than n, and the second reading unit 20Y determines whether the counter j is smaller than m. When the counter i is smaller than n and the counter j is smaller than m, the routine proceeds to step 132, and when the counter i is n or more or the counter j is m or more, this routine is finished. That is, when all the elements are read from at least one of the data source X and the data source Y, this routine is finished.

ステップ132では、第3の比較部22が、第3の比較演算子“=”により、X[i]がY[j]と同一であるか否かを判定する。そして、第1の要素X[i]が第2の要素Y[j]と同一である場合は、選択部16がステップ108へ移行させる。一方、第1の要素X[i]が第2の要素Y[j]と同一でない場合には、ステップ134へ移行する。   In step 132, the third comparison unit 22 determines whether X [i] is the same as Y [j] by the third comparison operator “=”. If the first element X [i] is the same as the second element Y [j], the selection unit 16 proceeds to step 108. On the other hand, if the first element X [i] is not the same as the second element Y [j], the process proceeds to step 134.

ステップ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 step 134, the third comparison unit 22 determines whether or not the first element X [i] is smaller than the second element Y [j] by the first comparison operator “<”. When the first element X [i] is smaller than the second element Y [j], the selection unit 16 proceeds to Step 112. On the other hand, when the first element X [i] is not smaller than the second element Y [j], the selection unit 16 proceeds to Step 114.

これにより、第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 step 132 is repeated by the third comparison unit 22. Therefore, when extracting common elements of data sources including those in which the first element and the second element are in the same state, wasteful comparison determination processing can be reduced and processing time increases. Can be suppressed.

なお、本実施形態では、第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 steps 104, 106, 118, and 120 are opposite to those in FIG. 28, and the comparison determination results in steps 104, 106, 118, 120, and 132 are determined. The branch destination is the reverse of FIG.

(第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 element extraction device 50 in which a plurality of common element extraction devices 10 are connected in multiple stages. In the same figure, the example which connected the common element extraction apparatus 10 in three steps was shown as an example. As shown in the figure, in the common element extraction apparatus 50, each element of the data sources D1 and D2 is input to the first-stage common element extraction apparatus. Further, the common element extraction apparatus 10 at the second stage receives the common elements (identical data) of the data sources D1 and D2 output from the common element extraction apparatus 10 at the first stage and the elements of the data source D3. . The common element extraction device 10 at the third stage receives the common elements of the data sources D1 to D3 and the element of the data source D4 output from the common element extraction apparatus 10 at the second stage.

このように、共通要素抽出装置50は、2段目以降の共通要素抽出装置10に、前段の共通要素抽出装置10から出力された同一要素と、データ源から出力された要素と、が入力されるように、複数の共通要素抽出装置10を多段接続した構成となっている。このように、2段目以降の共通要素抽出装置10の一方の入力には、前段の共通要素抽出装置10から出力された同一要素が入力されるため、要素数が少ない。このため、2段目以降の共通要素抽出装置10で比較するデータ源の要素数が偏るため、無駄な比較判定処理を更に少なくすることができ、処理時間が増大するのを更に抑制することができる。   In this way, the common element extraction apparatus 50 receives the same element output from the previous common element extraction apparatus 10 and the element output from the data source to the second and subsequent stages of the common element extraction apparatus 10. As described above, a plurality of common element extraction devices 10 are connected in multiple stages. Thus, since the same element output from the common element extraction apparatus 10 in the preceding stage is input to one input of the common element extraction apparatus 10 in the second and subsequent stages, the number of elements is small. For this reason, since the number of elements of the data source to be compared by the common element extraction apparatus 10 in the second and subsequent stages is biased, useless comparison determination processing can be further reduced, and increase in processing time can be further suppressed. it can.

また、図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 element extraction devices 10 are connected in multiple stages. In the common element extraction device 52 shown in the figure, each element of the data sources D1 and D2 is input to one common element extraction device 10 in the first stage. In addition, each element of the data sources D3 and D4 is input to the other common element extraction apparatus 10 in the first stage. The second-stage common element extraction apparatus 10 includes the common elements of the data sources D1 and D2 output from one common element extraction apparatus 10 in the first stage and the other common element extraction apparatus 10 in the first stage. And the common elements of the data sources D3 and D4 output from.

このように、共通要素抽出装置52は、1段目に2つのデータ源からの各要素が入力される共通要素抽出装置10が複数設けられている。そして、2段目の共通要素抽出装置10に、前段の2つの共通要素抽出装置10から各々出力された同一要素が各々入力されるように、複数の共通要素抽出装置10を多段接続した構成となっている。   Thus, the common element extraction device 52 is provided with a plurality of common element extraction devices 10 to which the respective elements from the two data sources are input in the first stage. A configuration in which a plurality of common element extraction devices 10 are connected in multiple stages so that the same elements output from the two common element extraction devices 10 in the previous stage are respectively input to the common element extraction device 10 in the second stage. It has become.

なお、上記では複数の共通要素抽出装置10を多段接続する場合について説明したが、複数の共通要素抽出装置10Aを多段接続した構成としてもよい。また、共通要素抽出装置10と共通要素抽出装置10Aが混在した構成としてもよい。   In the above description, a case where a plurality of common element extraction apparatuses 10 are connected in multiple stages has been described. However, a configuration in which a plurality of common element extraction apparatuses 10A are connected in multiple stages may be employed. Further, the common element extraction device 10 and the common element extraction device 10A may be mixed.

また、上記各実施形態では、データ源の各要素が昇順に整列済みの場合について説明したが、データ源の各要素が降順に整列済みであってもよい。また、一つのデータ源に同じ値の要素が含まれていても良い。   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 storage unit 66 in advance. However, the present invention is not limited to this. The image processing program according to the disclosed technology can be provided in a form recorded on a recording medium such as a CD-ROM or a DVD-ROM.

本明細書に記載された全ての文献、特許出願及び技術規格は、個々の文献、特許出願及び技術規格が参照により取り込まれることが具体的かつ個々に記された場合と同程度に、本明細書中に参照により取り込まれる。   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 1, wherein, when determined, the same element determined to be the same is output.
(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 appendix 3, which outputs the same element determined to be the same when it is determined.

以下、開示の技術の効果を確認するために実施された実験の結果を説明する。この実験では、図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 Pattern 4 was the smallest.

また、図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 step 118 of FIG. 3 is repeated.

また、図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 pattern 3 and pattern 4, particularly pattern 4, as compared with the conventional case.

10、10A、50、52 共通要素抽出装置
10A 共通要素抽出装置
12 第1の比較部
14 第2の比較部
16 選択部
18 出力部
20 読み出し部
22 第3の比較部
60、60A コンピュータ
68、68A 共通要素抽出プログラム
10, 10A, 50, 52 Common element extraction device 10A Common element extraction device 12 First comparison unit 14 Second comparison unit 16 Selection unit 18 Output unit 20 Reading unit 22 Third comparison unit 60, 60A Computers 68, 68A Common element extraction program

Claims (7)

整列済みの複数の要素を含む第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のデータ源のうち他方のデータ源から次の要素を読み出す読み出し部と、
を含む共通要素抽出装置。
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.
前記第1の要素と前記第2の要素とが同一であるか否か又は同一でないか否かを比較判定する第3の比較演算子と、前記第1の比較演算子及び前記第2の比較演算子のうち一方の比較演算子と、により前記第1の要素と前記第2の要素とを順次比較判定する第3の比較部をさらに備え、
前記選択部は、前記第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.
複数の前記請求項1又は請求項2記載の共通要素抽出装置を多段接続した共通要素抽出装置。   A common element extraction apparatus in which a plurality of the common element extraction apparatuses according to claim 1 or 2 are connected in multiple stages. 2段目以降の前記共通要素抽出装置に、前段の前記共通要素抽出装置から出力された前記同一要素と、データ源から出力された要素と、が入力されるように、複数の前記共通要素抽出装置を多段接続した
請求項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.
1段目に2つのデータ源からの各要素が入力される前記共通要素抽出装置が複数設けられ、2段目以降の前記共通要素抽出装置に、前段の2つの前記共通要素抽出装置から各々出力された前記同一要素が各々入力されるように、複数の前記共通要素抽出装置を多段接続した
請求項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
JP2012077498A 2012-03-29 2012-03-29 Common element extraction device, common element extraction method, and common element extraction program Active JP5862418B2 (en)

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)

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