Jump to content

Хэрэглэгч:Timur/Ноорог/Штрассений алгоритм

Википедиа — Чөлөөт нэвтэрхий толь

In the mathematical discipline of linear algebra, the Strassen algorithm, named after Volker Strassen, is an algorithm used for matrix multiplication. It is asymptotically faster than the standard matrix multiplication algorithm, but slower than the fastest known algorithm, and is useful in practice for large matrices.

Volker Strassen published the Strassen algorithm in 1969. Although his algorithm is only slightly faster than the standard algorithm for matrix multiplication, he was the first to point out that Gaussian elimination is not optimal. His paper started the search for even faster algorithms such as the Winograd algorithm in 1980 (which uses 7 binary multiplications, but 15 binary additions instead of 18 with the Strassen algorithm), and the more complex Coppersmith-Winograd algorithm published in 1987.

A ба B нь R цагираг дээрх матрицууд бөгөөд тэдгээрийн үржвэр нь C болог:

Хэрэв A ба B матрицуудын мөр баганын тоо 2n биш бол бид тохирох тооны тэг мөр баганууд нэмэх замаар ийм хэмжээтэй болгож болно.

A, B ба C матрицуудыг тэнцүү хэмжээтэй блок матрицуудад хуваая:

үүнд

Тэгвэл

With this construction we have not reduced the number of multiplications. We still need 8 multiplications to calculate the Ci,j matrices, the same number of multiplications we need when using standard matrix multiplication.

Now comes the important part. We define new matrices

which are then used to express the Ci,j in terms of Mk. Because of our definition of the Mk we can eliminate one matrix multiplication and reduce the number of multiplications to 7 (one multiplication for each Mk) and express the Ci,j as

We iterate this division process n-times until the submatrices degenerate into numbers.

Practical implementations of Strassen's algorithm switch to standard methods of matrix multiplication for small enough submatrices, for which they are more efficient. The particular crossover point for which Strassen's algorithm is more efficient depends on the specific implementation and hardware.

The standard matrix multiplications takes

multiplications of the elements in the ring R. We ignore the additions needed because, depending on R, they can be much faster than the multiplications in computer implementations, especially if the sizes of the matrix entries exceed the word size of the machine.

With the Strassen algorithm we can reduce the number of multiplications to

.

The reduction in the number of multiplications however comes at the price of a somewhat reduced numeric stability.