mp2: done 1-3 except 2.3
This commit is contained in:
parent
4cd35f229d
commit
c2e4b3933a
8 changed files with 220 additions and 7 deletions
|
@ -31,10 +31,11 @@ A = p * G * D + e * z;
|
||||||
x = e/n;
|
x = e/n;
|
||||||
|
|
||||||
% Check if B will be a singular matrix. If so, change it
|
% Check if B will be a singular matrix. If so, change it
|
||||||
alpha = 1;
|
alpha = 0.8;
|
||||||
while rcond(A - alpha * I) < eps
|
while rcond(A - alpha * I) < eps
|
||||||
alpha = alpha + 0.01;
|
alpha = alpha + 0.01;
|
||||||
end
|
end
|
||||||
|
B = A - alpha * I;
|
||||||
|
|
||||||
old_x = zeros(n, 1);
|
old_x = zeros(n, 1);
|
||||||
old_norm = -1;
|
old_norm = -1;
|
||||||
|
|
BIN
mp2/1_spy_a.pdf
Normal file
BIN
mp2/1_spy_a.pdf
Normal file
Binary file not shown.
BIN
mp2/1_spy_chol_a.pdf
Normal file
BIN
mp2/1_spy_chol_a.pdf
Normal file
Binary file not shown.
BIN
mp2/1_spy_chol_rcm.pdf
Normal file
BIN
mp2/1_spy_chol_rcm.pdf
Normal file
Binary file not shown.
BIN
mp2/1_spy_rcm.pdf
Normal file
BIN
mp2/1_spy_rcm.pdf
Normal file
Binary file not shown.
16
mp2/Project.2.Maggioni.Claudio/ex2.m
Normal file
16
mp2/Project.2.Maggioni.Claudio/ex2.m
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
clear;
|
||||||
|
clc;
|
||||||
|
load('householder/housegraph.mat')
|
||||||
|
names = split(strtrim(convertCharsToStrings(name')));
|
||||||
|
counts = full(sum(A, 2));
|
||||||
|
ranks = sortrows([counts, (1:size(counts,1))'], 'descend');
|
||||||
|
|
||||||
|
for i = 1:size(ranks, 1)
|
||||||
|
fprintf("%14s %2d: ", names(ranks(i, 2)), ranks(i, 1)-1);
|
||||||
|
for j = 1:size(A, 2)
|
||||||
|
if ranks(i, 2) ~= j && A(ranks(i, 2), j) > 0
|
||||||
|
fprintf("%s, ", names(j));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fprintf("\n");
|
||||||
|
end
|
Binary file not shown.
|
@ -1,5 +1,7 @@
|
||||||
\documentclass[unicode,11pt,a4paper,oneside,numbers=endperiod,openany]{scrartcl}
|
\documentclass[unicode,11pt,a4paper,oneside,numbers=endperiod,openany]{scrartcl}
|
||||||
|
\usepackage{graphicx}
|
||||||
|
\usepackage{subcaption}
|
||||||
|
\usepackage{amsmath}
|
||||||
\input{assignment.sty}
|
\input{assignment.sty}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +15,7 @@
|
||||||
\setassignment
|
\setassignment
|
||||||
\setduedate{Wednesday, 14 October 2020, 11:55 PM}
|
\setduedate{Wednesday, 14 October 2020, 11:55 PM}
|
||||||
|
|
||||||
\serieheader{Numerical Computing}{2020}{Student: FULL NAME}{Discussed with: FULL NAME}{Solution for Project 2}{}
|
\serieheader{Numerical Computing}{2020}{Student: Claudio Maggioni}{Discussed with: FULL NAME}{Solution for Project 2}{}
|
||||||
\newline
|
\newline
|
||||||
|
|
||||||
\assignmentpolicy
|
\assignmentpolicy
|
||||||
|
@ -31,10 +33,204 @@ These two graphs are one of the first examples where matrix methods were used in
|
||||||
|
|
||||||
\section{The Reverse Cuthill McKee Ordering [10 points]}
|
\section{The Reverse Cuthill McKee Ordering [10 points]}
|
||||||
|
|
||||||
|
The Reverse Cuthill McKee Ordering of matrix \texttt{A\_SymPosDef} is computed with MATLAB's \texttt{sysrcm(\ldots)} and
|
||||||
|
the matrix is rearranged accordingly. Here are the spy plot of these matrices:
|
||||||
|
|
||||||
|
\begin{figure}[h]
|
||||||
|
\centering
|
||||||
|
\begin{subfigure}{0.49\textwidth}
|
||||||
|
\centering
|
||||||
|
\includegraphics[width = \textwidth]{1_spy_a}
|
||||||
|
\caption{Spy plot of \texttt{A\_SymPosDef}}
|
||||||
|
\end{subfigure}
|
||||||
|
\begin{subfigure}{0.49\textwidth}
|
||||||
|
\centering
|
||||||
|
\includegraphics[width = \textwidth]{1_spy_rcm}
|
||||||
|
\caption{Spy plot of \texttt{sysrcm(\ldots)} rearranged version of \texttt{A\_SymPosDef}}
|
||||||
|
\end{subfigure}
|
||||||
|
\caption{Spy plots of the two matrices}
|
||||||
|
\label{fig:1}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
And the spy plots of the corresponding Cholesky factor are listed in figure~\ref{fig:1chol}.
|
||||||
|
|
||||||
|
\begin{figure}[h]
|
||||||
|
\centering
|
||||||
|
\begin{subfigure}{0.49\textwidth}
|
||||||
|
\centering
|
||||||
|
\includegraphics[width = \textwidth]{1_spy_chol_a}
|
||||||
|
\caption{Spy plot of \texttt{chol(A\_SymPosDef)}}
|
||||||
|
\end{subfigure}
|
||||||
|
\begin{subfigure}{0.49\textwidth}
|
||||||
|
\centering
|
||||||
|
\includegraphics[width = \textwidth]{1_spy_chol_rcm}
|
||||||
|
\caption{Spy plot of \texttt{chol(A\_SymPosDef(sysrcm(A\_SymPosDef), sysrcm(A\_SymPosDef)))}}
|
||||||
|
\end{subfigure}
|
||||||
|
\caption{Spy plots of the two Cholesky factors}
|
||||||
|
\label{fig:1chol}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
The number of nonzero elements in the Cholesky factor of the RCM optimized matrix are significantly lower (circa 0.1x) of the ones in the vanilla process. The respective nonzero counts can be found in figure~\ref{fig:1chol}.
|
||||||
|
|
||||||
\section{Sparse Matrix Factorization [10 points]}
|
\section{Sparse Matrix Factorization [10 points]}
|
||||||
|
|
||||||
|
\subsection{Show that $A \in R^{n x n}$ has exactly $5n - 6$ nonzero elements.}
|
||||||
|
|
||||||
|
The given description of $A$ says that all the element at the edges of the
|
||||||
|
matrix (rows and columns 1 and $n$) plus all the elements on the main diagonal
|
||||||
|
are the only nonzero elements of $A$. Therefore, this cells can be counted as
|
||||||
|
the 4 vertex cells in the matrix square plus 5 $n-2$-long segments,
|
||||||
|
corresponding to all edges and the main diagonal. Therefore:
|
||||||
|
|
||||||
|
\[4 + 5 \dot (n - 2) = 5n - 6\]
|
||||||
|
|
||||||
|
\subsection{Construct this matrix and visualize its non-zero structure.}
|
||||||
|
|
||||||
|
The matrix $A \in R^{n x n}$ looks like this (zero entries are represented as
|
||||||
|
blanks):
|
||||||
|
|
||||||
|
\[
|
||||||
|
A := \begin{bmatrix}
|
||||||
|
1 & 1 & 1 & \hdots & 1 \\
|
||||||
|
1 & 1 & && 1 \\
|
||||||
|
1 & & 1 && 1 \\
|
||||||
|
\vdots & & & \ddots & \vdots \\
|
||||||
|
1 & 1 & 1 & \hdots & 1 \\
|
||||||
|
\end{bmatrix}
|
||||||
|
\]
|
||||||
|
|
||||||
|
\subsection{Explain why for n = $100000$ using Matlab’s \texttt{chol(\ldots)}
|
||||||
|
to solve $Ax = b$
|
||||||
|
for a given righthand-side vector would be problematic.}
|
||||||
|
|
||||||
|
\textbf{A IS NOT POSITIVE DEFINITE: CHECK WITH EDOARDO}
|
||||||
|
|
||||||
\section{Degree Centrality [10 points]}
|
\section{Degree Centrality [10 points]}
|
||||||
|
|
||||||
|
Assuming that the degree of the Householder graph is the number of co-authors of
|
||||||
|
each author and that an author is not co-author of himself, the degree
|
||||||
|
centralities of all authors sorted in descending order are below.
|
||||||
|
|
||||||
|
This output has been obtained by running \texttt{ex2.m}.
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
Author Centrality: Coauthors...
|
||||||
|
|
||||||
|
Golub 31: Wilkinson TChan Varah Overton Ernst VanLoan Saunders Bojanczyk
|
||||||
|
Dubrulle George Nachtigal Kahan Varga Kagstrom Widlund
|
||||||
|
OLeary Bjorck Eisenstat Zha VanDooren Tang Reichel Luk Fischer
|
||||||
|
Gutknecht Heath Plemmons Berry Sameh Meyer Gill
|
||||||
|
Demmel 15: Edelman VanLoan Bai Schreiber Kahan Kagstrom Barlow
|
||||||
|
NHigham Arioli Duff Hammarling Bunch Heath Greenbaum Gragg
|
||||||
|
Plemmons 13: Golub Nagy Harrod Pan Funderlic Bojanczyk George Barlow Heath
|
||||||
|
Berry Sameh Meyer Nichols
|
||||||
|
Heath 12: Golub TChan Funderlic George Gilbert Eisenstat Ng Liu Laub Plemmons
|
||||||
|
Paige Demmel
|
||||||
|
Schreiber 12: TChan VanLoan Moler Gilbert Pothen NTrefethen Bjorstad NHigham
|
||||||
|
Eisenstat Tang Elden Demmel
|
||||||
|
Hammarling 10: Wilkinson Kaufman Bai Bjorck VanHuffel VanDooren Duff Greenbaum
|
||||||
|
Gill Demmel
|
||||||
|
VanDooren 10: Golub Boley Bojanczyk Kagstrom VanHuffel Luk Hammarling Laub
|
||||||
|
Nichols Paige
|
||||||
|
TChan 10: Golub Saied Ong Kuo Tong Schreiber Arioli Duff Heath Hansen
|
||||||
|
Gragg 9: Borges Kaufman Harrod Reichel Stewart BunseGerstner Ammar Warner Demmel
|
||||||
|
Moler 8: Wilkinson VanLoan Gilbert Schreiber Henrici Stewart Bunch Laub
|
||||||
|
VanLoan 8: Golub Moler Schreiber Kagstrom Luk Bunch Paige Demmel
|
||||||
|
Paige 7: Anjos VanLoan Saunders Bjorck VanDooren Laub Heath
|
||||||
|
Gutknecht 7: Golub Ashby Boley NTrefethen Nachtigal Varga Hochbruck
|
||||||
|
Luk 7: Golub Overton Boley VanLoan Bojanczyk Park VanDooren
|
||||||
|
Eisenstat 7: Golub Gu George Schreiber Liu Heath Ipsen
|
||||||
|
George 7: Golub Eisenstat Ng Liu Tang Heath Plemmons
|
||||||
|
Meyer 6: Golub Benzi Funderlic Stewart Ipsen Plemmons
|
||||||
|
Bunch 6: LeBorne Fierro VanLoan Moler Stewart Demmel
|
||||||
|
Stewart 6: Moler Bunch Gragg Meyer Gill Mathias
|
||||||
|
Reichel 6: Golub NTrefethen Nachtigal Fischer Gragg Ammar
|
||||||
|
Bjorck 6: Golub Park Duff Hammarling Elden Paige
|
||||||
|
NTrefethen 6: Schreiber Nachtigal Reichel Gutknecht Greenbaum ATrefethen
|
||||||
|
Nichols 5: Byers Barlow VanDooren Plemmons BunseGerstner
|
||||||
|
Greenbaum 5: Cullum Strakos NTrefethen Hammarling Demmel
|
||||||
|
Ipsen 5: Chandrasekaran Barlow Eisenstat Meyer Jessup
|
||||||
|
Laub 5: Kenney Moler VanDooren Heath Paige
|
||||||
|
Duff 5: TChan Bjorck Arioli Hammarling Demmel
|
||||||
|
Liu 5: George Gilbert Eisenstat Ng Heath
|
||||||
|
Park 5: Boley Bjorck VanHuffel Luk Elden
|
||||||
|
Zha 5: Golub Bai Barlow VanHuffel Hansen
|
||||||
|
Widlund 5: Golub Bjorstad OLeary Smith Szyld
|
||||||
|
Barlow 5: Zha Ipsen Plemmons Nichols Demmel
|
||||||
|
Kagstrom 5: Golub VanLoan VanDooren Ruhe Demmel
|
||||||
|
Varga 5: Golub Marek Young Gutknecht Starke
|
||||||
|
Gilbert 5: Moler Schreiber Ng Liu Heath
|
||||||
|
Gill 4: Golub Saunders Hammarling Stewart
|
||||||
|
Sameh 4: Golub Harrod Plemmons Berry
|
||||||
|
Berry 4: Golub Harrod Plemmons Sameh
|
||||||
|
BunseGerstner 4: He Byers Gragg Nichols
|
||||||
|
Hansen 4: TChan Fierro OLeary Zha
|
||||||
|
Ng 4: George Gilbert Liu Heath
|
||||||
|
Arioli 4: TChan MuntheKaas Duff Demmel
|
||||||
|
VanHuffel 4: Zha Park VanDooren Hammarling
|
||||||
|
Nachtigal 4: Golub NTrefethen Reichel Gutknecht
|
||||||
|
Bojanczyk 4: Golub VanDooren Luk Plemmons
|
||||||
|
Harrod 4: Plemmons Gragg Berry Sameh
|
||||||
|
Boley 4: Park VanDooren Luk Gutknecht
|
||||||
|
Wilkinson 4: Golub Dubrulle Moler Hammarling
|
||||||
|
Ammar 3: He Reichel Gragg
|
||||||
|
Elden 3: Schreiber Bjorck Park
|
||||||
|
Fischer 3: Golub Modersitzki Reichel
|
||||||
|
Tang 3: Golub George Schreiber
|
||||||
|
NHigham 3: Schreiber Pothen Demmel
|
||||||
|
OLeary 3: Golub Widlund Hansen
|
||||||
|
Bjorstad 3: Schreiber Widlund Boman
|
||||||
|
Kahan 3: Golub Davis Demmel
|
||||||
|
Bai 3: Zha Hammarling Demmel
|
||||||
|
Saunders 3: Golub Paige Gill
|
||||||
|
Funderlic 3: Heath Plemmons Meyer
|
||||||
|
Kaufman 3: Hammarling Gragg Warner
|
||||||
|
Starke 2: Varga Hochbruck
|
||||||
|
Hochbruck 2: Gutknecht Starke
|
||||||
|
Jessup 2: Crevelli Ipsen
|
||||||
|
Warner 2: Kaufman Gragg
|
||||||
|
Ruhe 2: Wold Kagstrom
|
||||||
|
Szyld 2: Marek Widlund
|
||||||
|
Young 2: Kincaid Varga
|
||||||
|
Pothen 2: Schreiber NHigham
|
||||||
|
Tong 2: TChan Kuo
|
||||||
|
Kuo 2: TChan Tong
|
||||||
|
Marek 2: Varga Szyld
|
||||||
|
Dubrulle 2: Golub Wilkinson
|
||||||
|
Fierro 2: Bunch Hansen
|
||||||
|
Byers 2: BunseGerstner Nichols
|
||||||
|
Overton 2: Golub Luk
|
||||||
|
He 2: BunseGerstner Ammar
|
||||||
|
Mathias 1: Stewart
|
||||||
|
Davis 1: Kahan
|
||||||
|
ATrefethen 1: NTrefethen
|
||||||
|
Henrici 1: Moler
|
||||||
|
Smith 1: Widlund
|
||||||
|
MuntheKaas 1: Arioli
|
||||||
|
Boman 1: Bjorstad
|
||||||
|
Chandrasekaran 1: Ipsen
|
||||||
|
Wold 1: Ruhe
|
||||||
|
Ong 1: TChan
|
||||||
|
Saied 1: TChan
|
||||||
|
Strakos 1: Greenbaum
|
||||||
|
Cullum 1: Greenbaum
|
||||||
|
Edelman 1: Demmel
|
||||||
|
Pan 1: Plemmons
|
||||||
|
Nagy 1: Plemmons
|
||||||
|
Gu 1: Eisenstat
|
||||||
|
Benzi 1: Meyer
|
||||||
|
Anjos 1: Paige
|
||||||
|
Crevelli 1: Jessup
|
||||||
|
Kincaid 1: Young
|
||||||
|
Borges 1: Gragg
|
||||||
|
Ernst 1: Golub
|
||||||
|
Modersitzki 1: Fischer
|
||||||
|
LeBorne 1: Bunch
|
||||||
|
Ashby 1: Gutknecht
|
||||||
|
Kenney 1: Laub
|
||||||
|
Varah 1: Golub
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
\section{The Connectivity of the Coauthors [10 points]}
|
\section{The Connectivity of the Coauthors [10 points]}
|
||||||
|
|
||||||
\section{PageRank of the Coauthor Graph [10 points]}
|
\section{PageRank of the Coauthor Graph [10 points]}
|
||||||
|
|
Reference in a new issue