<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Aditya Morolia</title>
    <description>Hi, I&apos;m Aditya Morolia.</description>
    <link>https://adityamorolia.github.io/</link>
    <atom:link href="https://adityamorolia.github.io/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sun, 07 Jun 2026 08:03:13 +0000</pubDate>
    <lastBuildDate>Sun, 07 Jun 2026 08:03:13 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Operator Inverse as an Integral and the Sylvester Equation</title>
        <description>&lt;p&gt;I saw a paper by Somma et. al. &lt;a href=&quot;https://arxiv.org/abs/2508.02822&quot;&gt;Quantum algorithm for linear matrix equations&lt;/a&gt; for solving the &lt;a href=&quot;https://en.wikipedia.org/wiki/Sylvester_equation&quot;&gt;Sylvester equation&lt;/a&gt;. I did not immediately recall that one can write matrix inverse as an integral, so I thought I will recall and write it up here, a short proof of equation 9 in their paper. We assume that the matrix $A$ is positive definite and with to write $A^{-1}$ as an integral. We also mention a simple solution to the Sylvester equation when $A,B \gt 0$.&lt;/p&gt;

&lt;p&gt;Let’s start with scalars first. For a real number $a&amp;gt;0$, we have that&lt;/p&gt;

\[\int_{0}^{\infty} e^{-at} dt = \Big[-\frac{1}{a} e^{-at}\Big]_{0}^{\infty} = \frac{1}{a}.\]

&lt;p&gt;So we have an identity $a^{-1}=\int_0^\infty e^{-at} dt$. We can essentially extend this identity for positive definite matrices. We know that for any square matrix $A$,&lt;/p&gt;

\[e^{-tA} := \sum_{k=0}^{\infty}\frac{(-t)^k}{k!}A^k.\]

&lt;p&gt;First check that this is well defined. The series converges for every $t$ because the scalar exponential series is absolutely convergent, and matrix norms are sub-multiplicative.&lt;/p&gt;

&lt;p&gt;Now notice that&lt;/p&gt;

\[\frac{d}{dt}e^{-tA}=-\sum_{k=1}^{\infty}\frac{(-t)^{k-1}}{(k-1)!}A^{k}=-A e^{-tA}.\]

&lt;p&gt;Also notice that $A$ commutes with any polynomial in $A$ (since they diagonalize in the same basis), hence with its exponential also.&lt;/p&gt;

&lt;p&gt;By our assumption, all eigenvalues of $A$ are positive, and therefore $|e^{-tA}|\to 0$ as $t\to\infty$. Now integrate the derivative identity above&lt;/p&gt;

\[\frac{d}{dt}e^{-tA}=-A e^{-tA}\]

&lt;p&gt;from $0$ to $T$ to get&lt;/p&gt;

\[e^{-TA}-I = -A\int_{0}^{T} e^{-tA} dt.\]

&lt;p&gt;Thus&lt;/p&gt;

\[A\int_{0}^{T} e^{-tA} dt = I - e^{-TA}.\]

&lt;p&gt;Let $T\to\infty$. Because $e^{-TA}\to 0$, we get that&lt;/p&gt;

\[A\left(\int_{0}^{\infty} e^{-tA} dt\right)=I.\]

&lt;p&gt;Since $A$ commutes with $e^{-tA}$, the same computation on the right gives&lt;/p&gt;

\[\left(\int_{0}^{\infty} e^{-tA} dt\right)A=I.\]

&lt;p&gt;Therefore&lt;/p&gt;

\[\boxed{ \quad A^{-1}  =  \int_{0}^{\infty} e^{-tA} dt \quad }.\]

&lt;p&gt;Notice that in the above we only used the fact that all the eigenvalues of $A$ all have positive real part (so that the integral converges). Therefore, this result can extend to all such matrices.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;The Sylvester equation can be thought of as a linear operator acting on $X$ that acts as $\mathcal{L}(X) = AX + XB$. It has a unique solution iff the spectra of $A$ and $-B$ are disjoint (check wikipedia). In the above case where $A$ and $B$ are PSD (or they have positive real spectra), one can obtain a closed form solution to the inverse of $\mathcal{L}$ (technically I should be writing $\mathcal{L}_{A,B}$) (I thank ChatGPT for this idea 😛.) Define&lt;/p&gt;

\[X^*:=\int_{0}^{\infty} e^{-tA} C e^{-tB} dt.\]

&lt;p&gt;Let $Y(t):=e^{-tA} C e^{-tB}$. Taking the derivative, we get (recall that $A,B$ commute with their exponentials)&lt;/p&gt;

\[Y&apos;(t) = -A Y(t) - Y(t) B.\]

&lt;p&gt;Integrate from $0$ to $T$ to get&lt;/p&gt;

\[Y(T)-Y(0) = -\int_{0}^{T}\big(A Y(t)+Y(t)B\big) dt.\]

&lt;p&gt;Because of our assumption on the spectra of $A$ and $B$, $Y(0)=C$ and $Y(T)\to 0$. Thus&lt;/p&gt;

\[C=\int_{0}^{\infty}\big(A Y(t)+Y(t)B\big) dt
 = A\!\left(\int_{0}^{\infty}\!Y(t) dt\right)+\left(\int_{0}^{\infty}\!Y(t) dt\right)\!B
 = A X^* + X^* B.\]

&lt;p&gt;Therefore $X^*=\mathcal{L}^{-1}(C)$ is the “operator inverse as an integral” for the operator $X\mapsto AX+XB$.&lt;/p&gt;

&lt;p&gt;Notice that one can always truncate the integral and discretize it, and then use Hamiltonian simulation to construct block encodings of the solution.&lt;/p&gt;
</description>
        <pubDate>Sat, 23 Aug 2025 00:00:00 +0000</pubDate>
        <link>https://adityamorolia.github.io/blog/sylvester-equation</link>
        <guid isPermaLink="true">https://adityamorolia.github.io/blog/sylvester-equation</guid>
        
        <category>Math</category>
        
        <category>Linear Agebra</category>
        
        <category>Functional Analysis</category>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Too Much Words.</title>
        <description>&lt;h3 id=&quot;destined-for-war-by-graham-allison&quot;&gt;Destined for War, by Graham Allison&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Modern behavioral scientists have explained this at the basic psychological level, noting that people’s fears of loss (or intimations of “decline”) trump our hopes of gain—driving us to take often unreasonable risks to protect what is ours.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;in-a-flight-of-starlings-by-giorgio-parisi&quot;&gt;In a Flight of Starlings, by Giorgio Parisi&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;This, after all, is the scientist’s calling: to imagine or to do what no one has done before.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Is this what the scientists these days train to do?&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;To illustrate this, we can use the model proposed by Ernst Ising in his 1924 doctoral thesis—perhaps the first model invented by physicists to aid an understanding of reality by simplifying its description as much as possible. This model allows spins to orient themselves in just two directions: up or down (as shown in figure 1), with all other orientations forbidden.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Really, Ising model is one of the first such? Woah. Humans are wayy younger than I thought.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Furthermore, having flitted between different problems for almost ten years, I had developed the tools that enabled me to understand what was incomprehensible to many—and had acquired a curiosity for problems in areas unfamiliar to me. I had alighted on the right problem at the right time, at the height of my scientific abilities and curiosity.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;The physicist sometimes uses mathematics ungrammatically; not following all the rules of grammar is a license that we grant to poets.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;OH MY FUCKING GOD.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“Pausing one”s concentration on a difficult problem—to allow ideas to settle, and to face that problem again with a fresh mind—is no doubt very common. The Italian phrase La notte porta consiglio has counterparts in so many languages: In nocte consilium (“Night is the time for counsel”—or, more colloquially, “Sleep on it”); Die nacht bringt rat (“Night brings advice”); Il est utile de consulter l’oreiller and Antes de hacer nada, consúltado con la almohala (where l’oreiller and almohada both mean “pillow”, so literally “It is useful to consult your pillow”); La note xe la mare d’i pensieri (“Night is the sea of thought”).”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;“Science is like sex: sometimes something useful comes out, but that is not the reason we are doing it.” So said Richard Feynman (allegedly), one of the greatest physicists of the twentieth century and perhaps the most charismatic. This sentence, together with the Dantean imperative that we “were not made to live like brutes, but to seek virtue and knowledge,” sums up pretty well the motivating, subjective passions of scientists.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Beyond such considerations, however, it is fundamental that scientists find seeking to solve the puzzle fun. When I was discussing potential assignments with my teacher Nicola Cabibbo, he would ask: “Why study this problem if it doesn’t really grab you?” Often among scientists, there is a feeling verging on astonishment that we are being paid to do what we are so passionate about. Or as my dear friend Aurelio Grillo used to say: “Being a physicist is hard, but it’s better than having to work for a living.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;uncle-petros-and-goldbachs-conjecture-by-apostolos-doxiadis&quot;&gt;Uncle Petros and Goldbach’s Conjecture, by Apostolos Doxiadis&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;…his brilliance as a chess player couldn’t disguise the fact that he was a broken man. And the closer to him I got, the more I realized that the reason for his condition lay in his profound insincerity. Uncle Petros had lied to himself about the most crucial event in his life and this lie had become a cancerous growth that stifled his essence, eating away at the very roots of his psyche. His sin, indeed, had been Pride. And the pride was still there, nowhere more apparent than in his inability to come face to face with himself.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;the-essex-serpent-sarah-perry&quot;&gt;The Essex Serpent, Sarah Perry&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;‘You know, I always thought that was the great benefit of being religious: get the guilt over and done with, and move on to another sin…’&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Male pride, she thinks: the most tender, contemptible thing!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;I am in charge! I’ll do what I think’s right!’ he said, sounding not at all like her father, but like a boy who couldn’t get his own way&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;love is not love which alters when it alteration finds!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;logicomix&quot;&gt;Logicomix&lt;/h3&gt;

&lt;p&gt;Russell, while explaining Hilbert’s infinite hotel to his wife Alys: “When poets are in love they recite verses to their beloved … A mathematician in love will hum his own brand of poetry!”&lt;/p&gt;

&lt;p&gt;Russell, to Alfred Whitehead: “…every morning I wake up an optimist, but after a day’s work, I despair.” – Well, life of every research student. &lt;a href=&quot;https://twitter.com/AdityaMorolia/status/1652271782018301953&quot;&gt;This tweet, lol&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;kafka-on-the-shore-murakami&quot;&gt;Kafka on the Shore, Murakami&lt;/h3&gt;

&lt;p&gt;Read &lt;a href=&quot;https://lithub.com/the-political-murakami-on-life-in-a-dark-timeline/&quot;&gt;The Political Murakami&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The girl to Hoshino: “The pure present is an ungraspable advance of the past devouring the future. In truth, all sensation is already memory.” – Henri Bregson in Mame mo memelay (or Matter and Memory)&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;the-god-of-small-things&quot;&gt;The God of Small Things&lt;/h3&gt;

&lt;p&gt;[when they lay together in bed]…“their bodies fit like stacked spoons.” What a beauifully written statement. Arundhati Roy seems to be the queen of metaphors. I thoroughly enjoyed reading this book.&lt;/p&gt;

&lt;p&gt;Also read &lt;a href=&quot;https://frontline.thehindu.com/cover-story/reading-arundhati-roy-politically-by-aijaz-ahmad/article38458826.ece&quot;&gt;Reading Arundhati Roy politically by Aijaz Ahmad&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;the-plague&quot;&gt;The Plague&lt;/h3&gt;

&lt;p&gt;I was recently asked If I could have dinner with anyone, dead or alive, who would it be? My two choices were Camus and Feynmann (duh!)
What struck me most while reading the book was how slow social development of humans has been, when compared to technological development. It makes sense, since social patterns are emergent behaviour and it would take a lot of effort to change the system enough to observe a change. This book was written in 1947, and the description is probably from that time. It was fun to compare people’s behaviour during the COVID-19 pandemic vs. people’s behaviour in the book. Compare that with the rapid development of vaccines, processing of viral genome, etc. that happened during the COVID.&lt;/p&gt;

&lt;p&gt;I was recently reading &lt;a href=&quot;https://web.ics.purdue.edu/~wggray/Teaching/His300/Illustrations/Limits-to-Growth.pdf&quot;&gt;Limits to Growth&lt;/a&gt;,&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;shoe-dog&quot;&gt;Shoe Dog&lt;/h3&gt;

&lt;p&gt;Shoe Dog is a must read. It’s exciting, energizing, absolutely fantastic. I planned on reading it slowly, actually ended up reading all of it over a weekend. His life has been a roller coster ride, and he did a fantastic job in turning it into a book. The book is summarised well by something that my grandfather says very often when recalling some of his life’s stories to he: &lt;em&gt;Paise se hi paisa aata hai&lt;/em&gt; which basically means it takes money to make money.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;tuesdays-with-morrie&quot;&gt;Tuesdays with Morrie&lt;/h3&gt;

&lt;p&gt;I don’t read a lot of self help books since they are not really my type. I think they all say the same things in a different manner, very much inflated in terms of numebr of pages to make it seem necessary, and can be summarised well in some short blog. Some decide to add in some fiction, and the story makes it more readable. I decided to give this one a try since I got it recommended by too many people. The story is heartwarming and the character of Morrie is really interesting in terms of personality and his outlook to life can certainly add a lot of value to mine.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;the-summer-that-melted-everything&quot;&gt;The Summer That Melted Everything&lt;/h3&gt;

&lt;p&gt;“He existed. hurrah! He existed, and we shall be each moment celebrating him and singing him and through eternity, we shall hold him with our strong hearts. And strong we must be because we cannot stop in the night, for the powerful play goes on, and you may contribute a verse. The powerful play goes on, and you, dear Grand, have contributed your beautiful verse.”&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;samsa-in-love-from-desire-by-murakami&quot;&gt;Samsa in Love, from Desire by Murakami&lt;/h3&gt;

&lt;p&gt;The woman: “Everything is blowing up around us, but there are still those of us who care about a broken lock, and others who are dutiful enough to try and fix it … But maybe that’s the way it should be. Maybe working on the little things as dutifully and honestly as we can is how we stay sane when the world is falling apart.”&lt;/p&gt;

&lt;h3 id=&quot;the-little-prince&quot;&gt;The Little Prince&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Well, I must endure the presence of two or three caterpillars if I wish to become acquainted with the butterflies.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Mon, 24 Oct 2022 00:00:00 +0000</pubDate>
        <link>https://adityamorolia.github.io/blog/books</link>
        <guid isPermaLink="true">https://adityamorolia.github.io/blog/books</guid>
        
        <category>Books</category>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Quantum Singular Value Transformation</title>
        <description>&lt;p&gt;In this section we present a self contained overview of the technique of Quantum Singular Value Transformation (QSVT) presented in &lt;a href=&quot;https://arxiv.org/abs/1806.01838&quot;&gt;GSLW2019&lt;/a&gt;, generalizing Quantum Signal Processing (QSP). We refer the reader to an excellent paper &lt;a href=&quot;https://arxiv.org/abs/2105.02859&quot;&gt;Grand Unification of Quantum Algorithms&lt;/a&gt; for a more complete overview of these techniques. QSP is a quantum algorithm to apply a \(d\)-degree bounded polynomial transformation with parity \(d \mod 2\) to an arbitrary quantum subsystem, using a quantum circuit \(U_{\Phi}\) consisting of only controlled single qubit rotations. This is achieved by interleaving what is called a &lt;em&gt;signal rotation operator&lt;/em&gt; \(W\), which is an \(x\)-rotation by some fixed angle \(\theta\) and a &lt;em&gt;signal processing operator&lt;/em&gt; \(S_{\phi}\), which is an \(z\)-rotation by a variable angle parameterized by some \(\phi \in [0, 2 \pi]\). Note that the choice of \(x\) and \(z\) axes is conventional, and other equivalent constructions exist. Conventionally, the signal rotation operator is defined as&lt;/p&gt;

\[W(x) := \begin{pmatrix}
        x &amp;amp; i \sqrt{1 - x^2} \\
        i \sqrt{1 - x^2} &amp;amp; x
    \end{pmatrix},\]

&lt;p&gt;which is an \(x\)-rotation by an angle \(\theta = -2 \arccos(x)\), and the signal processing operator is defined as&lt;/p&gt;

\[S_{\phi} := e^{i \phi Z},\]

&lt;p&gt;which is a \(z\)-rotation by an angle \(- 2 \phi\). Fascinatingly, sandwiching them together for some \(\Phi := ( \phi_0, \phi_1, \ldots \phi_d ) \in \mathbb{R}^{d + 1}\), as shown above, gives us a matrix whose elements are polynomial transformations of \(x\),&lt;/p&gt;

\[U_{\Phi} := e^{i \phi_0 Z} \prod_{j = 1}^{j= d} \left(  W(x) e^{ i \phi_j Z } \right) \\
             = \begin{pmatrix}
        P(x) &amp;amp; i Q(x) \sqrt{1 - x^2} \\
        i Q^*(x) \sqrt{1 - x^2} &amp;amp; P^*(x)
    \end{pmatrix},\]

&lt;p&gt;such that&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;\(\deg P \leq d;\ \deg Q \leq d - 1\),&lt;/li&gt;
  &lt;li&gt;$P(x) $ has a parity $d \mod 2 $,&lt;/li&gt;
  &lt;li&gt;\(\| P(x) \|^2 + (1 - x^2) \| Q(x) \|^2 = 1 \quad \forall x \in [-1, 1]\).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Following the application of the quantum circuit $ U_{\Phi} $ for an appropriate \(\Phi\), one can project into the top left block of \(U_{\Phi}\) to recover the polynomial \(\bra{0} U_{\Phi} \ket{0} = P(x)\). Projecting to other basis allows the ability to perform more interesting polynomial transformations, which can be linear combinations of \(P(x), Q(x)\), and their complex conjugates. For example, projecting to \(\{ \ket{+}, \ket{-} \}\) basis gives us&lt;/p&gt;

\[\bra{+} U_{\Phi} \ket{+} = \real (P(x)) + i \real (Q(x)) \sqrt{1 - x^2} .\]

&lt;p&gt;This procedure can be naturally generalized to apply a similar polynomial transformation to each singular value of an arbitrary block of a unitary matrix. Suppose we have access to a matrix $ A $ which is block encoded into some unitary $ U_A $, and can be accessed by projectors $ \Pi, \widetilde{\Pi} $ as $ A := \widetilde{\Pi} U_A \Pi $. The singular value decomposition of $ A $ is given as&lt;/p&gt;

\[A := W \Sigma V^{\dagger} = \sum_j \sigma_j \ket{w_j} \bra{w_j},\]

&lt;p&gt;where $ W, V $ are unitary matrices, $ \Sigma $ is a diagonal matrix whose $j^{th}$ diagonal entry is $ \sigma_j $, the singular value of $ A $, and $ \ket{w_j}, \ket{v_j} $ are the corresponding singular vectors (the columns of $W$ and $V$ respectively.)
Then one can interleave $ U_A $ and $ U_A^{\dagger} $ with a \emph{projector controlled phase shift} operator, $ \Pi_{\phi} := e^{i \phi ( 2 \Pi - I )}, \widetilde{\Pi}_{\phi} := e^{i \phi ( 2 \widetilde{\Pi} - I )} $, for a parameter $ \phi $. For a given phase angle sequence $ \Phi \in \mathbb{R}^{d} $, the QSVT sequence is given as&lt;/p&gt;

\[U_{\Phi} = \begin{cases}
        \widetilde{\Pi}_{\phi_1} U_A \left[ \prod_{k = 1}^{(d - 1) / 2} \Pi_{\phi_{2k}} U_A^{\dagger} \widetilde{\Pi}_{\phi_{2 k + 1}} U_A \right] &amp;amp; d \text{ is odd } \\
        \left[ \prod_{k = 1}^{d/ 2} \Pi_{\phi_{2k - 1}} U_A^{\dagger} \widetilde{\Pi}_{\phi_{2 k}} U_A \right] &amp;amp; d \text{ is even},
    \end{cases}\]

&lt;p&gt;where $ \phi_i $ is the $i^{th}$ element of $ \Phi $. Now projecting to $ \Pi, \widetilde{\Pi} $ gives us the polynomial transformation of $ A $ as&lt;/p&gt;

\[P^{SV} (A) = \begin{cases}
        \widetilde{\Pi} U_{\Phi} \Pi &amp;amp; d \text{ is odd} \\
        \Pi U_{\Phi} \Pi &amp;amp; d \text{ is even},
    \end{cases}\]

&lt;p&gt;where $ P^{SV} (A) $ is the polynomial transformation of the matrix $ A $ defined as&lt;/p&gt;

\[P^{SV} (A) := \begin{cases}
        \sum_j P(\sigma_j) \ket{w_j} \bra{v_j} &amp;amp; P \text{ is odd} \\
        \sum_j P(\sigma_j) \ket{v_j} \bra{v_j} &amp;amp; P \text{ is even},
    \end{cases}\]

&lt;p&gt;This gives us an extremely powerful primitive to design novel quantum algorithms. In this work we use QSVT for matrix inversion and square root decomposition of a matrix. In the remainder of this section, we shall formally lay out the theorems for these transformations.&lt;/p&gt;

&lt;h5 id=&quot;acknowledgement&quot;&gt;Acknowledgement&lt;/h5&gt;

&lt;p&gt;I thank my advisor &lt;a href=&quot;https://sites.google.com/view/shchakra&quot;&gt;Shantanav Chakraborty&lt;/a&gt; and &lt;a href=&quot;https://anurudhp.github.io/&quot;&gt;Anurudh Peduri&lt;/a&gt; for useful discussions when I was reading these papers.&lt;/p&gt;

</description>
        <pubDate>Thu, 27 Jan 2022 00:00:00 +0000</pubDate>
        <link>https://adityamorolia.github.io/blog/qsvt</link>
        <guid isPermaLink="true">https://adityamorolia.github.io/blog/qsvt</guid>
        
        <category>Quantum Algorithms</category>
        
        <category>Quantum Computing</category>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Ranking and Rating Systems</title>
        <description>&lt;h1 id=&quot;ranking-and-rating-systems&quot;&gt;Ranking and Rating Systems&lt;/h1&gt;

&lt;p&gt;When you play an online multiplayer game, how does the system decide which opponent out of the opponent pool to match you with? When you play chess against an opponent and win, how does the system decide how much to change your respective ratings by? These are questions I never thought about until my internship at &lt;a href=&quot;https://www.aicrowd.com/&quot;&gt;AICrowd&lt;/a&gt;. It turns out these are really interesting problems with complex solutions and real world applications. The problem boils down to estimating the skill distribution of a population in a game, given their performance in some games. We may then the this estimate to match people in future games, or rank them in order of skills. There are various algorithms for this problem, like Elo and TrueSkill. I took an Independent Study on Monte Carlo Markov Chain Sampling last semester at the university. My motivation for exploring these further was to use MCMC techniques to give theoretical bounds on number of rounds of games necessary before the matching becomes ‘good enough’, by formulating the problem in terms of sampling from a markov chain. We can define ‘good enough’ in various ways. It turns out I didn’t end up tackling this problem in specific for various reasons, but I did learn a little about these topics throughout the remainder of the semester. Here I’ll write about some of these concepts, as well as about Elo and TrueSkill. Let’s define some terms first.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Skill: We can define some scale for a ‘skill’ measure, which would indicate a player’s skill in playing that game. For example, we can take $0$ to indicate a really poor player (beginner at a game), and \(500\) and above to be really good (expert) player. We assume that this is represented by some continuous distribution, like a gaussian.&lt;/li&gt;
  &lt;li&gt;Real Skill: This is the player’s real world skill, the skill with which his performance in a game would be determined. This is the skill we want to estimate in our problem.&lt;/li&gt;
  &lt;li&gt;Performance: This is a player’s skill in one particular game. This can be different from &lt;em&gt;real skill&lt;/em&gt; since there can be a variation to how well a player will perform in each game if he is playing multiple games simultaneously. (She could be tired, hungry or drunk.)&lt;/li&gt;
  &lt;li&gt;Estimated Skill: This is an estimate of &lt;em&gt;real skill&lt;/em&gt; that our algorithm will determine. We want this to be as close to &lt;em&gt;real skill&lt;/em&gt; as possible.&lt;/li&gt;
  &lt;li&gt;Round: Each round is one game or match. Two or more players compete, and the outcome is a binary variable determining the winner, or a draw.&lt;/li&gt;
  &lt;li&gt;Tournament: A collection of rounds will form a tournament.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;elo-rating-system&quot;&gt;Elo rating system&lt;/h2&gt;
&lt;p&gt;It is a method for calculating the relative skill levels of players in zero-sum games such as chess. It is named after its creator Arpad Elo. It is extensively used in games other than chess as well, with little modification.&lt;/p&gt;

&lt;p&gt;In Elo, the skill estimate is considered to be a whole number called the &lt;em&gt;Rating&lt;/em&gt;, and the values are updated as the outcomes of more and more games becomes available. Players’ ratings depend on the ratings of their opponents and the results scored against them. The difference in rating between two players determines an estimate for the expected score between them. Players with higher rating have a higher probability of winning a game than a player with lower rating. After each game, rating of players is updated. If a player with higher rating wins, only a few points are transferred from the lower rated player. However if lower rated player wins, then transferred points from a higher rated player are far greater.&lt;/p&gt;

&lt;p&gt;If players A and B have ratings \(R_A, R_B\), respectively, then their expected score \(E_A\) and \(E_B\) (the probability of winning) is given as follows:&lt;/p&gt;

\[E_A = \frac{1}{1 + 10^{\frac{R_B - R_A}{400}}} = \frac{Q_A}{Q_A + Q_B} \\
    E_B = \frac{1}{1 + 10^{\frac{R_A - R_B}{400}}} = \frac{Q_B}{Q_A + Q_B}\]

&lt;p&gt;where \(Q_i = 10^{\frac{R_i}{400}}\). The constants 10 and 400 are set such that that for each 400 rating points of advantage over the opponent, the expected score is magnified ten times in comparison to the opponent’s expected score. Now we can use this expected score or the winning probability to update the ratings of the players involved. A simple adjustment is given as follows.&lt;/p&gt;

\[R&apos;_A = R_A + K (S_A - E_A) \\
    R&apos;_B = R_B + K (S_B - E_B)\]

&lt;p&gt;Here, \(R&apos;_i\) is the new rating of the \(i^{th}\) player, \(S_i\) is the score of the \(i^{th}\) player, which can be binary (0-1) values, denoting a loss or a win, or it can be something else. The constant \(K\) here is the called the K-factor, and it denotes the maximum possible rating change in one game. This is because, the maximum difference between expected and actual score can be 1, changing the rating of the players involved by \(K\). We can also use different K-factors for players with varying experience on a platform (i.e., players whose ratings we are more confident on can have a lower K-factor than otherwise.)&lt;/p&gt;

&lt;p&gt;There are some drawbacks to Elo, such as it does not apply directly to team games, or games involving more than two players.&lt;/p&gt;

&lt;h2 id=&quot;trueskill&quot;&gt;Trueskill&lt;/h2&gt;
&lt;p&gt;TrueSkill is a model based approach to the match making problem, based on the assumption that the skill of a player is an uncertain quantity, and should be modelled using a probability distribution. We’ll try to understand this model here.&lt;/p&gt;

&lt;h3 id=&quot;assumptions&quot;&gt;Assumptions&lt;/h3&gt;
&lt;p&gt;As mentioned above, TrueSkill is a model based rating system. Here are the assumptions of the model:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Each player has a skill value, represented by a continuous variable with a broad Gaussian distribution.&lt;/li&gt;
  &lt;li&gt;Each player has a performance value for each game, which varies from game to game such that the average value is equal to the skill of that player. The variation in performance, which is the same for all players, is symmetrically distributed around the mean value and is more likely to be close to the mean than to be far from the mean.&lt;/li&gt;
  &lt;li&gt;The player with the higher performance value wins the game.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that the skill values are represented as probability distributions, we can use our knowledge of probabilistic graphical models to represent the random variable associated with performance, skill and the game outcomes as a factor graph, and use belief propagation on the graph to update skill values.&lt;/p&gt;

&lt;h3 id=&quot;modelling-the-outcomes-of-games&quot;&gt;Modelling the outcomes of games&lt;/h3&gt;
&lt;p&gt;Suppose we have two players, Fred and Jill. They have skills Fskill and Jskill respectively, and their performance is Fperf and Jperf, derived from their skill values. Suppose the Bernoulli variable Jwins denotes the winning or losing of Jill by taking the values true and false respectively. Then, the game can be represented using the following factor graph.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;./assets/reputation-and-ranking/model.png&quot; alt=&quot;Model&quot; title=&quot;Model&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here we have assumed that the skill of Jill and Fred are represented by Gaussian distributions with means 120 and 100, and variances \(40^2, 5^2\) respectively. A higher variance captures a lower confidence in the estimated skill of a player, and vice versa. The mean for the performance of both players is derived by sampling from the skill distributions, and the variance is a constant \(5^2\). Then, the value of Jwins is given by a simple max function (\(&amp;gt;\) operation).&lt;/p&gt;

&lt;p&gt;This model captures the uncertainty in the performance of players, say because of a down day or a bad luck, and also captures the under-confidence in the estimated skills for new players. There is a chance that with some probability, the performance of a player with the higher skill might be lower in a game.&lt;/p&gt;

&lt;p&gt;Now if we are given the skill values, we can use the factor graph to find the probabilistic outcome of the game. Or the other way round, given the outcome of a game, we can run inference in order to compute the marginal posterior distributions of the skill variables Jskill and Fskill.&lt;/p&gt;

&lt;h3 id=&quot;using-belief-propagation-to-update-skills&quot;&gt;Using belief propagation to update skills&lt;/h3&gt;
&lt;p&gt;Since the graph has a tree structure, we can use belief propagation to solve this problem.&lt;/p&gt;

&lt;p&gt;As in the reference, we can take an example to understand this. Suppose Jwins is true, and we want to evaluate the posterior distribution for Jskill. The following figure gives an overview of which messages that need to be evaluated.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;./assets/reputation-and-ranking/messages.png&quot; alt=&quot;Messages&quot; title=&quot;Messages&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Message (1) is just given by the Gaussian factor itself. Similarly, message (2) is just the product of all incoming messages on other edges of the Fskill node, and since there is only one incoming message this is just copied to the output message. To compute message (3), the belief propagation algorithm tells us to multiply the incoming message (2) by the Gaussian factor and then sum over the variable Fskill. Using convolution, this comes out to be Gaussian(100, \(5^2+5^2\)). Message (4) is just a copy of message (3) as there is only one incoming message to the Fperf node. Message (5) is just a Bernoulli point mass at the value true. Continuing with the algorithm, the final outcome is summarised in the following figure.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;./assets/reputation-and-ranking/messages_2.png&quot; alt=&quot;Messages_2&quot; title=&quot;Messages 2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The marginal distribution of Jskill is obtained by multiplying messages (8) and (9). Because this is the product of a Gaussian and a cumulative Gaussian the result is an asymmetrical distribution, which is not a Gaussian. This is the posterior distribution for Jskill. We can also pass messages in the opposite direction around the graph to obtain the corresponding posterior distribution for Fskill.&lt;/p&gt;

&lt;h3 id=&quot;extending-to-multiple-players--expectation-propagation&quot;&gt;Extending to multiple players – expectation propagation&lt;/h3&gt;
&lt;p&gt;We have seen how to exactly find posterior distributions for the distributions representing skills of the two players. We can easily extend this to other players, by adding the other games in the same graph, and running belief propagation on the bigger graph one by one. But there is a problem with doing this. Initially, Jskill was a 2 parameter gaussian distribution. After running belief propagation once, we get a distribution which is a product of a gaussian and a cumulative gaussian, and hence has 4 parameters. If we now run belief propagation on a game with another player, we will get another distribution with two cumulative distributions and six parameters.&lt;/p&gt;

&lt;p&gt;To get around this problem, we use expectation propagation. We approximate the non-gaussian distributions locally with a gaussian distribution, and we do it in the following manner.&lt;/p&gt;

&lt;p&gt;We want to approximate message (6), the cumulative gaussian distribution using a gaussian so as to maximize the accuracy of the marginal distribution of Jperf. We could just replace the Cumulative Gaussian function with a gaussian with the same mean and variance, but that is not possible since the mean and variance of the cumulative gaussian functions are undefined (as \(x \rightarrow \infty\), value of the cumulative gaussian function approaches 1.) We get around this problem by using a ‘context’, which is the downward message on the same edge as the message (6). Let \(e\) denote the exact message (6), \(c\) denote the downward ‘context’ message, and \(g\) denote our desired Gaussian approximation to message \(e\). We use&lt;/p&gt;

\[cg = Proj(ce)\]

&lt;p&gt;where Proj() is the projection, and represents the process of replacing a non-gaussian distribution with a Gaussian having the same mean and variance. This can be viewed as projecting the exact message onto the ‘nearest’ message within the family of Gaussian distributions. We can now compute \(g\) exactly. This is because the product \(ce\) gives a distribution with finite mean and variance.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;./assets/reputation-and-ranking/proj.png&quot; alt=&quot;Projection&quot; title=&quot;Projection&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This approach of using an incoming message to provide the context in which to approximate the corresponding outgoing message is known as expectation propagation (or EP). With this technique, we can always locally approximate the non-gaussian messages by a gaussian. And we also know that the product of two gaussian distribution is a gaussian. Hence, we now have a posterior distribution which is also a gaussian with 2 parameters, thus is of the same form as the prior. Therefore, we can now easily run the algorithm multiple times without blowing up the parameters in our distribution.&lt;/p&gt;

&lt;p&gt;The beauty of this model is that now we can easily add more players to the graph and extend it to work for team games, multi player games, and also handle draws.&lt;/p&gt;

&lt;h5 id=&quot;acknowledgement&quot;&gt;Acknowledgement&lt;/h5&gt;

&lt;p&gt;I thank my friend &lt;a href=&quot;https://cathreya.github.io/&quot;&gt;Athreya Chandramouli&lt;/a&gt; for spending hours with me on calls where we tried to understand these topics.&lt;/p&gt;

</description>
        <pubDate>Sun, 23 Jan 2022 00:00:00 +0000</pubDate>
        <link>https://adityamorolia.github.io/blog/reputation-and-ranking</link>
        <guid isPermaLink="true">https://adityamorolia.github.io/blog/reputation-and-ranking</guid>
        
        <category>Algorithms</category>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Exporting Tex Elements As Images Using Python.</title>
        <description>&lt;p&gt;Today while writing a blog post on &lt;a href=&quot;https://thecharmingsociopath.github.io/blog/swap-gate&quot;&gt;a quantum circuit trick&lt;/a&gt;, I needed to create some quantum circuit diagrams. First I thought of using Qiskit or Cirq for it, but the overhead to install and setup them didn’t seem worth it. So I tried Tikz, and a Tex package called &lt;a href=&quot;https://www.ctan.org/tex-archive/graphics/qcircuit&quot;&gt;Qcircuit.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I wanted to export the circuit created using Qcircuit as images, and it took a while to figure out an optimal way to do it. I decided to write it here since this method is very versatile and can be used to export tables, tikz images, and a lot more.&lt;/p&gt;

&lt;h5 id=&quot;note-commands-here-are-for-arch-you-can-use-apt-for-debian-distros&quot;&gt;Note: Commands here are for Arch. You can use apt for debian distros.&lt;/h5&gt;

&lt;p&gt;You need to have tex installed in your system. Packages I use are&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;pacman &lt;span class=&quot;nt&quot;&gt;-S&lt;/span&gt; texlive-most texlive-core texlive-science texlive-latexextra texlive-bibtexextra texlive-publishers texlive-pictures
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Some of these will be useless for you so check with documentation before installing to avoid polluting your system.&lt;/p&gt;

&lt;p&gt;You need a python packages &lt;a href=&quot;https://pypi.org/project/latextools/&quot;&gt;latextools&lt;/a&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;drawsvg&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;latextools drawsvg
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pdf2svg&lt;/code&gt; to convert the generated pdf to svg, which can then be converted to png, etc.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yay &lt;span class=&quot;nt&quot;&gt;-S&lt;/span&gt; pdf2svg
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You need to install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Qcircuit&lt;/code&gt; from CTAN. Create a path &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$HOME/texmf/tex/latex/qcircuit&lt;/code&gt;. Then download the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.sty&lt;/code&gt; file into that location.
You can figure out above path using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kpsewhich -var-value TEXMFHOME&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now you can use latextools to export a latex snippet as an image. Here is a short snippet.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;latextools&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;pdf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;latextools&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;render_qcircuit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&apos;&apos;
         \push{\ket{a}} &amp;amp; \ctrl{1} &amp;amp; \targ &amp;amp; \ctrl{1} &amp;amp; \qw &amp;amp; \push{\ket{b}} \\
         \push{\ket{b}} &amp;amp; \targ &amp;amp; \ctrl{-1} &amp;amp; \targ &amp;amp; \qw &amp;amp; \push{\ket{a}} \\
        &apos;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;pdf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;swap-using-cnot.pdf&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;pdf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rasterize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;swap-using-cnot.png&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;latextools&lt;/code&gt; documentation lists more examples.&lt;/p&gt;

</description>
        <pubDate>Sat, 22 Jan 2022 00:00:00 +0000</pubDate>
        <link>https://adityamorolia.github.io/blog/tex-to-images</link>
        <guid isPermaLink="true">https://adityamorolia.github.io/blog/tex-to-images</guid>
        
        <category>Tex</category>
        
        <category>Scripting</category>
        
        <category>Workflow</category>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>SWAP Using CNOT is swapping memory without memory overhead.</title>
        <description>&lt;h4 id=&quot;introduction&quot;&gt;Introduction&lt;/h4&gt;

&lt;p&gt;It is a standard exercise in quantum computing textbooks to construct a SWAP gate using CNOT gates as elementary building blocks.&lt;/p&gt;

&lt;p&gt;Did you know that this construction is basically the classical algorithm we use all the time that swaps two memory locations without using any additional memory? I was talking to a few friends recently and was surprised they had never made this connection. So I’m writing this up.&lt;/p&gt;

&lt;h4 id=&quot;swap-and-cnot-gates&quot;&gt;SWAP and CNOT gates&lt;/h4&gt;

&lt;p&gt;In quantum computing, a SWAP gate is used to swap the contents of two quantum registers. Its circuit diagram is as shown.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;./assets/swap-gates/swap.png&quot; alt=&quot;Swap Gate&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A CNOT gate, which is a controlled-NOT gate, applies the not gate to the second (target) qubit if the first (control) qubit is set to one. Its action is as follows.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;./assets/swap-gates/cnot.png&quot; alt=&quot;CNOT Gate&quot; /&gt;&lt;/p&gt;

&lt;p&gt;where \(\oplus\) is the classical XOR operation.&lt;/p&gt;

&lt;p&gt;A SWAP gate can be constructed using 3 CNOT gates as follows.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;./assets/swap-gates/swap-using-cnot.png&quot; alt=&quot;Swap Gates Using 3 CNOT Gates&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;swapping-two-classical-memory-locations-without-using-additional-memory&quot;&gt;Swapping two classical memory locations without using additional memory.&lt;/h4&gt;

&lt;p&gt;Given two memory locations \(a\) and \(b\), how do you swap their contents without using a third container? You can simply do the following,&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;a = a ^ b
b = b ^ a
a = a ^ b
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;^&lt;/code&gt; is the classical XOR operation. You can verify that following this, the contents of \(a\) and \(b\) will be swapped.&lt;/p&gt;

&lt;h4 id=&quot;theyre-equivalent-procedures&quot;&gt;They’re equivalent procedures&lt;/h4&gt;

&lt;p&gt;Now let’s write down what the SWAP gate circuit is doing mathematically.&lt;/p&gt;

\[\ket{a, b} \xmapsto{CNOT_{1, 2}} \ket{a, a \oplus b} \xmapsto{CNOT_{2, 1}} \ket{a \oplus (a \oplus b), a \oplus b} = \ket{ b, a \oplus b } \xmapsto{CNOT_{1, 2}} \ket{ b, (a \oplus b) \oplus b } = \ket{ b, a }\]

&lt;p&gt;Notice how these operations are the same as that in the code snippet above? That’s right.&lt;/p&gt;

&lt;p&gt;Ciao!&lt;/p&gt;

</description>
        <pubDate>Sat, 22 Jan 2022 00:00:00 +0000</pubDate>
        <link>https://adityamorolia.github.io/blog/swap-gate</link>
        <guid isPermaLink="true">https://adityamorolia.github.io/blog/swap-gate</guid>
        
        <category>Quantum Computing</category>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>The Algebra Conundrum</title>
        <description>&lt;p&gt;I was reading a paper which mentioned &lt;em&gt;We may view [a specific] ring as an algebra over the real or over the complex numbers&lt;/em&gt;, and I realised I did not know formally what an &lt;em&gt;Algebra&lt;/em&gt; was. So thought I’ll clear it up for myself. Turns out the word is a bit overused.&lt;/p&gt;

&lt;h4 id=&quot;algebraic-structures&quot;&gt;Algebraic Structures&lt;/h4&gt;

&lt;blockquote&gt;
  &lt;p&gt;An Algebraic Structure is a set \(A\), along with some operations (functions) on \(A\) of finite arity and a finite set of axioms that the operations must satisfy.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Examples of algebraic structures are structures of types Groups, Rings, Lattices, Modules and [wait for it…] Algebras.&lt;/p&gt;

&lt;h4 id=&quot;algebra-over-a-field&quot;&gt;Algebra over a field&lt;/h4&gt;

&lt;p&gt;That last type of Algebraic Structure, known as an &lt;em&gt;Algebra&lt;/em&gt; is an Algebra over a field (which, it turns out, the paper I was reading actually meant). It is defined as follows:&lt;/p&gt;

&lt;p&gt;Let \(\mathcal{F}\) be a field and let \(A\) be a vector space over \(\mathcal{F}\) along with a binary operation \(\cdot : A \times A \to A\). \(A\) is an algebra over \(\mathcal{F}\) if \(\forall x, y, z \in A, \forall a,b \in \mathcal{F}\),&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Right Distributivity of \(\cdot\) –  \((x + y) \cdot z = x \cdot z + y \cdot z\)&lt;/li&gt;
  &lt;li&gt;Left Distributivity of \(\cdot\) –   \(z \cdot (x + y) = z \cdot x + z \cdot y\)&lt;/li&gt;
  &lt;li&gt;Compatibility with Scalars –    \((ax)\cdot (by) = (ab)(x \cdot y)\)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The above three axioms basically mean that the binary operation \(\cdot\) is bilinear.&lt;/p&gt;

&lt;p&gt;It turns out these aren’t the only contexts in which the term is used. Here is a text snippet from Wikipedia:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The properties of specific algebraic structures are studied in &lt;em&gt;abstract algebra&lt;/em&gt;. The general theory of algebraic structures has been formalized in &lt;em&gt;universal algebra&lt;/em&gt;. The language of &lt;em&gt;category theory&lt;/em&gt; is used to express and study relationships between different classes of algebraic and non-algebraic objects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Mathematicians are clearly great at naming things. And confusing me.&lt;/p&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Algebraic_structure&quot;&gt;Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
        <pubDate>Tue, 17 Aug 2021 00:00:00 +0000</pubDate>
        <link>https://adityamorolia.github.io/blog/algebra-conundrum</link>
        <guid isPermaLink="true">https://adityamorolia.github.io/blog/algebra-conundrum</guid>
        
        <category>Math</category>
        
        <category>TIL</category>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>The most bizarre news I’ve read in a while</title>
        <description>&lt;p&gt;Sometime last year I had stopped reading the news and other publications about the national politics and quit a good chuck of social media to keep my sanity intact for a little longer. I still read some curated content once in a while to be up to date with what’s happening around. Then recently I came across the news that &lt;a href=&quot;https://nerdist.com/article/invisible-sculpture-salvatore-garau-sold-18000-dollars/&quot;&gt;an Italian artist sold an invisible sculpture titled ‘I am’ for $18,000.&lt;/a&gt; What a neat way to make money. Maybe he’s just selling the idea that anything is art. Even the idea of nothing. The set of all sets includes the null set. The absence of something has to be a thing, just as the presence of something else. And without the idea of nothing, will the idea of something be well defined? The artist would probably say no. Either that, or the buyer probably just bought the world’s most expensive paper.&lt;/p&gt;

&lt;p&gt;PS: An interesting video by Vox on &lt;a href=&quot;https://youtu.be/9aGRHOpMRUg&quot;&gt;Why are some completely white paintings in the museum.&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Thu, 03 Jun 2021 00:00:00 +0000</pubDate>
        <link>https://adityamorolia.github.io/blog/italian-artist-sells-invisible-sculpture</link>
        <guid isPermaLink="true">https://adityamorolia.github.io/blog/italian-artist-sells-invisible-sculpture</guid>
        
        <category>Random</category>
        
        <category>Commentary</category>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Goodbye Undergrad. Hello Blog.</title>
        <description>&lt;p&gt;Last week I finished the eighth and final semester of my undergrad, from my room at home 1260km from college over a shitty internet connection. No JC, DLF, Tawa Bonda, C8 — these are terms my IIIT peers would be familiar with — I celebrated with a good night’s sleep. I still have another year at IIIT to finish my masters , and to some institutions I’m still an undergrad. But I am done with my engineering. I guess I’m an engineer now. But don’t ask me to fix your phone — I’ll probably just delete your WhatsApp and Facebook and hope that does the job.&lt;/p&gt;

&lt;p&gt;I took the week to relax, watch Invincible, play DnD and start reading again — &lt;em&gt;The Plague, by Albert Camus&lt;/em&gt;. Now that I have some time, I decided to finally start writing this blog. This is something that I’ve been wanting to do for a long time, but kept procrastinating on.&lt;/p&gt;

&lt;p&gt;Rather than a pedagogical discourse, this is more of an effort to organize my thoughts and resources and to connect with people who might be interested in similar subjects — feel free to hit me up! I have been whimsically writing since I was in school, for the school and college magazine, or for myself, journaling on and off in my diary, writing stories, poems, etc. At one point in life I even considered writing as a career path. But Computer Science and Theoretical Physics charmed me away.&lt;/p&gt;

&lt;p&gt;I do prefer a pen and a paper to typing. It’s less distracting, thoughts seem to flow more easily, and it’s a lot more privacy friendly. But I’m inclined to give in to this tradition for a while and see where it takes me. It’s definitely better than posting on social media, where I might have to switch through 10 different platforms over the years, trying to keep up with the latest trends while losing the content and  paying with data all along the way.&lt;/p&gt;

&lt;p&gt;I’ll try to write fairly regularly from now on, mostly about what I work on or read — and as a bonus I might also dump random facts or resources I discover every now and then. What you might expect to find here: Quantum Computing, Complexity Theory, Theoretical Physics, life updates, book recommendations and reviews, and more. So keep checking back in to see what’s up! Or better yet, add the RSS link to your preferred aggregator— I use and love &lt;a href=&quot;https://www.feedly.com/&quot;&gt;Feedly&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Mon, 24 May 2021 00:00:00 +0000</pubDate>
        <link>https://adityamorolia.github.io/blog/helloworld</link>
        <guid isPermaLink="true">https://adityamorolia.github.io/blog/helloworld</guid>
        
        <category>Life Update</category>
        
        
        <category>blog</category>
        
      </item>
    
  </channel>
</rss>
