Initial commit

This commit is contained in:
2021-08-02 10:05:44 -05:00
commit 30635db56d
7 changed files with 445 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto

17
.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
.idea
dist
*.aux
*.fdb_latexmk
*.fls
*.tdo
*.toc
*.log
*.pdf
*.bbl
*.bcf
*.blg
*.run.xml
*.out
*.nb

56
Makefile Normal file
View File

@@ -0,0 +1,56 @@
### Build tools
#
LATEXMK := latexmk -pdflatex="luahblatex %O %S" -pdf -dvi- -ps- -quiet -logfilewarninglist
WS := wolframscript -f
### Directory variables
#
PDF_DIR := pdfs
FIG_DIR := figures
CALC_DIR := calc
### Here we go
#
OUT_PDF:= $(PDF_DIR)/notes.pdf
.PHONY: all
all: $(OUT_PDF)
### How we do that
#
## setup main pdf deps as variable that subdirs can add to
MAIN_PDF_DEPS := bibliography.bib
## Defining common directory recipes
$(PDF_DIR):
mkdir $(PDF_DIR)
$(FIG_DIR):
mkdir -p $(FIG_DIR)
$(CALC_DIR):
mkdir -p $(CALC_DIR)
## Figures
#
FIGURES :=
## Making main.pdf and other pdfs
#
$(PDF_DIR)/notes.pdf: notes.tex $(MAIN_PDF_DEPS) | $(PDF_DIR) $(FIGURES)
$(LATEXMK) $(<F)
cp $(@F) $@
### Convenience scripts for tidying tex
.PHONY: declutter
declutter:
@rm -f *.tdo
@rm -f *.run.xml
@rm -f *.bbl
.PHONY: tidy
tidy: declutter
@latexmk -c
.PHONY: clean
clean: declutter
rm -rf $(PDF_DIR)
@latexmk -C

1
README.md Normal file
View File

@@ -0,0 +1 @@
Gradient descent algorithm.

273
bibliography.bib Normal file
View File

@@ -0,0 +1,273 @@
@article{Nam1967,
doi = {10.1103/physrev.156.470},
url = {https://doi.org/10.1103/physrev.156.470},
year = {1967},
month = apr,
publisher = {American Physical Society ({APS})},
volume = {156},
number = {2},
pages = {470--486},
author = {Sang Boo Nam},
title = {Theory of Electromagnetic Properties of Superconducting and Normal Systems. {I}},
journal = {Physical Review}
}
@book{SolyomV3,
doi = {10.1007/978-3-642-04518-9},
url = {https://doi.org/10.1007/978-3-642-04518-9},
year = {2010},
publisher = {Springer Berlin Heidelberg},
author = {Jen{\H{o}} S{\'{o}}lyom},
title = {Fundamentals of the Physics of Solids},
subtitle = {Normal, Broken-Symmetry, and Correlated Systems},
volume = {3},
}
@article{Henkel1999,
doi = {10.1007/s003400050823},
url = {https://doi.org/10.1007/s003400050823},
year = {1999},
month = dec,
publisher = {Springer Science and Business Media {LLC}},
volume = {69},
number = {5-6},
pages = {379--387},
author = {C. Henkel and S. P\"{o}tting and M. Wilkens},
title = {Loss and heating of particles in small and noisy traps},
journal = {Applied Physics B}
}
@article{Henkel2006,
doi = {10.1007/s00340-006-2219-9},
url = {https://doi.org/10.1007/s00340-006-2219-9},
year = {2006},
month = apr,
publisher = {Springer Science and Business Media {LLC}},
volume = {84},
number = {1-2},
pages = {61--68},
author = {C. Henkel and K. Joulain},
title = {Electromagnetic field correlations near a surface with a nonlocal optical response},
journal = {Applied Physics B}
}
@article{QubitRelax,
doi = {10.1103/physreva.86.010301},
url = {https://doi.org/10.1103/physreva.86.010301},
year = {2012},
month = jul,
publisher = {American Physical Society ({APS})},
volume = {86},
number = {1},
author = {Luke S. Langsjoen and Amrit Poudel and Maxim G. Vavilov and Robert Joynt},
title = {Qubit relaxation from evanescent-wave Johnson noise},
journal = {Physical Review A}
}
@incollection{Pippard,
doi = {10.1016/s0065-2539(08)60130-4},
url = {https://doi.org/10.1016/s0065-2539(08)60130-4},
year = {1954},
publisher = {Elsevier},
pages = {1--45},
author = {A.B. Pippard},
title = {Metallic Conduction at High Frequencies and Low Temperatures},
booktitle = {Advances in Electronics and Electron Physics Volume 6}
}
@article{Churchill2016,
doi = {10.1103/physrevb.94.235422},
url = {https://doi.org/10.1103/physrevb.94.235422},
year = {2016},
month = dec,
publisher = {American Physical Society ({APS})},
volume = {94},
number = {23},
author = {R. J. Churchill and T. G. Philbin},
title = {Electromagnetic reflection, transmission, and energy density at boundaries of nonlocal media},
journal = {Physical Review B}
}
@book{AGD,
author = {Abrikosov, A A and Dzyaloshinskii, I and Gorkov, L P and Silverman, Richard A},
title = {Methods of quantum field theory in statistical physics},
publisher = {Dover},
address = {New York, NY},
year = {1975},
}
@article{Zimmermann1991,
doi = {10.1016/0921-4534(91)90771-p},
url = {https://doi.org/10.1016/0921-4534(91)90771-p},
year = {1991},
month = nov,
publisher = {Elsevier {BV}},
volume = {183},
number = {1-3},
pages = {99--104},
author = {W. Zimmermann and E.H. Brandt and M. Bauer and E. Seider and L. Genzel},
title = {Optical conductivity of {BCS} superconductors with arbitrary purity},
journal = {Physica C: Superconductivity}
}
@article{Ford1984,
doi = {10.1016/0370-1573(84)90098-x},
url = {https://doi.org/10.1016/0370-1573(84)90098-x},
year = {1984},
month = nov,
publisher = {Elsevier {BV}},
volume = {113},
number = {4},
pages = {195--287},
author = {G.W. Ford and W.H. Weber},
title = {Electromagnetic interactions of molecules with metal surfaces},
journal = {Physics Reports}
}
@article{Agarwal1975,
doi = {10.1103/physreva.11.230},
url = {https://doi.org/10.1103/physreva.11.230},
year = {1975},
month = jan,
publisher = {American Physical Society ({APS})},
volume = {11},
number = {1},
pages = {230--242},
author = {G. S. Agarwal},
title = {Quantum electrodynamics in the presence of dielectrics and conductors. I. Electromagnetic-field response functions and black-body fluctuations in finite geometries},
journal = {Physical Review A}
}
@article{Nam1967_Part2,
doi = {10.1103/physrev.156.487},
url = {https://doi.org/10.1103/physrev.156.487},
year = {1967},
month = apr,
publisher = {American Physical Society ({APS})},
volume = {156},
number = {2},
pages = {487--493},
author = {Sang Boo Nam},
title = {Theory of Electromagnetic Properties of Strong-Coupling and Impure Superconductors. {II}},
journal = {Physical Review}
}
@article{Tenberg2019,
doi = {10.1103/physrevb.99.205306},
url = {https://doi.org/10.1103/physrevb.99.205306},
year = {2019},
month = may,
publisher = {American Physical Society ({APS})},
volume = {99},
number = {20},
author = {Stefanie B. Tenberg and Serwan Asaad and Mateusz T. M{\k{a}}dzik and Mark A. I. Johnson and Benjamin Joecker and Arne Laucht and Fay E. Hudson and Kohei M. Itoh and A. Malwin Jakob and Brett C. Johnson and David N. Jamieson and Jeffrey C. McCallum and Andrew S. Dzurak and Robert Joynt and Andrea Morello},
title = {Electron spin relaxation of single phosphorus donors in metal-oxide-semiconductor nanoscale devices},
journal = {Physical Review B}
}
@article{Kolkowitz2015,
doi = {10.1126/science.aaa4298},
url = {https://doi.org/10.1126/science.aaa4298},
year = {2015},
month = jan,
publisher = {American Association for the Advancement of Science ({AAAS})},
volume = {347},
number = {6226},
pages = {1129--1132},
author = {S. Kolkowitz and A. Safira and A. A. High and R. C. Devlin and S. Choi and Q. P. Unterreithmeier and D. Patterson and A. S. Zibrov and V. E. Manucharyan and H. Park and M. D. Lukin},
title = {Probing Johnson noise and ballistic transport in normal metals with a single-spin qubit},
journal = {Science}
}
@book{llv9,
place={Oxford},
title={Statistical Physics. Part 2},
volume={9},
publisher={Pergamon Press},
author={Lifshitz, Evgenii Mikhailovich. and Pitaevskii, Lev Petrovich.},
year={1980}
}
@book{Tinkham,
title={Introduction to Superconductivity},
author={Michael Tinkham},
edition = 2,
isbn={9780486435039},
lccn={95022378},
series={Dover Books on Physics},
year={2004},
publisher={Dover Publications},
location={Mineola, N.Y.},
}
@article{Mattis,
doi = {10.1103/physrev.111.412},
url = {https://doi.org/10.1103/physrev.111.412},
year = {1958},
month = jul,
publisher = {American Physical Society ({APS})},
volume = {111},
number = {2},
pages = {412--417},
author = {D. C. Mattis and J. Bardeen},
title = {Theory of the Anomalous Skin Effect in Normal and Superconducting Metals},
journal = {Physical Review}
}
@book{FetterWalecka,
address = {Boston},
author = {Fetter, A. L. and Walecka, J. D.},
publisher = {McGraw-Hill},
title = {Quantum Theory of Many-Particle Systems},
year = 1971
}
@article{Lindhard,
title = {ON THE PROPERTIES OF A GAS OF CHARGED PARTICLES},
author = {Lindhard, J},
abstractNote = {},
doi = {},
journal = {Kgl. Danske Videnskab. Selskab Mat.-fys. Medd.},
number = 8,
volume = 28,
year = {1954},
month = {1}
}
@book{LandauLifshitzElectrodynamics,
author = "Landau, Lev Davidovich and Lifshitz, Evgenii Mikhailovich and Pitaevskii, Lev Petrovich",
title = "{Electrodynamics of continuous media; 2nd ed.}",
publisher = "Butterworth",
address = "Oxford",
series = "Course of theoretical physics",
year = "1984",
url = "https://cds.cern.ch/record/712712",
}
@article{Eliashberg,
title = {Interactions between electrons and lattice vibrations in a superconductor},
author = {Eliashberg, G M},
abstractNote = {},
doi = {},
url = {https://www.osti.gov/biblio/7354388},
journal = {Sov. Phys. - JETP (Engl. Transl.); (United States)},
volume = 11,
number = 3,
place = {United States},
year = {1960},
month = {9}
}
@article{Nambu1960,
doi = {10.1103/physrev.117.648},
url = {https://doi.org/10.1103/physrev.117.648},
year = {1960},
month = feb,
publisher = {American Physical Society ({APS})},
volume = {117},
number = {3},
pages = {648--663},
author = {Yoichiro Nambu},
title = {Quasi-Particles and Gauge Invariance in the Theory of Superconductivity},
journal = {Physical Review}
}

18
do.sh Normal file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env sh
# Do - The Simplest Build Tool on Earth.
# Documentation and examples see https://github.com/8gears/do
set -Eeuo pipefail # -e "Automatic exit from bash shell script on error" -u "Treat unset variables and parameters as errors"
build() {
echo "I am ${FUNCNAME[0]}ing"
make pdfs/notes.pdf
}
all() {
build
}
"$@" # <- execute the task
[ "$#" -gt 0 ] || printf "Usage:\n\t./do.sh %s\n" "($(compgen -A function | grep '^[^_]' | paste -sd '|' -))"

79
notes.tex Normal file
View File

@@ -0,0 +1,79 @@
\documentclass{article}
%other packages
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{physics}
\usepackage[
style=phys, articletitle=false, biblabel=brackets, chaptertitle=false, pageranges=false, url=true
]{biblatex}
\usepackage{graphicx}
\usepackage{todonotes}
\usepackage{siunitx}
\usepackage{cleveref}
\title{Notes on initial gradient descent testing}
% \addbibresource{./bibliography.bib}
\graphicspath{{./figures/}}
\begin{document}
\maketitle
Before beginning an implementation of the ``dimensional reduction'' solution method of the charge qubit locating problem, I started with a naïve gradient descent algorithm.
This gives us something to benchmark against later.
\section{gradient descent}
We are given a set of real-valued cost functions $C_n(\vec{x})$, such that a solution $\vec{x}_{sol}$ has $C_n(\vec{x}_{sol}) = 0$ for all $n$.
We want to minimise the function $f(\vec{x}) = \sum_{n} C_n(\vec{x})^2$ (which is how we keep the costs non-negative in this algorithm).
Then given some initial point $\vec{x}_0$, we can minimise $f$ by moving to a point $\vec{x}_1 = \vec{x}_0 - \epsilon \grad f(\vec{x}_0)$, where $\epsilon$ is a step-size we'll discuss soon.
It's pretty straightforward to show that $\grad f(\vec{x}) = J^\top \vec{C}$, where $\vec{C}$ is the cost functions as a vector and $J$ is the Jacobian of $\vec{C}$ with respect to $\vec{x}$.
The advantage of writing it this way is mostly that we already have the cost functions $C$, and we can pretty easily code up the Jacobians when those cost functions are simple polynomials.
There are ways of calculating the Jacobian given a black-box set of cost functions, but fortunately we don't need to use them.
The step size $\epsilon$ can be somewhat adaptively set, and it turned out that to get anything useful from this method that it needed to be.
Essentially a default step size $\epsilon_0$ is chosen, and at each step, if $f(\vec{x_n} - \epsilon_0 \grad f) > f(\vec{x_n})$, then I used an $\epsilon_1 = \frac{\epsilon_0}{10}$.
This is iterated up to $a$ times, where $a$ is some parameter free to set in the code ($a$ for adaptive).
This basically lets us pick an order of magnitude that actually lowers the cost.
Essentially then, we can use this process, iterating step by step lowering the cost, and at each step trying different step sizes.
We can set some target cost $f_{target}$, and if $f(\vec{x}_n) < f_{target}$, we end the process and return $\vec{x}_n$.
Otherwise we step when we hit a max number of iterations.
\section{Toy problem}
The first step is to look at the toy problem of intersecting circles.
We can begin by defining two circles, one of radius $5$ centered at the origin, and another of radius $13$ centered at $(8, -8)$.
These two circles should have two intersections, one at $(3, 4)$ and one at $(-4, -3)$.
Our cost functions here are $C_1\left(\left(x, y\right)\right) = 25 - x^2 - y^2$ and $C_2\left(\left(x, y\right)\right) = 13^2 - (x - 8)^2 - (y + 8)^2$.
This was relatively easily for the gradient descent program to solve.
After 1200 iterations, the program returned $(3.00000011, 4.00000002)$, so as might be expected standard gradient descent is very effective at handling this case.
\section{Single noise source example}
Next, we look at the dipole source problem.
To set up a particular example values, I started by picking a dipole moment $(p_x, p_y, p_z) = (1, 3, 5)$ located at $(s_x, s_y, s_z) = (5, 6, 7)$.
Then, for five qubits located at $r_n = (0, 0, n)$, I found $V_n = \frac{\vec{p} \cdot (\vec{r}_n - \vec{s})}{\abs{\vec{r}_n - \vec{s}}^3}$.
For the rest of the problem we take the $r_n$ and $V_n$ as givens, and our goal will be to find $(p_x, p_y, p_z, s_x, s_y, s_z)$, which should be $(1, 3, 5, 5, 6, 7)$.
I then took a cost function based on a known dipole magnitude, so $C_0(\vec{x} = (p_x, p_y, p_z, s_x, s_y, s_z)) = p_x^2 - p_y^2 - p_z^2 - 35$.
Then the next five cost functions are $C_n(\vec{x}) = V_n \left(\abs{\vec{r}_n - \vec{s}}^3\right) - \vec{p} \cdot \left( \vec{r}_n - \vec{s} \right)$.
As might be expected, the naïve gradient descent solver found this six-dimensional problem much harder to solve.
After \num[group-separator={,}]{100000} iterations, the algorithm found $\vec{x} = (1.03770348, 2.94004682, 5.02785529, 4.98257315, 6.00541671, 7.017208)$.
This is the correct answer, but the low precision after a huge number of iterations is unideal.
For higher numbers of charge sources and qubits, this would naturally scale quite poorly.
\section{Gradient descent thoughts}
The main point, that gradient descent works but is an inefficient method, is not a particularly surprising outcome, which is good.
It also suggests that if I want a backup method to test the results of the dimensional reduction method, I can re-run the same problems with this gradient descent algorithm and compare the outcomes.
\end{document}