2024年4月26日发(作者:)

This article copy form MSDN 2001.

mk:@MSITStore:C:Program%20FilesMicrosoft%20Visual%20StudioMSDN2001OCT103

::/hh/gdicpp/cpp_aboutgdip05_

Platform SDK: GDI+ Translate By guozhengkun

转换矩阵表示

一个 m×n matrix is a set of numbers arranged in m rows and n columns. The following

illustration shows several matrices.

一个m×n 矩阵是m行n列的一组数字集合。下图列出了几种矩阵。

You can add two matrices of the same size by adding individual elements. The following

illustration shows two examples of matrix addition.

你可以通过矩阵每个元素相加实现两个大小相同的矩阵的加法运算

An m×n matrix can be multiplied by an n×p matrix, and the result is an m×p matrix. The

number of columns in the first matrix must be the same as the number of rows in the second

matrix. For example, a 4×2 matrix can be multiplied by a 2×3 matrix to produce a 4×3 matrix.

一个 m×n 矩阵乘以 n×p 矩阵, 结果是m×p 矩阵. 第一个矩阵的列数必须和第二个矩阵的行数相同才能相乘。

举例,一个 4×2 矩阵可以通过一个 4×3 矩阵乘以 2×3 矩阵得到。

Points in the plane and rows and columns of a matrix can be thought of as vectors. For example,

(2, 5) is a vector with two components, and (3, 7, 1) is a vector with three components. The dot

product of two vectors is defined as follows:

平面上的点集和矩阵的行列可以看作向量的集合。例如,(2, 5) 是一个包含两个分量的向量,and (3, 7, 1)

是一个包含三个分量的向量。两个向量的点积定义如下:

(a, b) • (c, d) = ac + bd

(a, b, c) • (d, e, f) = ad + be + cf

For example, the dot product of (2, 3) and (5, 4) is (2)(5) + (3)(4) = 22. The dot product of (2,

5, 1) and (4, 3, 1) is (2)(4) + (5)(3) + (1)(1) = 24. Note that the dot product of two vectors is

a number, not another vector. Also note that you can calculate the dot product only if the two

vectors have the same number of components.

例如, (2, 3) 和 (5, 4) 的点积等于 (2)*(5) + (3)*(4) = 22。 (2, 5, 1) 和 (4, 3, 1) 等于 (2)(4) +

(5)(3) + (1)(1) = 24。注意两个向量的点积是一个数值,不是另一个向量。另外,注意只有分量个数相同的

向量才能计算点积。

Let A(i, j) be the entry in matrix A in the i

th

row and the j

th

column. For example A(3, 2) is the

entry in matrix A in the 3

rd

row and the 2

nd

column. Suppose A, B, and C are matrices, and AB =

C. The entries of C are calculated as follows:

假定A(i, j) 是矩阵A第i行第j列的项。例如,A(3, 2)是矩阵A的第3行第2列的项。假设A, B 和 C都是

矩阵,且AB相乘等于C。C的任一项计算方法如下:

C(i, j) = (row i of A) • (column j of B)

The following illustration shows several examples of matrix multiplication.

下面插图是了几个矩阵相乘的例子

If you think of a point in the plane as a 1×2 matrix, you can transform that point by multiplying

it by a 2×2 matrix. The following illustration shows several transformations applied to the point

(2, 1).

如果把平面上一点看作是1行2列的矩阵,你可以通过给该矩阵乘以2行2列矩阵对该点进行坐标变换。下面

是点(2, 1)的几个转换应用。

All the transformations shown in the previous figure are linear transformations. Certain other

transformations, such as translation, are not linear, and cannot be expressed as multiplication

by a 2×2 matrix. Suppose you want to start with the point (2, 1), rotate it 90 degrees, translate