Dynamic calibration fixed point number reciprocal table look-up method and device, computer equipment and storage medium

By dividing the fixed-point number interval into multiple segments and performing Taylor expansion to construct a relation table, and combining shifting and dynamic scaling, the problems of accuracy loss and low efficiency in solving the reciprocal of fixed-point numbers are solved, achieving efficient and accurate solutions applicable to the entire interval.

CN121116010APending Publication Date: 2025-12-12SHANGHAI SMARTLOGIC TECHNOLOGY LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511221129.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-28
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

Existing fixed-point reciprocal calculation methods suffer from accuracy loss, low computational efficiency, and uneven resource consumption when dealing with numerical values ​​in different ranges. This is especially true in molecular dynamics simulations, where it is difficult to adapt to input values ​​across the entire range and dynamically adjust the computational accuracy.

Method used

The fixed-point number interval is evenly divided into multiple segments, and an nth-order Taylor expansion is performed to construct a relationship table between each segment and the coefficients. By shifting and dynamic scaling, the reciprocal of the target fixed-point number is determined. This method is suitable for inputs in the full value space, reduces storage usage, and improves computational accuracy.

Benefits of technology

It achieves efficient and precise determination of point reciprocal in the full value space, balancing resource consumption and computational efficiency, and is suitable for temperature and pressure control modules in molecular dynamics simulations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121116010A_ABST
    Figure CN121116010A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a dynamic calibration fixed-point number reciprocal table look-up method and device, computer equipment and a storage medium, and the method comprises the steps: uniformly dividing a fixed-point number interval [m1, m2) into a plurality of sections, carrying out the n-order Taylor expansion of a reciprocal function of a fixed-point number at the head of each section obtained through division, determining n + 2 coefficients corresponding to each section, constructing a corresponding relation table between each section and the coefficient; receiving a target fixed-point number, shifting the target fixed-point number to enable the shifted fixed-point number to be in a fixed-point number interval [m1, m2), and dynamically calibrating the shifted fixed-point number; based on the relation table, determining a to-be-input fixed point number and a coefficient corresponding to the calibrated fixed point number; the reciprocal of the target fixed point number is determined according to the to-be-input fixed point number and the coefficient, a reciprocal table is constructed for [m1, m2] during tabulation, the method is suitable for a full value space, storage occupation is reduced, and calculation precision is improved through shifting and calibration.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of fixed-point calculation, in particular to a dynamic scaling fixed-point number reciprocal lookup table method and device, computer equipment and storage medium. BACKGROUND

[0002] In fixed-point calculation, the engineering implementation method for solving reciprocal for division calculation can be applied in molecular dynamics, digital signal processing, machine learning, embedded systems and other fields, and can quickly and accurately solve the reciprocal of fixed-point numbers.

[0003] In order to improve the calculation performance and reduce the use of computing resources, fixed-point numbers and addition, subtraction and multiplication calculations between fixed-point numbers are used to replace the application of floating-point numbers in the engineering implementation in these fields. Fixed-point calculation does not require the support of floating-point units, and can be more efficient. Through reasonable setting, the energy efficiency ratio can be improved, and the storage space can be reduced. A fixed-point number can be represented by Qm.n, where m represents the number of integer bits (including 1 bit of sign bit), and n represents the number of decimal bits. The complex function calculation of fixed-point numbers, such as reciprocal, exponential, and root, can use lookup table calculation method.

[0004] In molecular dynamics simulation calculation, the amount of data is huge, and fixed-point numbers are used for calculation. At the same time, many calculation modules face the problem of solving reciprocal, such as solving the reciprocal of the current system temperature in the temperature control module, and solving the reciprocal of the volume in the pressure control module. These modules will be called multiple times in the simulation loop, so a fast and efficient fixed-point number reciprocal solving method with high accuracy is needed. In addition, the input value data range of different modules is different, and the representation accuracy of the data is also different, so a reciprocal solving scheme that can adapt to the full range and is widely used is needed.

[0005] However, the existing reciprocal solving scheme has the following deficiencies: first, the input value is based on a specific value range. In the table range, many existing schemes do not fully consider how to efficiently cover the full range, resulting in the need for complex conversion or loss of accuracy when processing different range values. Second, the solving accuracy is affected by the fixed-point representation accuracy of the input value. When processing fixed-point numbers with low representation accuracy, the existing method cannot dynamically adjust the calculation accuracy according to the characteristics of the input data, thereby affecting the accuracy of the final result. Third, the balance between calculation efficiency and resource consumption. More storage space is needed to place the reciprocal table to improve the range of use or calculation accuracy. SUMMARY

[0006] The present application provides a dynamic scaling fixed-point number reciprocal lookup table method, device, computer equipment and storage medium.

[0007] The first aspect of this application provides a dynamic scaling method for reciprocal lookup of fixed-point numbers, including:

[0008] The fixed-point number interval [m1, m2) is uniformly divided into multiple segments. For each segment, an nth-order Taylor expansion is performed on the reciprocal function of the fixed-point number at the beginning of the segment to determine the n+2 coefficients corresponding to each segment, so as to construct a relationship table between each segment and the coefficients. Here, 0 < m1 < m2 and m1 and m2 are both integer powers of 2. The number of segments is an integer power of 2.

[0009] Receive the target fixed-point number, shift the target fixed-point number so that the shifted fixed-point number is within the fixed-point number interval [m1, m2), and dynamically calibrate the shifted fixed-point number;

[0010] Based on the relationship table between each interval and the coefficient, determine the number of fixed points and coefficients to be input after calibration;

[0011] The reciprocal of the target fixed point number is determined based on the input fixed point number and coefficient.

[0012] In an optional embodiment of this application, the step of performing an nth-order Taylor expansion of the reciprocal function of the fixed-point number at the beginning of each segment to determine the n+2 coefficients corresponding to each segment includes:

[0013] For each interval obtained by the division, perform an nth-order Taylor expansion on the reciprocal function of the fixed-point number at the beginning of the interval to determine the Taylor fitting coefficients k1 to k2 for each interval. n+1 ;

[0014] For each interval of fixed points, determine the minimum number of bits h that can be shifted left, and for k... n+1 ~k1 is shifted left by 0, h, 2h, 3h...nh bits respectively to obtain the shifted k n+1 ~k1;

[0015] After shifting k n+1 ~k1 is calibrated to obtain the calibrated k n+1 ~k1 and k n+1 ~k1 left shift and scaling shift values ​​serve as n+2 coefficients for each interval.

[0016] In an optional embodiment of this application, when n is 4, the Taylor fitting coefficients for each segment are determined by performing a 4th-order Taylor expansion on the reciprocal of the fixed-point number at the beginning of the segment using the following expression:

[0017] F(x+x0)=k1+k2*x+k3*x 2 +k4*x 3 +k5*x4

[0018] Where k1~k5 are the Taylor fitting coefficients corresponding to the current segment interval, x is the number of fixed points, x0 is the value of the first segment, and F(x+x0) is the value of the reciprocal of the number of fixed points x+x0.

[0019] The shifted k5 to k1 are obtained by left-shifting k5 to k1 by 0, h, 2h, 3h, and 4h bits respectively using the following expressions:

[0020] F(x+x0)*2 4h =((k5*x*2 h +k4*2 h )*x*2 h +k3*2 2h )*x*2 h +k2*2 3h )*x*2 h +k1*2 4h

[0021] c1 = k5, c2 = k4 * 2 h c3 = k3 * 2 2h c4 = k2 * 2 3h c5 = k1 * 2 4h

[0022] Where c1~c5 are the shifted k5~k1, F(x+x0)*2 4h Let x+x0 be the value of the reciprocal of the fixed point x+x0 shifted to the left by 4h.

[0023] In an optional embodiment of this application, the step of shifting the target fixed-point number so that the shifted fixed-point number is within the fixed-point number interval [m1, m2), and dynamically calibrating the shifted fixed-point number, includes:

[0024] Determine whether the target fixed point number is within the fixed point number interval [m1, m2);

[0025] When the target fixed point number is within the fixed point number interval [m1, m2), the target fixed point number is dynamically calibrated to obtain the calibrated fixed point number;

[0026] If the target fixed point number exceeds the fixed point number interval [m1, m2), the target fixed point number is shifted so that the shifted fixed point number is within the fixed point number interval [m1, m2), and the shifted fixed point number is dynamically calibrated to obtain the calibrated fixed point number.

[0027] In an optional embodiment of this application, determining the input fixed-point number and coefficients corresponding to the calibrated fixed-point number based on the relationship table between each interval and the coefficients includes:

[0028] Determine the index corresponding to the fixed point number after the shift, where the index is the number of segments in the interval;

[0029] The coefficients of the interval corresponding to the shifted fixed-point number are read from the table corresponding to the relationship between each interval and the coefficient according to the index;

[0030] The number of fixed points to be input is determined by the difference between the number of fixed points after calibration and the starting value of the corresponding interval.

[0031] In an optional embodiment of this application, the index corresponding to the shifted fixed-point number is determined by the following expression:

[0032] idx = floor((x-2) f-m01 ) / 2 f-m02 )

[0033] Where idx is the index of the shifted fixed-point number, floor() is the floor function, f is the number of decimal places in the Qe.f format, m01 is the exponent of m1, and m02 is the exponent of the quotient obtained by dividing m1 by the number of interval segments.

[0034] The difference between the shifted fixed-point number and the starting value of its corresponding interval is determined by the following expression:

[0035] Δx=(x-2 f-m01 )mod 2 f-m02

[0036] Where Δx is the difference between the shifted fixed-point number and the starting value of its corresponding interval, and mod is the modulo operation.

[0037] The step of determining the input fixed-point number corresponding to the calibrated fixed-point number based on the difference between the calibrated fixed-point number and the starting value of its corresponding interval includes:

[0038] The difference between the calibrated fixed-point number and the starting value of its corresponding interval is shifted left by h bits to obtain the input fixed-point number corresponding to the calibrated fixed-point number.

[0039] In an optional embodiment of this application, determining the reciprocal of the target fixed-point number based on the input fixed-point number and the coefficient includes:

[0040] The reciprocal of the target fixed-point displacement is determined using the following expression:

[0041] y_temp = F(x) * 2 4h =(((c1*dx+c2)*dx+c3)*dx+c4)*dx+c5

[0042] Where y_temp is the reciprocal of the target fixed-point displacement, dx is the number of fixed points to be input, and dx = x - x0.

[0043] In the Qc.d format, the reciprocal of the target fixed-point number is obtained by left-shifting y_temp by d+f+b–c6 bits, where c6 is the shift value for left shifting and scaling of k5 to k1, b is the shift value for dynamic scaling and shifting of the target fixed-point number x, and d is the decimal place of the reciprocal of the target fixed-point number.

[0044] A second aspect of this application provides a dynamically calibrated fixed-point reciprocal lookup table device, comprising:

[0045] The partitioning module is used to uniformly divide the fixed-point number interval [m1, m2) into multiple segments. For each segment, an nth-order Taylor expansion is performed on the reciprocal function of the fixed-point number at the beginning of the segment to determine the n+2 coefficients corresponding to each segment, so as to construct a relationship table between each segment and the coefficients. Here, 0 < m1 < m2 and m1 and m2 are both integer powers of 2, and the number of segments is an integer power of 2.

[0046] The shift module is used to receive the target fixed-point number, shift the target fixed-point number so that the shifted fixed-point number is within the fixed-point number interval [m1, m2), and dynamically calibrate the shifted fixed-point number.

[0047] The first determination module is used to determine the number of fixed points and coefficients to be input after calibration, based on the relationship table between each interval and the coefficients.

[0048] The second determining module is used to determine the reciprocal of the target fixed point number based on the input fixed point number and coefficient.

[0049] A third aspect of this application provides a computer device, including: a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above dynamic scaling fixed-point reciprocal lookup table methods.

[0050] A fourth aspect of the embodiments of this application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the steps of the dynamic scaling fixed-point reciprocal lookup table method as described in any of the preceding claims.

[0051] Compared with the prior art, the technical solutions provided in this application have at least some or all of the following advantages:

[0052] The dynamic calibration fixed-point number reciprocal lookup table method described in this application divides the fixed-point number interval [m1, m2) evenly into multiple segments. For each segment, an nth-order Taylor expansion is performed on the reciprocal function of the fixed-point number at the beginning of the segment to determine the n+2 coefficients corresponding to each segment, thereby constructing a relationship table between each segment and the coefficients. Here, 0 < m1 < m2, and m1 and m2 are both integer powers of 2. The number of segments is an integer power of 2. The target fixed-point number is received and shifted so that after the shift... The fixed-point number is located within the fixed-point number interval [m1, m2). The shifted fixed-point number is dynamically calibrated. Based on the relationship table between each interval and the coefficients, the input fixed-point number and coefficients corresponding to the calibrated fixed-point number are determined. The reciprocal of the target fixed-point number is determined based on the input fixed-point number and coefficients. The preset fixed-point number x∈[m1, m2) is used, and the Taylor fitting function 1 / x is used to calculate the fitting coefficients, which are stored in a table. When solving for the reciprocal, the fitting coefficients are obtained by looking up the table, and the result is fitted. The reciprocal function satisfies: 1 / x=y, then 1 / (x*2) a )=y*2 -a When x is not in the preset interval, x is shifted to be within the preset interval, and the calculation result is shifted back. When the representation precision of x is low, x is dynamically calibrated, and the calculation result is shifted back. Therefore, the dynamic calibration fixed-point reciprocal lookup table method described in this application is applicable to inputs in the full value space. It can use dynamic calibration to solve the problem of low precision. When creating the table, the reciprocal table is only constructed for x∈[m1,m2), which reduces storage occupation. Combining the full value space and improving calculation precision, it balances resource consumption and calculation efficiency. Attached Figure Description

[0053] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0054] Figure 1 A flowchart of a dynamic calibration fixed-point reciprocal lookup table method provided in one embodiment of this application;

[0055] Figure 2 A flowchart for determining n+2 coefficients corresponding to each interval is provided as an embodiment of this application;

[0056] Figure 3 A schematic diagram of a dynamic calibration fixed-point reciprocal lookup table device provided in one embodiment of this application;

[0057] Figure 4 This is a schematic diagram of a computer device structure provided in one embodiment of this application. Detailed Implementation

[0058] In the process of developing this application, the inventors discovered that the current methods for finding reciprocals are poor in terms of both efficiency and accuracy.

[0059] To address the aforementioned issues, this application provides a dynamically calibrated fixed-point reciprocal lookup table method, apparatus, computer equipment, and storage medium to improve the efficiency and accuracy of reciprocal calculation.

[0060] The solutions in this application embodiment can be implemented using various computer languages, such as the object-oriented programming language C++, the compiled language C, and assembly language.

[0061] To make the technical solutions and advantages of the embodiments of this application clearer, the exemplary embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not an exhaustive list of all embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.

[0062] Please see Figure 1 The dynamic calibration fixed-point reciprocal lookup table method provided in this application includes the following steps S100 to S400:

[0063] Step S100: Divide the fixed-point number interval [m1, m2) evenly into multiple segments. For each segment, perform an nth-order Taylor expansion on the reciprocal function of the fixed-point number at the beginning of the segment to determine the n+2 coefficients corresponding to each segment, so as to construct a relationship table between each segment and the coefficients. Here, 0 < m1 < m2 and m1 and m2 are both integer powers of 2, and the number of segments is an integer power of 2.

[0064] Step S200: Receive the target fixed-point number, shift the target fixed-point number so that the shifted fixed-point number is within the fixed-point number interval [m1, m2), and dynamically calibrate the shifted fixed-point number;

[0065] Step S300: Based on the relationship table between each interval and the coefficient, determine the number of fixed points and coefficients to be input after calibration.

[0066] Step S400: Determine the reciprocal of the target fixed point number based on the number of fixed points to be input and the coefficient.

[0067] In an optional embodiment of this application, in step S100, when m1 and m2 are respectively 2 -1 and 2 0In the case where the fixed-point number interval [m1, m2) is [0.5, 1), a table is created in the interval [0.5, 1). The interval is evenly divided into several segments. Taking 64 segments as an example: [0.5, 0.5 + 0.5 / 64), [0.5 + 0.5 / 64, 0.5 + 0.5 / 32) …… A table is created in the interval [0.5, 1), and the interval is evenly divided into 64 segments. Each segment interval records n + 2 coefficients: n + 1 coefficient values of the nth-order Taylor fitting are calculated for each segment interval, and the (n + 2)th number records the shift value for calibrating these n + 1 Taylor fitting coefficients. When looking up the table, according to the segment where x is located, the corresponding n + 2 coefficients are taken for the calculation of fixed-point Taylor fitting.

[0068] In an optional embodiment of the present application, since 1 / x = y, then 1 / (x * 2 a ) = y * 2 -a , when the fixed-point number x is not in the table-making interval, x can be shifted to get x * 2 a , and x * 2 a is used as the input for looking up the table, and the output obtained is y * 2 -a . Then, the output y * 2 -a is shifted to get y. By creating a table in the fixed-point number interval [m1, m2), it can adapt to the entire value range.

[0069] In an optional embodiment of the present application, when the fixed-point representation precision of x is relatively low, calculate the actual effective occupied bit number of x. By shifting x << b, the highest significant bit of x is moved to the highest bit, and then the table lookup calculation is performed. The obtained output is then shifted in the reverse direction y << b to cancel the initial shift of x. Before the table lookup calculation, if x needs to be shifted b bits to move its highest significant bit to the highest bit, then only after the table lookup calculation, the calculation result needs to be shifted an additional b bits to achieve this. This method dynamically shifts x by b bits, which also requires y to be shifted by b bits, improving the representation precision of the shifted y, equivalent to dynamically changing the decimal representation precision, improving the calculation precision in the fixed-point table lookup calculation process, and improving the precision through dynamic calibration.

[0070] The dynamic calibration fixed-point number reciprocal table lookup method of the present application presets that the fixed-point number x ∈ [m1, m2), uses the Taylor fitting function 1 / x to calculate the fitting coefficients and stores them in the table; when solving the reciprocal, the fitting coefficients are obtained by looking up the table and the result is fitted. The reciprocal function satisfies: 1 / x = y, then 1 / (x * 2 a ) = y * 2 -aWhen x is not in the preset interval, x is shifted to be within the preset interval, and the calculation result is shifted back. When the representation precision of x is low, x is dynamically calibrated, and the calculation result is shifted back. Therefore, the dynamic calibration fixed-point reciprocal lookup table method described in this application is applicable to inputs in the full value space. It can use dynamic calibration to solve the problem of low precision. When creating the table, the reciprocal table is only constructed for x∈[m1,m2), which reduces storage occupation. Combining the full value space and improving calculation precision, it balances resource consumption and calculation efficiency.

[0071] In an optional embodiment of this application, see [link to relevant documentation]. Figure 2 In step S100, for each segment obtained by dividing the interval, an nth-order Taylor expansion is performed on the reciprocal function of the fixed-point number at the beginning of the segment to determine the n+2 coefficients corresponding to each segment, including:

[0072] S210, For each interval obtained by the division, perform an nth-order Taylor expansion on the reciprocal function of the fixed-point number at the beginning of the segment to determine the Taylor fitting coefficients k1 to k2 for each interval. n+1 ;

[0073] S220, for each interval of fixed points, determine the minimum number of bits h that can be shifted left, and for k... n+1 ~k1 is shifted left by 0, h, 2h, 3h...nh bits respectively to obtain the shifted k n+1 ~k1;

[0074] S230, for the shifted k n+1 ~k1 is calibrated to obtain the calibrated k n+1 ~k1 and k n+1 ~k1 left shift and scaling shift values ​​serve as n+2 coefficients for each interval.

[0075] In an optional embodiment of this application, determining the minimum number of left-shiftable bits h for each interval of fixed points includes:

[0076] Given that the fixed-point number adopts the Qp1.p2 format and the numerical range of the current segment interval is [a,b], determine the maximum absolute value M of [a,b], where the numerical range of Qp1.p2 is [α,β].

[0077] h≤log2(β / M), where h is the integer part.

[0078] The dynamic calibration fixed-point reciprocal lookup table method of this application, when n is 4, determines the minimum number of left shifts h for the fixed-point numbers of each interval, and shifts k5 to k1 to the left by 0, h, 2h, 3h, and 4h positions respectively to obtain the shifted k5 to k1. The Taylor fitting coefficients are then shifted and calibrated, and the Taylor fitting accuracy during table lookup is improved by increasing the accuracy of the calibrated k5 to k1.

[0079] In an optional embodiment of this application, when n is 4, the Taylor fitting coefficients for each segment are determined by performing a 4th-order Taylor expansion on the reciprocal of the fixed-point number at the beginning of the segment using the following expression:

[0080] F(x+x0)=k1+k2*x+k3*x 2 +k4*x 3 +k5*x 4

[0081] Where k1~k5 are the Taylor fitting coefficients corresponding to the current segment interval, x is the number of fixed points, x0 is the value of the first segment, and F(x+x0) is the value of the reciprocal of the number of fixed points x+x0.

[0082] The shifted k5 to k1 are obtained by left-shifting k5 to k1 by 0, h, 2h, 3h, and 4h bits respectively using the following expressions:

[0083] F(x+x0)*2 4h =((k5*x*2 h +k4*2 h )*x*2 h +k3*2 2h )*x*2 h +k2*2 3h )*x*2 h +k1*2 4h

[0084] c1 = k5, c2 = k4 * 2 h c3 = k3 * 2 2h c4 = k2 * 2 3h c5 = k1 * 2 4h

[0085] Where c1~c5 are the shifted k5~k1, F(x+x0)*2 4h Let x+x0 be the value of the reciprocal of the fixed point x+x0 shifted to the left by 4h.

[0086] In an optional embodiment of this application, for each interval, such as [0.5, 0.5+0.5 / 64), with the first 0.5 of the interval as x0, a 4th-order Taylor expansion is performed on 1 / x at x0, wherein the order can be adjusted according to the precision:

[0087] F(x) = k1 + k2 * (x - x0) + k3 * (x - x0) 2 + k4 * (x - x0) 3 + k5 * (x - x0) 4 + O((x - x0) 5 )

[0088] When tabulating, the last high - order infinitesimal term can be ignored, and F(x + x0) = k1 + k2 * x + k3 * x 2 + k4 * x 3 + k5 * x 4

[0089] In the case where the fixed - point number interval [m1, m2) is [0.5, 1) and this interval is evenly divided into 64 segments, in the reciprocal table, each segment has coefficients c1 to c6, a total of 64 * 6 values. Considering the general relationship of Taylor fitting coefficients k1 < k2 < k3 < k4 < k5, and since F(x + x0) = k1 + k2 * x + k3 * x 2 + k4 * x 3 + k5 * x 4 And F(x + x0) * 2 4h = (((k5 * x * 2 h + k4 * 2 h ) * x * 2 h + k3 * 2 2h ) * x * 2 h + k2 * 2 3h ) * x * 2 h + k1 * 2 4h , so for the x in each interval, a minimum left - shift bit number h can be determined; then k5 to k1 are left - shifted by 0 bits, h bits, 2h bits, 3h bits, and 4h bits respectively to align the order of magnitude of k5 to k1 as much as possible; finally, k5 to k1 after shifting are calibrated, and the fixed - point values c5 to c1 after left - shifting and calibration are stored. In the case where k5 to k1 are all left - shifted by u bits during this calibration, record c6 = 4h + u.

[0090] The fixed - point number reciprocal lookup table method with dynamic calibration in this application, when shifting k5 to k1, the number of bits left - shifted for k5 to k1 is different, aligning the order of magnitude of k5 to k1 as much as possible, and improving the Taylor fitting accuracy during lookup by increasing the accuracy of c5 to c1.

[0091] In an optional embodiment of this application, in step S200, when shifting the target fixed - point number so that the shifted fixed - point number is within the fixed - point number interval [m1, m2), and performing dynamic calibration on the shifted fixed - point number, it includes:

[0092] Determine whether the target fixed point number is within the fixed point number interval [m1, m2);

[0093] When the target fixed point number is within the fixed point number interval [m1, m2), the target fixed point number is dynamically calibrated to obtain the calibrated fixed point number;

[0094] If the target fixed point number exceeds the fixed point number interval [m1, m2), the target fixed point number is shifted so that the shifted fixed point number is within the fixed point number interval [m1, m2), and the shifted fixed point number is dynamically calibrated to obtain the calibrated fixed point number.

[0095] In an optional embodiment of this application, when the target fixed-point number is within the fixed-point number interval [m1, m2), the target fixed-point number is dynamically calibrated to obtain the calibrated fixed-point number, including:

[0096] The fixed-point number x is represented using Qe.f (1 sign bit, e-1 integer bits, f fractional bits). To calculate the actual number of effective bits occupied by x, shift x left by b bits, so that the most significant bit of x is moved to the highest bit position (excluding the sign bit). The binary representation of the fixed-point number x is shown below. x can be shifted left by 4 bits, i.e., b = 4.

[0097]

[0098] In an optional embodiment of this application, when the target fixed-point number exceeds the fixed-point number interval [m1, m2), the target fixed-point number is shifted so that the shifted fixed-point number falls within the fixed-point number interval [m1, m2), and the shifted fixed-point number is dynamically calibrated to obtain the calibrated fixed-point number, including:

[0099] Given that the binary representation of the fixed-point number x is 0 0000 0000 100000… and [m1, m2) is [0.5, 1), the target fixed-point number is shifted left by 4 bits to obtain 0 0000 1000 000000…. 0 0000 1000 000000… is then dynamically calibrated by shifting left by 4 bits to obtain 0 1000 0000 000000…, which is used as the calibrated fixed-point number.

[0100] The dynamic calibration method for reciprocal lookup of fixed-point numbers in this application ensures that the calibrated fixed-point numbers are within the fixed-point number interval [m1, m2) with the highest accuracy by shifting and dynamically calibrating the target fixed-point numbers. This not only achieves full coverage of the value space by creating a table for [m1, m2), i.e., creating a table for a specific interval but adapting the lookup to the entire interval, but also ensures the accuracy of the calibrated fixed-point numbers.

[0101] In an optional embodiment of this application, step S300, which involves determining the number of fixed points and coefficients to be input corresponding to the calibrated fixed points based on the relationship table between each interval and the coefficients, includes:

[0102] Determine the index corresponding to the fixed point number after the shift, where the index is the number of segments in the interval;

[0103] The coefficients of the interval corresponding to the shifted fixed-point number are read from the table corresponding to the relationship between each interval and the coefficient according to the index;

[0104] The number of fixed points to be input is determined by the difference between the number of fixed points after calibration and the starting value of the corresponding interval.

[0105] In an optional embodiment of this application, the interval [0.5, 1) is divided into 64 segments, and the length of each segment is 0.5 / 64 = 2. -7 The operation to shift the interval [0.5,1) to the beginning of 0 is: [2 -1 ,1)-2 -1 =[0,2 -1 x is also translated synchronously to obtain x-2 -1 To determine which segment of the interval x falls within, we can calculate idx = floor((x-2). -1 ) / 2 -7 The difference between x and the initial value of the interval is calculated to be Δx = (x - 2). -1 mod2 -7 Fixed-point numbers of size x are represented using Qe.f (1 sign bit, e-1 integer bits, f decimal bits); 2 -1 and 2 -7 Converting to a Qe.f fixed-point number, we get idx = floor((x-2) f-1 ) / 2 f-7 Similarly, Δx = (x - 2) f-1 mod2 f-7 The remainder can be achieved using bitwise operations, i.e., Δx = bitand(x-2). f-1 ,2 f-7 -1).

[0106] The dynamic calibration fixed-point number reciprocal lookup table method of this application determines the input fixed-point number and coefficient corresponding to the calibrated fixed-point number through the relationship table between each interval and the coefficient. It can perform addition, subtraction and multiplication operations to achieve division operations on the input fixed-point number and coefficient, avoiding complex calculations. While reducing storage occupation by only creating tables for specific intervals, it further balances resource consumption and computing efficiency.

[0107] In an optional embodiment of this application, the index corresponding to the shifted fixed-point number is determined by the following expression:

[0108] idx = floor((x-2) f-m01 ) / 2 f-m02 )

[0109] Where idx is the index of the shifted fixed-point number, floor() is the floor function, f is the number of decimal places in the Qe.f format, m01 is the exponent of m1, and m02 is the exponent of the quotient obtained by dividing m1 by the number of interval segments.

[0110] The difference between the shifted fixed-point number and the starting value of its corresponding interval is determined by the following expression:

[0111] Δx=(x-2 f-m01 )mod 2 f-m02

[0112] Where Δx is the difference between the shifted fixed-point number and the starting value of its corresponding interval, and mod is the modulo operation.

[0113] The step of determining the input fixed-point number corresponding to the calibrated fixed-point number based on the difference between the calibrated fixed-point number and the starting value of its corresponding interval includes:

[0114] The difference between the calibrated fixed-point number and the starting value of its corresponding interval is shifted left by h bits to obtain the input fixed-point number corresponding to the calibrated fixed-point number.

[0115] The dynamic scaling fixed-point number reciprocal lookup table method of this application uses the index idx to retrieve coefficients c1 to c6 from the reciprocal table, where c1 to c5 correspond to k5 and k4*2, respectively. h k3*2 2h k2*2 3h k1*2 4h The fixed-point number, shifted left by h bits by Δx, yields dx (corresponding to x*2). h The method of obtaining parameters for calculating the reciprocal of a fixed-point number by looking up a table is simple and fast, improving the efficiency of the calculation process.

[0116] In an optional embodiment of this application, step S400, determining the reciprocal of the target fixed-point number based on the input fixed-point number and coefficients, includes:

[0117] The reciprocal of the target fixed-point displacement is determined using the following expression:

[0118] y_temp = F(x) * 2 4h =(((c1*dx+c2)*dx+c3)*dx+c4)*dx+c5

[0119] Where y_temp is the reciprocal of the target fixed-point displacement, dx is the number of fixed points to be input, and dx = x - x0.

[0120] In the Qc.d format, the reciprocal of the target fixed-point number is obtained by left-shifting y_temp by d+f+b–c6 bits, where c6 is the shift value for left shifting and scaling of k5 to k1, b is the shift value for dynamic scaling and shifting of the target fixed-point number x, and d is the decimal place of the reciprocal of the target fixed-point number.

[0121] In the dynamic scaling fixed-point reciprocal lookup table method of this application, the dynamic scaling and shifting of x by b bits moves the most significant bit of x to the highest position. The left shift of x by b bits also shifts y_temp left by b bits. The left shift of y_temp by b bits improves the precision of y. This is because if y_temp were only left shifted by d+f-c6 bits (without shifting by b bits), some significant bits of y would be truncated and lost. Therefore, the dynamic scaling and shifting of x by b bits also requires shifting y_temp by b bits, thereby improving the representation precision of y_temp after the shift by b bits.

[0122] In an optional embodiment of this application, x = x - x0 = dx is substituted into the following expression:

[0123] F(x+x0)*2 4h =((k5*x*2 h +k4*2 h )*x*2 h +k3*2 2h )*x*2 h +k2*2 3h )*x*2 h +k1*2 4h

[0124] We get y_temp = F(x) * 2 4h = (((c1*dx+c2)*dx+c3)*dx+c4)*dx+c5, when calculating this expression in fixed-point numbers, each step of the fixed-point multiplication is shifted right by f bits to align the decimal places. That is, y_temp at this time is F(x)*2 in fixed-point representation. 4h .

[0125] The dynamic calibration fixed-point number lookup table method of this application takes x-x0 as the input fixed-point number and F(x+x0)*2 4h Transform into F(x)*2 4h After determining the reciprocal of the target fixed point number before displacement, the reciprocal of the target fixed point number can be obtained by simply shifting the reciprocal of the target fixed point number before displacement. This method is simple and fast, improving the efficiency of the calculation process for the reciprocal of the fixed point number.

[0126] In an optional embodiment of this application, the dynamic scaling fixed-point reciprocal lookup table method of this application can be applied to the calculation of long-range and short-range electrostatic interactions of atoms in the method for determining electrostatic interaction forces. Specifically, the following expression is used to determine the electrostatic force between the first and second atoms by using the current atom as the first atom and traversing with a specified second atom. The electrostatic forces between the first and second atoms are then canceled out, and the target electrostatic force is obtained as the long-range electrostatic force of the current atom. This includes:

[0127]

[0128] Among them, F long Let f be the target electrostatic force, α be the electrostatic conversion factor, and q be the Gaussian cloud factor. i q j The charges carried by atoms i and j are respectively, r ij Let N be the distance between atoms i and j, N be the total number of atoms, and k be the distance between atoms i and j. x ,k y ,k z L is the number of lattice points for three-way diffusion. x ,L y ,L z To simulate the side length of the box,

[0129] The short-range electrostatic interaction of each atom can be obtained using the following expressions, including:

[0130]

[0131] Among them, F short Let f be the short-range electrostatic interaction for each atom, f be the electrostatic conversion factor, α be the Gaussian cloud factor, and q be the short-range electrostatic interaction for each atom. i q j The charges carried by atoms i and j are respectively, r ij Let N be the distance between atoms i and j, N be the total number of atoms, and k be the distance between atoms i and j. x k y k z L is the number of lattice points for three-way diffusion. x L y L z To simulate the side length of the box, erfc(x) is the error complementation function.

[0132] In an optional embodiment of this application, the method for determining the electrostatic interaction force includes:

[0133] The target molecular dynamics simulation system is divided into multiple three-dimensional grids, where each three-dimensional grid is treated as a node. Each node contains a computational unit and a storage unit, and each node contains at least one atom. Different nodes communicate with each other through point-to-point direct connection channels, and edge nodes are periodically connected to form a closed loop.

[0134] For each atom in the target molecular dynamics simulation system, the current atom is taken as the first atom and traversed with the specified second atom to determine the electrostatic force between the first atom and the second atom. The electrostatic force between the non-electrostatic pairs of atoms in the first atom and the second atom is canceled to obtain the target electrostatic force, which is taken as the long-range electrostatic force of the current atom. The second atom diffuses around the first atom and the diffusion radius is within a preset value. All atoms involved in the rigid atomic group are stored in the same storage unit.

[0135] The long-range electrostatic interaction of each atom is corrected based on the long-range electrostatic interaction of all atoms in the target molecular dynamics simulation system, and the corrected long-range electrostatic interaction is obtained.

[0136] Obtain the short-range electrostatic interaction of each atom, and sum the corrected long-range electrostatic interaction of each atom with the short-range electrostatic interaction. The sum is taken as the electrostatic interaction force of each atom.

[0137] In an optional embodiment of this application, the designated second atom is obtained through the following steps:

[0138] For each atom other than the first atom, atoms whose distance from the first atom is greater than a preset value are considered as atoms to be eliminated.

[0139] The atoms in the target molecular dynamics simulation system other than the first atom and the atom to be eliminated are designated as the second atom.

[0140] In an optional embodiment of this application, the long-range electrostatic interactions of all atoms in the target molecular dynamics simulation system are obtained through the following steps:

[0141] The target molecular dynamics simulation system is divided into multiple regions by multiple three-dimensional grids. The cumulative value of long-range electrostatic interactions within each region is collected. The number of regions is less than the number of three-dimensional grids.

[0142] The summation of the long-range electrostatic interactions within each region in all regions yields the total long-range electrostatic interaction of the target molecular dynamics simulation system, which is then used as the long-range electrostatic interaction of all atoms in the target molecular dynamics simulation system.

[0143] In an optional embodiment of this application, collecting the cumulative value of long-range electrostatic interactions within each region includes:

[0144] The receiving function of each computing unit within the configuration area is interrupted;

[0145] The broadcast function between computing units in the configuration area is interrupted;

[0146] For each region, each computing unit within the current region sends long-range electrostatic discharge (ESD) signals to the same designated computing unit. The designated computing unit accumulates the received ESD signals. When the number of ESD signals received by the designated computing unit reaches the first specified number in the receive function interruption configuration, the designated computing unit stops receiving ESD signals, obtaining the cumulative value of long-range ESD signals for the current region, and clearing the interruption configuration of the receive function for each computing unit within the region.

[0147] The summation of the cumulative long-range electrostatic effects within each region of all regions includes:

[0148] Each designated computing unit broadcasts the cumulative value of long-range electrostatic discharge (ESD) within the region to the fixed address of designated computing units in other regions. The designated computing unit then accumulates the broadcast ESD. When the number of ESD received by the designated computing unit reaches the second specified number in the broadcast function interruption configuration, the cumulative value of long-range ESD between regions is obtained, and the broadcast function interruption configuration of each computing unit in the region is cleared.

[0149] In an optional embodiment of this application, the step of correcting the long-range electrostatic interaction of each atom based on the long-range electrostatic interactions of all atoms in the target molecular dynamics simulation system to obtain the corrected long-range electrostatic interaction includes:

[0150] The long-range correction force for each atom is determined based on the long-range electrostatic interactions of all atoms in the target molecular dynamics simulation system using the following expression:

[0151]

[0152] Among them, F cor The long-range correction force for each atom, F tot Let N represent the long-range electrostatic interactions of all atoms in the target molecular dynamics simulation system, and N be the number of atoms in the target molecular dynamics simulation system.

[0153] The long-range correction force is broadcast regionally to each computational unit. The long-range electrostatic interaction of each atom is corrected using the following expression, resulting in the corrected long-range electrostatic interaction:

[0154] F v,long =F long -F cor

[0155] Among them, F v,long For the corrected long-range electrostatic interaction of each atom, F long For the long-range electrostatic interaction before correction for each atom, F cor The long-range correction force for each atom.

[0156] In an optional embodiment of this application, the dynamic scaling fixed-point reciprocal lookup table method of this application can be applied to the calculation of the reciprocal in the butterfly factor calculation of the FFT calculation method, wherein the FFT calculation method includes:

[0157] The target 3D data is preprocessed to make each dimension of the target 3D data m*2. n Multiples of, where the array in the microcode memory is 2 n ×2 n ×2 n m is the number of microcode storage devices. The preprocessed three-dimensional data includes first-dimensional data, second-dimensional data, and third-dimensional data.

[0158] The data in the first dimension are divided and FFT calculated sequentially according to radix-5, radix-3, and radix-2 to obtain the FFT calculation result of the first dimension.

[0159] The FFT calculation result of the first dimension is used as the data of the second dimension. The data of the second dimension is divided and FFT calculated in turn according to the radix-5, radix-3 and radix-2 to obtain the FFT calculation result of the second dimension.

[0160] The second-dimensional FFT calculation result is used as the third-dimensional data. The third-dimensional data is then divided and FFT calculated sequentially according to radix 5, radix 3, and radix 2 to obtain the third-dimensional FFT calculation result, which is used as the three-dimensional FFT calculation result.

[0161] In an optional embodiment of this application, the step of sequentially partitioning and FFT-computing the first-dimensional data according to radix-5, radix-3, and radix-2 to obtain the first-dimensional FFT calculation result includes:

[0162] Determine if the number of points in the first dimension is divisible by 5;

[0163] If the number of points in the first dimension data is divisible by 5, the first dimension data is divided according to radix 5 to obtain the t1th batch of 5 radix 5 subsequences. The t1th batch of 5 radix 5 subsequences is transformed into the frequency domain using the radix 5 FFT algorithm, which is used as the result of the t1th batch of 5 radix 5 subsequences, where t1 is the number of times the data is divided according to radix 5.

[0164] If the number of data points in the first dimension is not divisible by 5, or if the results of the 5 groups of radix-5 subsequences in the t1th batch are obtained, determine whether the number of points in the first dimension data or the results of each group of radix-5 subsequences in the t1th batch is divisible by 3.

[0165] If the number of points in the first dimension data or the result of each radix-5 subsequence in the t1th batch is divisible by 3, the first dimension data or the result of each radix-5 subsequence in the t1th batch is divided according to radix-3 to obtain the 3 radix-3 subsequences in the t2th batch. The 3 radix-3 subsequences in the t2th batch are transformed into the frequency domain using the radix-3 FFT algorithm, which is used as the result of the 3 radix-3 subsequences in the t2th batch, where t2 is the number of times the data is divided according to radix-3.

[0166] If the number of data points in the first dimension is not divisible by 3, or if the results of the 3 groups of radix-3 subsequences in the t2th batch are obtained, determine whether the number of points in the first dimension data or the results of each group of radix-3 subsequences in the t2th batch is divisible by 2.

[0167] If the number of points in the first dimension data or each radix-3 subsequence result is divisible by 2, the first dimension data or each radix-3 subsequence result is divided according to radix-2 to obtain the t3th batch of 2 radix-2 subsequences. The t3th batch of 2 radix-2 subsequences is transformed into the frequency domain using the radix-2 FFT algorithm and used as the first dimension FFT calculation result, where t3 is the number of times the data is divided according to radix-2.

[0168] In an optional embodiment of this application, the step of dividing the first dimension data according to radix-5 to obtain the t1th batch of 5-group radix-5 subsequences, and using a radix-5 FFT algorithm to transform the t1th batch of 5-group radix-5 subsequences to the frequency domain as the result of the t1th batch of 5-group radix-5 subsequences, includes:

[0169] Step 1: Divide the data in the first dimension according to radix-5 to obtain 5 radix-5 subsequences;

[0170] Step 2: Use the radix-5 FFT algorithm to transform the 5 radix-5 subsequences into the frequency domain to obtain the first batch of 5 radix-5 subsequence results;

[0171] Step 3: Determine whether the number of points in each of the first batch of base-5 subsequence results is divisible by 5;

[0172] Step 4: If the number of points in each group of radix-5 subsequences in the first batch is divisible by 5, divide each group of radix-5 subsequences in the first batch according to radix-5 to obtain the first, second, third, fourth and fifth subsequence segments of each group of radix-5 subsequences in the first batch. Concatenate the first subsequence segments corresponding to the first to fifth groups of radix-5 subsequences in the first batch to obtain the first group of radix-5 subsequences in the second batch. Concatenate the second subsequence segments corresponding to the first to fifth groups of radix-5 subsequences in the first batch to obtain the second group of radix-5 subsequences in the second batch, and so on, until the second batch of 5 groups of radix-5 subsequences is obtained.

[0173] Step 5: Use the radix-5 FFT algorithm to transform the second batch of 5 radix-5 subsequences to the frequency domain to obtain the second batch of 5 radix-5 subsequence results. Return to step 3 until the number of points in each radix-5 subsequence result is no longer divisible by 5, and obtain the t1th batch of 5 radix-5 subsequence results.

[0174] In an optional embodiment of this application, the first batch of 5 radix-5 subsequences is obtained by transforming the 5 radix-5 subsequences to the frequency domain using the radix-5 FFT algorithm through the following expression:

[0175]

[0176] Where, X(k1), and The results for the first batch of 5 radix-5 subsequences are as follows: A1, B1, C1, D1, and E1 are the first batch of 5 radix-5 subsequences. and As a base 5 butterfly factor, and radix is ​​the base-5 adjustment factor, where radix is ​​the base number.

[0177] In an optional embodiment of this application, the step of dividing the first dimension data or the radix-5 subsequence results of each group in the t1 batch according to radix-3 to obtain the 3 groups of radix-3 subsequences in the t2 batch includes:

[0178] Step 1: Divide the data of the first dimension into radix 3 or the radix 5 subsequence results of each group in the t1 batch according to radix 3, to obtain 3 groups of radix 3 subsequences;

[0179] Step 2: Use the radix-3 FFT algorithm to transform the three radix-3 subsequences into the frequency domain to obtain the first batch of three radix-3 subsequence results;

[0180] Step 3: Determine whether the number of points in each of the first batch of base-3 subsequence results is divisible by 3;

[0181] Step 4: If the number of points in each group of radix-3 subsequences in the first batch is divisible by 3, divide each group of radix-3 subsequences in the first batch according to radix-3 to obtain the first, second, and third subsequence segments after the division of each group of radix-3 subsequences in the first batch. Concatenate the first subsequence segments corresponding to the first to third groups of radix-3 subsequences in the first batch to obtain the first group of radix-3 subsequences in the second batch. Concatenate the second subsequence segments corresponding to the first to third groups of radix-3 subsequences in the first batch to obtain the second group of radix-3 subsequences in the second batch, and so on, until the second batch of 3 groups of radix-3 subsequences is obtained.

[0182] Step 5: Use the radix-3 FFT algorithm to transform the second batch of 3 groups of radix-3 subsequences into the frequency domain to obtain the results of the second batch of 3 groups of radix-3 subsequences. Return to step 3 and continue until the number of points in each group of radix-3 subsequences is no longer divisible by 3, to obtain the results of the t2th batch of 3 groups of radix-3 subsequences.

[0183] In an optional embodiment of this application, the three sets of radix-3 subsequences are transformed to the frequency domain using the radix-3 FFT algorithm through the following expression to obtain the first batch of three sets of radix-3 subsequence results:

[0184]

[0185] Where X(k2), and The results for the first batch of three radix-3 subsequences are shown. A2, B2, and C2 are the first batch of three radix-3 subsequences. and As a base 3 butterfly factor, and The base is 3, which is the adjustment factor.

[0186] In an optional embodiment of this application, the step of dividing the first-dimensional data or each group of radix-3 subsequences according to radix-2 to obtain the t3th batch of 2 groups of radix-2 subsequences, and using the radix-2 FFT algorithm to transform the t3th batch of 2 groups of radix-2 subsequences into the frequency domain as the first-dimensional FFT calculation result includes:

[0187] Step 1: Divide each group of base 3 subsequences into two groups of base 2 subsequences according to base 2.

[0188] Step 2: Use the radix-2 FFT algorithm to transform the two sets of radix-2 subsequences into the frequency domain to obtain the first batch of two sets of radix-2 subsequence results;

[0189] Step 3: Determine whether the number of points in each base-2 subsequence result of the first batch is divisible by 2;

[0190] Step 4: If the number of points in each group of radix-2 subsequences in the first batch is divisible by 2, divide each group of radix-2 subsequences according to radix-2 to obtain the first and second subsequence segments of each group of radix-2 subsequences in the first batch. Concatenate the first subsequence segments corresponding to the first and second groups of radix-2 subsequences in the first batch to obtain the first group of radix-2 subsequences in the second batch. Concatenate the second subsequence segments of the first and second groups of radix-2 subsequences in the first batch to obtain the second group of radix-2 subsequences in the second batch, thus obtaining the second batch of 2 groups of radix-2 subsequences.

[0191] Step 5: Use the radix-2 FFT algorithm to transform the second batch of two groups of radix-2 subsequences to the frequency domain, obtaining the results of the second batch of two groups of radix-2 subsequences. Return to step 3, and repeat until the number of points in each group of radix-2 subsequences is no longer divisible by 2, to obtain the results of the t3th batch of two groups of radix-2 subsequences.

[0192] The following expression is used to transform the two sets of radix-2 subsequences to the frequency domain using the radix-2 FFT algorithm, resulting in the first batch of two sets of radix-2 subsequences:

[0193]

[0194] Where X(k3) and These are the results of the first two sets of radix-2 subsequences. A3 and B3 are the first two sets of radix-2 subsequences. The base is a butterfly factor.

[0195] It should be understood that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order constraint on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the diagram may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0196] Please see Figure 3 One embodiment of this application provides a dynamically calibrated fixed-point reciprocal lookup table device 300, comprising:

[0197] The partitioning module 310 is used to uniformly divide the fixed-point number interval [m1, m2) into multiple segments. For each segment, an nth-order Taylor expansion is performed on the reciprocal function of the fixed-point number at the beginning of the segment to determine the n+2 coefficients corresponding to each segment, so as to construct a relationship table between each segment and the coefficients. Here, 0 < m1 < m2 and m1 and m2 are both integer powers of 2, and the number of segments is an integer power of 2.

[0198] The shift module 320 is used to receive the target fixed-point number, shift the target fixed-point number so that the shifted fixed-point number is within the fixed-point number interval [m1, m2), and dynamically calibrate the shifted fixed-point number;

[0199] The first determining module 330 is used to determine the number of fixed points and coefficients to be input after calibration based on the relationship table between each interval and the coefficients.

[0200] The second determining module 340 is used to determine the reciprocal of the target fixed point number based on the number of fixed points to be input and the coefficient.

[0201] Specific limitations regarding the aforementioned device 300 can be found in the above description of the limitations on the fixed-point reciprocal lookup table method for dynamic calibration, and will not be repeated here. Each module in the aforementioned device 300 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in a computer device, or stored in software in the memory of a computer device, so that the processor can call and execute the operations corresponding to each module.

[0202] In one embodiment, a computer device is provided, the internal structure of which can be as follows: Figure 4 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the above-described dynamic scaling fixed-point inverse lookup table method. It includes: memory and a processor; the memory stores the computer program; and the processor, when executing the computer program, implements any step of the above-described dynamic scaling fixed-point inverse lookup table method.

[0203] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, can perform any step of the above-described dynamic scaling fixed-point reciprocal lookup table method.

[0204] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0205] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0206] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0207] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0208] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0209] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A dynamic calibration method for reciprocal lookup of fixed-point numbers, characterized in that, include: The fixed-point number interval [m1, m2) is uniformly divided into multiple segments. For each segment, an nth-order Taylor expansion is performed on the reciprocal function of the fixed-point number at the beginning of the segment to determine the n+2 coefficients corresponding to each segment, so as to construct a relationship table between each segment and the coefficients. Here, 0 < m1 < m2 and m1 and m2 are both integer powers of 2. The number of segments is an integer power of 2. Receive the target fixed-point number, shift the target fixed-point number so that the shifted fixed-point number is within the fixed-point number interval [m1, m2), and dynamically calibrate the shifted fixed-point number; Based on the relationship table between each interval and the coefficient, determine the number of fixed points and coefficients to be input after calibration; The reciprocal of the target fixed point number is determined based on the input fixed point number and coefficient.

2. The method according to claim 1, characterized in that, For each interval obtained by the division, an nth-order Taylor expansion is performed on the reciprocal function of the fixed-point number at the beginning of the interval to determine the n+2 coefficients corresponding to each interval, including: For each interval obtained by the division, perform an nth-order Taylor expansion on the reciprocal function of the fixed-point number at the beginning of the interval to determine the Taylor fitting coefficients k1 to k2 for each interval. n+1 ; For each interval of fixed points, determine the minimum number of bits h that can be shifted left, and for k... n+1 ~k1 is shifted left by 0, h, 2h, 3h...nh bits respectively to obtain the shifted k n+1 ~k1; After shifting k n+1 ~k1 is calibrated to obtain the calibrated k n+1 ~k1 and k n+1 ~k1 left shift and scaling shift values ​​serve as n+2 coefficients for each interval.

3. The method according to claim 2, characterized in that, When n is 4, the Taylor fitting coefficients for each interval are determined by performing a 4th-order Taylor expansion on the reciprocal of the fixed-point number at the beginning of each interval using the following expression: F(x+x0)=k1+k2*x+k3*x 2 +k4*x 3 +k5*x 4 Where k1~k5 are the Taylor fitting coefficients corresponding to the current segment interval, x is the number of fixed points, x0 is the value of the first segment, and F(x+x0) is the value of the reciprocal of the number of fixed points x+x0. The shifted k5 to k1 are obtained by left-shifting k5 to k1 by 0, h, 2h, 3h, and 4h bits respectively using the following expressions: F(x+x0)*2 4h =(((k5*x*2 h +k4*2 h )*x*2 h +k3*2 2h )*x*2 h +k2*2 3h )*x*2 h +k1*2 4h c1=k5,c2=k4*2 h ,c3=k3*2 2h ,c4=k2*2 3h ,c5=k1*2 4h Where c1~c5 are the shifted k5~k1, F(x+x0)*2 4h Let x+x0 be the value of the reciprocal of the fixed point x+x0 shifted to the left by 4h.

4. The method according to claim 1, characterized in that, The process of shifting the target fixed-point number so that the shifted fixed-point number is within the fixed-point number interval [m1, m2), and dynamically calibrating the shifted fixed-point number, includes: Determine whether the target fixed point number is within the fixed point number interval [m1, m2); When the target fixed point number is within the fixed point number interval [m1, m2), the target fixed point number is dynamically calibrated to obtain the calibrated fixed point number; If the target fixed point number exceeds the fixed point number interval [m1, m2), the target fixed point number is shifted so that the shifted fixed point number is within the fixed point number interval [m1, m2), and the shifted fixed point number is dynamically calibrated to obtain the calibrated fixed point number.

5. The method according to claim 1, characterized in that, The process of determining the input fixed-point number and coefficients corresponding to the calibrated fixed-point number based on the relationship table between each interval and the coefficients includes: Determine the index corresponding to the fixed point number after calibration, where the index is the number of segments in the interval; According to the index, the coefficients of the interval corresponding to the calibrated fixed point number are read from the corresponding relationship table between each interval and the coefficient; The number of fixed points to be input is determined by the difference between the number of fixed points after calibration and the starting value of the corresponding interval.

6. The method according to claim 5, characterized in that, The index corresponding to the calibrated fixed-point number is determined using the following expression: idx=floor((x-2 f-m01 ) / 2 f-m02 ) Where idx is the index corresponding to the calibrated fixed-point number, floor() is the floor function, f is the number of decimal places in the Qe.f format of the fixed-point number, m01 is the exponent corresponding to m1, and m02 is the exponent corresponding to the quotient obtained by dividing m1 by the number of interval segments. The difference between the calibrated fixed-point number and the starting value of its corresponding interval is determined by the following expression: Δx=(x-2 f-m01 )mod 2 f-m02 Where Δx is the difference between the calibrated fixed-point number and the starting value of its corresponding interval, and mod is the modulo operation. The step of determining the input fixed-point number corresponding to the calibrated fixed-point number based on the difference between the calibrated fixed-point number and the starting value of its corresponding interval includes: The difference between the calibrated fixed-point number and the starting value of its corresponding interval is shifted left by h bits to obtain the input fixed-point number corresponding to the calibrated fixed-point number.

7. The method according to claim 1, characterized in that, The step of determining the reciprocal of the target fixed-point number based on the input fixed-point number and coefficients includes: The reciprocal of the target fixed-point displacement is determined using the following expression: y_temp=F(x)*2 4h =(((c1*dx+c2)*dx+c3)*dx+c4)*dx+c5 Where y_temp is the reciprocal of the target fixed-point displacement, dx is the number of fixed points to be input, and dx = x - x0. In the Qc.d format, the reciprocal of the target fixed-point number is obtained by left-shifting y_temp by d+f+b–c6 bits, where c6 is the shift value for left shifting and scaling of k5 to k1, b is the shift value for dynamic scaling and shifting of the target fixed-point number x, and d is the decimal place of the reciprocal of the target fixed-point number.

8. A dynamic calibration fixed-point reciprocal lookup table device, characterized in that, include: The partitioning module is used to uniformly divide the fixed-point number interval [m1, m2) into multiple segments. For each segment, an nth-order Taylor expansion is performed on the reciprocal function of the fixed-point number at the beginning of the segment to determine the n+2 coefficients corresponding to each segment, so as to construct a relationship table between each segment and the coefficients. Here, 0 < m1 < m2 and m1 and m2 are both integer powers of 2, and the number of segments is an integer power of 2. The shift module is used to receive the target fixed-point number, shift the target fixed-point number so that the shifted fixed-point number is within the fixed-point number interval [m1, m2), and dynamically calibrate the shifted fixed-point number. The first determination module is used to determine the number of fixed points and coefficients to be input after calibration, based on the relationship table between each interval and the coefficients. The second determining module is used to determine the reciprocal of the target fixed point number based on the input fixed point number and coefficient.

9. A computer device, comprising: A memory and a processor, the memory storing a computer program, characterized in that, when the processor executes the computer program, it implements the steps of the dynamic scaling fixed-point reciprocal lookup table method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the fixed-point reciprocal lookup table method for dynamic scaling as described in any one of claims 1 to 7.