代写PHYS5033 Environmental Footprints and IO Analysis Week 2代做Java语言
- 首页 >> C/C++编程PHYS5033 Environmental Footprints and IO Analysis
Reading Material
Week 2
Week 2 Matrix manipulation
A matrix is a rectangular array of numbers in the form.
where m is the number of rows and n is the number of columns
The size of the matrix is denoted by (m x n), and the numbers represented by cmn are known as the elements of the matrix, with m indicating which row the element is found in, and n indicating which column the element is found in. A square matrix is one which has the same number of rows as it does columns. A matrix with only one row (i.e. a 1 x n matrix) is also known as a row vector, while a matric with only one column (i.e. a m x 1 matrix) is also known as a column vector.
In week 1 we noted that input-output tables are made up of three different matrices T, Y, and v. Using the hypothetical input-output table provided in Figure 2.1, we can see that the matrices have the following dimensions:
T Intermediate demand matrix (6 x 6)
Y Final demand matrix (6 x 3)
v Value-added matrix (3 x 6)
The intermediate demand matrix T must always be a square matrix, since each sector is represented in both the rows and the columns.
Figure 2.1: A hypothetical input-output table, with total output and total input calculated.
In order to undertake input-output analysis, the matrix manipulation techniques which are outlined in the following pages are employed. The size of the matrices being manipulated is important, so it is good practice to note down the matrix size before undertaking any manipulations.
Matrix techniques
i) Matrix addition
Matrices can only be added together if they are the same size, i.e. they have the same number of rows and the same number of columns.
ii) Matrix subtraction
Matrices can only be subtracted from each other if they are the same size, i.e. they have the same number of rows and the same number of columns.
iii) Element-wise multiplications
Two matrices can be multiplied together using element-wise multiplication only if they are the same size.
iv) Matrix multiplication
Two matrices can be multiplied together using matrix multiplication only if the number of rows in the second matrix equals the number of columns in the first matrix. The size of the resultant matrix will be based on the number of rows in the first matrix and the number of columns in the second matrix.
Given two matrixes with dimensions (m1 x n1) and (m2 x n2), if n1 = m2 these matrices can be multiplied together using matrix multiplication, and the answer will be a matrix with dimensions (m1 x n2).
Once the dimension check confirms that matrix multiplication can be used, it is calculated following mathematical convention, which involves both multiplication and addition. This can be represented mathematically as follows, where cij represents the elements of the answer matrix C.
The following example provides workings for the matrix multiplication of two (2x2) matrices.
The properties of matrix multiplication are as follows:
• Matrix manipulation is associative, i.e. assuming that their dimensions allow for it:
(AB) C = A (BC)
• Matrix manipulation is distributive, i.e. assuming that their dimensions allow for it:
(A + B) C = AC + BC
• Matrix manipulation is NOT commutative, i.e. even if their dimensions allow for it:
AB ≠ BA
• The cancellation law does not apply:
AB = 0 does not necessarily imply that A = 0 or B = 0
v) Matrix transposition
A matrix can be transposed by ‘swapping’ the rows and columns of the matrix so that the first row becomes the first column, the second row becomes the second column, and so on.
vi) Diagonal matrices
A square matrix which contains zero values in all elements above and below the main diagonal is known as a diagonal matrix.
A diagonal matrix with all elements on the diagonal equal to one (1) is known as the Identity matrix (I).
vii) Inverse of a matrix
The inverse of a square matrix can be calculated by considering that the Identity matrix (I) has similar properties to the number one (1) in non-matrix mathematics. Just as any number multiplied by its inverse will have a value of one:
any matrix (A) multiplied by its inverse (A-1) will return the Identity matrix (I), with dimensions equal to the original matrix:
Summation operators
As noted in (i), matrices can only be added together when they are the same size. When using input-output techniques the totals across the intermediate demand matrix (T) and final demand matrix (Y), and the intermediate demand matrix (T) and value-added matric (v), are required however these matrices are not the same size. The use of summation operators enables us to calculate these totals efficiently.
A column summation operator is a row vector with all values equal to one (1). This is used to calculate the sum of all values ‘down’ the columns.
A row summation operator is a column vector with all values equal to one (1). This is used to calculate the sum of all values ‘across’ the rows.
Calculating total output and total input of input-output tables
The first step in any input-output analysis is to calculate the total output and the total input for each sector within the input-output table. The total output for each sector is a column vector represented by x, with dimensions (m x 1), where m is the number of sectors in the input-output table. It is calculated by adding across each row, such that:
total output (x) = total intermediate demand (T) + total final demand (Y)
The total input for each sector is calculated by adding down each column, such that
total input (x’) = total intermediate demand (T) + total value-added (v)
Noting that the input-output system must be balanced, the total input vector will be equal to the transpose of the total output vector, and can therefore be denoted as x‘.
These additions are not possible unless summation operators are used since the matrices T, Y, and v are all different sizes. Consider the example input-output table shown in Figure 2.1, which consists of the following matrices
T Intermediate demand matrix (6 x 6)
Y Final demand matrix (6 x 3)
v Value-added matric (3 x 6)
In order to calculate the sub-total of T along the rows, it must be multiplied by a row summation operator with dimensions (6 x 1), which can be annotated as 1T . Likewise, to calculate the sub-total of T along the columns, it must be multiplied by a column summation operator with dimensions (1 x 6), which can be annotated as 1T’ .
The sub-total of Y is calculated using a row summation operator with dimensions (3 x 1), which can be annotated as 1Y, and the sub-total of v is calculated using a column summation operator with dimensions (1 x 3), which can be annotated as 1V.
The total output can then be calculated as follows, noting that row summation operators are the second term in the required matrix multiplication:
and, noting that column summation operators are the first term in the required matrix multiplication, the total input can be calculated using:
Figure 2.2 highlights each of these operators using the example input-output table shown in Figure 2.1.
Figure 2.2: A hypothetical input-output table, with row and column summation operators included.
Once these subtotals are calculated using row and column summation operators, the total output and total input can be calculated using matrix addition, since the relevant matrices are now the same size. In the hypothetical table presented in Figures 2.1 and 2.2 these calculations would be as follows: