Data sorting method and device based on digital integrated circuit, chip and equipment
By determining and updating the sequence of target symbols in a digital integrated circuit and moving other symbols to the corresponding position, the problem of low data sorting efficiency is solved, real-time statistics and sorting of data flows are realized, and data processing efficiency is improved.
Patent Information
- Application Number
- CN202310877762.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-17
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2043-07-17
AI Technical Summary
When the prior art uses digital integrated circuits to perform data processing, the data sorting efficiency is low, resulting in a long data processing time.
By determining the first sequence and the second sequence of multiple target symbols in the data stream, moving other symbols to corresponding positions, and updating the ordered sequences in combination with the statistical table, real-time statistics and sorting of the data stream are realized.
The data processing efficiency is improved, and the ordered sequence can be obtained at any time in the data stream, saving data processing time.
Smart Images

Figure CN119088845A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to data processing technology, and in particular to a data sorting method, device, chip and equipment based on digital integrated circuits. Background Art
[0002] In the process of data processing using digital integrated circuits, statistics and sorting of data (or symbols) is a very common application scenario. In these application scenarios, statistics and sorting often exist at the same time. Generally, the data (or symbols) are sorted according to a certain method based on the statistical results of the data (or symbols).
[0003] However, the above method takes a lot of time and has low data processing efficiency. Summary of the invention
[0004] The present application provides a data sorting method, device, chip and equipment based on digital integrated circuits to solve the problem of low efficiency in sorting data (or symbols) in the prior art.
[0005] In a first aspect, the present application provides a data sorting method based on a digital integrated circuit, comprising:
[0006] When sorting symbols in a data stream, for an i-th group of data in the data stream, determining a first sequence and a second sequence of multiple target symbols, the multiple target symbols being symbols in the i-th group of data, the first sequence being obtained by sorting the multiple target symbols according to the number of times they appear in a first group of data to an i-1th group of data in the data stream, and the second sequence being obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2;
[0007] According to the first sequence and the second sequence of the multiple target symbols, each other symbol in the first ordered sequence is moved to the corresponding first position to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting each symbol in the first group of data to the i-1th group of data in the data stream according to the number of occurrences, and the other symbols are symbols other than the multiple target symbols in the first ordered sequence;
[0008] According to the second sequence of the plurality of target symbols, each target symbol in the second ordered sequence is moved to a corresponding second position to obtain a target ordered sequence.
[0009] In a possible implementation manner, the step of moving each other symbol in the first ordered sequence to a corresponding first position according to the first sequence and the second sequence of the plurality of target symbols to obtain the second ordered sequence includes:
[0010] For each other symbol, based on the number of first symbols that appear less than the other symbols in the first sequence and the number of second symbols that appear less than the other symbols in the second sequence, the other symbols in the first ordered sequence need to be moved to the corresponding first position to obtain the second ordered sequence.
[0011] In a possible implementation, for each other symbol, according to the number of first symbols whose appearance times in the first sequence is less than that of the other symbol and the number of second symbols whose appearance times in the second sequence is less than that of the other symbol, moving the other symbols in the first ordered sequence to the corresponding first positions to obtain the second ordered sequence includes:
[0012] For each other symbol, calculating a first difference between the first number of symbols and the second number of symbols;
[0013] The other symbols in the first ordered sequence are moved in a target direction by the first difference positions so as to move the other symbols to the corresponding first positions, and the second ordered sequence is obtained. The target direction is the direction in which the number of occurrences of each symbol in the first ordered sequence decreases.
[0014] In a possible implementation manner, the step of moving each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of the plurality of target symbols to obtain a target ordered sequence includes:
[0015] Determine the position of the target symbol in the second ordered sequence as a second position;
[0016] For each second position, determining a third position in front of the second position along the target direction;
[0017] According to the character corresponding to the third position, the first ordered sequence and the second sequence, the target symbol corresponding to the second position is placed in the second position to obtain the target ordered sequence.
[0018] In a possible implementation, for each second position, determining a third position in front of the second position along the target direction includes:
[0019] For each second position, a position where the first other symbol appears is determined as the corresponding third position along the target direction.
[0020] In a possible implementation, placing the target symbol corresponding to the second position at the second position according to the character corresponding to the third position, the first ordered sequence, and the second sequence to obtain the target ordered sequence includes:
[0021] For each third position, determining a second difference between a position of a character corresponding to the third position in the first ordered sequence and the third position;
[0022] Determine a fourth position along the target direction that is the second difference position behind the third position;
[0023] determining a target value of the character at the fourth position in the first ordered sequence, the target value being the number of characters in the second sequence that appear less than the character;
[0024] Determining a target symbol corresponding to the third position according to the target value and the second sequence;
[0025] The target symbol corresponding to the third position is moved to the third position to obtain the target ordered sequence.
[0026] In a possible implementation, when sorting the symbols in the data stream, determining, for the i-th group of data in the data stream, a first sequence and a second sequence of multiple target symbols includes:
[0027] When sorting the symbols in the data stream, for the i-th group of data in the data stream, obtaining the number of first occurrences of the target symbol in the first group of data to the i-1-th group of data from a statistical table, wherein the statistical table is used to store the number of occurrences of each symbol in the first group of data to the i-1-th group of data;
[0028] For each target symbol, add the number of times the target symbol appears in the i-th group of data to the corresponding first number, to obtain the second number of times the target symbol appears in the first group of data to the i-th group of data;
[0029] According to the first order of each target symbol, a plurality of target symbols are bitonally sorted to obtain the first sequence;
[0030] According to the second number of each target symbol, a plurality of target symbols are binocularly sorted to obtain the second sequence.
[0031] In a second aspect, the present application provides a data sorting device based on a digital integrated circuit, comprising:
[0032] a determination module, configured to determine, when sorting symbols in a data stream, for an i-th group of data in the data stream, a first sequence and a second sequence of multiple target symbols, wherein the multiple target symbols are symbols in the i-th group of data, the first sequence is obtained by sorting the multiple target symbols according to the number of times they appear in a first group of data to an i-1th group of data in the data stream, and the second sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2;
[0033] a moving module, configured to move each other symbol in a first ordered sequence to a corresponding first position according to the first sequence and the second sequence of the multiple target symbols, to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting each symbol in the first group of data to the i-1th group of data in the data stream according to a number of occurrences, and the other symbols are symbols in the first ordered sequence other than the multiple target symbols;
[0034] The moving module is further used to move each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of the plurality of target symbols, so as to obtain a target ordered sequence.
[0035] In a possible implementation, the mobile module is specifically used to:
[0036] For each other symbol, based on the number of first symbols that appear less than the other symbol in the first sequence and the number of second symbols that appear less than the other symbol in the second sequence, the other symbols in the first ordered sequence need to be moved to the corresponding first position to obtain the second ordered sequence.
[0037] In a possible implementation, the mobile module is specifically used to:
[0038] For each other symbol, calculating a first difference between the first number of symbols and the second number of symbols;
[0039] The other symbols in the first ordered sequence are moved in a target direction by the first difference positions so as to move the other symbols to the corresponding first positions, and the second ordered sequence is obtained. The target direction is a direction in which the number of occurrences of each symbol in the first ordered sequence decreases.
[0040] In a possible implementation, the mobile module is specifically used to:
[0041] Determine the position of the target symbol in the second ordered sequence as a second position;
[0042] For each second position, determining a third position in front of the second position along the target direction;
[0043] According to the character corresponding to the third position, the first ordered sequence and the second sequence, the target symbol corresponding to the second position is placed in the second position to obtain the target ordered sequence.
[0044] In a possible implementation, the mobile module is specifically used to:
[0045] For each second position, a position where the first other symbol appears is determined as the corresponding third position along the target direction.
[0046] In a possible implementation, the mobile module is specifically used to:
[0047] For each third position, determining a second difference between a position of a character corresponding to the third position in the first ordered sequence and the third position;
[0048] Determine a fourth position along the target direction that is the second difference position behind the third position;
[0049] determining a target value of the character at the fourth position in the first ordered sequence, the target value being the number of characters in the second sequence that appear less than the character;
[0050] Determining a target symbol corresponding to the third position according to the target value and the second sequence;
[0051] The target symbol corresponding to the third position is moved to the third position to obtain the target ordered sequence.
[0052] In a possible implementation, the determining module is specifically configured to:
[0053] When sorting the symbols in the data stream, for the i-th group of data in the data stream, obtaining the number of first occurrences of the target symbol in the first group of data to the i-1-th group of data from a statistical table, wherein the statistical table is used to store the number of occurrences of each symbol in the first group of data to the i-1-th group of data;
[0054] For each target symbol, add the number of times the target symbol appears in the i-th group of data to the corresponding first number, to obtain the second number of times the target symbol appears in the first group of data to the i-th group of data;
[0055] According to the first order of each target symbol, a plurality of target symbols are bitonally sorted to obtain the first sequence;
[0056] According to the second number of each target symbol, a plurality of target symbols are binocularly sorted to obtain the second sequence.
[0057] In a third aspect, the present application provides a chip, including a digital integrated circuit, wherein the digital integrated circuit is used to execute the method as described in any one of the first aspect and possible implementations.
[0058] In a fourth aspect, the present application provides an electronic device, including:
[0059] at least one processor; and
[0060] a memory communicatively coupled to the at least one processor;
[0061] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform a method as described in any one of the first aspect and possible implementation methods.
[0062] In a fifth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, a method as described in any one of the first aspect and various possible implementation methods is implemented.
[0063] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method as described in the first aspect and any one of the possible implementation methods.
[0064] The present application provides a data sorting method, device, chip and equipment based on digital integrated circuits. The data sorting method based on digital integrated circuits includes: when sorting symbols in a data stream, for the i-th group of data in the data stream, determining a first sequence and a second sequence of multiple target symbols; according to the first sequence and the second sequence of multiple target symbols, each other symbol in the first ordered sequence is moved to a corresponding first position to obtain a second ordered sequence; according to the second sequence of multiple target symbols, each target symbol in the second ordered sequence is moved to a corresponding second position to obtain a target ordered sequence. In this technical solution, after obtaining the i-th group of data, the first ordered sequence generated by the i-1-th group of data can be updated according to the target symbols included in the i-th group of data and the number of occurrences of each target symbol, so as to obtain a target ordered sequence, and the target ordered sequence is a sequence obtained by sorting the first group of data to the i-th group of data, so that the symbols in the data stream can be sorted while the data stream is obtained, that is, at any time when the data stream is counted, an ordered sequence can be obtained, and the ordered sequence is obtained by sorting the counted symbols, which can effectively save data processing time and improve data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0066] Figure 1a A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0067] Figure 1b A schematic diagram of a scenario of a data sorting method based on a digital integrated circuit provided in an embodiment of the present application;
[0068] Figure 2 A schematic diagram of a flow chart of a data sorting method based on a digital integrated circuit provided in an embodiment of the present application;
[0069] Figure 3 A schematic flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;
[0070] Figure 4 A schematic flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;
[0071] Figure 5a A schematic flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;
[0072] Figure 5bA schematic flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;
[0073] Figure 5c A schematic flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;
[0074] Figure 5d A schematic flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;
[0075] Figure 5e A schematic flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;
[0076] Figure 6 A schematic diagram of the structure of a data sorting device based on a digital integrated circuit provided in an embodiment of the present application;
[0077] Figure 7 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application.
[0078] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0079] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0080] It should be noted that the user information (including but not limited to user device information, user attribute information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0081] Next, the application scenario of this application is explained.
[0082] In the actual development of product projects, it is usually necessary to count and sort data (or symbols). For example, suppose a compression and decompression accelerator needs to be implemented on the product project. During use, the accelerator needs to count and sort the symbols to be compressed, and after sorting, perform Huffman encoding on them through a dynamic Huffman compression algorithm.
[0083] When using digital integrated circuits to implement statistics and sorting of data (or symbols), the existing technology mainly counts the data (or symbols), and after the statistics are completed, sorts the data (or symbols) according to a specific sorting algorithm to finally obtain an ordered sequence.
[0084] However, the above method implements statistics and sorting of data (or symbols) serially, that is, there is a sequence in the statistical processing and sorting processing of the data. Only after all the data (or symbols) contained in the data stream are counted, the data (or symbols) in the data stream can be sorted, resulting in a relatively large delay in the entire data processing (the time required from the start of data (or symbol) statistics to the completion of data (or symbol) sorting), and there is a problem of low data processing efficiency.
[0085] Based on this, the present application provides a data sorting method based on digital integrated circuits. The method can acquire data in the data stream and sort the acquired data in the data stream according to the symbols of each group of data in the data stream and the number of times each symbol appears, thereby realizing real-time statistics and sorting of the data stream.
[0086] Exemplarily, the above-mentioned data sorting method based on digital integrated circuit can be applied to Figure 1a In the electronic device shown, Figure 1a This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 1a The electronic device includes a chip 70 and a memory 702 , wherein the chip 70 includes a processor 701 and a communication interface 703 .
[0087] The above-mentioned data sorting method based on digital integrated circuit can be applied to chip 70, or implemented by chip 70, and processor 701 can be an integrated circuit chip with signal processing capability. In the implementation process, each step of the data sorting method based on digital integrated circuit can be completed by hardware integrated logic circuits in processor 701 or software instructions.
[0088] Specifically, the processor 701 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), a graphics processing unit (GPU), a field programmable gate array (FPGA), or one or more digital integrated circuits for controlling the execution of the program of the present application.
[0089] In the embodiment of the present application, the memory 702, the communication interface 703 and the memory 702 are coupled together via a system bus.
[0090] The memory 702 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 701. The processor 701 is used to execute the computer-executable instructions stored in the memory 702, thereby realizing the data sorting method based on digital integrated circuits provided in the embodiment of the present application.
[0091] Specifically, the processor 701 may obtain the data stream to be sorted through the communication interface 703, execute the above-mentioned data sorting method based on digital integrated circuits, and obtain the ordered sequence obtained by sorting.
[0092] Optionally, the ordered sequence may also be output via the communication interface 703 .
[0093] Further, the processor 701 can perform the above-mentioned data sorting method based on digital integrated circuits by referring to Figure 1b The scene diagram shown is Figure 1b A schematic diagram of a scenario of a data sorting method based on a digital integrated circuit provided in an embodiment of the present application. Figure 1b As shown, the data stream to be sorted includes n groups of data, namely the first group of data, the second group of data, the third group of data, ..., the i-th group of data, ..., the n-th group of data, and the electronic device obtains each group of data in the data stream in sequence.
[0094] Specifically, after acquiring the first set of data, the electronic device updates the initial ordered table according to the symbols in the first set of data and the number of times each symbol appears, and generates an ordered table 1 and an ordered sequence 1. The ordered table includes all symbols that may be included in the data stream and the number of times each symbol has appeared. The symbols in the ordered table are sorted according to the number of times they appear, and the number of times each symbol has appeared in the initial ordered table is 0.
[0095] Further, the electronic device obtains a second set of data, updates the ordered table 1 according to the symbols in the second set of data and the number of times each symbol appears, and generates an ordered table 2 and an ordered sequence 2. Further, the electronic device obtains a third set of data, updates the ordered table 2 according to the symbols in the third set of data and the number of times each symbol appears, and generates an ordered table 3 and an ordered sequence 3. And so on, until the nth set of data is obtained, the ordered table n-1 is updated according to the symbols in the nth set of data and the number of times each symbol appears, and an ordered table n and an ordered sequence n are generated, and the ordered sequence n is the ordered sequence generated by sorting the data stream.
[0096] It is understandable that the execution subject of the embodiment of the present application can be an electronic device, for example, a terminal device such as a computer or a tablet computer, or a server, for example, a background processing platform, etc. Therefore, the present embodiment is explained by collectively referring to the terminal device and the server as an electronic device, and whether the electronic device is specifically a terminal device or a server can be determined according to actual conditions.
[0097] The technical solution of the present application is described in detail below through specific embodiments.
[0098] It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0099] Figure 2 A flowchart of a data sorting method based on a digital integrated circuit provided in an embodiment of the present application. Figure 2 As shown, the data sorting method based on digital integrated circuit may include the following steps:
[0100] S21. When sorting symbols in a data stream, determine a first sequence and a second sequence of multiple target symbols for an i-th group of data in the data stream.
[0101] The execution subject of the embodiment of the present application may be an electronic device, or a data sorting device based on a digital integrated circuit provided in the electronic device. The data sorting device based on a digital integrated circuit may be implemented by software, or by a combination of software and hardware. For ease of understanding, the following description is made by taking the execution subject as an electronic device as an example.
[0102] In an embodiment of the present application, the electronic device can sequentially obtain each group of data in the data stream, each group of data includes multiple symbols, and when sorting the symbols in the data stream, after obtaining each group of data, the ordered sequence generated based on the previous group of data can be updated according to the symbols in the group of data and the number of times each symbol appears. In this way, after updating the ordered sequence generated from the penultimate group of data based on the last group of data in the data stream, the ordered sequence of the data stream can be obtained, and each symbol in the ordered sequence of the data stream is arranged according to the number of times each symbol appears in the data stream.
[0103] In this step, the multiple target symbols are symbols in the i-th group of data, the first sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-1th group of data in the data stream, and the second sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, and i is an integer greater than or equal to 2. That is, in addition to the first group of data, after the electronic device obtains the i-th group of data in the data stream, it can generate the first sequence and the second sequence of the i-th group of data based on the target symbol of the i-th group of data and the number of times the target symbol appears in the i-th group of data.
[0104] It should be understood that when i=2, the first sequence is obtained by sorting the target symbols according to the number of times they appear in the first data set of the data stream, and the second sequence is obtained by sorting the target symbols according to the number of times they appear in the first data set and the second data set.
[0105] In a possible implementation, a statistical table is pre-stored in the electronic device. When sorting symbols in a data stream, for the i-th group of data in the data stream, the first number of times a target symbol appears in the first group of data to the i-1th group of data can be obtained from the statistical table, and the number of times the target symbol appears in the i-th group of data is added to the corresponding first number to obtain the second number of times the target symbol appears in the first group of data to the i-th group of data. Further, according to the first number of each target symbol, multiple target symbols are sorted to obtain a first sequence; according to the second number of each target symbol, multiple target symbols are sorted to obtain a second sequence.
[0106] Exemplarily, the above-mentioned sorting method can be a bitonic sorting method, or can be other sorting methods existing in the prior art, which can be determined according to actual needs and will not be described in detail here.
[0107] The statistical table is used to count the number of times each symbol appears in the statistical data stream. For example, before receiving the i-th group of data, the statistical table is used to indicate the number of times all possible symbols appearing in the data stream appear in the first group of data to the i-1th group of data. Assuming that the number of times symbol B appears in the first group of data to the i-1th group of data is 2, and symbol B appears 4 times in the i-th group of data, then the statistical table is updated according to the i-th group of data, and the number of times symbol B in the updated statistical table becomes 6, and the updated statistical table is used to indicate the number of times all possible symbols appearing in the data stream appear in the first group of data to the i-th group of data.
[0108] Optionally, the statistics table is organized by symbol size, rather than by the number of times the symbol occurs.
[0109] Next, the implementation is explained through a specific example.
[0110] Exemplarily, the i-th group of data can be represented by Table 1.
[0111] Table 1
[0112]
[0113]
[0114] In Table 1, valid bit is a valid bit, Y represents that the row is valid, that is, the row has a target symbol; N represents that the row is invalid, that is, the row does not have a target symbol, Symbol Array is a symbol, and Symbol Count is the number of times the symbol appears. As shown in Table 1, the target symbols included in the i-th group of data are: symbol A, symbol B, symbol D, symbol E, and the number of times each target symbol appears in the i-th group of data is: 1, 4, 2, 1.
[0115] Exemplarily, before receiving the i-th group of data, the statistical table can be represented by the following Table 2.
[0116] Table 2
[0117] Symbol Array A B C D E F …… Z …… Symbol Count 1 2 3 4 0 0 …… 0 ……
[0118] It can be seen from Table 2 that in the first to the i-1th data sets, the total number of occurrences of symbol A, symbol B, symbol D, and symbol E are 1, 2, 4, and 0, respectively.
[0119] Based on this, it can be obtained that the total number of times symbol A, symbol B, symbol D, and symbol E appear in the first group of data to the i-th group of data are: 2, 6, 6, and 1 respectively. The statistical table shown in Table 2 can be updated according to the i-th group of data. The updated statistical table is used to indicate the number of times all possible symbols that may appear in the data stream appear in the first group of data to the i-th group of data.
[0120] Exemplarily, the updated statistical table can be represented by Table 3.
[0121] Table 3
[0122] Symbol Array A B C D E F …… Z …… Symbol Count 2 6 3 6 1 0 …… 0 ……
[0123] Exemplarily, based on Table 1, Table 2, and Table 3, the first sequence of symbol A, symbol B, symbol D, and symbol E can be represented by Table 4, and the second sequence can be represented by Table 5.
[0124] Table 4
[0125] Valid bit Symbol Array Symbol Count Y E 1 Y A 2 Y B 6 Y D 6 N - - N - - N - - N - -
[0126] Table 5
[0127]
[0128]
[0129] Based on Table 4 and Table 5, it can be seen that the first sequence and the second sequence obtained by sorting are both: E, A, B, D. The first sequence and the second sequence are both obtained by sorting the target symbols in order from the least to the most frequent occurrences.
[0130] S22. According to the first sequence and the second sequence of the plurality of target symbols, move each other symbol in the first ordered sequence to a corresponding first position to obtain a second ordered sequence.
[0131] In an embodiment of the present application, the first ordered sequence is obtained by sorting each symbol in the first group of data to the i-1th group of data in the data stream according to the number of occurrences. After obtaining the i-th group of data, the first ordered sequence needs to be updated according to the i-th group of data.
[0132] In this step, updating the first ordered sequence first requires adjusting the position of each other symbol in the first ordered sequence according to the first sequence and the second sequence of multiple target symbols of the i-th group of data to obtain a second ordered sequence, where the other symbols are the symbols in the first ordered sequence except the multiple target symbols.
[0133] In one possible implementation, for each other symbol, based on the number of first symbols that appear less than other symbols in the first sequence and the number of second symbols that appear less than other symbols in the second sequence, the other symbols in the first ordered sequence need to be moved to the corresponding first position to obtain the second ordered sequence.
[0134] In this implementation, specifically, for each other symbol, a first difference between the number of first symbols and the number of second symbols is calculated; the other symbols in the first ordered sequence are moved in the target direction by the first difference number of positions so that the other symbols are moved to the corresponding first positions, and the second ordered sequence is obtained, and the target direction is the direction in which the number of occurrences of each symbol in the first ordered sequence decreases.
[0135] Optionally, when the valid sequence sorts the symbols in order of number of occurrences from small to large, the target direction is from right to left.
[0136] Specifically, an ordered table may be pre-stored in an electronic device, and the ordered table includes all symbols that may be included in the data stream and the number of times each symbol has appeared, and the symbols in the ordered table are sorted according to the number of times they appear. The essential idea of real-time sorting of the ordered table is that for each other symbol "X" in the ordered table, after generating the first sequence and the second sequence of the target symbol, the position that "X" needs to move to the target direction = the number of first symbols with a number of appearances less than "X" in the first sequence minus the number of second symbols with a number of appearances less than "X" in the second sequence. The target symbol with a number of appearances less than "X" in the first sequence represents that the target symbol needs to be moved from the position in the target direction of "X" to a new position; and the target symbol with a number of appearances less than "X" in the second sequence represents that the target symbol needs to be inserted into a new position in the target direction of "X". Therefore, the difference between the two represents the number of bits that "X" needs to move to the target direction.
[0137] Exemplarily, the ordered list may be represented by the following Table 6.
[0138] Table 6
[0139] Symbol Array A B C D E F …… Z …… Symbol Count 0 1 2 3 4 5 …… 25 ……
[0140] S23. According to the second sequence of multiple target symbols, move each target symbol in the second ordered sequence to a corresponding second position to obtain a target ordered sequence.
[0141] In this step, the position of the target symbol in the second ordered sequence can be determined as the second position. At this time, the target symbol placed at the second position has not been sorted and needs to be adjusted. According to the second sequence of multiple target symbols, the position of the target symbol can be adjusted on the basis of the second ordered sequence, so as to obtain the target ordered sequence, which is obtained by sorting the symbols in the first group of data to the i-th group of data according to the number of occurrences, so as to achieve the purpose of updating the first ordered sequence.
[0142] The way to adjust the target symbol placed at the second position may include the following two methods:
[0143] In a first approach, a plurality of second positions may be sorted according to the sorting order of the target symbols in the second sequence, and the target symbol corresponding to each second position may be adjusted to the second position.
[0144] Exemplarily, assuming that the second sequence is symbol A, symbol B, symbol C and symbol D, the second sequence is to sort the target symbols in order of appearance from small to large, and sort the second positions according to the above order (that is, the order of appearance from small to large), and the sorting results are second position 1, second position 2, second position 3 and second position 4, and the corresponding relationship between each second position and the symbol is: symbol A-second position 1, symbol B-second position 2, symbol C-second position 3 and symbol D-second position 4. Then symbol A is moved to second position 1, symbol B is moved to second position 2, symbol C-is moved to second position 3, and symbol D is moved to second position 4.
[0145] Method 2: The third position in front of the second position can be determined according to the target direction, the character corresponding to the third position and the second difference between the position of the character in the first ordered sequence and the third position can be determined, and then the fourth position that is the second difference position behind the third position can be determined along the target direction, and the target value of the character at the fourth position in the first ordered sequence can be determined, the target value is the number of characters that appear less than the character in the second sequence, and the target symbol corresponding to the third position can be determined based on the target value and the second sequence.
[0146] It should be understood that the specific implementation process and principle of the second method can refer to Figure 3 The embodiments shown will not be described in detail here.
[0147] The data sorting method based on digital integrated circuit provided in the embodiment of the present application, when sorting symbols in a data stream, for the i-th group of data in the data stream, determines the first sequence and the second sequence of multiple target symbols; according to the first sequence and the second sequence of multiple target symbols, moves each other symbol in the first ordered sequence to the corresponding first position to obtain the second ordered sequence; according to the second sequence of multiple target symbols, moves each target symbol in the second ordered sequence to the corresponding second position to obtain the target ordered sequence. Wherein, the multiple target symbols are symbols in the i-th group of data, the first sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-1th group of data in the data stream, the second sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-1th group of data, i is an integer greater than or equal to 2, the first ordered sequence is obtained by sorting each symbol in the first group of data to the i-1th group of data in the data stream according to the number of occurrences, and the other symbols are symbols other than the multiple target symbols in the first ordered sequence. In the present technical solution, after obtaining the i-th group of data, the first ordered sequence generated by the i-1-th group of data can be updated according to the target symbols included in the i-th group of data and the number of times each target symbol appears, so as to obtain the target ordered sequence, which is a sequence obtained by sorting the first group of data to the i-th group of data. In this way, the symbols in the data stream can be sorted while the data stream is obtained. In other words, at any time when the data stream is counted, an ordered sequence can be obtained, which is obtained by sorting the counted symbols, which can effectively save data processing time and improve data processing efficiency.
[0148] Next, through Figure 3 The illustrated embodiment provides an expanded description of S23.
[0149] Figure 3 A flow chart of another data sorting method based on digital integrated circuits provided in an embodiment of the present application. Figure 3 As shown, S23 may include the following steps:
[0150] S231. Determine the position of the target symbol in the second ordered sequence as the second position.
[0151] S232. For each second position, determine a third position in front of the second position along the target direction.
[0152] In this step, the target symbol placed at the second position in the second ordered sequence has not been sorted and needs to be adjusted. Since the symbols in the first ordered sequence are arranged in a certain order, the third position in front of the second position can be determined along the target direction, and the target symbol corresponding to the second position can be determined according to the symbol corresponding to the third position.
[0153] In a possible implementation, for each second position, the position where the first other symbol appears may be determined as the corresponding third position along the target direction.
[0154] S233. According to the character corresponding to the third position, the first ordered sequence and the second sequence, place the target symbol corresponding to the second position at the second position to obtain the target ordered sequence.
[0155] In this step, the moving distance of the symbol from the position in the first ordered sequence to the third position can be determined according to the character corresponding to the third position, so as to determine theoretically from which position (fourth position) in the first ordered sequence the third position should obtain the character. However, compared with the first ordered sequence, the target symbol has more occurrences, and when the first ordered sequence is updated, the target symbol needs to be inserted between the third position and the fourth position of the first ordered sequence, resulting in that the character at the fourth position in the first ordered sequence is not the character that needs to be inserted into the second position in the second ordered sequence, and the corresponding target symbol needs to be inserted into the second position.
[0156] In one possible implementation, for each third position, determine the second difference between the position of the character corresponding to the third position in the first ordered sequence and the third position; along the target direction, determine the fourth position that is the second difference position behind the third position; determine the target value of the character at the fourth position in the first ordered sequence, and the target value is the number of characters that appear less than the character in the second sequence, and the number of characters is the number of symbols that need to be inserted before the fourth position; determine the target symbol corresponding to the third position based on the target value and the second sequence; move the target symbol corresponding to the third position to the third position to obtain the target ordered sequence.
[0157] Exemplarily, assuming that the first ordered sequence is obtained by sorting the symbols in order of the number of occurrences from small to large, and the symbols in the second sequence are obtained by sorting the target characters in order of the number of occurrences from small to large, when the target value is determined to be 1, it means that one target symbol needs to be inserted before the fourth position, that is, the first target symbol in the second sequence needs to be inserted into the third position.
[0158] Based on the data sorting method based on digital integrated circuit provided in the above embodiment, the method is explained in detail through a specific example.
[0159] The entire process from obtaining to sorting the i-th group of data in the data stream can be achieved by Figure 4 , Figure 5a , Figure 5b , Figure 5c , Figure 5d , Figure 5eTo express, Figure 4 A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is shown in FIG. Figure 5a A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is shown in FIG. Figure 5b A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is shown in FIG. Figure 5c A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is shown in FIG. Figure 5d A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is shown in FIG. Figure 5e A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application. Figure 4 , Figure 5a , Figure 5b , Figure 5c , Figure 5d , Figure 5e In the figure, clock cycles 0-11 (English: Cycle) represent time points, which is the concept of clock cycles in digital integrated circuits, where clock cycle 0 represents the first clock cycle, clock cycle 1 represents the second clock cycle, and so on.
[0160] like Figure 4 As shown, the data sorting method based on digital integrated circuit includes the following process:
[0161] Clock cycle 0: Get the i-th group of data in the data stream.
[0162] Clock cycle 1: Obtain the first number of occurrences of the target symbol in the first to i-1th groups of data from the statistical table, and update the statistical table based on the i-th group of data to obtain an updated statistical table.
[0163] Among them, the target symbol is the symbol in the i-th group of data.
[0164] It should be understood that the specific updating method can refer to the relevant content in S21 and will not be repeated here.
[0165] Clock cycle 2: Add the number of times the target symbol appears in the i-th group of data to the corresponding first number to obtain the second number of times the target symbol appears in the first group of data to the i-th group of data.
[0166] Clock cycles 3-8, performing bitonal sorting on multiple target symbols according to the first number of each target symbol; performing bitonal sorting on multiple target symbols according to the second number of each target symbol.
[0167] Clock cycle 9: Acquire the first sequence and the second sequence of target symbols.
[0168] It should be understood that multiple target symbols can be bitonally sorted through clock cycles 3-8 (a total of 6 clock cycles), or the target symbols can be bitonally sorted through other numbers of clock cycles. For example, multiple target symbols can be bitonally sorted through clock cycle 3 (a total of 1 clock cycle). It can be pre-set according to the number of symbols included in the i-th group of data, which will not be repeated here.
[0169] Furthermore, Figure 5a , Figure 5b , Figure 5c , Figure 5d , Figure 5e The processing that needs to be executed in clock cycle 10 is as follows: Figure 5a As shown, the data sorting method based on digital integrated circuit also includes the following process:
[0170] Step 0: Get the Insert Bit Vectors and Remove Bit Vectors for each symbol, where the bits of the Insert Bit Vectors (i.e. Figure 5a The square at the Insert Bit Vectors in the second sequence represents the number of symbols that appear more or equal to the symbol in the second sequence. The bit at the Remove Bit Vectors (that is, Figure 5a The squares at the RemoveBit Vectors in ) represent the number of symbols that appear more times than this symbol in the second sequence.
[0171] Further, such as Figure 5b As shown, the data sorting method based on digital integrated circuit also includes the following process:
[0172] Step 1. Shift the Remove Bit Vectors of each symbol by the number of 1s in Insert Bit Vectors (upward), and obtain the shift result (Shift Remove Bit Vector by Insert Bit Vector). For example, the Remove Bit Vectors of the character J is 8'b11000000 (from top to bottom), and the insert bitvec is 8'b10000000 (from top to bottom, with 3 1s), so the Remove Bit Vectors becomes 8'b10000000 (from top to bottom) after shifting.
[0173] Further, such as Figure 5b As shown, the data sorting method based on digital integrated circuit also includes the following process:
[0174] Step 2: Based on step 1, perform one-hot encoding on the shift result to obtain the one-hot encoding result.
[0175] Among them, the position of 1 in the one-hot encoding result (shift bitvec) represents how many positions the symbol at the corresponding position needs to be shifted left.
[0176] Further, such as Figure 5c As shown, the data sorting method based on digital integrated circuit also includes the following process:
[0177] Step 3: According to the one-hot encoding result, shift the other symbols in the first ordered sequence in the ordered table to obtain the second ordered sequence.
[0178] The arrows point to the destination positions of the symbols. For example, symbol E needs to be moved to the original position of symbol D, and symbol F needs to be moved to the original position of symbol E.
[0179] Further, such as Figure 5d As shown, the data sorting method based on digital integrated circuit also includes the following process:
[0180] Step 4: Insert the target symbol in the i-th group of data into the second ordered sequence.
[0181] Among them, the target value (Insert Sum) can refer to the relevant content in S23, which will not be repeated here.
[0182] The position difference (PULL Num) is the difference between the position of the symbol in the second ordered sequence and the position of the symbol in the first ordered sequence.
[0183] Furthermore, the data sorting method based on digital integrated circuits also includes the following process:
[0184] Clock cycle 11, obtain the target ordered sequence.
[0185] Among them, the target ordered sequence is A, B, C, E, F, G, D, I, J, H, K, L, M, N, O, P.
[0186] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0187] Figure 6 This is a schematic diagram of the structure of a data sorting device based on a digital integrated circuit provided in an embodiment of the present application. Figure 6 As shown, the data sorting device 600 based on digital integrated circuit includes:
[0188] A determination module 601 is used to determine, for an i-th group of data in the data stream, when sorting symbols in the data stream, a first sequence and a second sequence of multiple target symbols, wherein the multiple target symbols are symbols in the i-th group of data, the first sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-1th group of data in the data stream, and the second sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2;
[0189] a moving module 602, configured to move each other symbol in a first ordered sequence to a corresponding first position according to a first sequence and a second sequence of a plurality of target symbols, to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting each symbol in a first group of data to an i-1th group of data in a data stream according to a number of occurrences, and the other symbols are symbols other than the plurality of target symbols in the first ordered sequence;
[0190] The moving module 602 is further configured to move each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of multiple target symbols, so as to obtain a target ordered sequence.
[0191] In a possible implementation, the mobile module 602 is specifically configured to:
[0192] For each other symbol, according to the number of first symbols that appear less than other symbols in the first sequence and the number of second symbols that appear less than other symbols in the second sequence, the other symbols in the first ordered sequence need to be moved to the corresponding first position to obtain the second ordered sequence.
[0193] In a possible implementation, the mobile module 602 is specifically configured to:
[0194] For each other symbol, calculating a first difference between the first symbol quantity and the second symbol quantity;
[0195] Move the other symbols in the first ordered sequence toward the target direction by the first difference position, so that the other symbols are moved to the corresponding first position, and obtain the second ordered sequence. The target direction is the direction in which the number of occurrences of each symbol in the first ordered sequence decreases.
[0196] In a possible implementation, the mobile module 602 is specifically configured to:
[0197] Determine the position of the target symbol in the second ordered sequence as the second position;
[0198] For each second position, determining a third position in front of the second position along the target direction;
[0199] According to the character corresponding to the third position, the first ordered sequence and the second sequence, the target symbol corresponding to the second position is placed in the second position to obtain the target ordered sequence.
[0200] In a possible implementation, the mobile module 602 is specifically configured to:
[0201] For each second position, the position where the first other symbol appears is determined as the corresponding third position along the target direction.
[0202] In a possible implementation, the mobile module 602 is specifically configured to:
[0203] For each third position, determining a second difference between a position of a character corresponding to the third position in the first ordered sequence and the third position;
[0204] Determine a fourth position that is a second difference position behind the third position along the target direction;
[0205] determining a target value for the character at the fourth position in the first ordered sequence, the target value being the number of characters in the second sequence that appear less than the character;
[0206] Determine a target symbol corresponding to the third position according to the target value and the second sequence;
[0207] Move the target symbol corresponding to the third position to the third position to obtain the target ordered sequence.
[0208] In a possible implementation, the determination module 601 is specifically configured to:
[0209] When sorting the symbols in the data stream, for the i-th group of data in the data stream, the first number of occurrences of the target symbol in the first group of data to the i-1th group of data is obtained from the statistical table, and the statistical table is used to store the number of occurrences of each symbol in the first group of data to the i-1th group of data;
[0210] For each target symbol, add the number of times the target symbol appears in the i-th group of data to the corresponding first number, and obtain the second number of times the target symbol appears in the first group of data to the i-th group of data;
[0211] According to the first order of each target symbol, a plurality of target symbols are sorted by bitonic order to obtain a first sequence;
[0212] According to the second order of each target symbol, a plurality of target symbols are bitonally sorted to obtain a second sequence.
[0213] The data sorting device based on digital integrated circuit provided in the embodiment of the present application can be used to execute the data sorting method based on digital integrated circuit in any of the above embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0214] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0215] Figure 7 This is a schematic diagram of the structure of another electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device of this embodiment may include:
[0216] at least one processor 701; and
[0217] A memory 702 communicatively connected to the at least one processor;
[0218] The memory 702 stores instructions that can be executed by the at least one processor 701, and the instructions are executed by the at least one processor 701 to enable the electronic device to execute the method described in any of the above embodiments.
[0219] Optionally, the memory 702 may be independent or integrated with the processor 701 .
[0220] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the aforementioned embodiments and will not be described in detail here.
[0221] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in any of the above embodiments is implemented.
[0222] An embodiment of the present application further provides a computer program product, including a computer program, which implements the method described in any of the above embodiments when executed by a processor.
[0223] An embodiment of the present application further provides a chip, including a digital integrated circuit, which is used to implement the method described in any of the above embodiments.
[0224] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0225] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application.
[0226] It should be understood that the above processor may be a CPU, or other general-purpose processors, digital signal processors (DSP), ASICs, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in the application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor. The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.
[0227] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0228] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.
[0229] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0230] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0231] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0232] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data sorting method based on digital integrated circuits, characterized in that: include: When sorting symbols in a data stream, for an i-th group of data in the data stream, determining a first sequence and a second sequence of multiple target symbols, the multiple target symbols being symbols in the i-th group of data, the first sequence being obtained by sorting the multiple target symbols according to the number of times they appear in a first group of data to an i-1th group of data in the data stream, and the second sequence being obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2; According to the first sequence and the second sequence of the multiple target symbols, each other symbol in the first ordered sequence is moved to the corresponding first position to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting each symbol in the first group of data to the i-1th group of data in the data stream according to the number of occurrences, and the other symbols are symbols other than the multiple target symbols in the first ordered sequence; According to the second sequence of the plurality of target symbols, each target symbol in the second ordered sequence is moved to a corresponding second position to obtain a target ordered sequence.
2. The method according to claim 1, characterized in that The step of moving each other symbol in the first ordered sequence to a corresponding first position according to the first sequence and the second sequence of the plurality of target symbols to obtain a second ordered sequence includes: For each other symbol, based on the number of first symbols that appear less than the other symbols in the first sequence and the number of second symbols that appear less than the other symbols in the second sequence, the other symbols in the first ordered sequence need to be moved to the corresponding first position to obtain the second ordered sequence.
3. The method according to claim 2, characterized in that The step of moving, for each other symbol, other symbols in the first ordered sequence to corresponding first positions according to the number of first symbols that appear less than the other symbol in the first sequence and the number of second symbols that appear less than the other symbol in the second sequence to obtain the second ordered sequence includes: For each other symbol, calculating a first difference between the first number of symbols and the second number of symbols; The other symbols in the first ordered sequence are moved in a target direction by the first difference positions so as to move the other symbols to the corresponding first positions, and the second ordered sequence is obtained. The target direction is the direction in which the number of occurrences of each symbol in the first ordered sequence decreases.
4. The method according to claim 3, characterized in that The step of moving each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of the plurality of target symbols to obtain a target ordered sequence includes: Determine the position of the target symbol in the second ordered sequence as a second position; For each second position, determining a third position in front of the second position along the target direction; According to the character corresponding to the third position, the first ordered sequence and the second sequence, the target symbol corresponding to the second position is placed in the second position to obtain the target ordered sequence.
5. The method according to claim 4, characterized in that The step of determining, for each second position, a third position in front of the second position along the target direction comprises: For each second position, a position where the first other symbol appears is determined as the corresponding third position along the target direction.
6. The method according to claim 4 or 5, characterized in that: The step of placing the target symbol corresponding to the second position at the second position according to the character corresponding to the third position, the first ordered sequence, and the second sequence to obtain the target ordered sequence includes: For each third position, determining a second difference between a position of a character corresponding to the third position in the first ordered sequence and the third position; Determine a fourth position along the target direction that is the second difference position behind the third position; determining a target value of the character at the fourth position in the first ordered sequence, the target value being the number of characters in the second sequence that appear less than the character; Determining a target symbol corresponding to the third position according to the target value and the second sequence; The target symbol corresponding to the third position is moved to the third position to obtain the target ordered sequence.
7. The method according to claim 1, characterized in that The step of determining a first sequence and a second sequence of multiple target symbols for an i-th group of data in the data stream when sorting the symbols in the data stream comprises: When sorting the symbols in the data stream, for the i-th group of data in the data stream, obtaining the number of first occurrences of the target symbol in the first group of data to the i-1-th group of data from a statistical table, wherein the statistical table is used to store the number of occurrences of each symbol in the first group of data to the i-1-th group of data; For each target symbol, add the number of times the target symbol appears in the i-th group of data to the corresponding first number, to obtain the second number of times the target symbol appears in the first group of data to the i-th group of data; According to the first order of each target symbol, a plurality of target symbols are bitonally sorted to obtain the first sequence; According to the second number of each target symbol, a plurality of target symbols are binocularly sorted to obtain the second sequence.
8. A data sorting device based on digital integrated circuit, characterized in that: include: a determination module, configured to determine, when sorting symbols in a data stream, for an i-th group of data in the data stream, a first sequence and a second sequence of multiple target symbols, wherein the multiple target symbols are symbols in the i-th group of data, the first sequence is obtained by sorting the multiple target symbols according to the number of times they appear in a first group of data to an i-1th group of data in the data stream, and the second sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2; a moving module, configured to move each other symbol in a first ordered sequence to a corresponding first position according to the first sequence and the second sequence of the multiple target symbols, to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting each symbol in the first group of data to the i-1th group of data in the data stream according to a number of occurrences, and the other symbols are symbols in the first ordered sequence other than the multiple target symbols; The moving module is further used to move each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of the plurality of target symbols, so as to obtain a target ordered sequence.
9. A chip, characterized in that: The method comprises a digital integrated circuit, wherein the digital integrated circuit is used to execute the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method described in any one of claims 1 to 7.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 7 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Merging tree sorting device, sorting system and sorting method
CN113076312A
Ranking query processing method for stream data and stream data processing system having ranking query processing mechanism
US20090112853A1
Method for gray coding a symbol alphabet
US20140254728A1
Converting negative floating point numbers to integer notation without two's complement hardware
US6965906B1
Video frame processing method and device
WO2018076370A1
