Refactor and add test 2.
This commit is contained in:
+69
-10
@@ -1,25 +1,79 @@
|
|||||||
% !TeX program = pdflatex
|
\documentclass[11pt]{article}
|
||||||
\documentclass{mathreport} % Uses our custom mathreport.cls
|
\usepackage[margin=1.2in]{geometry}
|
||||||
|
\usepackage[utf8]{inputenc}
|
||||||
|
\usepackage[T1]{fontenc}
|
||||||
|
\usepackage[english]{babel}
|
||||||
|
\usepackage{fourier}
|
||||||
|
\usepackage{amsthm}
|
||||||
|
\usepackage{amssymb}
|
||||||
|
\usepackage{amsmath}
|
||||||
|
\usepackage{amsfonts}
|
||||||
|
\usepackage{latexsym}
|
||||||
|
\usepackage{graphicx}
|
||||||
|
\usepackage{float}
|
||||||
|
\usepackage{etoolbox}
|
||||||
|
\usepackage{hyperref}
|
||||||
|
\usepackage{tikz}
|
||||||
|
\usepackage{lipsum}
|
||||||
|
\usepackage{algorithm}
|
||||||
|
\usepackage{algpseudocode}
|
||||||
|
\usepackage{mathtools}
|
||||||
|
\usepackage{nccmath}
|
||||||
|
\usepackage[most]{tcolorbox}
|
||||||
|
\newtcolorbox[auto counter]{problem}[1][]{%
|
||||||
|
enhanced,
|
||||||
|
breakable,
|
||||||
|
colback=white,
|
||||||
|
colbacktitle=white,
|
||||||
|
coltitle=black,
|
||||||
|
fonttitle=\bfseries,
|
||||||
|
boxrule=.6pt,
|
||||||
|
titlerule=.2pt,
|
||||||
|
toptitle=3pt,
|
||||||
|
bottomtitle=3pt,
|
||||||
|
title=GitHub repository of this project}
|
||||||
|
|
||||||
% Load bibliography
|
\RequirePackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true]{microtype}
|
||||||
\addbibresource{references.bib}
|
\SetTracking{encoding={*}, shape=sc}{40} % Spacing for Small Caps
|
||||||
|
|
||||||
|
|
||||||
|
\newcommand{\R}{\mathbb{R}}
|
||||||
|
\newcommand{\N}{\mathbb{N}}
|
||||||
|
\newcommand{\Z}{\mathbb{Z}}
|
||||||
|
\newcommand{\Q}{\mathbb{Q}}
|
||||||
|
\newcommand{\C}{\mathbb{C}}
|
||||||
|
|
||||||
|
\newtheorem{theorem}{Theorem}[section]
|
||||||
|
\newtheorem{lemma}[theorem]{Lemma}
|
||||||
|
\newtheorem{proposition}[theorem]{Proposition}
|
||||||
|
\newtheorem{corollary}[theorem]{Corollary}
|
||||||
|
\theoremstyle{definition}
|
||||||
|
\newtheorem{definition}[theorem]{Definition}
|
||||||
|
\newtheorem{example}[theorem]{Example}
|
||||||
|
\theoremstyle{remark}
|
||||||
|
\newtheorem{remark}[theorem]{Remark}
|
||||||
|
|
||||||
% --- Document Metadata ---
|
|
||||||
\title{%
|
\title{%
|
||||||
Accelerated filtering on graphs using Lanczos method
|
Accelerated filtering on graphs using Lanczos method
|
||||||
\\ \large Relazione del progetto di Calcolo Scientifico}
|
\\ \large Relazione del progetto di Calcolo Scientifico}
|
||||||
\author{Alberto Defendi}
|
\author{Alberto Defendi}
|
||||||
\date{\small\today}
|
|
||||||
|
\date{}
|
||||||
|
|
||||||
|
\setlength{\parskip}{1em}
|
||||||
|
\setlength{\parindent}{0em}
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
||||||
\maketitle
|
\maketitle
|
||||||
|
|
||||||
\begin{abstract}
|
\begin{abstract}
|
||||||
\noindent \small \textbf{\textit{Abstract.}}
|
\noindent The Lanczos algorithm \ldots
|
||||||
\end{abstract}
|
\end{abstract}
|
||||||
|
|
||||||
\section{Introduction}
|
{\setlength{\parskip}{0em}
|
||||||
|
\tableofcontents}
|
||||||
|
|
||||||
|
\section{Introduzione}
|
||||||
|
|
||||||
Introduciamo alcuni concetti di teoria dei grafi e alcuni risultati del corso che verranno usati nel corso della sperimentazione.
|
Introduciamo alcuni concetti di teoria dei grafi e alcuni risultati del corso che verranno usati nel corso della sperimentazione.
|
||||||
Scopo del progetto è verificare numericamente i risultati
|
Scopo del progetto è verificare numericamente i risultati
|
||||||
@@ -38,6 +92,11 @@ attraverso la valutazione $g(\mathcal{L})s$.
|
|||||||
test
|
test
|
||||||
|
|
||||||
|
|
||||||
\printbibliography
|
\clearpage
|
||||||
|
\bibliographystyle{unsrt}
|
||||||
|
\bibliography{ref}
|
||||||
|
\nocite{*}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@article{susnjara2015,
|
||||||
|
title={Accelerated filtering on graphs using Lanczos method},
|
||||||
|
author={Ana Susnjara and Nathanael Perraudin and Daniel Kressner and Pierre Vandergheynst},
|
||||||
|
year={2015},
|
||||||
|
eprint={1509.04537},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={math.NA},
|
||||||
|
url={https://arxiv.org/abs/1509.04537},
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
def run() -> None:
|
|
||||||
"""Genera i grafi di di Erdos-Reny di grandezza crescente (ad esempio 250,
|
|
||||||
500,1000, 2000, 4000) e parametro p = 0.04 e misura il tempo
|
|
||||||
computazionale del metodo di Lanczos utilizzando come soglia per il criterio
|
|
||||||
d'arresto epsilon = 10^-2 (o una soglia a scelta).
|
|
||||||
|
|
||||||
Args:
|
|
||||||
None
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
None
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
+3
-8
@@ -1,18 +1,13 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import scienceplots # noqa: F401
|
import afgl.test_2 as t_2
|
||||||
|
|
||||||
# Requires latex installed
|
|
||||||
import afgl.example_1 as ex1
|
|
||||||
import afgl.example_2 as ex2
|
|
||||||
from afgl.util.plot import plot_setup
|
from afgl.util.plot import plot_setup
|
||||||
|
|
||||||
|
|
||||||
def run() -> None:
|
def run() -> None:
|
||||||
plot_setup()
|
plot_setup()
|
||||||
# example_1()
|
# t_1.run()
|
||||||
ex1.run()
|
t_2.run()
|
||||||
ex2.run()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import matplotlib.pyplot as plt
|
|||||||
import matplotlib.ticker as ticker
|
import matplotlib.ticker as ticker
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import numpy.linalg as LA
|
import numpy.linalg as LA
|
||||||
import scienceplots # noqa: F401
|
|
||||||
import scipy
|
|
||||||
|
|
||||||
# Requires latex installed
|
# Requires latex installed
|
||||||
|
import scienceplots # noqa: F401
|
||||||
|
import scipy
|
||||||
from pygsp import graphs
|
from pygsp import graphs
|
||||||
|
|
||||||
from afgl.util.build_T_matrix import build_T_matrix
|
from afgl.util.build_T_matrix import build_T_matrix
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import numpy as np
|
||||||
|
import numpy.linalg as LA
|
||||||
|
from pygsp import graphs
|
||||||
|
|
||||||
|
from afgl.util.lanczos import lanczos
|
||||||
|
|
||||||
|
|
||||||
|
def run() -> None:
|
||||||
|
"""Genera i grafi di di Erdos-Reny di grandezza crescente (ad esempio 250,
|
||||||
|
500,1000, 2000, 4000) e parametro p = 0.04 e misura il tempo
|
||||||
|
computazionale del metodo di Lanczos utilizzando come soglia per il criterio
|
||||||
|
d'arresto epsilon = 10^-2 (o una soglia a scelta).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
None
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
None
|
||||||
|
"""
|
||||||
|
n = 6
|
||||||
|
p = 0.04
|
||||||
|
|
||||||
|
M = 200
|
||||||
|
|
||||||
|
N_VALUES = 250 * (2 ** np.arange(n))
|
||||||
|
|
||||||
|
for N in N_VALUES:
|
||||||
|
s = np.random.randint(1, 10000, N).astype(float)
|
||||||
|
# Normalize s as in request
|
||||||
|
s /= LA.norm(s)
|
||||||
|
|
||||||
|
G = graphs.ErdosRenyi(N, p)
|
||||||
|
G.compute_laplacian("combinatorial")
|
||||||
|
L = G.L
|
||||||
|
|
||||||
|
lanczos(L, s, M)
|
||||||
Reference in New Issue
Block a user