In completing the matrix multiplication algorithm is used as follows:
a. initialize the matrix ~ A [] [], matrix _b [] [], matrix _c [] [], i = 0, j = 0, k = 0, row ~ A, ~ A column,
_b column
b. input line ~ A, ~ A column, the column _b
c. Looping process to enter a value in the matrix ~ A:
1. for i = 0 to the many lines _ a-1, i = i +1
a) for j = 0 to the number of columns ~ A-1, j = j +1
b) the input matrix _b [i +1] [j +1]
c) Is j
2. Did i
d.Proses loop to enter a value in the matrix _b:
1. for j = 0 to the many columns ~ A-1, j = j +1
a) for k = 0 to the number of columns ~ A-1, k = k +1
b) the input matrix _b [j +1] [k +1]
c) Is k <_b column? if not, return to the process d.1.a
2. Is j
e. The process loops to multiply the matrix:
1. for i = 0 to ~ A lot of line-1, i = i +1
a) for k = 0 to the number of columns _b-1, k = k +1
i) for j = 0 to ~ A column -1, j = j +1
ii) the matrix _c [i] [k] + = matrix ~ A [i] [j] * matrix _b [j] [k]
iii) Is j
b) Is k2.Apakah i
f. The process loops to display the matrix _c:
1. for i = 0 to ~ A lot of line-1, i = i +1
a) for k = 0 to the number of columns _b -1, k = k +1
b) Print the matrix _c [i] [k]
c) Is k <_b column? if not, return to the process f.1.a
2. Did i
g.Program finished.
SOURCE
Langganan:
Posting Komentar (Atom)
0 comments