mirror of
https://github.com/NotXia/unibo-ai-notes.git
synced 2025-12-16 19:32:21 +01:00
Fix typos
This commit is contained in:
@ -54,7 +54,7 @@ has an unique solution iff one of the following conditions is satisfied:
|
||||
|
||||
The solution can be algebraically determined as \marginnote{Algebraic solution to linear systems}
|
||||
\[ \matr{A}\vec{x} = \vec{b} \iff \vec{x} = \matr{A}^{-1}\vec{b} \]
|
||||
However this approach requires to compute the inverse of a matrix, which has a time complexity of $O(n^3)$.
|
||||
However, this approach requires to compute the inverse of a matrix, which has a time complexity of $O(n^3)$.
|
||||
|
||||
|
||||
|
||||
@ -74,21 +74,23 @@ the matrix $\matr{A} \in \mathbb{R}^{n \times n}$ is factorized into $\matr{A} =
|
||||
\item $\matr{U} \in \mathbb{R}^{n \times n}$ is an upper triangular matrix
|
||||
\end{itemize}
|
||||
%
|
||||
As directly solving a system with a triangular matrix has complexity $O(n^2)$ (forward or backward substitutions),
|
||||
the system can be decomposed to:
|
||||
\begin{equation}
|
||||
The system can be decomposed to:
|
||||
\[
|
||||
\begin{split}
|
||||
\matr{A}\vec{x} = \vec{b} & \iff \matr{LU}\vec{x} = \vec{b} \\
|
||||
& \iff \vec{y} = \matr{U}\vec{x} \text{ \& } \matr{L}\vec{y} = \vec{b}
|
||||
\end{split}
|
||||
\end{equation}
|
||||
\]
|
||||
To find the solution, it is sufficient to solve in order:
|
||||
\begin{enumerate}
|
||||
\item $\matr{L}\vec{y} = \vec{b}$ (solved w.r.t. $\vec{y}$)
|
||||
\item $\vec{y} = \matr{U}\vec{x}$ (solved w.r.t. $\vec{x}$)
|
||||
\end{enumerate}
|
||||
|
||||
The overall complexity is $O(\frac{n^3}{3}) + 2 \cdot O(n^2) = O(\frac{n^3}{3})$
|
||||
The overall complexity is $O(\frac{n^3}{3}) + 2 \cdot O(n^2) = O(\frac{n^3}{3})$.\\
|
||||
$O(\frac{n^3}{3})$ is the time complexity of the LU factorization.
|
||||
$O(n^2)$ is the complexity to directly solving a system with a triangular matrix (forward or backward substitutions).
|
||||
|
||||
|
||||
\subsection{Gaussian factorization with pivoting}
|
||||
\marginnote{Gaussian factorization with pivoting}
|
||||
@ -100,12 +102,12 @@ This is achieved by using a permutation matrix $\matr{P}$, which is obtained as
|
||||
|
||||
The permuted system becomes $\matr{P}\matr{A}\vec{x} = \matr{P}\vec{b}$ and the factorization is obtained as $\matr{P}\matr{A} = \matr{L}\matr{U}$.
|
||||
The system can be decomposed to:
|
||||
\begin{equation}
|
||||
\[
|
||||
\begin{split}
|
||||
\matr{P}\matr{A}\vec{x} = \matr{P}\vec{b} & \iff \matr{L}\matr{U}\vec{x} = \matr{P}\vec{b} \\
|
||||
& \iff \vec{y} = \matr{U}\vec{x} \text{ \& } \matr{L}\vec{y} = \matr{P}\vec{b}
|
||||
\end{split}
|
||||
\end{equation}
|
||||
\]
|
||||
|
||||
An alternative formulation (which is what \texttt{SciPy} uses)
|
||||
is defined as:
|
||||
@ -132,7 +134,7 @@ The two most common families of iterative methods are:
|
||||
compute the sequence as:
|
||||
\[ \vec{x}_k = \matr{B}\vec{x}_{k-1} + \vec{d} \]
|
||||
where $\matr{B}$ is called iteration matrix and $\vec{d}$ is computed from the $\vec{b}$ vector of the system.
|
||||
The time complexity per iteration $O(n^2)$.
|
||||
The time complexity per iteration is $O(n^2)$.
|
||||
|
||||
\item[Gradient-like methods] \marginnote{Gradient-like methods}
|
||||
have the form:
|
||||
@ -142,20 +144,20 @@ The two most common families of iterative methods are:
|
||||
|
||||
\subsection{Stopping criteria}
|
||||
\marginnote{Stopping criteria}
|
||||
One ore more stopping criteria are needed to determine when to truncate the sequence (as it is theoretically infinite).
|
||||
One or more stopping criteria are needed to determine when to truncate the sequence (as it is theoretically infinite).
|
||||
The most common approaches are:
|
||||
\begin{descriptionlist}
|
||||
\item[Residual based]
|
||||
The algorithm is terminated when the current solution is close enough to the exact solution.
|
||||
The residual at iteration $k$ is computed as $\vec{r}_k = \vec{b} - \matr{A}\vec{x}_k$.
|
||||
Given a tolerance $\varepsilon$, the algorithm stops when:
|
||||
Given a tolerance $\varepsilon$, the algorithm may stop when:
|
||||
\begin{itemize}
|
||||
\item $\Vert \vec{r}_k \Vert \leq \varepsilon$
|
||||
\item $\frac{\Vert \vec{r}_k \Vert}{\Vert \vec{b} \Vert} \leq \varepsilon$
|
||||
\item $\Vert \vec{r}_k \Vert \leq \varepsilon$ (absolute)
|
||||
\item $\frac{\Vert \vec{r}_k \Vert}{\Vert \vec{b} \Vert} \leq \varepsilon$ (relative)
|
||||
\end{itemize}
|
||||
|
||||
\item[Update based]
|
||||
The algorithm is terminated when the change between iterations is very small.
|
||||
The algorithm is terminated when the difference between iterations is very small.
|
||||
Given a tolerance $\tau$, the algorithm stops when:
|
||||
\[ \Vert \vec{x}_{k} - \vec{x}_{k-1} \Vert \leq \tau \]
|
||||
\end{descriptionlist}
|
||||
@ -183,5 +185,5 @@ Finally, we can define the \textbf{condition number} of a matrix $\matr{A}$ as:
|
||||
\[ K(\matr{A}) = \Vert \matr{A} \Vert \cdot \Vert \matr{A}^{-1} \Vert \]
|
||||
|
||||
A system is \textbf{ill-conditioned} if $K(\matr{A})$ is large \marginnote{Ill-conditioned}
|
||||
(i.e. small perturbation on the input causes large changes in the output).
|
||||
(i.e. a small perturbation of the input causes a large change of the output).
|
||||
Otherwise it is \textbf{well-conditioned}. \marginnote{Well-conditioned}
|
||||
Reference in New Issue
Block a user