1
Fork 0
mirror of https://github.com/Steffo99/appunti-magistrali.git synced 2024-10-16 09:47:26 +00:00

Add some new things

This commit is contained in:
Steffo 2024-08-20 05:06:21 +02:00
parent e2daf80c8e
commit a5839ba785
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
38 changed files with 1423 additions and 541 deletions

View file

@ -8,7 +8,7 @@
"collapse-color-groups": false,
"colorGroups": [
{
"query": "path:\"7 - Introduction to quantum information processing\" ",
"query": "path:\"8 - Crittografia applicata\" ",
"color": {
"a": 1,
"rgb": 14701138
@ -25,6 +25,6 @@
"repelStrength": 10,
"linkStrength": 1,
"linkDistance": 250,
"scale": 0.0948360950603675,
"close": false
"scale": 0.0944029852823346,
"close": true
}

View file

@ -301,10 +301,6 @@
"path": "9 - Cloud and edge computing/★ cloud and edge computing.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "9 - Fondamenti di machine learning/★ fondamenti di machine learning.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "9 - Kernel hacking/★ kernel hacking.md",
"color": "fc3lLaITDn62PYbzBhqxl"
@ -381,10 +377,6 @@
"path": "7 - Introduction to quantum information processing/1 - Concetti base/★ concetti base.canvas",
"color": "7j7Pqog0VHMVVAfazMNlb"
},
{
"path": "7 - Introduction to quantum information processing",
"color": "7j7Pqog0VHMVVAfazMNlb"
},
{
"path": "README.md",
"color": "me4XBNQC4rwzQFLlvIAn0"
@ -481,14 +473,6 @@
"path": "7 - Introduction to quantum information processing/5 - Cose strane/costruire un Hardy state, old.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "9 - Fondamenti di machine learning",
"color": "7j7Pqog0VHMVVAfazMNlb"
},
{
"path": "9 - Kernel hacking",
"color": "7j7Pqog0VHMVVAfazMNlb"
},
{
"path": "1 - Algebra lineare/★ algebra lineare.md",
"color": "7j7Pqog0VHMVVAfazMNlb"
@ -528,6 +512,90 @@
{
"path": "4 - Sistemi operativi/★ sistemi operativi.md",
"color": "7j7Pqog0VHMVVAfazMNlb"
},
{
"path": "9 - Kernel hacking/1 - Cercando di capire le cose/Patchwork.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "9 - Kernel hacking/1 - Cercando di capire le cose/kernel e Visual Studio Code.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/★ fondamenti di machine learning.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/2 - Support vector machines/support vector machine.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/2 - Support vector machines/kernel lineare.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/2 - Support vector machines/kernel polinomiale.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/2 - Support vector machines/kernel gaussiano.md",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/02 - Richiami di calcolo vettoriale.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/03 - Metodi del gradiente in ambito deterministico.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/04 - Accelerazione dei metodi del gradiente.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/05 - Metodologia SVM per classificazione binaria.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/06 - Ottimizzazione vincolata.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/07 - Introduzione a MatLab.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/08 - Laboratorio Logistic Regression.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/09 - Gradiente stocastico.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/10 - Laboratorio gradiente stocastico.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/11 - Deep learning.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/12 - Laboratorio deep learning.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/0 - Materiale di studio/Slides/2023/13 - SVR per problemi di regressione.pdf",
"color": "fc3lLaITDn62PYbzBhqxl"
},
{
"path": "7 - Fondamenti di machine learning/1 - Concetti base/★ glossario simboli matematici.md",
"color": "7j7Pqog0VHMVVAfazMNlb"
},
{
"path": "7 - Fondamenti di machine learning/1 - Concetti base/★ mappa concettuale.canvas",
"color": "7j7Pqog0VHMVVAfazMNlb"
}
]
}

5
0 - Generale/array.md Normal file
View file

@ -0,0 +1,5 @@
---
aliases:
- vettore
---
[[Lista]] di elementi **omogenei**.

View file

@ -0,0 +1,6 @@
[[campo matematico]] contenente tutti i possibili [[output]] di una [[funzione]].
$$
\Huge
\mathsf{C}
$$

6
0 - Generale/dominio.md Normal file
View file

@ -0,0 +1,6 @@
[[campo matematico]] rappresentante tutti i possibili [[input]] di una [[funzione]].
$$
\Huge
\mathsf{D}
$$

View file

@ -0,0 +1,21 @@
[[operazione]] di [[somma]] effettuata tra due [[array|vettori]].
Consiste nel sommare i componenti uno ad uno tra loro:
$$
\def \varX {{\color{Red} \mathbf{x}}}
\def \varY {{\color{Cyan} \mathbf{y}}}
\def \varXa {{\color{Crimson} x_1}}
\def \varXb {{\color{IndianRed} x_2}}
\def \varXc {{\color{Salmon} x_3}}
\def \varYa {{\color{RoyalBlue} y_1}}
\def \varYb {{\color{DeepSkyBlue} y_2}}
\def \varYc {{\color{LightSkyBlue} y_3}}
\varX + \varY
=
\begin{bmatrix}
\varXa + \varYa\\
\varXb + \varYb\\
\varXc + \varYc
\end{bmatrix}
$$

View file

@ -0,0 +1 @@
[[algoritmo]] che risolve un [[problema di supervised learning]] trovando il [[modello di supervised learning|modello]] migliore possibile.

View file

@ -0,0 +1,15 @@
---
aliases:
- data set
---
[[insieme]] di [[coppie]] [[input]]-[[output]] per un [[modello di supervised learning]].
$$
\Huge D
$$
in base al loro utilizzo si dividono in:
- [[training set]]
- [[validation set]]
- [[testing set]]

View file

@ -0,0 +1,25 @@
---
aliases:
- modello
---
[[modello matematico]].
[[funzione]] che [[problema di minimizzazione|minimizza]] la [[perdita]] in un [[problema di supervised learning]]:
$$
\Large
f^*
=
\min_{f \in \mathcal{H}}
\
\sum_{(\mathbf{X},\ y) \in D}
\left(\
V(y, f(\mathbf{X}))
+
\lambda
\left\lVert
f
\right\rVert
^2
\ \right)
$$

View file

@ -0,0 +1 @@
Errore che si verifica quando un [[modello di supervised learning]] non [[generalizzazione|generalizza]] sufficientemente ed invece segue troppo il [[training set]].

View file

@ -0,0 +1,21 @@
---
aliases:
- loss
---
[[funzione]] in un [[problema di supervised learning]] che misura quanto si allontana il [[modello di supervised learning|modello]] dal risultato desiderato.
$$
\Large
\sum_{(\mathbf{X},\ y) \in D}
\left(\
V(y, f(\mathbf{X}))
+
\lambda
\left\lVert
f
\right\rVert
^2
\ \right)
$$
Considera sia l'[[errore]] che il modello commette generalizzando, sia la sua [[complessità del modello|complessità]], e bilancia tra le due cose attraverso il [[parametro]] $\lambda$.

View file

@ -0,0 +1,6 @@
[[problema di supervised learning]] il cui [[output]] è [[boolean|booleano]].
$$
\Huge
\mathbb{Y} = \{ -1, 1 \}
$$

View file

@ -0,0 +1,6 @@
[[problema di supervised learning]] il cui [[output]] è una [[variante]] di una [[enumerazione]].
$$
\Huge
\mathbb{Y} = \{ 1, 2, \dots, N \}
$$

View file

@ -0,0 +1,6 @@
[[problema di supervised learning]] in cui l'[[output]] è un [[numero reale]].
$$
\Huge
\mathbb{Y} \subseteq \mathbb{R}
$$

View file

@ -0,0 +1,7 @@
[[problema di minimizzazione]].
Si vuole determinare un [[modello di supervised learning]] che minimizzi una certa [[perdita]].
Per scegliere il modello, vengono usati [[campione|campioni]] di coppie [[input]]-[[output]] conosciute, detti [[data set per supervised learning|data set]].
Il [[campo matematico]] di tutti i modelli possibili è detto [[spazio delle ipotesi]].

View file

@ -0,0 +1,8 @@
[[codominio]] di un [[problema di supervised learning]].
Le funzioni aventi come [[0 - Generale/dominio|dominio]] $\mathbb{X}^n$ e come [[codominio]] $\mathbb{Y}$:
$$
\Huge
\mathcal{H} = f : \mathbb{X}^n \to \mathbb{Y}
$$

View file

@ -0,0 +1,6 @@
---
aliases:
- test set
---
[[data set per supervised learning]] usato per [[benchmarking]] in un [[problema di supervised learning]].

View file

@ -0,0 +1 @@
[[Insieme]] delle [[coppie]] [[input]]-[[output]] usate come [[campione]] di [[apprendimento]] in un [[problema di supervised learning]].

View file

@ -0,0 +1 @@
[[Insieme]] delle [[coppie]] [[input]]-[[output]] usate come [[campione]] di [[validazione]] in un [[problema di supervised learning]].

View file

@ -0,0 +1,18 @@
| Simbolo | Significato |
| -------------- | ---------------------------------------------------------- |
| $D$ | [[data set per supervised learning]] |
| $\mathbf{x}$ | [[array]] di [[array\|vettori]] degli [[input]] di $D$ |
| $N$ | [[cardinalità di un insieme\|cardinalità]] di $\mathbf{X}$ |
| $\mathbf{x}_i$ | $i$-esimo [[array]] di $\mathbf{x}$ |
| $i$ | [[indice]] di $\mathbf{x}$ da $1$ a $N$ |
| $\mathbb{X}^N$ | [[campo matematico]] di $\mathbf{x}_i$ |
| $x_{ij}$ | $j$-esimo [[scalare]] di $\mathbf{x}_i$ |
| $j$ | [[indice]] di $\mathbf{x}_i$ |
| $\mathbb{X}$ | [[campo matematico]] di $x_{ij}$ |
| $y$ | [[scalare]] di [[output]] di $D$ |
| $\mathbb{Y}$ | [[campo matematico]] di $y$ |
| $f$ | [[classificatore]] |
| $\mathcal{H}$ | [[spazio delle ipotesi]] |
| $\lambda$ | [[parametro]] che configura la [[complessità del modello]] |
| $f^*$ | [[modello di supervised learning]] |

View file

@ -0,0 +1,31 @@
{
"nodes":[
{"id":"aa08ea82fd2ff1df","type":"file","file":"9 - Algoritmi distribuiti/1 - Problemi algoritmici/problema di minimizzazione.md","x":-960,"y":-1360,"width":400,"height":400},
{"id":"158d8da07bba10f9","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/problema di supervised learning.md","x":-960,"y":-800,"width":400,"height":400},
{"id":"a28d708ff4f64391","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/data set per supervised learning.md","x":-1520,"y":-800,"width":400,"height":400},
{"id":"9ebbcb1a4cb0f500","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/training set.md","x":-2080,"y":-980,"width":400,"height":200},
{"id":"099a5e4ec9accaf5","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/testing set.md","x":-2080,"y":-700,"width":400,"height":200},
{"id":"84aff7b9f416b138","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/validation set.md","x":-2080,"y":-420,"width":400,"height":200},
{"id":"21a4d817d35a7f4d","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/modello di supervised learning.md","x":-960,"y":-240,"width":400,"height":400},
{"id":"8cbab7d637ee76e1","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/algoritmo di supervised learning.md","x":-1520,"y":-240,"width":400,"height":400},
{"id":"4225469a33c497ee","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/perdita.md","x":-960,"y":320,"width":400,"height":400},
{"id":"38a97c29b755cc04","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/problema di classificazione binaria.md","x":-400,"y":-980,"width":400,"height":200},
{"id":"c92bbbdcd9f512e6","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/problema di classificazione multi-classe.md","x":-400,"y":-700,"width":400,"height":200},
{"id":"096c6707131defca","type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/problema di regressione.md","x":-400,"y":-420,"width":400,"height":200},
{"id":"b360f9268a0f52ab","x":-1520,"y":320,"width":400,"height":400,"type":"file","file":"7 - Fondamenti di machine learning/1 - Concetti base/overfitting.md"}
],
"edges":[
{"id":"c4f9077cee804220","fromNode":"aa08ea82fd2ff1df","fromSide":"bottom","toNode":"158d8da07bba10f9","toSide":"top"},
{"id":"f56800b452ddb99b","fromNode":"158d8da07bba10f9","fromSide":"bottom","toNode":"21a4d817d35a7f4d","toSide":"top"},
{"id":"019b625f8b0205c2","fromNode":"158d8da07bba10f9","fromSide":"left","toNode":"a28d708ff4f64391","toSide":"right"},
{"id":"cce6de49435ce780","fromNode":"a28d708ff4f64391","fromSide":"left","toNode":"9ebbcb1a4cb0f500","toSide":"right"},
{"id":"05ddef88355d8edb","fromNode":"a28d708ff4f64391","fromSide":"left","toNode":"099a5e4ec9accaf5","toSide":"right"},
{"id":"087e8f7acc8b514e","fromNode":"a28d708ff4f64391","fromSide":"left","toNode":"84aff7b9f416b138","toSide":"right"},
{"id":"3a2453bd09ee39fb","fromNode":"21a4d817d35a7f4d","fromSide":"left","toNode":"8cbab7d637ee76e1","toSide":"right"},
{"id":"7e4efe8ea2545561","fromNode":"21a4d817d35a7f4d","fromSide":"bottom","toNode":"4225469a33c497ee","toSide":"top"},
{"id":"07bf45ee5439ca26","fromNode":"158d8da07bba10f9","fromSide":"right","toNode":"38a97c29b755cc04","toSide":"left"},
{"id":"27e9987ac6d9fafd","fromNode":"158d8da07bba10f9","fromSide":"right","toNode":"c92bbbdcd9f512e6","toSide":"left"},
{"id":"cf48fc781605492c","fromNode":"158d8da07bba10f9","fromSide":"right","toNode":"096c6707131defca","toSide":"left"},
{"id":"4c02d6463c22e641","fromNode":"4225469a33c497ee","fromSide":"left","toNode":"b360f9268a0f52ab","toSide":"right"}
]
}

View file

@ -0,0 +1,19 @@
[[kernel di una support vector machine]].
==Cos'ha di particolare?==
$$
\Large
K(D,\ \mathbf{X})
=
e^{\left(
-
\frac{
\left\lVert
D - \mathbf{X}
\right\rVert^2
}{
2 \cdot \sigma^2
}
\right)}
$$

View file

@ -0,0 +1,12 @@
[[kernel di una support vector machine]].
==Cos'ha di particolare?==
$$
\Large
K(D,\ \mathbf{X})
=
D'
\times
\mathbf{X}
$$

View file

@ -0,0 +1,16 @@
[[kernel di una support vector machine]].
==Cos'ha di particolare?==
$$
\Large
K(D,\ \mathbf{X})
=
\left(
D'
\times
\mathbf{X}
+
1
\right)^s
$$

View file

@ -0,0 +1,15 @@
==TODO: Cos'è? Perchè mi è stata buttata addosso la formula così???==
$$
\Large
f^* (\mathbf{X})
=
\sum_{(\mathbf{X},\ y) \in D}
\left(\
c_i^*
\cdot
K(D, \mathbf{X})
+
b^*
\ \right)
$$

View file

@ -0,0 +1,14 @@
---
aliases:
- orthonormal vectors
- ortonormali
- vettori ortonormali
- ortonormale
- orthonormality
---
[[Proprietà]] che possono avere i [[array|vettori]] di un dato [[insieme]].
Significa che essi sono tutti [[vettore normalizzato|normalizzati]] e [[perpendicolarità|perpendicolari]] tra loro.
> [!Note]
> Essendo perpendicolari, il loro [[prodotto scalare]] sarà sempre $0$!

View file

@ -18,7 +18,8 @@
{"id":"93c57c42392b8135","type":"file","file":"7 - Introduction to quantum information processing/1 - Concetti base/ket.md","x":1040,"y":880,"width":400,"height":400},
{"id":"6760e1a2e3bc62b5","type":"file","file":"7 - Introduction to quantum information processing/1 - Concetti base/prodotto tensoriale.md","x":1600,"y":1440,"width":400,"height":400},
{"id":"1ec8b31da5bdc6ea","type":"file","file":"7 - Introduction to quantum information processing/1 - Concetti base/entanglement.md","x":480,"y":320,"width":400,"height":400},
{"id":"2b4e8e28d1158ebf","type":"file","file":"7 - Introduction to quantum information processing/1 - Concetti base/ampiezza.md","x":760,"y":-240,"width":400,"height":400}
{"id":"2b4e8e28d1158ebf","type":"file","file":"7 - Introduction to quantum information processing/1 - Concetti base/ampiezza.md","x":760,"y":-240,"width":400,"height":400},
{"id":"8435c9fb83f437b9","x":-60,"y":1440,"width":400,"height":400,"type":"file","file":"7 - Introduction to quantum information processing/1 - Concetti base/ortonormalità.md"}
],
"edges":[
{"id":"cc2c8485866dcdfc","fromNode":"bf8486f1d14fd86c","fromSide":"right","toNode":"e4fea56f5f076093","toSide":"left"},
@ -40,6 +41,7 @@
{"id":"b839a8531a91feeb","fromNode":"e4fea56f5f076093","fromSide":"right","toNode":"9e5e72bc891cfc69","toSide":"bottom"},
{"id":"ec9f111aba5531ae","fromNode":"8f83a29609c7b25b","fromSide":"bottom","toNode":"93c57c42392b8135","toSide":"left"},
{"id":"bece9be7dae04b58","fromNode":"e4fea56f5f076093","fromSide":"right","toNode":"2b4e8e28d1158ebf","toSide":"left"},
{"id":"eefb382410147aa8","fromNode":"e4fea56f5f076093","fromSide":"right","toNode":"1ec8b31da5bdc6ea","toSide":"top"}
{"id":"eefb382410147aa8","fromNode":"e4fea56f5f076093","fromSide":"right","toNode":"1ec8b31da5bdc6ea","toSide":"top"},
{"id":"d2e360e3d510d823","fromNode":"8f83a29609c7b25b","fromSide":"bottom","toNode":"8435c9fb83f437b9","toSide":"top"}
]
}

View file

@ -1,42 +1,34 @@
Si vuole creare un [[Hardy state]] su due [[qbit]] nello stato neutro applicandovi due [[gate quantistico universale|gate quantistici universali]].
## Obiettivo
Si vogliono quindi trovare i valori di $\mathbf{T}$ e $\mathbf{U}$ per cui:
Si vuole creare un [[Hardy state]] su due [[qbit]] nello stato neutro applicandovi tre [[gate quantistico universale|gate quantistici universali]]:
$$
\def \ufirst {{\color{mediumpurple} \mathbf{U_A}}}
\def \usecond {{\color{mediumorchid} \mathbf{U_B}}}
\def \uthird {{\color{violet} \mathbf{U_C}}}
\def \kzero {{\color{darkgreen} 3}}
\def \kone {{\color{forestgreen} 1}}
\def \ktwo {{\color{limegreen} 1}}
\def \kthree {{\color{lightgreen} -1}}
\large
{\color{mediumpurple} \mathbf{T}}
{\color{mediumorchid} \mathbf{U}}
\ket{00}
=
\frac{
\kzero \cdot \ket{00} +
\kone \cdot \ket{01} +
\ktwo \cdot \ket{10} +
\kthree \cdot \ket{11}
}{\sqrt{12}}
$$
\def \notea {{\color{orangered} \Leftarrow}}
\def \noteb {{\color{dodgerblue} \Rightarrow}}
Ovvero:
$$
{\color{mediumpurple} \mathbf{T}}
\times
{\color{mediumorchid} \mathbf{U}}
\times
{
\begin{bmatrix}
1\\
0\\
0\\
0
\end{bmatrix}
}
\large
\uthird
\usecond
\ufirst
\ket{00}
\quad
=
\quad
\frac{
\kzero \ket{00} +
\kone \ket{01} +
\ktwo \ket{10} +
\kthree \ket{11}
}{\sqrt{12}}
\quad
=
\quad
\frac{1}{\sqrt{12}}
\cdot
{
@ -49,51 +41,454 @@ $$
}
$$
## Separazione e raccolta nell'[[Hardy state]]
> [!Note]
> I [[gate quantistico controllato universale|gate controllati]] costano di più dei [[gate quantistico universale|gate normali]], quindi per minimizzare il costo del [[circuito quantistico]] si:
> 1. $\ufirst$: utilizza un gate normale per configurare lo stato di $\noteb$
> 2. $\usecond$: utilizza un gate normale per configurare lo stato di $\notea$ quando $\ket{0}_\noteb$
> 3. $\uthird$: utilizza un gate controllato per annullare le modifiche del passo precedente e inoltre configurare lo stato di $\notea$ quando $\ket{1}_\noteb$.
Ricordando che è possibile separare i [[qbit]]:
## Costruzione di $\ufirst$
Ricordiamo che è possibile invertire il [[prodotto tensoriale]] per separare i [[qbit]]:
$$
\def \noteA {{\color{orangered} \Leftarrow}}
\def \noteB {{\color{dodgerblue} \Rightarrow}}
\displaylines{
\ket{00} = \ket{0}_\noteA \otimes \ket{0}_\noteB \\
\ket{01} = \ket{0}_\noteA \otimes \ket{1}_\noteB \\
\ket{10} = \ket{1}_\noteA \otimes \ket{0}_\noteB \\
\ket{11} = \ket{1}_\noteA \otimes \ket{1}_\noteB
\ket{00} = \ket{0}_\notea \otimes \ket{0}_\noteb \\
\ket{01} = \ket{0}_\notea \otimes \ket{1}_\noteb \\
\ket{10} = \ket{1}_\notea \otimes \ket{0}_\noteb \\
\ket{11} = \ket{1}_\notea \otimes \ket{1}_\noteb
}
$$
Vogliamo costruire il gate $\ufirst$ da applicare solamente al [[qbit]] $\noteb$.
Possiamo separare i [[qbit]] dell'[[Hardy state]] in:
$$
\frac{1}{\sqrt{12}}
\cdot
\left\{
\begin{matrix}
\kzero & \cdot & (\ket{0}_\noteA \otimes \ket{0}_\noteB) \\
\kzero & \cdot & (\ket{0}_\notea \otimes \ket{0}_\noteb) \\
& + \\
\kone & \cdot & (\ket{0}_\noteA \otimes \ket{1}_\noteB) \\
\kone & \cdot & (\ket{0}_\notea \otimes \ket{1}_\noteb) \\
& + \\
\ktwo & \cdot & (\ket{1}_\noteA \otimes \ket{0}_\noteB) \\
\ktwo & \cdot & (\ket{1}_\notea \otimes \ket{0}_\noteb) \\
& + \\
\kthree & \cdot & (\ket{1}_\noteA \otimes \ket{1}_\noteB)
\kthree & \cdot & (\ket{1}_\notea \otimes \ket{1}_\noteb)
\end{matrix}
\right\}
$$
Poi, possiamo raccogliere lo stato di uno dei due [[qbit]], per esempio $\noteB$, ottenendo:
Poi, possiamo raccogliere gli [[qbit|stati del qbit]] $\noteb$, ottenendo:
$$
\frac{1}{\sqrt{12}}
\cdot
\left\{
\begin{matrix}
(\ \kzero \cdot \ket{0}_\noteA + \ktwo \cdot \ket{1}_\noteA\ ) & \otimes & \ket{0}_\noteB \\
& + \\
(\ \kone \cdot \ket{0}_\noteA + \kthree \cdot \ket{1}_\noteA\ ) & \otimes & \ket{1}_\noteB
(& \kzero \cdot \ket{0}_\notea & + & \ktwo \cdot \ket{1}_\notea &) & \otimes & \ket{0}_\noteb \\
&&&&& + \\
(& \kone \cdot \ket{0}_\notea & + & \kthree \cdot \ket{1}_\notea &) & \otimes & \ket{1}_\noteb
\end{matrix}
\right\}
$$
## Determinare gli elementi di ${\color{mediumorchid}\mathbf{U}}$
Decidiamo di ignorare temporaneamente il [[qbit]] $\notea$; determiniamo le [[ampiezza|ampiezze]] del gate alla [[stato base di un qbit|base]] di $\noteb$:
==TODO==
$$
\frac{1}{\sqrt{12}}
\cdot
\left\{
\begin{matrix}
\sqrt{ \kzero^2 + \ktwo^2 } & \otimes & \ket{0}_\noteb \\
& + \\
\sqrt{ \kone^2 + \kthree^2 } & \otimes & \ket{1}_\noteb
\end{matrix}
\right\}
\quad = \quad
\frac{1}{\sqrt{12}}
\cdot
\left\{
\begin{matrix}
{\color{mediumaquamarine} \sqrt{ 10 }} & \otimes & \ket{0}_\noteb \\
& + \\
{\color{palegreen} \sqrt{ 2 }} & \otimes & \ket{1}_\noteb
\end{matrix}
\right\}
$$
Ricordando che lo stato iniziale del sistema è sempre $\ket{0}_\noteb$, e che il [[gate quantistico universale]] è definito come:
$$
\def \varX {a}
\def \varY {b}
\def \varZ {c}
\def \varI {i}
\ufirst
\quad = \quad
\begin{bmatrix}
{\color{mediumaquamarine} \cos \left( \frac{\varX}{2} \right)} &
- e^{\varI \varZ} \sin \left( \frac{\varX}{2} \right) \\
{\color{palegreen} e^{\varI \varY} \sin \left( \frac{\varX}{2} \right)} &
e^{\varI \varY + \varI \varZ} \cos \left( \frac{\varX}{2} \right)
\end{bmatrix}
\quad = \quad
\begin{bmatrix}
{\color{mediumaquamarine} \frac{\sqrt{10}}{\sqrt{12}}} &
\ *\ \\
{\color{palegreen} \frac{\sqrt{2}}{\sqrt{12}}} &
\ *\
\end{bmatrix}
$$
Possiamo mettere a sistema i seguenti vincoli per determinare il valore di $\varX$ e $\varY$:
$$
\begin{cases}
{\color{mediumaquamarine} \cos \left( \frac{\varX}{2} \right)}
& = &
{\color{mediumaquamarine} \frac{\sqrt{10}}{\sqrt{12}}}
\\
- e^{\varI \varZ} \sin \left( \frac{\varX}{2} \right)
& = &
*
\\
{\color{palegreen} e^{\varI \varY} \sin \left( \frac{\varX}{2} \right)}
& = &
{\color{palegreen} \frac{\sqrt{2}}{\sqrt{12}}}
\\
e^{\varI \varY + \varI \varZ} \cos \left( \frac{\varX}{2} \right)
& = &
*
\end{cases}
$$
Abbiamo dunque due variabili libere; per semplificare i calcoli, decidiamo di fissare $\varY$ e $\varZ$ a $0$:
$$
\begin{cases}
{\color{mediumaquamarine} \cos \left( \frac{\varX}{2} \right)}
& = &
{\color{mediumaquamarine} \frac{\sqrt{10}}{\sqrt{12}}}
\\
\varZ
& = &
0
\\
{\color{palegreen} e^{\varI \varY} \sin \left( \frac{\varX}{2} \right)}
& = &
{\color{palegreen} \frac{\sqrt{2}}{\sqrt{12}}}
\\
\varY
& = &
0
\end{cases}
$$
Risolvendo il sistema:
$$
\begin{cases}
{\color{mediumaquamarine} \cos \left( \frac{\varX}{2} \right)}
& = &
{\color{mediumaquamarine} \frac{\sqrt{10}}{\sqrt{12}}}
\\
\varZ
& = &
0
\\
{\color{palegreen} \sin \left( \frac{\varX}{2} \right)}
& = &
{\color{palegreen} \frac{\sqrt{2}}{\sqrt{12}}}
\\
\varY
& = &
0
\end{cases}
$$
E poi:
$$
\begin{cases}
{\color{mediumaquamarine} \varX}
& = &
{\color{mediumaquamarine} 2 \cdot \arccos \left( \frac{\sqrt{10}}{\sqrt{12}} \right) }
\\
\varZ
& = &
0
\\
\varY
& = &
0
\end{cases}
$$
Visto che si vuole riprodurre l'[[Hardy state]] in un simulatore che necessita di [[numero razionale|numeri razionali]], determiniamo un'approssimazione del valore di $\varX$:
$$
\begin{cases}
{\color{mediumaquamarine} \varX}
& \approx &
{\color{mediumaquamarine} 0.841 }
\\
\varZ
& = &
0
\\
\varY
& = &
0
\end{cases}
$$
## Costruzione di $\usecond$
Vogliamo costruire il [[gate quantistico universale]] $\usecond$ da applicare al [[qbit]] $\notea$.
Ripetiamo lo stesso procedimento di prima, ma ignorando $\ket{1}_{\noteb}$, visto che ci interessa configurare il qbit per $\ket{0}_\noteb$:
$$
\frac{1}{\sqrt{\kzero^2 + \ktwo^2}}
\cdot
\left\{
\begin{matrix}
\kzero & \otimes & \ket{0}_\notea \\
& + \\
\ktwo & \otimes & \ket{1}_\notea
\end{matrix}
\right\}
\quad = \quad
\frac{1}{\sqrt{10}}
\cdot
\left\{
\begin{matrix}
\kzero & \otimes & \ket{0}_\notea \\
& + \\
\ktwo & \otimes & \ket{1}_\notea
\end{matrix}
\right\}
$$
La sua [[matrice]] sarà quindi:
$$
\def \varX {a}
\def \varY {b}
\def \varZ {c}
\def \varI {i}
\usecond
\quad = \quad
\begin{bmatrix}
{\color{darkgreen} \cos \left( \frac{\varX}{2} \right)} &
- e^{\varI \varZ} \sin \left( \frac{\varX}{2} \right) \\
{\color{limegreen} e^{\varI \varY} \sin \left( \frac{\varX}{2} \right)} &
e^{\varI \varY + \varI \varZ} \cos \left( \frac{\varX}{2} \right)
\end{bmatrix}
\quad = \quad
\begin{bmatrix}
{\color{darkgreen} \frac{3}{\sqrt{10}}} &
\ *\ \\
{\color{limegreen} \frac{1}{\sqrt{10}}} &
\ *\
\end{bmatrix}
$$
E i vincoli:
$$
\begin{cases}
{\color{darkgreen} \cos \left( \frac{\varX}{2} \right)}
& = &
{\color{darkgreen} \frac{3}{\sqrt{10}}}
\\
- e^{\varI \varZ} \sin \left( \frac{\varX}{2} \right)
& = &
*
\\
{\color{limegreen} e^{\varI \varY} \sin \left( \frac{\varX}{2} \right)}
& = &
{\color{limegreen} \frac{1}{\sqrt{10}}}
\\
e^{\varI \varY + \varI \varZ} \cos \left( \frac{\varX}{2} \right)
& = &
*
\end{cases}
$$
Che diventano:
$$
\begin{cases}
{\color{darkgreen} \varX}
& = &
{\color{darkgreen} 2 \cdot \arccos \left( \frac{3}{\sqrt{10}} \right) }
\\
\varZ
& = &
0
\\
\varY
& = &
0
\end{cases}
$$
Approssimati:
$$
\begin{cases}
{\color{darkgreen} \varX}
& \approx &
{\color{darkgreen} 0.643 }
\\
\varZ
& = &
0
\\
\varY
& = &
0
\end{cases}
$$
## Costruzione di $\uthird$
Infine, vogliamo costruire il [[gate quantistico controllato universale]] $\uthird$ da applicare al [[qbit]] $\notea$.
Ci troviamo nello stato configurato dal gate $\usecond$ per $\ket{0}_\noteb$:
$$
\frac{1}{\sqrt{10}}
\left\{
\begin{matrix}
\kzero & \otimes & \ket{0}_\notea \\
& + \\
\ktwo & \otimes & \ket{1}_\notea
\end{matrix}
\right\}
$$
Vogliamo usare il gate $\uthird$ per configurare lo stato per $\ket{1}_\noteb$ al valore seguente:
$$
\frac{1}{\sqrt{\kone^2 + \kthree^2}}
\cdot
\left\{
\begin{matrix}
\kone & \otimes & \ket{0}_\notea \\
& + \\
\kthree & \otimes & \ket{1}_\notea
\end{matrix}
\right\}
\quad = \quad
\frac{1}{\sqrt{2}}
\cdot
\left\{
\begin{matrix}
\kone & \otimes & \ket{0}_\notea \\
& + \\
\kthree & \otimes & \ket{1}_\notea
\end{matrix}
\right\}
$$
Abbiamo dunque che:
$$
\uthird
\otimes
\frac{1}{\sqrt{10}}
\left\{
\begin{matrix}
\kzero & \otimes & \ket{0}_\notea \\
& + \\
\ktwo & \otimes & \ket{1}_\notea
\end{matrix}
\right\}
\quad = \quad
\frac{1}{\sqrt{2}}
\left\{
\begin{matrix}
\kone & \otimes & \ket{0}_\notea \\
& + \\
\kthree & \otimes & \ket{1}_\notea
\end{matrix}
\right\}
$$
In forma matriciale:
$$
\uthird
\otimes
\frac{1}{\sqrt{10}}
\begin{bmatrix}
\kzero \\
\ktwo
\end{bmatrix}
\quad = \quad
\frac{1}{\sqrt{2}}
\begin{bmatrix}
\kone \\
\kthree
\end{bmatrix}
$$
Portando tutto a destra, sfruttando l'[[operatore aggiunto]]:
$$
\uthird
\quad = \quad
\frac{\sqrt{10}}{\sqrt{2}}
\begin{bmatrix}
\kone \\
\kthree
\end{bmatrix}
\begin{bmatrix}
\kzero \\
\ktwo
\end{bmatrix}^\dagger
$$
Che diventa:
$$
\uthird
\quad = \quad
\sqrt{5}
\begin{bmatrix}
\kone \\
\kthree
\end{bmatrix}
\begin{bmatrix}
\kzero &
\ktwo
\end{bmatrix}
$$
Risolvendo il [[prodotto matriciale]]:
$$
\uthird
\quad = \quad
\sqrt{5}
\begin{bmatrix}
\kone \cdot \kzero & \kone \cdot \ktwo \\
\kthree \cdot \kzero & \kthree \cdot \ktwo
\end{bmatrix}
$$
Moltiplicando:
$$
\uthird
\quad = \quad
\sqrt{5}
\begin{bmatrix}
{\color{teal} 3} & {\color{aqua} 1} \\
{\color{turquoise} -3} & {\color{aquamarine} -1}
\end{bmatrix}
$$
$$
\def \varX {a}
\def \varY {b}
\def \varZ {c}
\def \varI {i}
\begin{bmatrix}
{\color{teal} \cos \left( \frac{\varX}{2} \right)} &
{\color{aqua} - e^{\varI \varZ} \sin \left( \frac{\varX}{2} \right)} \\
{\color{turquoise} e^{\varI \varY} \sin \left( \frac{\varX}{2} \right)} &
{\color{aquamarine} e^{\varI \varY + \varI \varZ} \cos \left( \frac{\varX}{2} \right)}
\end{bmatrix}
\quad = \quad
\sqrt{5}
\begin{bmatrix}
{\color{teal} 3} & {\color{aqua} 1} \\
{\color{turquoise} -3} & {\color{aquamarine} -1}
\end{bmatrix}
$$
==BOH??==

View file

@ -1,3 +1,3 @@
Dimostrazione formale che un [[vincolo]] non possa mai essere violato in un dato [[dominio]].
Dimostrazione formale che un [[vincolo]] non possa mai essere violato in un dato [[8 - Crittografia applicata/1 - Concetti/1 - Trovare soluzioni crittografiche/dominio]].
Solitamente, le garanzie hanno un codice di tre lettere, nel formato `ABC`.

View file

@ -1,4 +1,4 @@
[[dominio|Contesto]] in cui:
[[8 - Crittografia applicata/1 - Concetti/1 - Trovare soluzioni crittografiche/dominio|Contesto]] in cui:
- i [[squadra blu|difensori]] desiderano scambiarsi privatamente messaggi con determinate [[garanzia|garanzie]]
- gli [[squadra rossa|attaccanti]] desiderano [[violazione|violare]] la segretezza dei messaggi inviati, ricavando delle informazioni

View file

@ -1,3 +1,3 @@
[[Paradosso]].
L'[[evoluzione naturale]] porta solo a miglioramenti finiti e di breve impatto, ma la [[complessità]] della [[vita]] è in continuo aumento.
L'[[evoluzione naturale]] porta solo a miglioramenti finiti e di breve impatto, ma la [[complessità del modello]] della [[vita]] è in continuo aumento.

View file

@ -0,0 +1,2 @@
> [!Question]
> Cos'è questo? https://patchwork.kernel.org/project/linux-kselftest/list/

View file

@ -0,0 +1,55 @@
Ci sono varie cose che vanno effettuate per rendere possibile debuggare il kernel con [[gdb]].
## Generare un config di debug iniziale
Iniziare la compilazione del kernel con [[virtme-ng]], poi interromperla subito con <kbd><kbd>Ctrl</kbd>+<kbd>C</kbd></kbd>:
```bash
virtme-ng --build
```
## Abilitare le info di debug
Aprire [[menuconfig]]:
```bash
make menuconfig
```
Nella sezione *Kernel hacking*, attivare *Kernel debugging*.
Nella sezione *Memory Management options*, attivare *Disable heap randomization*.
## Ricompilare il kernel
Ricompilare il kernel con [[virtme-ng]]:
```bash
virtme-ng \
--verbose \
--build \
--config .config
```
## Eseguire il kernel in modalità debug
Eseguire il kernel con [[virtme-ng]]:
```bash
virtme-ng \
--run \
--debug
```
## Connettere gdb al kernel
Avviare [[gdb]]:
```bash
gdb
```
Caricare i [[simboli di debug]]:
```gdb
file vmlinux
```
Connettersi al server [[gdb]] remoto:
```gdb
target remote localhost:1234
```

View file

@ -0,0 +1,2 @@
> [!TODO]
> Ho fatto progressi, ma non sono riuscito a scrivere niente a riguardo.

View file

@ -0,0 +1,34 @@
Utilty di [[integration test|integration testing]] per il [[kernel Linux]].
Eseguita da *dentro* il kernel compilato.
## Esecuzione
È possibile compilare ed eseguire la suite completa di [[test]] con:
```bash
make kselftest
```
> [!Tip]
> Usando [[virtme-ng]], l'utility va avviata con:
> ```bash
> vng --rw --user root -- make kselftest
> ```
L'output viene emesso su [[standard output]] in formato [[Test Anywhere Protocol]].
> [!Tip]
> Per non perdere i risultati del test, si suggerisce di:
> ```bash
> mkdir .tmp_kselftest
> ... | tee .tmp_kselftest/output_kselftest.log
> ```
> [!Note]
> Apparentemente un sacco di test falliscono su [[virtme-ng]] perchè non possono andare su macchina virtuale...
>
> Eppure `/sys/module/kvm_amd/parameters/nested` per la virtualizzazione innestata è `1`?
## Directory
I test sono collocati in `tools/testing/selftests`.

View file

@ -0,0 +1 @@
Utility per compilare il kernel Linux

File diff suppressed because it is too large Load diff