Singular value decomposition method, chip and electronic device implemented by hardware

By employing a two-dimensional rotation matrix to iteratively diagonalize the positive semidefinite matrix in the hardware device, the high cost and high power consumption problem of IMU data processing is solved, realizing low-complexity and low-power IMU data processing, and promoting the commercial application of edge computing devices such as smart ear tags.

CN116680533BActive Publication Date: 2026-11-20SHANGHAI SYNSENSE TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310637399.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-31
Publication Date
2026-11-20
Estimated Expiration
2043-05-31

AI Technical Summary

Technical Problem

Existing technologies struggle to process IMU sensor data in hardware devices at low cost and low power consumption, limiting the large-scale commercial application of edge computing devices such as smart ear tags.

Method used

Singular value decomposition can be implemented using programmable gate arrays or application-specific integrated circuits, and positive semidefinite matrices can be iteratively diagonalized using simple two-dimensional rotation matrices, thereby reducing computational and storage resource consumption.

Benefits of technology

It achieves low-complexity, low-power IMU data processing, suitable for smart ear tags and wearable devices with limited hardware resources, and improves the accuracy of data processing and battery life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116680533B_ABST
    Figure CN116680533B_ABST
Patent Text Reader

Abstract

The application discloses a singular value decomposition method, a chip and electronic equipment realized by hardware. In order to solve the shortcomings of the existing singular value decomposition, such as complexity, high cost and high power consumption, the application uses a simple 2*2 rotation sub-matrix K to gradually diagonalize a given 3*3 matrix C in an iterative manner, wherein C is a covariance matrix obtained according to sensor output data, and the matrix C is a semi-positive definite matrix. The application uses a lookup table to quickly obtain a 2D rotation matrix in the current iteration process at each iteration, and has the advantages of low complexity and high efficiency. The application is friendly to hardware implementation, has the advantages of low cost and low power consumption, and can be used in intelligent ear tags, wearable devices and other electronic products with limited hardware resources or / and ultra-low power consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a singular value decomposition method, chip, and electronic device implemented in hardware, and more particularly to a singular value decomposition method, chip, and electronic device implemented in a hardware-friendly, low-power, and low-cost manner. Background Technology

[0002] With the increasing demand for improved health and productivity, commercially viable animal detection technologies are attracting more and more attention. For example, smart ear tags based on wearable technology enable scientific and intelligent breeding management, health management, and disease management for livestock and pets.

[0003] Some technologies utilize RFID ear tags for health and disease management, but currently, RFID ear tags are mainly used for temperature measurement, and their functionality is not comprehensive enough. Other technologies combine advanced AI visual recognition and / or voice recognition technologies for monitoring; however, visual methods have limitations in terms of viewing angle, lighting, and cost, while voice methods are difficult to use for behavioral monitoring and analysis.

[0004] In summary, there are currently no fully functional smart ear tag products on the market (including automated status monitoring and health management). Most offer only partial functionality and provide limited, inaccurate data. AI-based smart ear tags typically suffer from complex hardware implementation, poor environmental adaptability, high cost, and poor battery life (high power consumption). These issues limit the large-scale adoption of smart ear tags.

[0005] For the commercial application of smart ear tags, the basic requirements are multi-dimensional sensors, always-on monitoring, long battery life (ideally covering the entire life cycle of livestock), high accuracy, low cost, and ease of implementation. Data such as body temperature and abnormal sounds are easy to process, but the acquisition and processing of low-cost and effective behavioral data is a pressing problem that needs to be solved for current industrialization.

[0006] An Inertial Measurement Unit (IMU) is a combination of sensors used to measure the linear acceleration and angular velocity of an object. IMUs are used in applications such as motion recognition, attitude control, navigation, and positioning in aerospace, automotive, drones, and mobile devices. AI processing based on IMU data is an important direction in current liveness detection; however, IMU data is often affected by various factors.

[0007] Singular Value Decomposition (SVD) is a matrix factorization technique that can be used to process IMU data in certain scenarios, rotating its original coordinate system to a new one. While executing the SVD algorithm is relatively simple on ordinary program-instruction-based computers (such as CPUs), it involves a large number of matrix calculations, making its implementation on hardware with limited computing resources very complex. Furthermore, SVD consumes significant storage and computing resources, resulting in low computational efficiency. This significantly increases the implementation cost and power consumption of edge computing devices such as smart ear tags. Therefore, how to implement information processing for IMU sensors based on SVD in resource-constrained scenarios with low power consumption and low cost is a difficult technical challenge.

[0008] Prior art 1 discloses an SVD processor implemented on an FPGA, which achieves parallel computing based on the Jacobi algorithm in prior art 2, realizing an efficient hardware solution. However, the technology in document 1 is tailored for the CORDIC (COordinate Rotation Digital Computer) algorithm and is not universally applicable. Furthermore, its complexity, cost, and power consumption still have room for further optimization.

[0009] Prior art 1: Ma, Weiwei, et al. "An FPGA-based singular value decomposition processor." 2006 Canadian Conference on Electrical and Computer Engineering. IEEE, 2006.

[0010] Prior art 2: Brent RP, Luk FT, Van Loan C. Computation of the singularvalue decomposition using mesh-connected processors. Cornell University, 1982.

[0011] The current technological goal pursued in this field is to find a universal, low-cost, low-power / low-complexity way to process sensor data such as IMUs in hardware devices, so as to promote the large-scale commercial application of edge computing devices such as smart ear tags. Summary of the Invention

[0012] To solve or alleviate some or all of the above-mentioned technical problems, the present invention is achieved through the following technical solution:

[0013] A first type of singular value decomposition method implemented in hardware, wherein the singular value decomposition is implemented by programming a programmable gate array or an application-specific integrated circuit, and performs the following steps:

[0014] Step S1: Initialize: Assign the identity matrix I to matrix R, and assign the matrix C to matrix M, where matrix C is the covariance matrix obtained from the sensor output data, and matrix C is a positive semi-definite matrix.

[0015] Step S2: Obtain the matrix R based on the rotation of axis i based on the matrix M updated in the previous iteration. i (θ i And update matrix R using multipliers and adders: R = R × R i (θ i ), and based on the updated matrix R, matrix M is diagonalized to update matrix M, where θ i ∈[0,2π], i∈{1,2,3}, where axis i is an axis in the spatial coordinate system;

[0016] Update axis i and repeat step S2 above until matrix M is completely diagonalized.

[0017] In one type of embodiment, the R i (i i Diagonalize all rows and columns of matrix M except for i.

[0018] In one type of embodiment, the rotation matrix R based on axis i... i (θ i The following requirements must be met in R: ij =1, i=j; R ij =0, i≠j.

[0019] In one type of embodiment, diagonalizing matrix M based on the updated matrix R is achieved by M = R. T ×M×R update matrix M.

[0020] In one embodiment, step S2 includes: calculating the angle θ using the element values ​​in the matrix M updated in the previous iteration. i The corresponding cosθi and sinθi are used to obtain the rotation matrix R. i (θ i ).

[0021] In one type of embodiment, a lookup table is used to obtain the angle θ. i The corresponding cosθi and sinθi.

[0022] In one type of implementation, the matrix M updated based on the previous iteration of axis i is rewritten to obtain a 2×2 matrix M. i Mi It is a 2×2 matrix obtained by removing the i-th row and i-th column from matrix M;

[0023] Based on matrix M i Obtaining the angle θ i The corresponding cosθi and sinθi are used to obtain the 2×2 rotation submatrix K. θi ;

[0024] Based on the 2×2 rotation submatrix K θi Iteratively update the rotation matrix R and matrix M, further diagonalizing matrix M.

[0025] In one type of embodiment, the matrix M-based i Obtaining the angle θ i The corresponding cosθi and sinθi are used to obtain the 2×2 rotation submatrix K. θi It includes the following steps:

[0026] For a 2×2 matrix M i It has the following forms:

[0027]

[0028] 2×2 rotation submatrix K θi for:

[0029]

[0030] Use one of the following methods to obtain matrix M i Obtaining θ i The corresponding sinθi and cosθi:

[0031] i) Direct calculation

[0032]

[0033]

[0034] ii) Use tan 2θi to obtain sinθi and cosθi corresponding to θi:

[0035]

[0036] In one type of embodiment, sinθi and cosθi corresponding to θi are obtained by looking up a table based on the tan 2θi value.

[0037] In some embodiments, based on tan|2θ i |Value acquisition and θ i The corresponding sin|θ i |and cos|θ i |

[0038] In some embodiments, a left-shifting and comparison network is used to realize the value of tan 2θi or tan||2θ. i | Value search.

[0039] In one type of implementation, the number of iterations is less than or equal to 8.

[0040] In one type of embodiment, let the fully diagonalized matrix M be D = diag(d1, d2, d3), where d i =D ii Represents the i-th diagonal element of C;

[0041] Sort the diagonal elements of the diagonal matrix D in descending order and adjust the columns of the rotation matrix R accordingly.

[0042] In one embodiment, the sensor is an IMU sensor.

[0043] A second type of singular value decomposition method implemented in hardware, which performs the following steps by programming a programmable gate array or designing an application-specific integrated circuit:

[0044] Step S200: Initialize: Assign the identity matrix I to matrix R, and assign the matrix C to matrix M, where matrix C is the covariance matrix obtained from the sensor output data, and matrix C is a positive semi-definite matrix;

[0045] Step S300: Diagonalize the given matrix C step by step using low-order rotation submatrices, specifically including the following sub-steps:

[0046] Sub-step S301: For axis i, obtain a 2×2 matrix M from the 3×3 matrix M. i M i It is a 2×2 matrix obtained by removing the i-th row and i-th column from matrix M, where i∈{1,2,3}, and axis i is an axis in the spatial coordinate system; matrix M i It has the following forms:

[0047]

[0048] Sub-step S302: Use a lookup table to find the match. or The corresponding cosθi and sinθi are used to obtain the 2×2 rotation submatrix K. θi ,in

[0049] Sub-step S303: Using the rotation submatrix K θi Iteratively update the rotation matrix R and / or matrix M to locally diagonalize matrix M;

[0050] Update axis i and repeat step S300 above iteratively until matrix M is completely diagonalized.

[0051] In one embodiment, the sensor is an IMU sensor.

[0052] In one type of embodiment, R i (θ i Diagonalize the rows and columns of matrix M except for row i and column i.

[0053] In one type of embodiment, matrix R and / or matrix M are iteratively updated using multipliers and adders.

[0054] In one type of embodiment, a left-shifting and comparison network is used to achieve this. or The search.

[0055] In one embodiment, while arranging the diagonal elements of the diagonal matrix D after fully diagonalizing matrix M in descending order, the columns of the rotation matrix R are adjusted accordingly.

[0056] In one type of embodiment, the use of K θi Iterate through matrix M, further diagonalizing it, including:

[0057] When i=1, the rotation matrix R and matrix M obtained by iterative update using the following formulas are respectively:

[0058]

[0059]

[0060] Continuing the iteration, when i = 2, the updated matrix M is:

[0061]

[0062] And the rotation matrix is ​​updated iteratively using R = R × R²(θ²), where,

[0063]

[0064] Continuing the iteration, when i = 3, the updated matrix M is:

[0065]

[0066] And the rotation matrix is ​​updated iteratively using R = R × R3(θ3), where,

[0067]

[0068] A chip includes a sensor data receiving module and a singular value decomposition module;

[0069] The singular value decomposition module is coupled to the sensor data receiving module and is used to implement singular value decomposition on the covariance matrix C obtained from the correlation of the sensor output data based on the covariance matrix C obtained from the sensor output data in hardware.

[0070] The singular value decomposition module executes the singular value decomposition method implemented in hardware as described above.

[0071] An electronic device comprising the chip as described above.

[0072] Some or all of the embodiments of the present invention have the following beneficial technical effects:

[0073] 1) This invention diagonalizes a given PSD matrix C through the iteration of a simple two-dimensional rotation matrix. It is hardware-friendly, consumes little storage and computing resources, and has the advantages of low cost and low power consumption. It can be used in electronic products with limited hardware resources or / and ultra-low power consumption requirements, such as smart ear tags and wearable devices.

[0074] 2) This invention is based on a simple lookup table method to quickly obtain and calculate the 2D rotation matrix in the current iteration process at each iteration, which has low complexity, high efficiency and is easy to implement in hardware.

[0075] 3) In the SVD implementation of the 3×3 PSD matrix, this invention can convert almost all PSD matrices and their variants into multiplication of a small number (6-8) simple rotation matrices, which greatly reduces the complexity and power consumption of the multiplier hardware implementation.

[0076] Further beneficial effects will be described in the preferred embodiments.

[0077] The technical solutions / features disclosed above are intended to summarize the technical solutions and features described in the Detailed Embodiments section, and therefore the scope of the description may not be entirely the same. However, these new technical solutions disclosed in this section are also part of the numerous technical solutions disclosed in this invention document. The technical features disclosed in this section, together with the technical features disclosed in the subsequent Detailed Embodiments section and some contents in the drawings not explicitly described in the specification, disclose more technical solutions in a reasonable combination.

[0078] The technical solution formed by combining all the technical features disclosed at any position in this invention is used to support the summary of the technical solution, the modification of the patent document, and the disclosure of the technical solution. Attached Figure Description

[0079] Figure 1This is a schematic diagram illustrating the stepwise diagonalization of a given PSD matrix in a certain embodiment of the present invention;

[0080] Figure 2 This is the process based on a partially diagonalized matrix M along axis i in a preferred embodiment of the present invention;

[0081] Figure 3 In a preferred embodiment of this invention, θ i The lookup table corresponding to the value;

[0082] Figure 4 This demonstrates the performance of the SVD hardware implementation of the present invention. Detailed Implementation

[0083] Since it is impossible to exhaustively describe all alternative solutions, the key points of the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Other technical solutions and details not disclosed in detail below generally belong to technical objectives or features that can be achieved by conventional means in the art, and due to space limitations, they will not be described in detail here.

[0084] Unless it refers to division, the " / " in any position in this invention represents logical "OR". The serial numbers "first", "second", etc., in any position in this invention are merely descriptive distinguishing marks and do not imply an absolute temporal or spatial order, nor do they imply that terms prefixed with such serial numbers necessarily refer to different things than the same terms prefixed with other modifiers.

[0085] This invention describes various key points used to combine into various specific embodiments, which will be incorporated into various methods and products. In this invention, even if a key point is described only when introducing a method / product solution, it means that the corresponding product / method solution also explicitly includes that technical feature.

[0086] The description of the existence or inclusion of a step, module, or feature at any location in this invention does not imply that such existence is exclusive or unique. Those skilled in the art can obtain other embodiments by supplementing the technical solutions disclosed in this invention with other technical means. The embodiments disclosed in this invention are generally for the purpose of disclosing preferred embodiments, but this does not imply that opposite embodiments of the preferred embodiments are excluded by this invention. As long as such opposite embodiments at least solve one of the technical problems of this invention, they are intended to be covered by this invention. Based on the key points described in the specific embodiments of this invention, those skilled in the art can substitute, delete, add, combine, or change the order of certain technical features to obtain a technical solution that still follows the concept of this invention. These solutions that do not depart from the technical concept of this invention are also within the protection scope of this invention.

[0087] Definitions:

[0088] A positive semi-definite (PSD) matrix C has the following characteristics: matrix C is symmetric, i.e., C... T =C, then for all vectors x, if x T Cx≥0 is equivalent to all eigenvalues ​​of C being positive.

[0089] Rotation matrix R, if R T R = I, where R is called a rotation matrix and I represents the identity matrix. A matrix is ​​a rotation matrix if its columns and rows have an identity norm and the inner product of different rows / columns is 0. Rotation matrices are sometimes called orthogonal matrices.

[0090] In projects using smart ear tags for livestock monitoring, the data acquired by the IMU sensor may be randomly rotated due to animal movement or sudden changes in orientation, as the animals may move erratically. However, this random rotation is not helpful for animal behavior analysis; on the contrary, it is unwanted data that interferes with routine behavior analysis. Therefore, in liveness detection, the data acquired by the IMU needs to be corrected to ensure that near-random orientations do not affect data quality.

[0091] Due to the extremely limited storage and computing resources in smart ear tags, this invention uses a second-order subspace method in its hardware implementation to estimate and / or compensate for the rotational effects of sudden animal movement on IMU data.

[0092] There are many methods for finding a rotation matrix R containing orientation / rotation information using singular value decomposition (SVD). Most of these methods require solving a polynomial equation to find the singular values ​​in the rotated matrix, followed by an eigenvalue problem. However, these methods are not suitable for hardware implementation. To reduce the hardware implementation difficulty, this invention implements SVD for a high-order (3×3) PSD matrix C based on an iterative method for a simple low-order (2×2) rotation matrix, progressively diagonalizing the given matrix C.

[0093] This invention calculates a positive semidefinite (PSD) correlation matrix C based on the correlation of IMU data, and partially diagonalizes the given PSD matrix C using a simple two-dimensional rotation matrix. Then, iteratively, it transforms matrix C into a diagonal matrix R. T CR = D. Here, the rotation matrix R is the product of simple two-dimensional rotation matrices used step-by-step in the iterative calculation.

[0094] A simple rotation matrix is ​​also called a two-dimensional planar rotation. For a 3×3 matrix, there are three types of two-dimensional rotation matrices:

[0095]

[0096]

[0097]

[0098] Where R i (θ) can be viewed as a two-dimensional rotation matrix that preserves the i-axis while rotating the other two axes (orthogonal to the i-axis) by an angle θ. i Rotation. In some embodiments, i = 1 may be set to represent the x-axis, i = 2 to represent the y-axis, and i = 3 to represent the z-axis; however, this invention does not impose any limitations on this.

[0099] These simple two-dimensional matrices can be used to generate any rotation matrix to adapt to input rotations in any complex scenario.

[0100] The singular value decomposition method of this invention is implemented in hardware, specifically an FPGA or ASIC chip. M is the matrix updated in each iteration, and R is a rotation matrix that diagonalizes the matrix M updated in each iteration.

[0101] The singular value decomposition method implemented in hardware, with the following specific steps: Figure 1 As shown, it includes:

[0102] Step S110: Initialize: Assign the identity matrix I to matrix R, and assign the matrix C to matrix M, where matrix C is the covariance matrix obtained from the sensor output data, and matrix C is a positive semi-definite matrix.

[0103] Step S120: Obtain the matrix R based on the rotation of axis i based on the matrix M updated in the previous iteration. i (θ i The matrix R is updated using multipliers and adders: R×R i (θ i →R (where the → symbol here signifies assignment, equivalent to R = R × R) i (θ i (The same notation is used for other assignment / update operations in this invention), and the matrix M is diagonalized based on the updated matrix R to update matrix M, where θ i ∈[0,2π], i∈{1,2,3}, where axis i is an axis in the spatial coordinate system;

[0104] Update axis i and repeat step S2 above until matrix M is completely diagonalized.

[0105] For example, the process is iterated in the order of i=1, i=2, i=3, i=1, i=2, i=3… until matrix M is completely diagonalized. As shown below:

[0106] Based on the matrix M = C initialized in step S1, the rotation matrix R1(θ1) based on axis 1 is obtained, thereby updating the rotation matrix R = R1(θ1) × I. In some embodiments, a multiplier and an adder are used to update the matrix R: R × R i (θ i → R. Based on this updated rotation matrix, diagonalize matrix M to update matrix M.

[0107] Specifically, the parameter values ​​(or element values) of the initialized matrix M = C are used to calculate the angle θ1 and its corresponding cosθ1 and sinθ1, thereby obtaining the rotation matrix R1(θ1) based on the rotation of axis 1.

[0108] Based on the updated rotation matrix R = R1(θ1) × I, diagonalize matrix M to obtain the updated matrix:

[0109] R T ×M×R→M.

[0110] Continue updating axis i, and rotate the updated matrix M along the remaining axes 2 and 3. That is, iterate using a similar method as described above until the matrix M is completely diagonalized.

[0111] Specifically, in step S2, based on axis 2, the rotation matrix R2(θ2) corresponding to axis 2 is obtained, and the rotation matrix is ​​updated.

[0112] R×R i (θ i → R.

[0113] Diagonalize all rows and columns except i=2 based on the updated rotation matrix R to update matrix M. Then, continue based on axis 3 to obtain the rotation matrix R3(θ3) corresponding to axis 3, and update the rotation matrix, as well as update matrix M.

[0114] Continue repeating the steps of rotating along axis 1 to axis 2 to axis 3 until matrix M is completely diagonalized. Let the number of iterations be k. Then, for any 3×3 matrix M, its corresponding total rotation matrix R can be approximated as:

[0115] R=R1(θ1)×R2(θ2)×……×R k (θ k ).

[0116] Where k is an integer and k≥1, and θ1, …, θ k ∈[0,2π].

[0117] In some preferred embodiments, the sensor is an IMU sensor.

[0118] In most embodiments, the number of iterations is less than or equal to 8.

[0119] To reduce hardware resources and computational complexity, this invention progressively attempts to diagonalize a given PSD matrix C (3×3) by applying a simple 2×2 rotation submatrix. In other words, this invention achieves complete diagonalization of matrix C through several iterations by gradually diagonalizing a portion of matrix C using submatrices.

[0120] This invention is based on the stepwise diagonalization of a given PSD matrix using submatrices. Figure 2 The process of partially diagonalizing matrix M based on axis i is shown. Here, M is the matrix updated in each iteration.

[0121] S210. For axis i, a 2×2 matrix M is obtained from the 3×3 matrix M. i M i It is a 2×2 matrix obtained by removing the i-th row and i-th column from matrix M. Where i∈{1,2,3}, and axis i is an axis in the spatial coordinate system.

[0122] S220, based on matrix M i Obtaining the angle θ i The corresponding cosθi and sinθi are used to obtain the 2×2 rotation submatrix K. θi .

[0123] S230, based on K θi Iteratively update the rotation matrix R and matrix M, further diagonalizing matrix M.

[0124] Repeat the above steps until matrix M is completely diagonalized.

[0125] For a 2×2 matrix M i It has the following forms:

[0126]

[0127] Therefore, the relationship with θ can be calculated. i The corresponding sinθi and cosθi:

[0128]

[0129]

[0130] We obtain the 2×2 rotation submatrix K in the 2D plane. θi :

[0131]

[0132] As shown above, the diagonalization of matrix M can be expressed as follows based on K: θi The update, for example for i=1, is based on K. θ1 The update of matrix M can be expressed as:

[0133]

[0134] To quickly obtain the angle θ i After calculation, this invention uses a lookup table to find the corresponding θ. i Value. To obtain a more efficient lookup table, this invention is based on parameter 2θ. i Create a lookup table:

[0135]

[0136] The range of values ​​for is [-∞, ∞], then the corresponding Or θ∈(-45, 45), in one embodiment a lookup table with precision Δθ=1 is used, as shown in the appendix. Figure 3 As shown.

[0137] In other embodiments, to further improve efficiency, calculations are performed. The absolute value of |θ i Then, add a sign to sinθi because sin(-θi) = -sin(θi), while keeping cosθi unchanged because cos(-θi) = cos(θi).

[0138] Furthermore, the lookup table further sorts the element values ​​in the same column, as shown in the appendix. Figure 3 The elements of tan 2θi are sorted in column E2. During hardware implementation, binary search is used to find the entry in E2 and the corresponding θi by comparison at each step.

[0139]

[0140] In some improved embodiments, a more efficient lookup table can be obtained through simple quantization. Furthermore, to improve accuracy, all values ​​are multiplied by an integer; in a preferred embodiment, for ease of hardware implementation, they are multiplied by powers of 2 to obtain an integer factor of E2, such as 32.

[0141] Therefore, this invention can achieve the search by left shifting and a simple comparison network to find θi or |θi. i Then, the previously calculated sign value is applied for subsequent processing.

[0142] This invention attempts to diagonalize a given PSD matrix C by applying simple 2×2 rotation matrices. As the iteration progresses, the matrix obtained by updating matrix M with these simple 2D rotation matrices becomes increasingly diagonal.

[0143] For example, in one embodiment, the sub-steps are implemented as follows:

[0144] Sub-step S310: Initialize R = I, M = C, and select index i ∈ {1, 2, 3}.

[0145] Sub-step S320: Obtain a 2×2 matrix M1 based on axis i=1. Here, M1 is the 2×2 matrix obtained by removing the first row and the first column from matrix M.

[0146] Initially, M = C. Since matrix M is a symmetric matrix, it can be rewritten in the following form:

[0147]

[0148] Where, m 11 M is a 1x1 vector containing the component of M at (1,1). m1 is a 2x1 vector containing the components of M at (2,1) and (3,1). M1 is a 2x2 matrix obtained by removing the first row and first column of matrix M.

[0149]

[0150] Based on matrix M1, we obtain cos(θ1) and sin(θ1) corresponding to angle θ1, thus obtaining the 2×2 rotation matrix K in the 2D plane. θ1 and using K θ1 Diagonalizing matrix M, i.e., updating matrix M, yields the updated matrix M. In some embodiments, a lookup table is used to find the matrix M with respect to the matrix M. or The corresponding cos(θ1) and sin(θ1) are used to obtain the 2×2 rotation submatrix K. θi .

[0151] In some embodiments, θ1 or 2θ1, and cos(θ1) and sin(θ1) corresponding to θ1 are looked up using a lookup table.

[0152] The updated matrix M can be calculated using the following formula:

[0153]

[0154] At the same time, based on K θ1 We obtain the rotation matrix R1(θ1), at which point the rotation matrix R = R1(θ1).

[0155]

[0156] Sub-step S330: Based on the updated matrix M in sub-step S320, obtain a 2×2 matrix M2 based on axis i=2. M2 is a 2×2 matrix obtained by removing the 2nd row and 22nd column from matrix M.

[0157] Based on matrix M2, we obtain cos(θ2) and sin(θ2) corresponding to angle θ2, thus obtaining the 2×2 rotation matrix K. θ2 And based on K θ2 Continue iteratively updating the matrix M, further diagonalizing it.

[0158] At the same time, based on K θ2 The rotation matrix R2(θ2) is obtained, and based on K... θ2 The iteratively updated matrix M and its corresponding total rotation matrix R = R1(θ1) × R2(θ2) are shown below:

[0159]

[0160]

[0161] Based on the updated matrix M from sub-steps S340 and S330, a 2×2 matrix M3 is obtained based on axis i=3. Here, M3 is the 2×2 matrix obtained by removing the 3rd row and 33rd column from matrix M. For example:

[0162]

[0163] Matrix M3 yields cos(θ3) and sin(θ3) corresponding to angle θ3, thus obtaining the 2×2 rotation matrix K. θ3 and using K θ3 Continue iteratively updating the matrix M, further diagonalizing it.

[0164] At the same time, based on K θ3 We obtain the rotation matrix R3(θ3), at which point we are based on K 03 The total rotation matrix R corresponding to the iteratively updated matrix M is R1(θ1)×R2(θ2)×R3(θ3).

[0165] In sub-step S350, if the updated matrix M is a diagonal matrix after processing by any of the aforementioned sub-steps S320 to S340, then stop the subsequent steps. Otherwise, continue iterating along axes i=1, i=2, and i=3 until matrix M is completely diagonalized.

[0166] Please note that the rotation matrix is ​​calculated / updated in each iteration. In the last iteration, its final value is given by RTCR, and the RTCR matrix is ​​(or nearly) a diagonal matrix, which can be represented as D = diag(d1, d2, d3), where d i =D ii Let i represent the i-th diagonal element of C, where i∈{1,2,3}.

[0167] In some embodiments, if the obtained diagonal elements do not satisfy the descending order, they need to be arranged to satisfy d1≥d2≥d3, and the same sorting needs to be applied to the columns of the rotation matrix R.

[0168] For example, assuming the final diagonal element is D = diag(3, 10, 5), then we need to perform the following sorting:

[0169] 3→p(5), 10→p(3), 5→p(10).

[0170] Wherein, p(d) i ) represents the position / position d in the current matrix D.

[0171] This means we need to change the order of the columns in R: 1→3, 2→1, 3→2.

[0172] The above steps can be easily implemented in hardware using a sorting network and a multiplexing network, with the multiplexing network arranging the columns in R according to the output of the sorting network. Furthermore, a simple lookup table-based method is used to quickly compute these simple 2D rotation matrices in each iteration. This method is easy to implement in hardware, consumes few storage and computational resources, and has the advantages of low cost and low power consumption, making it suitable for use in electronic products with limited hardware resources, such as smart ear tags and wearable devices.

[0173] The SVD hardware implementation method of this invention is applied to a randomly selected PSD matrix. A new basis is obtained by rotation, in which the PSD matrix C calculated based on the correlation of IMU data is diagonalized, and this processing speed is quite fast. Figure 4 To demonstrate the performance of the SVD hardware implementation of this invention, test results show that in the SVD implementation of a 3×3 PSD matrix, almost all PSD matrices and their variants can be converted into the multiplication of 6-8 simple rotation matrices (also called rotation submatrices). Figure 4The algorithm uses subspace distance and diagonalization as metrics for the diagonalization of the PSD matrix C, and converges in 6-8 iterations for almost all random PSD matrices or their variants. That is, in the SVD calculation of a 3×3 PSD matrix, almost all 3×3 rotation matrices can be written as the multiplication of 6-8 simple rotation matrices, which greatly reduces the complexity and power consumption of the multiplier hardware implementation.

[0174] A chip includes a sensor data receiving module and a singular value decomposition module; the singular value decomposition module is coupled to the sensor data receiving module and is used to implement singular value decomposition on the covariance matrix C obtained from the sensor output data in hardware; the singular value decomposition module performs the singular value decomposition method implemented in hardware as described in any of the preceding claims.

[0175] An electronic device includes the chip as described above. The electronic device can be various wearable devices, such as ear tags.

[0176] Although the invention has been described with reference to specific features and embodiments, various modifications, combinations, and substitutions can be made therein without departing from the invention. The scope of protection of this invention is not limited to the specific embodiments of processes, machines, manufactures, material compositions, apparatuses, methods, and steps described in the specification, and these methods and modules may also be implemented in one or more related, interdependent, cooperative, or upstream / downstream products or methods.

[0177] Therefore, the specification and drawings should be simply regarded as a description of some embodiments of the technical solutions defined by the appended claims, and thus the appended claims should be interpreted in accordance with the principle of the greatest reasonable interpretation, and are intended to cover as much as possible all modifications, variations, combinations or equivalents within the scope of the invention, while avoiding unreasonable interpretations.

[0178] To achieve better technical effects or for the needs of certain applications, those skilled in the art may make further improvements to the technical solution based on this invention. However, even if such improvements / designs are inventive and / or progressive, as long as they rely on the technical concept of this invention and cover the technical features defined in the claims, the technical solution should also fall within the protection scope of this invention.

[0179] The technical features mentioned in the appended claims may have alternative technical features, or the order of certain technical processes or material organization may be rearranged. Those skilled in the art, upon learning of this invention, will readily conceive of these alternative means, or alter the order of the technical processes or material organization, and then employ substantially the same means to solve substantially the same technical problems and achieve substantially the same technical effects. Therefore, even if the claims explicitly define the aforementioned means and / or order, these modifications, alterations, and substitutions should all fall within the scope of protection of the claims based on the principle of equivalents.

[0180] The method steps or modules described in the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application or design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered outside the scope of protection claimed by this invention.

Claims

1. A singular value decomposition method implemented in hardware, characterized in that: The singular value decomposition is implemented through programmable gate array programming or application-specific integrated circuits, and the following steps are performed: Step S1: Initialize: Assign the identity matrix I to matrix R, and assign the matrix C to matrix M, where matrix C is the covariance matrix obtained from the sensor output data, and matrix C is a positive semi-definite matrix. Step S2: Obtain the matrix R based on the rotation of axis i based on the matrix M updated in the previous iteration. i (θi), and update matrix R using multipliers and adders: R = R × Ri(θi), and diagonalize matrix M based on the updated matrix R to update matrix M, where θi∈[0,2π], i∈{1,2,3}, where axis i is an axis in the spatial coordinate system, and the diagonalization of matrix M based on the updated matrix R is done by M = ; Update matrix M; Step S2 further includes: calculating cosθi and sinθi corresponding to angle θi using the element values ​​in matrix M updated in the previous iteration, thereby obtaining matrix R. i (θi); Update axis i, and repeat step S2 above until matrix M is completely diagonalized; and, Based on the matrix M updated in the previous iteration of axis i, we obtain a 2×2 matrix Mi, where Mi is the 2×2 matrix obtained by removing the i-th row and i-th column from matrix M. Based on matrix Mi, we obtain cosθi and sinθi corresponding to angle θi, thus obtaining the 2×2 rotation submatrix Kθi; Based on the 2×2 rotation submatrix Kθi, iteratively update matrices R and M, further diagonalizing matrix M.

2. The singular value decomposition method implemented in hardware according to claim 1, characterized in that: Ri(θi) diagonalizes the rows and columns of matrix M except for row i and column i.

3. The singular value decomposition method implemented in hardware according to claim 2, characterized in that: The rotation matrix Ri(θi) based on axis i satisfies the following requirements: Rij = 1, i = j.

4. The singular value decomposition method implemented in hardware according to claim 3, characterized in that: The rotation matrix Ri(θi) based on axis i also satisfies the following requirements: Rij = 0, i ≠ j.

5. The singular value decomposition method implemented in hardware according to claim 4, characterized in that: Use a lookup table to obtain the cosθi corresponding to the angle θi.

6. The singular value decomposition method implemented in hardware according to claim 5, characterized in that: Use a lookup table to obtain sinθi corresponding to angle θi.

7. The singular value decomposition method implemented in hardware according to claim 6, characterized in that, The process of obtaining cosθi and sinθi corresponding to angle θi based on matrix Mi, thereby obtaining the 2×2 rotation submatrix Kθi, includes the following steps: For a 2×2 matrix Mi, it has the following form: ; The 2×2 rotation submatrix Kθi is: ; The sinθi and cosθi corresponding to θi can be obtained directly from matrix Mi using the following method: ; 。 8. The singular value decomposition method implemented in hardware according to claim 6, characterized in that, The process of obtaining cosθi and sinθi corresponding to angle θi based on matrix Mi, thereby obtaining the 2×2 rotation submatrix Kθi, includes the following steps: For a 2×2 matrix Mi, it has the following form: ; The 2×2 rotation submatrix Kθi is: ; The sinθi and cosθi corresponding to θi are obtained from matrix Mi in the following way: Using tan2θi, we can obtain sinθi and cosθi corresponding to θi: 。 9. The singular value decomposition method implemented in hardware according to claim 8, characterized in that: By looking up the table, we can obtain the sinθi and cosθi corresponding to θi based on the tan2θi value.

10. The singular value decomposition method implemented in hardware according to claim 9, characterized in that: Based on the value of tan |2θi|, obtain sin|θi| and cos|θi| corresponding to θi.

11. The singular value decomposition method implemented in hardware according to claim 9 or 10, characterized in that: The search for the value of tan 2θi or tan |2θi| is achieved by using a left-shift and comparison network.

12. The singular value decomposition method implemented in hardware according to any one of claims 1 to 4 and 6 to 10, characterized in that: The number of iterations is less than or equal to 8.

13. The singular value decomposition method implemented in hardware according to any one of claims 1 to 4 and 6 to 10, characterized in that: Let the fully diagonalized matrix M be D = diag(d1, d2, d3), where d i =D ii Represents the i-th diagonal element of C; Sort the diagonal elements of the diagonal matrix D in descending order and adjust the columns of matrix R accordingly.

14. The singular value decomposition method implemented in hardware according to any one of claims 1 to 4 and 6 to 10, characterized in that: The sensor is an IMU sensor.

15. A singular value decomposition method implemented in hardware, characterized in that, By programming a programmable gate array or designing an application-specific integrated circuit (ASIC), the following steps can be performed: Step S200: Initialize: Assign the identity matrix I to matrix R, and assign the matrix C to matrix M, where matrix C is the covariance matrix obtained from the sensor output data, and matrix C is a positive semi-definite matrix; Step S300: Diagonalize the given matrix C step by step using low-order rotation submatrices, specifically including the following sub-steps: Sub-step S301: For axis i, obtain a 2×2 matrix Mi from the 3×3 matrix M, where Mi is the 2×2 matrix obtained by removing the i-th row and i-th column from matrix M, where i∈{1,2,3}, and axis i is an axis in the spatial coordinate system; matrix Mi has the following form: ; Sub-step S302: Use a lookup table to find the match. or The corresponding cosθi and sinθi are used to obtain the 2×2 rotation submatrix Kθi, where , ; Sub-step S303: Iteratively update the rotation matrix R and / or matrix M using the rotation submatrix Kθi to locally diagonalize matrix M; Update axis i and repeat step S300 above iteratively until matrix M is completely diagonalized.

16. The singular value decomposition method implemented in hardware according to claim 15, characterized in that: Ri(θi) diagonalizes the rows and columns of matrix M except for row i and column i.

17. The singular value decomposition method implemented in hardware according to claim 15 or 16, characterized in that: Iteratively update matrix R and / or matrix M using multipliers and adders.

18. The singular value decomposition method implemented in hardware according to claim 17, characterized in that: Implemented using left-shift and comparison networks or The search.

19. The singular value decomposition method implemented in hardware according to claim 17, characterized in that: While arranging the diagonal elements of the diagonal matrix D after fully diagonalizing matrix M in descending order, the columns of the rotation matrix R are adjusted accordingly.

20. The singular value decomposition method implemented in hardware according to any one of claims 15 to 16 and 18 to 19, characterized in that, Iteratively update matrix M using the rotation submatrix Kθi to further diagonalize matrix M, including: When i=1, the matrices R and M obtained by iterative updating using the following formulas are respectively: ; ; Continuing the iteration, when i = 2, the updated matrix M is: ; And the rotation matrix is ​​updated iteratively using R = R × R²(θ²), where: ; Continuing the iteration, when i = 3, the updated matrix M is: ; And the rotation matrix is ​​updated iteratively using R = R × R3(θ3), where: 。 21. The singular value decomposition method implemented in hardware according to any one of claims 15 to 16 and 18 to 19, characterized in that: The sensor is an IMU sensor.

22. A chip, characterized in that: Includes a sensor data receiving module and a singular value decomposition module; The singular value decomposition module is coupled to the sensor data receiving module and is used to implement singular value decomposition on the covariance matrix C obtained from the correlation of the sensor output data based on the covariance matrix C obtained from the sensor output data in hardware; the singular value decomposition module executes the singular value decomposition method implemented in hardware as described in any one of claims 1 to 21.

23. An electronic device, characterized in that: The electronic device includes the chip as described in claim 22.

Citation Information

Patent Citations

  • FPGA-based parallel implementation method for eigenvalue decomposition of real symmetric matrix

    CN110222307A