Refactor and add test 2.

lanczos_demmel
alberto 1 month ago
parent 1cba3734ec
commit eb2d82115a

@ -1,25 +1,79 @@
% !TeX program = pdflatex
\documentclass{mathreport} % Uses our custom mathreport.cls
\documentclass[11pt]{article}
\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}
\RequirePackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true]{microtype}
\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}
% Load bibliography
\addbibresource{references.bib}
% --- Document Metadata ---
\title{%
Accelerated filtering on graphs using Lanczos method
\\ \large Relazione del progetto di Calcolo Scientifico}
\author{Alberto Defendi}
\date{\small\today}
\begin{document}
\date{}
\setlength{\parskip}{1em}
\setlength{\parindent}{0em}
\begin{document}
\maketitle
\begin{abstract}
\noindent \small \textbf{\textit{Abstract.}}
\noindent The Lanczos algorithm \ldots
\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.
Scopo del progetto è verificare numericamente i risultati
@ -38,6 +92,11 @@ attraverso la valutazione $g(\mathcal{L})s$.
test
\printbibliography
\clearpage
\bibliographystyle{unsrt}
\bibliography{ref}
\nocite{*}
\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

@ -1,18 +1,13 @@
import sys
import scienceplots # noqa: F401
# Requires latex installed
import afgl.example_1 as ex1
import afgl.example_2 as ex2
import afgl.test_2 as t_2
from afgl.util.plot import plot_setup
def run() -> None:
plot_setup()
# example_1()
ex1.run()
ex2.run()
# t_1.run()
t_2.run()
if __name__ == "__main__":

@ -2,10 +2,10 @@ import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
import numpy.linalg as LA
import scienceplots # noqa: F401
import scipy
# Requires latex installed
import scienceplots # noqa: F401
import scipy
from pygsp import graphs
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)
Loading…
Cancel
Save