instructions
The first problem of linear algebra in history is the problem of solving linear equations, and the development of linear equations theory promotes the establishment and development of matrix theory and determinant theory as tools.
Finally in computer graphics and other aspects, matrix, vector, quaternion has become an important tool to solve one geometric problem after another. But we should not forget that linear algebra can solve linear equations. In other words, SIMD framework can solve basic linear equations (i.e., multivariate first-order equations).
The geometric
First, let’s look at a matrix vector multiplication. The basic geometric meaning of this multiplication is that the point (x, y, z) has undergone a matrix transformation to reach the position (1, 2, 3).
And we can also use the determinant, or more generally write it as a system of equations:
1 * x + 0 * y + 2 * z = 1
1 * x - 1 * y - 1 * z = 2
1 * x + 2 * y + 0 * z = 3
Copy the code
That is to say: when I find the original positions of the points (x, y, z) geometrically, I solve the system. So, given the transformation matrix and the coordination, how do we figure out the position before the transformation? Of course, it is solved with inverse matrix. Simd framework has helped us to solve the inverse matrix. It is good to call directly.
code
The following code:
let m = matrix_float3x3(simd_float3(1.1.1),
simd_float3(0.-1.2),
simd_float3(2.-1.0))let r = simd_float3(1.2.3)
let x = m.inverse * r
print(x)
/ / SIMD3 < Float > (2.0, 0.5, 0.5)
Copy the code
Because simD framework only supports 4×4 matrix at most, it only supports solving quaternion equations at most. At the same time, the number of unknowns and equations should be consistent, and the matrix should be invertible.