Strassen-Algorithmus
Der Strassen-Algorithmus (erfunden vom deutschen Mathematiker Volker Strassen) ist ein Algorithmus aus der Linearen Algebra und wird zur Matrizenmultiplikation verwendet. Der Strassen-Algorithmus realisiert die Matrizenmultiplikation asymptotisch effizienter als das Standardverfahren und ist in der Praxis schneller für große Matrizen (solche mit einem Rang größer als 1000).
Der Algorithmus
Vereinfachend wird der Spezialfall quadratischer Matrizen mit <math>2^k</math> Zeilen bzw. Spalten betrachtet.
Seien also <math>A, B \in R^{2^k \times 2^k}</math> Matrizen über einem Ring <math>R</math> und ferner ihr Produkt <math>C = A \cdot B \in R^{2^k \times 2^k}</math>. Diese lassen sich auch als Blockmatrizen
- <math>
A= \begin{pmatrix}
A_{1,1} & A_{1,2} \\
A_{2,1} & A_{2,2}
\end{pmatrix} ,\qquad B= \begin{pmatrix}
B_{1,1} & B_{1,2} \\
B_{2,1} & B_{2,2}
\end{pmatrix} ,\qquad C= \begin{pmatrix}
C_{1,1} & C_{1,2} \\
C_{2,1} & C_{2,2}
\end{pmatrix} </math> betrachten, wobei <math>A_{i,j}, B_{i,j}, C_{i,j} \in R^{2^{k-1} \times 2^{k-1}} </math> sind.
Für die Multiplikation von Blockmatrizen gilt:
- <math>C_{1,1} = A_{1,1}\cdot B_{1,1} + A_{1,2}\cdot B_{2,1} </math>
- <math>C_{1,2} = A_{1,1}\cdot B_{1,2} + A_{1,2}\cdot B_{2,2} </math>
- <math>C_{2,1} = A_{2,1}\cdot B_{1,1} + A_{2,2}\cdot B_{2,1} </math>
- <math>C_{2,2} = A_{2,1}\cdot B_{1,2} + A_{2,2}\cdot B_{2,2} </math>
Die direkte Berechnung der <math>C_{i,j}</math> benötigt also <math>8</math> (aufwändige) Matrizenmultiplikationen. Um diese Anzahl zu reduzieren, berechnet der Algorithmus von Strassen folgende Hilfsmatrizen:
- <math>M_{1} := (A_{1,1} + A_{2,2})\cdot (B_{1,1} + B_{2,2})</math>
- <math>M_{2} := (A_{2,1} + A_{2,2})\cdot B_{1,1}</math>
- <math>M_{3} := A_{1,1} \cdot(B_{1,2} - B_{2,2})</math>
- <math>M_{4} := A_{2,2} \cdot(B_{2,1} - B_{1,1})</math>
- <math>M_{5} := (A_{1,1} + A_{1,2})\cdot B_{2,2}</math>
- <math>M_{6} := (A_{2,1} - A_{1,1}) \cdot(B_{1,1} + B_{1,2})</math>
- <math>M_{7} := (A_{1,2} - A_{2,2}) \cdot(B_{2,1} + B_{2,2})</math>
Zur Berechnung der <math>M_i</math> sind lediglich <math>7</math> Multiplikationen nötig, die <math>C_{ij}</math> lassen sich nun durch Additionen (und Subtraktionen) ermitteln:
- <math>C_{1,1} = M_{1} + M_{4} - M_{5} + M_{7}</math>
- <math>C_{1,2} = M_{3} + M_{5}</math>
- <math>C_{2,1} = M_{2} + M_{4}</math>
- <math>C_{2,2} = M_{1} - M_{2} + M_{3} + M_{6}</math>
Für die Multiplikationen in der Berechnung der <math>M_i</math> wird obiges Verfahren rekursiv ausgeführt, bis das Problem auf die Multiplikation von Skalaren reduziert ist.
In der Praxis kann die gewöhnliche Multiplikation für kleine Matrizen durchaus schneller sein. Daher bietet sich ein Wechsel zur gewöhnlichen Multiplikation anstelle eines rekursiven Aufrufs an, sobald die Matrizendimensionen klein genug sind (Cut-Off).
Aufwand
Der Standardalgorithmus zur Matrizenmultiplikation benötigt
- <math>n^{\log_{2}8}= n^3</math>
Multiplikationen der Elemente des Ringes <math>R</math>. Die benötigten Additionen sind hierbei nicht in die Komplexitätsberechnung eingeflossen, Sie können, abhängig von <math>R</math>, in Computerimplementationen viel schneller sein als die Multiplikationen. (Insbesondere bei gewöhnlichen ganzen oder Fließkommazahlen ist das oft der Fall.) Mit dem Strassen-Algorithmus wird die Anzahl der Multiplikationen auf
- <math>n^{\log_{2}7}\approx n^{2,807}</math>
reduziert. Die Reduktion der Anzahl der Multiplikationen führt allerdings zu einer Verringerung der numerischen Stabilität.<ref>{{#invoke:Vorlage:Literatur|f}}{{#if:
| {{#if: Vorlage:Cite book/ParamBool
| Vorlage:Toter Link/archivebot
| Vorlage:Webarchiv/archiv-bot
}}
}}{{#invoke:TemplatePar|check
|all = title=
|opt = vauthors= author= author1= authorlink= author-link= author-link1= author1-link= author2= author3= author4= author5= author6= author7= author8= author9= editor= last= first= last1= first1= last2= first2= last3= first3= last4= first4= last5= first5= last6= first6= last7= first7= last8= first8= last9= first9= last10= first10= last11= first11= last12= first12= last13= first13= last14= first14= last15= first15= others= script-title= trans-title= date= year= volume= issue= number= series= page= pages= at= issn= arxiv= bibcode= doi= pmid= pmc= jstor= oclc= id= url= url-status= format= access-date= archive-date= archive-url= archivebot= offline= location= publisher= language= quote= work= journal= newspaper= magazine= periodical= name-list-style= url-access= doi-access= display-authors= via= s2cid= mr= type= citeseerx= accessdate= archivedate= archiveurl= coauthors= month= day= last16= first16= last17= first17= last18= first18= last19= first19= last20= first20= last21= first21= last22= first22= last23= first23= last24= first24= last25= first25= last26= first26= last27= first27= last28= first28= last29= first29= last30= first30= last31= first31=
|cat = Wikipedia:Vorlagenfehler/Vorlage:Cite journal
|errNS = 0
|template = Vorlage:Cite journal
|format =
|preview = 1
}}Vorlage:Cite book/URL{{#if: | Vorlage:Cite book/Meldung }}{{#if: | Vorlage:Cite book/Meldung }}{{#if: SIAM News
|| Vorlage:Cite book/Meldung
}}{{#if: Vorlage:Cite book/ParamBool
| Vorlage:Cite book/Meldung
}}{{#if: Vorlage:Cite book/ParamBool
| Vorlage:Cite book/Meldung
}}{{#if: Vorlage:Cite book/ParamBool
| Vorlage:Cite book/Meldung
}}{{#if: Vorlage:Cite book/ParamBool
| Vorlage:Cite book/Meldung
}}{{#if: Vorlage:Cite book/ParamBool
| Vorlage:Cite book/Meldung
}}{{#if: Vorlage:Cite book/ParamBool
| Vorlage:Cite book/Meldung
}}Vorlage:Cite book/Meldung2{{#ifexpr: 0{{#ifeq:Miller|^^||+1}}{{#ifeq:^^|^^||+1}}{{#ifeq:^^|^^||+1}}{{#ifeq:^^|^^||+1}} > 1
| Vorlage:Cite book/Meldung
}}</ref>
Eine saubere Analyse einschließlich der Additionen ist mit dem Master-Theorem möglich: Die gewöhnliche Matrizenmultiplikation benötigt <math>2n^3-n^2 \in O(n^3)</math> Schritte (Multiplikationen und Additionen gleich gewichtet und zusammenaddiert). Dies gilt auch für den ganz oben erklärten naiven rekursiven Algorithmus, denn er erzeugt 8 Teilprobleme der Größe <math>\frac{n}{2}</math>und zudem sind 4 quadratische Matrizen der Seitenlänge <math>\frac{n}{2}</math> zu addieren, was einen zusätzlichen Aufwand von <math>4 \cdot \left( \frac{n}{2} \right)^2 = n^2</math> nach sich zieht, also gilt für seine Laufzeit die Rekursion
- <math>T(n) = 8 \cdot T \left( \frac{n}{2} \right) + n^2</math>
was nach dem Master-Theorem <math>T(n) \in O(n^{\log_2 8}) = O(n^3)</math> nach sich zieht.
Der Strassen-Algorithmus erzeugt hingegen jeweils nur sieben solche Teilprobleme, auch wenn dafür nun 18 Additionen oder Subtraktionen von Matrizen mit halber Seitenlänge, also <math>18 \cdot \left( \frac{n}{2} \right)^2 = \frac{9}{2} \cdot n^2</math> Additionen/Subtraktionen einzelner Matrixeinträge in <math>R</math>, erforderlich sind:
- <math>T(n) = 7 \cdot T \left( \frac{n}{2} \right) + \frac92 \cdot n^2</math>
Mit dem Master-Theorem folgt <math>T(n) \in O\left( n^{\log_2 7} \right)</math> (mit <math>\log_2 7 \approx 2{,}807</math>).
Literatur
- Volker Strassen: Gaussian Elimination is not Optimal. In: Numerische Mathematik, Band 13, 1969, S. 354–356, {{#invoke:URIutil|{{#ifeq:1|1|linkISSN|targetISSN}}|0029-599X|0}}{{#ifeq:1|0|[!]
}}{{#ifeq:0|1
|{{#switch:00
|11= (print/online)
|10= (print)
|01= (online)
}}
}}{{#ifeq:0|0
|{{#ifeq:0|0
|{{#if:{{#invoke:URIutil|isISSNvalid|1=0029-599X}}
|
|{{#invoke:TemplUtl|failure|ISSN ungültig}}}}}}
Weblinks
- {{#if: | {{{author}}} | Eric W. Weisstein }}: Strassen Formulas. In: MathWorld (englisch). {{#if: StrassenFormulas | {{#ifeq: {{#property:P2812}} | StrassenFormulas | | {{#if: {{#property:P2812}} | {{#ifeq: 0 | 0 | }} | {{#ifeq: 0 | 0 | }} }} }} }}
Einzelnachweise
<references />