Machine-translated by Google. Questions are authored in English.
Top

Discussion

Consider a matrix multiplication chain F1F2F3F4F5, where matrices F1, F2, F3, F4 and F5 are of dimensions 2×25, 25×3, 3×16, 16×1 and 1×1000, respectively. In the parenthesization of F1F2F3F4F5 that minimizes the total number of scalar multiplications, the explicitly computed pairs is/are

  • A.\(F_{1}F_{2}\) and \(F_{3}F_{4}\) only
  • B.\(F_{2}F_{3}\) only
  • C.\(F_{3}F_{4}\) only
  • D.\(F_{1}F_{2}\) and \(F_{4}F_{5}\) only

Answer: C

The only explicitly computed pair is \(F_{3}F_{4}\).

F4 is 16 × 1, so multiplying towards it collapses the inner dimension to 1. The minimum-cost parenthesization is \(((F_{1}(F_{2}(F_{3}F_{4})))F_{5})\):

\[ \begin{aligned} F_{3}F_{4} &: 3 \cdot 16 \cdot 1 = 48 \\ F_{2}(F_{3}F_{4}) &: 25 \cdot 3 \cdot 1 = 75 \\ F_{1}(\ldots) &: 2 \cdot 25 \cdot 1 = 50 \\ (\ldots)F_{5} &: 2 \cdot 1 \cdot 1000 = 2000 \\ \text{total} &= 2173 \end{aligned} \]

Here \(F_{3}F_{4}\) is the only product of two adjacent original matrices. The alternatives cost more: \(((F_{1}F_{2})(F_{3}F_{4}))F_{5}\) costs 150 + 48 + 6 + 2000 = 2204, any order that computes \(F_{4}F_{5}\) pays 16,000 for that step alone, and \(F_{2}F_{3}\) alone costs 1,200.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.