Matrix calculation rules

Source: Internet
Author: User

It is meaningless to record a set of numbers into a matrix. The key to learning a matrix is to understand the operations between matrices.

1. matrix addition

Matrices can also be added. Add a single element at the corresponding position of the two matrices. The new matrix is the result of matrix addition. According to its algorithm, addition can be performed only when the number of rows and the number of columns are identical.

There is no order to add the matrices. If both A and B are matrices, A + B = B +. It is generally considered that the matrix has no subtraction. to subtract from a matrix, a negative matrix of the matrix is introduced and then added. A-B is short for a + (-B. The following figure shows the addition of two three-row and three-column matrices.

Matrix addition is often used in image displacement operations.

2. Matrix Multiplication

Multiplication can also be performed between matrices, but the calculation process is much more complex. Unlike arithmetic multiplication, matrix multiplication is not the sum of multiple matrices. It has its own logic. The algorithm is described as follows: Assuming that matrix A of column N in Row M is multiplied by matrix B of Column V in row R to obtain matrix C, first, matrix A and matrix B must meet n = R. That is to say, the number of columns in the first Matrix must be the same as the number of rows in the second matrix. During the operation, all the elements in row I of the first matrix A are multiplied by the elements in column J of the second matrix B, and the result of the multiplication is added, the final value is the value of column J of row I of matrix C.

This process is described in mathematical formulas:

C (I, j) = a (I1, I2, I3 ...... In) × B (J1, J2, J3 ...... JV)

Further launch:

C (I, j) = I1 × J1 + I2 × J2 + I3 × J3 ...... + In × JV

From the matrix multiplication process, we can see that the matrix C generated by multiplying matrix A and matrix B must be Column V in the m row. For example, if a matrix of 5x3 is multiplied by a matrix of 3x7, a matrix of 5x7 is generated. A matrix of 5x3 and a matrix of 5x7 cannot be multiplied. The figure shows the multiplication of two groups of matrices.

Multiple transformations are often used in graph transformations, which causes multiple matrices to be multiplied. If multiple matrices are multiplied, the result is equivalent to the first two matrices multiplied by the third matrix, and so on. For example, if ABCD is a matrix, a x B x C x D = (a x B) x C) x D. Matrix Multiplication is different from numeric multiplication, and its operation sequence is very sensitive. The result of matrix A multiplication matrix B may be completely different from that of matrix B multiplication matrix A, and sometimes it cannot even be multiplied at all.

To multiply a matrix, the columns must be equal to the rows before and after the matrix. For ease of operation, in the practical application of graphics, the transformation matrix is a square matrix with the same number of rows and columns. For a matrix with different rows and columns, it must be supplemented manually.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.