<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki-de.moshellshocker.dns64.de/index.php?action=history&amp;feed=atom&amp;title=Householdertransformation</id>
	<title>Householdertransformation - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki-de.moshellshocker.dns64.de/index.php?action=history&amp;feed=atom&amp;title=Householdertransformation"/>
	<link rel="alternate" type="text/html" href="https://wiki-de.moshellshocker.dns64.de/index.php?title=Householdertransformation&amp;action=history"/>
	<updated>2026-06-11T23:37:01Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Wikipedia (Deutsch) – Lokale Kopie</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki-de.moshellshocker.dns64.de/index.php?title=Householdertransformation&amp;diff=222366&amp;oldid=prev</id>
		<title>~2025-43445-68: Möglicher Tippfehler im Beispiel. Sollte &quot;a&quot; sein, da dort gerade &quot;v&quot; ausgerechnet wird</title>
		<link rel="alternate" type="text/html" href="https://wiki-de.moshellshocker.dns64.de/index.php?title=Householdertransformation&amp;diff=222366&amp;oldid=prev"/>
		<updated>2025-12-27T15:04:10Z</updated>

		<summary type="html">&lt;p&gt;Möglicher Tippfehler im Beispiel. Sollte &amp;quot;a&amp;quot; sein, da dort gerade &amp;quot;v&amp;quot; ausgerechnet wird&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In der [[Mathematik]] beschreibt die &amp;#039;&amp;#039;&amp;#039;Householdertransformation&amp;#039;&amp;#039;&amp;#039; die [[Spiegelung (Geometrie)|Spiegelung]] eines [[Vektor]]s an einer [[Hyperebene]] durch Null im [[Euklidischer Raum|euklidischen Raum]]. Im dreidimensionalen Raum ist sie somit eine Spiegelung an einer [[Ebene (Mathematik)|Ebene]] (durch den Ursprung). Die Darstellung dieser [[lineare Abbildung|linearen Abbildung]] durch eine Matrix wird als &amp;#039;&amp;#039;&amp;#039;Householder-Matrix&amp;#039;&amp;#039;&amp;#039; bezeichnet. Verwendung findet sie vor allem in der [[Numerische Mathematik|numerischen Mathematik]], wenn mittels [[Orthogonale Matrix|orthogonaler Transformationen]] Matrizen so gezielt umgeformt werden, dass bestimmte Spaltenvektoren auf das Vielfache des ersten [[Einheitsvektor]]s abgebildet werden, insbesondere beim [[QR-Verfahren]] und der [[QR-Zerlegung]].&lt;br /&gt;
&lt;br /&gt;
Die Householdertransformation wurde 1958 durch den amerikanischen Mathematiker [[Alston Scott Householder]] eingeführt.&lt;br /&gt;
&lt;br /&gt;
== Definition und Eigenschaften ==&lt;br /&gt;
&lt;br /&gt;
[[Datei:Householdertransformation.svg|miniatur|rechts|Illustration der Householder-Transformation in 2D. Der Schnittpunkt der Spiegelebene mit &amp;lt;math&amp;gt;\vec{v}&amp;lt;/math&amp;gt; ist gegeben durch  &amp;lt;math&amp;gt;\vec{x}-\langle \vec{v},\, \vec{x} \rangle\vec{v}&amp;lt;/math&amp;gt;.]]&lt;br /&gt;
Die Spiegel-Hyperebene kann durch einen [[Normalenvektor]] &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;, also einen Vektor, der [[orthogonal]] zur Hyperebene ist, definiert werden. Ist &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; als [[Spaltenvektor]] gegeben und &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt; die [[Einheitsmatrix]], dann wird die oben beschriebene lineare Abbildung durch die folgende Matrix dargestellt:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;H = I - \frac {2} {v^T v} v v^T.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dabei bezeichnet &amp;lt;math&amp;gt;v^T&amp;lt;/math&amp;gt; die [[Transponierte]] des Spaltenvektors &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;, also einen Zeilenvektor.&lt;br /&gt;
Der Nenner &amp;lt;math&amp;gt;v^T v&amp;lt;/math&amp;gt; ist das [[Skalarprodukt]] von &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; mit sich selbst, &amp;lt;math&amp;gt;v v^T&amp;lt;/math&amp;gt; das [[dyadisches Produkt|dyadische Produkt]]. Die Matrix &amp;lt;math&amp;gt;\tfrac {1} {v^T v} v v^T&amp;lt;/math&amp;gt; beschreibt die [[Orthogonalprojektion]] auf die durch &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; gegebene Richtung.&lt;br /&gt;
Ist &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; auf die Länge eins normiert, also &amp;lt;math&amp;gt;v^T v=1&amp;lt;/math&amp;gt;, so vereinfacht sich die Formel zu&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;H = I - 2 v v^T.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Spiegelungseigenschaft ersieht man daraus, dass&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
Hx &lt;br /&gt;
  = x - 2 v v^Tx &lt;br /&gt;
  = x - 2 \langle v,\, x \rangle\, v&lt;br /&gt;
  = (x-\langle v,\, x \rangle\, v)-\langle v,\, x \rangle\, v&lt;br /&gt;
&amp;lt;/math&amp;gt;,&lt;br /&gt;
wobei &amp;lt;math&amp;gt;\langle \cdot, \cdot \rangle&amp;lt;/math&amp;gt; das [[Standardskalarprodukt]] bezeichnet. Der Term &amp;lt;math&amp;gt;\langle v,\, x \rangle&amp;lt;/math&amp;gt; entspricht dabei dem Abstand des Punktes &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; zur Hyperebene &amp;lt;math&amp;gt;v^\perp&amp;lt;/math&amp;gt;, die orthogonal zu &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; ist. Der Vektor &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; wird also zuerst um &amp;lt;math&amp;gt;\langle v,\, x \rangle\, v&amp;lt;/math&amp;gt; verschoben, d.&amp;amp;nbsp;h. es wird auf die Hyperebene &amp;lt;math&amp;gt;v^\perp&amp;lt;/math&amp;gt; projiziert und anschließend erneut um &amp;lt;math&amp;gt;\langle v,\, x \rangle\, v&amp;lt;/math&amp;gt; auf den gespiegelten Wert verschoben. Unter der Spiegelung wird der Anteil in der Ebene invariant gelassen, der Anteil in Richtung &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;, also senkrecht zur Ebene, wird „umgeklappt“, also nun abgezogen statt addiert.&lt;br /&gt;
&lt;br /&gt;
Die Householder-Matrix hat folgende Eigenschaften:&lt;br /&gt;
* Sie ist [[Symmetrische Matrix|symmetrisch]]: &amp;lt;math&amp;gt;H = H^T&amp;lt;/math&amp;gt;&lt;br /&gt;
* Sie ist [[Orthogonale Matrix|orthogonal]]: &amp;lt;math&amp;gt;H^T H = I&amp;lt;/math&amp;gt;&lt;br /&gt;
* Sie ist involutorisch: &amp;lt;math&amp;gt;H^2 = I&amp;lt;/math&amp;gt; (Dies folgt aus der Symmetrie und der Orthogonalität.)&lt;br /&gt;
* Sie hat den einfachen [[Eigenwert]] −1 zum Eigenvektor &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; und den &amp;lt;math&amp;gt;n-1&amp;lt;/math&amp;gt;-fachen Eigenwert 1. Der Eigenraum zum Eigenwert 1 ist die Spiegelebene, also das [[Orthogonales Komplement|orthogonale Komplement]] des von &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; erzeugten eindimensionalen Unterraums.&lt;br /&gt;
* [[Matrix-Vektor-Multiplikation]]en mit &amp;lt;math&amp;gt;H&amp;lt;/math&amp;gt; sind schnell berechenbar.&lt;br /&gt;
&lt;br /&gt;
== Konstruktion einer spezifischen Spiegelung ==&lt;br /&gt;
&lt;br /&gt;
Es sei ein Vektor &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; gegeben, der auf ein Vielfaches des Vektors &amp;lt;math&amp;gt;e&amp;lt;/math&amp;gt; gespiegelt werden soll, das heißt, gesucht ist ein Einheitsvektor &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;, so dass mit der zugehörigen Householder-Matrix &amp;lt;math&amp;gt;H_v = I - 2 vv^T&amp;lt;/math&amp;gt; gilt &amp;lt;math&amp;gt;H_va=\lambda e&amp;lt;/math&amp;gt;. Geometrisch ist der Vektor &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; die Richtung einer der zwei Winkelhalbierenden der Geraden in Richtung &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; und in Richtung &amp;lt;math&amp;gt;e&amp;lt;/math&amp;gt;. Die Winkelhalbierende ergibt sich, indem man auf beiden Geraden Punkte mit demselben Abstand zum Nullpunkt wählt und auf der Verbindungsstrecke dieser zwei Punkte den Mittelpunkt konstruiert. Die Gerade durch Nullpunkt und Mittelpunkt hat dann die gesuchte Richtung &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;, der Vektor &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; selbst ergibt sich durch Normieren dieser Richtung. Die zweite Winkelhalbierende ergibt sich, indem die Konstruktion ausgehend von &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; und &amp;lt;math&amp;gt;-e&amp;lt;/math&amp;gt; durchgeführt wird.&lt;br /&gt;
&lt;br /&gt;
Der Einfachheit halber sei &amp;lt;math&amp;gt;e&amp;lt;/math&amp;gt; normiert, &amp;lt;math&amp;gt;\|e\|=1&amp;lt;/math&amp;gt;. Dann muss, wegen der Orthogonalität der Spiegelung, &amp;lt;math&amp;gt;\lambda=\pm\|a\|&amp;lt;/math&amp;gt; gelten. Der gesuchte Spiegelungsvektor &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; ergibt sich nun durch Normieren des Differenzvektors &amp;lt;math&amp;gt;\tfrac12(a-\lambda\,e)&amp;lt;/math&amp;gt;, also&lt;br /&gt;
:&amp;lt;math&amp;gt;v=\frac{a-\lambda\, e}{\|a-\lambda\, e\|}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Beide Vorzeichenvarianten führen zum gewünschten Ergebnis (sofern der Nenner von Null verschieden ist). Aus Gründen numerischer Stabilität wird das [[Vorzeichen (Zahl)|Vorzeichen]] von &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; so gewählt, dass der Nenner am größten ist, also &amp;lt;math&amp;gt;\lambda\cdot\langle a,\,e\rangle\leq 0&amp;lt;/math&amp;gt; gilt.&lt;br /&gt;
&lt;br /&gt;
In der Probe ergibt sich&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{align}&lt;br /&gt;
H_va&lt;br /&gt;
&amp;amp; = a-2v\langle v,a\rangle&lt;br /&gt;
 \\[0.5em]&lt;br /&gt;
&amp;amp; = a-2\,(a-\lambda e)\,\frac{&lt;br /&gt;
 \|a\|^2-\lambda\langle e,a\rangle&lt;br /&gt;
 }{&lt;br /&gt;
 \|a\|^2-2\lambda\langle a,e\rangle+\lambda^2\|e\|^2}&lt;br /&gt;
 \\[0.8em]&lt;br /&gt;
&amp;amp; = a-2\,(a-\lambda e)\,&lt;br /&gt;
 \frac{\|a\|^2-\lambda\langle e,a\rangle}{\|a\|^2-2\lambda\langle a,e\rangle+\|a\|^2}&lt;br /&gt;
 \\[0.5em]&lt;br /&gt;
&amp;amp; = \lambda e\\[0.5em]&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Beispiel ===&lt;br /&gt;
&lt;br /&gt;
Am häufigsten wird der Fall betrachtet, in dem &amp;lt;math&amp;gt; e=e_1&amp;lt;/math&amp;gt; der erste kanonische Basisvektor ist. Sei &amp;lt;math&amp;gt;a=(a_1,\bar a)&amp;lt;/math&amp;gt; in erste Komponente und Restvektor zerlegt. Dann gilt für die Norm &amp;lt;math&amp;gt;\|a\|=\sqrt{|a_1|^2+\|\bar a\|^2}&amp;lt;/math&amp;gt;. Als Vorzeichen von &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; ist das Vorzeichen von &amp;lt;math&amp;gt;-a_1&amp;lt;/math&amp;gt; zu wählen, die Richtung der Spiegelung ist dann&lt;br /&gt;
:&amp;lt;math&amp;gt;a-\lambda e_1= a + \operatorname{sign}(a_1)\,\|a\| e_1 = \Bigl(\operatorname{sign}(a_1)\,(|a_1|+\|a\|),\;\bar a\Bigr)&amp;lt;/math&amp;gt;.&lt;br /&gt;
Dabei ist &amp;lt;math&amp;gt;\operatorname{sign}(a_1) := \begin{cases}1 &amp;amp;\quad\text{für}\quad a_1 \geq 0, \\ -1 &amp;amp;\quad\text{für}\quad a_1 &amp;lt; 0. \end{cases}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Vektor &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; entsteht durch Normierung dieser Richtung. Nach Umformen stellt sich die Norm der Richtung als&lt;br /&gt;
:&amp;lt;math&amp;gt;\|a-\lambda e_1\|=\sqrt{2\,\|a\|\,(\|a\|+|a_1|)}&amp;lt;/math&amp;gt;&lt;br /&gt;
dar, wobei in dieser Form nur bereits berechnete Zwischenergebnisse benutzt werden. In der unnormierten Variante der Spiegelung ergeben sich weitere Einsparungen an Rechenschritten.&lt;br /&gt;
&lt;br /&gt;
== Anwendung: QR-Zerlegung ==&lt;br /&gt;
&lt;br /&gt;
Householder-Spiegelungen können zur [[Stabilität (Numerik)|stabilen]] Berechnung von [[QR-Zerlegung]]en einer Matrix &amp;lt;math&amp;gt;A=QR\in\R^{m\times n}&amp;lt;/math&amp;gt; verwendet werden, indem zunächst die erste Spalte der Matrix mit einer Spiegelung &amp;lt;math&amp;gt;H_1&amp;lt;/math&amp;gt; auf das Vielfache des ersten Einheitsvektors gespiegelt wird, wie im letzten Abschnitt erläutert (jetzt bezeichnet der Index aber die Nummer der Spiegelung).&lt;br /&gt;
&lt;br /&gt;
Danach behandelt man &amp;lt;math&amp;gt;H_1A&amp;lt;/math&amp;gt; mit einer Spiegelung &amp;lt;math&amp;gt;H_2&amp;lt;/math&amp;gt; analog, wobei die Spiegelung so konstruiert wird, dass erste Zeile und Spalte von der Transformation unberührt bleiben. Dies wird erreicht, indem die erste Komponente des Spiegelungsvektors zu Null gesetzt wird. Zur Bestimmung des dritten Schrittes geht analog nur die Hauptuntermatrix unter dem dritten Diagonalelement ein, der Spiegelungsvektor ist Null in den ersten zwei Komponenten etc. Im &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-ten Schritt wird also die Untermatrix unter der Position &amp;lt;math&amp;gt;(i,i)&amp;lt;/math&amp;gt; des [[Matrizenprodukt|Produkts]] &amp;lt;math&amp;gt;A_i=H_{i-1}\cdots H_1A&amp;lt;/math&amp;gt; auf die gleiche Art reduziert, bis die Restmatrix &amp;lt;math&amp;gt;H_n\cdots H_2 H_1A = R&amp;lt;/math&amp;gt; Dreiecksgestalt besitzt.&lt;br /&gt;
&lt;br /&gt;
Mit &amp;lt;math&amp;gt;Q^T = H_n\cdots H_2 H_1&amp;lt;/math&amp;gt; gilt &amp;lt;math&amp;gt;Q^T A = R&amp;lt;/math&amp;gt;, also ergibt sich die QR-Zerlegung&lt;br /&gt;
:&amp;lt;math&amp;gt; A=QR&amp;lt;/math&amp;gt;&lt;br /&gt;
mit&lt;br /&gt;
:&amp;lt;math&amp;gt;Q= (H_n\cdots H_2 H_1)^T = H_1 H_2\cdots H_{n} \in\R^{m\times m},\quad\quad R=\begin{pmatrix}R_1\\0\end{pmatrix}\in\R^{m\times n}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Man beachte, dass &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; hier eine quadratische Matrix ist. Meist werden die Matrizen &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; bzw. &amp;lt;math&amp;gt;Q^T&amp;lt;/math&amp;gt; nicht explizit berechnet, sondern man nutzt direkt die Produktform. Dazu werden die Spiegelvektoren &amp;lt;math&amp;gt;v_i&amp;lt;/math&amp;gt; von &amp;lt;math&amp;gt;H_i=H_{v_i}&amp;lt;/math&amp;gt; im frei gewordenen Platz der Matrix &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; gespeichert.&lt;br /&gt;
&lt;br /&gt;
Die Zahl der Operationen für die QR-Zerlegung einer Matrix &amp;lt;math&amp;gt;A=QR \in \R^{m\times n},{m \ge n}&amp;lt;/math&amp;gt; mit dem Householder-Verfahren beträgt:&lt;br /&gt;
:&amp;lt;math&amp;gt;\begin{matrix} m \gg n &amp;amp;\qquad&amp;amp; 2n^2 \cdot m \\ m \approx n &amp;amp;\qquad&amp;amp; \frac{4}{3} n^3 \end{matrix}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
Im Fall &amp;lt;math&amp;gt;m=n&amp;lt;/math&amp;gt; genügen &amp;lt;math&amp;gt;n-1&amp;lt;/math&amp;gt; Schritte, da die letzte Spalte nicht mehr transformiert werden muss.&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode ===&lt;br /&gt;
Da für die meisten Berechnungen das explizite Ausrechnen von &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; nicht nötig ist, reicht es, nur die Matrix &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; zu berechnen. &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; ist die linke Spalte der jeweiligen [[Untermatrix]]. Bei der unten angegebenen Funktion wird das Ergebnis direkt in &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; geschrieben, so dass nach Abarbeitung des Algorithmus das &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; steht. Die Zeile &amp;lt;math&amp;gt;R=A&amp;lt;/math&amp;gt; könnte also auch weggelassen werden.&lt;br /&gt;
&lt;br /&gt;
   function GetR(A)&lt;br /&gt;
      for k=1…n&lt;br /&gt;
          z=A(k…m,k)&lt;br /&gt;
&lt;br /&gt;
          uk=z&lt;br /&gt;
          uk(1)+=sign(z(1))*norm(z)&lt;br /&gt;
          uk=uk/norm(uk)&lt;br /&gt;
&lt;br /&gt;
          vk=zeros(m)&lt;br /&gt;
          vk(k…m)= uk&lt;br /&gt;
&lt;br /&gt;
          A=A-(2*vk)*(vk&amp;#039;*A)&lt;br /&gt;
&lt;br /&gt;
      R=A&lt;br /&gt;
      return R&lt;br /&gt;
Sollte &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; dennoch benötigt werden, lässt sich das obere Beispiel einfach erweitern:&lt;br /&gt;
   function GetR(A)&lt;br /&gt;
     Q=eye(m)&lt;br /&gt;
     for k=1…n&lt;br /&gt;
          z=A(k…m,k)&lt;br /&gt;
&lt;br /&gt;
          uk=z&lt;br /&gt;
          uk(1)+=sign(z(1))*norm(z)&lt;br /&gt;
          uk=uk/norm(uk)&lt;br /&gt;
&lt;br /&gt;
          vk=zeros(m)&lt;br /&gt;
          vk(k…m)= uk&lt;br /&gt;
&lt;br /&gt;
          A=A-(2*vk)*(vk&amp;#039;*A)&lt;br /&gt;
          Q=Q-Q*vk*(2*vk&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
      R=A&lt;br /&gt;
      return R&lt;br /&gt;
&lt;br /&gt;
== Programmierung ==&lt;br /&gt;
Das folgende Beispiel in der [[Programmiersprache]] [[C++]] zeigt die Implementierung der Householdertransformation. Bei der Ausführung des Programms wird die [[Funktion (Mathematik)|Funktion]] &amp;#039;&amp;#039;main&amp;#039;&amp;#039; verwendet, die das Ergebnis auf der Konsole ausgibt.&amp;lt;ref&amp;gt;Rosetta Code: [https://rosettacode.org/wiki/QR_decomposition QR decomposition]&amp;lt;/ref&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
// Diese Funktion berechnet c = a + b * s&lt;br /&gt;
void vmadd(const Vector&amp;amp; a, const Vector&amp;amp; b, double s, Vector&amp;amp; c)&lt;br /&gt;
{&lt;br /&gt;
    if (c.size != a.size || c.size != b.size)&lt;br /&gt;
    {&lt;br /&gt;
        return;&lt;br /&gt;
    }&lt;br /&gt;
    for (int i = 0; i &amp;lt; c.size; i++)&lt;br /&gt;
    {&lt;br /&gt;
        c(i) = a(i) + s * b(i);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Diese Funktion berechnet matrix = I - 2 * v * v^T&lt;br /&gt;
void computeHouseholderFactor(Matrix&amp;amp; matrix, const Vector&amp;amp; v)&lt;br /&gt;
{&lt;br /&gt;
    int n = v.size;&lt;br /&gt;
    matrix.allocate(n, n);&lt;br /&gt;
    for (int i = 0; i &amp;lt; n; i++)&lt;br /&gt;
    {&lt;br /&gt;
        for (int j = 0; j &amp;lt; n; j++)&lt;br /&gt;
        {&lt;br /&gt;
            matrix(i, j) = -2 * v(i) * v(j);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    for (int i = 0; i &amp;lt; n; i++)&lt;br /&gt;
    {&lt;br /&gt;
        matrix(i, i) += 1;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Matrix::extractColumn(Vector&amp;amp; vector, int c)&lt;br /&gt;
{&lt;br /&gt;
    if (m != vector.size)&lt;br /&gt;
    {&lt;br /&gt;
        cerr &amp;lt;&amp;lt; &amp;quot;[Matrix::extract_column]: Matrix and Vector sizes don&amp;#039;t match\n&amp;quot;;&lt;br /&gt;
        return;&lt;br /&gt;
    }&lt;br /&gt;
    for (int i = 0; i &amp;lt; m; i++)&lt;br /&gt;
    {&lt;br /&gt;
        vector(i) = (*this)(i, c);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Diese Funktion gibt die Matrix auf der Konsole aus&lt;br /&gt;
void matrixShow(const Matrix&amp;amp; matrix, const string&amp;amp; str = &amp;quot;&amp;quot;)&lt;br /&gt;
{&lt;br /&gt;
    cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
    for (int i = 0; i &amp;lt; matrix.m; i++)&lt;br /&gt;
    {&lt;br /&gt;
        for (int j = 0; j &amp;lt; matrix.n; j++)&lt;br /&gt;
        {&lt;br /&gt;
            printf(&amp;quot; %8.3f&amp;quot;, matrix(i, j));&lt;br /&gt;
        }&lt;br /&gt;
        printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Diese Funktion berechnet die L2-norm ||A - B||^2&lt;br /&gt;
double matrixCompare(const Matrix&amp;amp; A, const Matrix&amp;amp; B)&lt;br /&gt;
{&lt;br /&gt;
    if (A.m != B.m or A.n != B.n)&lt;br /&gt;
    {&lt;br /&gt;
        return numeric_limits&amp;lt;double&amp;gt;::max();&lt;br /&gt;
    }&lt;br /&gt;
    double norm = 0;&lt;br /&gt;
    for (int i = 0; i &amp;lt; A.m; i++)&lt;br /&gt;
    {&lt;br /&gt;
        for (int j = 0; j &amp;lt; A.n; j++)&lt;br /&gt;
        {&lt;br /&gt;
            norm += (A(i, j) - B(i, j)) * (A(i, j) - B(i, j));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    norm /= A.m * A.n;&lt;br /&gt;
    return norm;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Diese Funktion bestimmt die QR-Zerlegung der gegebenen Matrix&lt;br /&gt;
void householder(Matrix&amp;amp; matrix, Matrix&amp;amp; R, Matrix&amp;amp; Q)&lt;br /&gt;
{&lt;br /&gt;
    int m = matrix.m;&lt;br /&gt;
    int n = matrix.n;&lt;br /&gt;
    vector&amp;lt;Matrix&amp;gt; qArray(m);&lt;br /&gt;
    Matrix z(matrix);&lt;br /&gt;
    Matrix z1;&lt;br /&gt;
    for (int k = 0; k &amp;lt; n &amp;amp;&amp;amp; k &amp;lt; m - 1; k++)&lt;br /&gt;
    {&lt;br /&gt;
        Vector e(m), x(m);&lt;br /&gt;
        double a;&lt;br /&gt;
        z1.computeMinor(z, k);&lt;br /&gt;
        z1.extractColumn(x, k);&lt;br /&gt;
        a = x.calculateNorm();&lt;br /&gt;
        if (matrix(k, k) &amp;gt; 0)&lt;br /&gt;
        {&lt;br /&gt;
            a = -a;&lt;br /&gt;
        }&lt;br /&gt;
        for (int i = 0; i &amp;lt; e.size; i++)&lt;br /&gt;
        {&lt;br /&gt;
            e(i) = i == k;&lt;br /&gt;
        }&lt;br /&gt;
        vmadd(x, e, a, e);&lt;br /&gt;
        e.rescaleUnit();&lt;br /&gt;
        computeHouseholderFactor(qArray[k], e);&lt;br /&gt;
        z.multiply(qArray[k], z1);&lt;br /&gt;
    }&lt;br /&gt;
    Q = qArray[0];&lt;br /&gt;
    for (int i = 1; i &amp;lt; n &amp;amp;&amp;amp; i &amp;lt; m - 1; i++)&lt;br /&gt;
    {&lt;br /&gt;
        z1.multiply(qArray[i], Q);&lt;br /&gt;
        Q = z1;&lt;br /&gt;
    }&lt;br /&gt;
    R.multiply(Q, matrix);&lt;br /&gt;
    Q.transpose();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Hauptfunktion die das Programm ausführt&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    double in[][3] = {&lt;br /&gt;
      { 12, -51,   4},&lt;br /&gt;
      {  6, 167, -68},&lt;br /&gt;
      { -4,  24, -41},&lt;br /&gt;
      { -1,   1,   0},&lt;br /&gt;
      {  2,   0,   3},&lt;br /&gt;
    };&lt;br /&gt;
    Matrix A(in);&lt;br /&gt;
    Matrix Q, R;&lt;br /&gt;
    matrixShow(A, &amp;quot;A&amp;quot;); // Aufruf der Funktion, gibt die Matrix A auf der Konsole aus&lt;br /&gt;
    // Berechnet die QR-Zerlegung&lt;br /&gt;
    householder(A, R, Q);&lt;br /&gt;
    matrixShow(Q, &amp;quot;Q&amp;quot;); // Aufruf der Funktion, gibt die Matrix Q auf der Konsole aus&lt;br /&gt;
    matrixShow(R, &amp;quot;R&amp;quot;); // Aufruf der Funktion, gibt die Matrix R auf der Konsole aus&lt;br /&gt;
    Matrix ACheck;&lt;br /&gt;
    ACheck.multiply(Q, R); // Berechnet das Matrixprodukt Q * R&lt;br /&gt;
    // Berechnet die L2-norm ||A - ACheck||^2&lt;br /&gt;
    double l2norm = matrixCompare(A, ACheck); // Aufruf der Funktion, vergleicht das Matrixprodukt Q * R mit der ursprünglichen Matrix A&lt;br /&gt;
    if (l2norm &amp;lt; 1e-12)&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;Die QR-Zerlegung ist korrekt.&amp;quot; &amp;lt;&amp;lt; endl; // Ausgabe auf der Konsole&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;Die QR-Zerlegung ist nicht korrekt.&amp;quot; &amp;lt;&amp;lt; endl; // Ausgabe auf der Konsole&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Siehe auch ==&lt;br /&gt;
* [[Spiegelungsmatrix]]&lt;br /&gt;
&lt;br /&gt;
== Literatur ==&lt;br /&gt;
* Alston Householder: &amp;#039;&amp;#039;Unitary triangularization of a nonsymmetric matrix&amp;#039;&amp;#039;. In: &amp;#039;&amp;#039;Journal of the ACM&amp;#039;&amp;#039;. Band 5, Nr. 4, 1958, S. 339–342.&lt;br /&gt;
* [[Gene H. Golub]], Charles F. van Loan: &amp;#039;&amp;#039;Matrix Computations&amp;#039;&amp;#039;. 2nd Edition. The Johns Hopkins University Press, 1989.&lt;br /&gt;
* Gerhard Opfer: &amp;#039;&amp;#039;Numerische Mathematik für Anfänger. Eine Einführung für Mathematiker, Ingenieure und Informatiker,&amp;#039;&amp;#039; 5. Aufl., Vieweg + Teubner, Wiesbaden 2008, ISBN 978-3-8348-0413-6&lt;br /&gt;
* [[Martin Hermann (Mathematiker)|Martin Hermann]]: &amp;#039;&amp;#039;Numerische Mathematik, Band 1: Algebraische Probleme.&amp;#039;&amp;#039; 4., überarbeitete und erweiterte Auflage, Walter de Gruyter Verlag, Berlin und Boston 2020, ISBN 978-3-11-065665-7.&lt;br /&gt;
&lt;br /&gt;
== Einzelnachweise ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Kategorie:Numerische lineare Algebra]]&lt;br /&gt;
[[Kategorie:Transformation]]&lt;/div&gt;</summary>
		<author><name>~2025-43445-68</name></author>
	</entry>
</feed>