# Quantum Scissor from Exact Generalized Photon Number Statistics

Abdul Q Batin  Suranjana Ghosh  Prasanta K. Panigrahi  Centre for Quantum
Science and Technology (CQST), Siksha ‘O’ Anusandhan Deemed to be University,
Khandagiri Square, Bhubaneswar-751030, Odisha, India  Utpal Roy
<EMAIL_ADDRESS>
###### Abstract

We report the close form expressions of the photon number statistics for a
generalized coherent state and a generalized photon-added coherent state,
which are shown to be crucial for proposing a variety of quantum scissor
operations. The analytically obtained distributions are also capable of
predicting the precise laser intensity windows for realizing a variety of
quantum scissors. Truncating a photon added state overcomes the selection rule
of obtaining the lower order Fock states. Photon addition also enables us to
obtain a higher order Fock state in a lower order superposition. The
importance of circular geometry is also demonstrated for engineering such
quantum scissors.

###### keywords:

Generalized coherent state, Generalized photon-added coherent state, Fock
state

## Introduction

In 1926, Erwin Schrödinger first introduced the concept of coherent state (CS)
through a non-spreading wavepacket of harmonic oscillator. The state is the
most classical state in quantum domain, having Poisson photon number
statistics, where the average photon number is directly correlated to the
absolute square of the CS parameter, $\alpha$. Though CS behaves classically,
the quantum supremacy can be accomplished by quantum superposition,
entanglement, squeezing, photon anti-bunching, negativity of Wigner
distribution, _etc_ [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. Such quantum featured
states are paid huge attention for their breakthrough contributions in diverse
fields and possible technological implications [11, 12, 13, 14, 15, 16, 17,
18]. In addition, quantum entanglement and teleportation [19, 20, 21, 22, 23],
nonlinear dynamics of coherent field [24, 25], quantum sensing and metrology
[26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37] are the subjects of some of
the recent emphasizes.

Often, the nonlocal superposition of two CSs, called Schrödinger cat state
(SCS), sets the building block of the quantum information protocols [38, 39,
40, 41]. Several experimental schemes exist to create higher order mesoscopic
superposition state in experiments [42, 43, 44, 45, 46, 47, 48, 49, 50, 51].
Unlike a CS, a photon added coherent state (PACS), introduced by Agarwal and
Tara, is non-Gaussian and manifests nonclassical nature [52]. Their
experimental generations have been reported [53, 54, 55, 56, 57, 58] and
nonclassical behaviours are thoroughly investigated [59, 60, 61, 47]. PACS is
also shown to be a favourable candidate for technological aspects like quantum
sensing [62], quantum key distribution [63] _etc_.

In this paper, we analytically derive a close form expressions of the photon
number distribution (PND) functions for a generalized-CS (GCS) and a
generalized-PACS (GPACS). Apart from the extensive merit of this PND in
quantum optics, here we use the PND for truncating the quantum states, termed
as quantum scissors, as proposed by Pegg et al. [64]. Quantum Scissors have
found enormous importance in the literature and various experimental schemes
for quantum state truncation are also in place [65, 66, 67, 68, 69, 70, 71,
72]. In this case, the said truncation can be achieved based on the knowledge
of the reported photon distributions. It is well-known to have the photon
distribution of a CS as Poissonian. However, a superpositions of CSs are non-
Gaussian and quantum, having super- or sub-Poisson-distribution. Here, we show
that, the envelop of the obtained photon distribution takes the form of a
Poissonian and this is valid for any order ($N$) of superposition, making it a
universal feature of the state to decide upon the parameter domains for
various quantum scissors. The scissor operation is demonstrated for obtaining
vacuum state, other Fock states, equal superposition of Fock states, and
mesoscopic quantum superposition states. Such crucial prediction is not
possible without the exact knowledge of the parameter restriction, imposed by
the reported photon statistics. Regarding truncating to a Fock state from a
GCS, the intriguing fact being, not to get a Fock state below a certain
$|n\rangle$, denoted by $|n_{c}\rangle$, whatsoever be the value of $N$. In
addition, experimental generation of the Fock state $|n(>n_{c})\rangle$ will
only be possible for a specific range of $\alpha$ ($=\triangle\alpha$).

In addition to the quantum scissor operation for a GCS, we also demonstrate
the scissor operations for a GPACS. Interestingly, GPACS allows generation of
Fock states with $|n(<n_{c})\rangle$, which is not possible for GCS. Moreover,
a $r$-photon added GPACS is capable of generating a particular Fock state from
a relatively lower order superposition. However, this reduction is allowed
only above a certain order of superposition, which is $N=6$, the hexagonal
state, also known as benzene-like state [28]. We also demonstrate the
production of equal Fock states superposition and identify the precise allowed
parameter domains for the above quantum states (but not limited to). Moreover,
we prove that the primary requirement of these comprehensive outcomes relies
on the merit of symmetrical circular arrangement, a slight deviation of which
(as illustrated by an elliptic state) will significantly aggravate the scissor
operations.

The paper is organized as follows. In the next section, we present the
analytical derivation of the modulated photon distribution for a GCS, which is
extended for a GPACS in Sec.III. In Sec.IV, a couple of examples of the
quantum scissor operations are demonstrated. Precise parameter domains are
identified for each generation in Sec.V. A deviation from the circular
geometry is adopted in elliptic form in Sec.VI. We conclude in Sec.VII with
the summary of outcomes and possible future directions.

## Analytical Derivation of the PND for a GCS

A single coherent state is known to exhibit Poissonian photon distribution,
where consecutive energy levels contribute, which is not the case for GCS. We
will start by writing the general form of a GCS by [73]

$\displaystyle|\psi\big{\rangle}=\mathcal{N}\frac{1}{\sqrt{N}}\sum_{j=1}^{N}|\alpha
e^{\frac{i2\pi j}{N}}\big{\rangle},$ (1)

where the normalization constant, $\mathcal{N}$, is expressed as

$\displaystyle\mathcal{N}=\sqrt{N}\left[\sum_{j_{1},j_{2}=1}^{N}exp\left(\alpha_{j_{1}}\alpha^{\ast}_{j_{2}}-|\alpha|^{2}\right)\right]^{-\frac{1}{2}},$
(2)

where $\alpha_{j}=|\alpha|e^{\frac{i2\pi j}{N}}$. This constant $\mathcal{N}$
is for a GCS, which goes to unity for a CS and for $j_{1}=j_{2}$. This also
provides the analytical expressions of the normalization constants for the
quantum superposition states of lower orders [74, 75]. We intend to derive a
close form expression of the photon number distribution (PND) for the above
state and the probability of the $n$-th state ($P_{n}$) becomes

$\displaystyle P_{n}$ $\displaystyle=|\big{\langle}n|\psi\rangle|^{2}$
$\displaystyle=\frac{|\mathcal{N}|^{2}}{N}e^{-|\alpha|^{2}}\frac{|\alpha|^{2n}}{n!}\sum_{j_{1},j_{2}=1}^{N}e^{\frac{i2\pi
n(j_{1}-j_{2})}{N}}$
$\displaystyle=\frac{|\mathcal{N}|^{2}}{N}e^{-|\alpha|^{2}}\frac{|\alpha|^{2n}}{n!}\left[N+\sum_{j_{1},j_{2}(\neq
j_{1})=1}^{N}e^{\frac{i2\pi n(j_{1}-j_{2})}{N}}\right].$

Here, the diagonal terms are taken out from the summation and then, the term
inside summation is converted into trigonometric function:

$\displaystyle
P_{n}\\!=\\!\frac{|\mathcal{N}|^{2}}{N}e^{-|\alpha|^{2}}\frac{|\alpha|^{2n}}{n!}\\!\\!\left[N\\!+\\!2\\!\\!\\!\\!\\!\\!\sum_{j_{1},j_{2}(>j_{1})=1,2}^{N-1,N}\\!\\!\\!\\!\\!\cos{\frac{2\pi
n(j_{1}-j_{2})}{N}}\right].$

The above equation can be simplified for single summation index,
$m=|j_{1}-j_{2}|=1,\;2,\;3,\;.....,\;(N-1)$ as

$\displaystyle
P_{n}=\frac{|\mathcal{N}|^{2}}{N}e^{-|\alpha|^{2}}\frac{|\alpha|^{2n}}{n!}\left[N+2\sum_{m=1}^{N-1}(N-m)\cos{\frac{2\pi
nm}{N}}\right].$ (3)

For arriving at a definite expression of $P_{n}$, the term inside the square
bracket needs to be simplified further. It involves the trigonometric
summations in the forms, $\sum_{m=1}^{N-1}\cos{mx}$ and
$\sum_{m=1}^{N-1}m\cos{mx}$, where $x=2\pi n/N$. These can be converted to a
term without summation by using the identities from the book by I. S.
Gradshteyn and I. M. Ryzhik (sec. $1.342$) [76]. After a straight-forward
simplification, the square bracketed term of Eq.(3) takes the form,
$\left[\sin(n\pi)/\sin\Big{(}\frac{n\pi}{N}\Big{)}\right]^{2}$, which enables
us to write PND in a much simpler form:

$\displaystyle
P_{n}=\frac{|\mathcal{N}|^{2}}{N}e^{-|\alpha|^{2}}\frac{|\alpha|^{2n}}{n!}\left[\frac{\sin(n\pi)}{\sin\Big{(}\frac{n\pi}{N}\Big{)}}\right]^{2}.$
(4)

It is worth noticing that, the numerator vanishes ($\sin(n\pi)=0$) for all
$n$. This may give an impression that, PND vanishes for all energy levels,
which is neither physically, nor mathematically justified. The reason being
the value of the denominator, _i.e._ , $\sin(\frac{n\pi}{N})$, which becomes
zero for the levels, $n=S\times N$. Thus, we obtain two parameter domains:
I. For $n\neq S\times N$, PND will simply vanish for all $n$ , where
$\sin(n\pi)=0$, but $\sin(\frac{n\pi}{N})\neq 0$.
II For $n=S\times N$, both the numerator and the denominator become zero,
making the PND into a (zero/zero) form or indeterminate form.
In such situation, the L’H$\hat{o}$pital’s rule is used to find out the value
of the function at those point, given by $n=S\times N$. According to the
L’H$\hat{o}$pital’s rule, if f(y) and g(y) are both differentiable at $y=a$,
and also the function, $\emph{f(y)}/\emph{g(y)}$ at $y=a$ takes a
($zero/zero$) form, then the value of the function at $y=a$ can be evaluated
by taking the derivatives, such that

$\displaystyle\lim_{y\to a}\frac{f(y)}{g(y)}=\lim_{y\to
a}\frac{f^{\prime}(y)}{g^{\prime}(y)}=\frac{f^{\prime}(a)}{g^{\prime}(a)}.$
(5)

This is applied in Eq. (4) for $y=n$ and $a=SN$. The value of the function at
$n=SN$ becomes

$\displaystyle\lim_{n\to SN}\frac{\sin{n\pi}}{\sin{\frac{n\pi}{N}}}$
$\displaystyle=\lim_{n\to
SN}\left[\frac{\pi\cos{(n\pi)}}{(\frac{\pi}{N})\cos(\frac{n\pi}{N})}\right]$
(6) $\displaystyle=N.$

This facilitates us to write the final form of the PND in a simple algebraic
form involving $\alpha$ without a trigonometric functional:

$\displaystyle P_{n}=$
$\displaystyle|\mathcal{N}|^{2}Ne^{-|\alpha|^{2}}\frac{|\alpha|^{2n}}{n!},$
for $n=SN$ $\displaystyle P_{n}=$ $\displaystyle P_{n}=$ $\displaystyle 0,$
for $n\neq SN$ (7)

This is one of the main analytical results of the paper, where a close-form
expression is obtained for the PND of a GCS. It is fascinating to observe
that, the Poisson envelop is globally maintained, having contributions from
the levels, $n=0,\;N,\;2N,\;3N,\;...$. We have also studied the variance of
the state _w.r.t._ the mean through the Fano factor [75] analysis, where the
Fano factor is defined as $\langle(\Delta n)^{2}\rangle/\langle n\rangle$.
Fano factor for higher $\alpha$ oscillates with $\alpha$ between sub- and
super-Poissonian statistics. However, the sub-Poissonian nature becomes more
probable for higher order mesoscopic superposition states.

## Analytical Derivation of the PND for a GPACS

We are going to focus on the properties of GPACS, which is produced by adding
$r$ photons to each constituent state. Different protocols exist for realizing
photon addition to a CS [53, 56, 57]. The general formalism is described by a
GPACS, which takes the form

$\displaystyle|\psi,r\big{\rangle}=\frac{\mathcal{N}_{pa}}{\sqrt{N}}\sum_{j=1}^{N}|\alpha
e^{\frac{i2\pi
j}{N}},r\big{\rangle}=\frac{\mathcal{N}_{pa}}{\sqrt{N}}(a^{\dagger})^{r}\sum_{j=1}^{N}|\alpha
e^{\frac{i2\pi j}{N}}\big{\rangle}.$ (8)

The normalization constant $|\mathcal{N}_{pa}|$ is defined by

$\displaystyle|\mathcal{N}_{pa}|=\left[\frac{r!}{N}\sum_{j,k=1}^{N}L_{r}\left(-\alpha_{j}\alpha^{\ast}_{k}\right)exp(-|\alpha|^{2}+\alpha_{j}\alpha^{\ast}_{k})\right]^{\frac{-1}{2}},$

where $\alpha_{j}=|\alpha|e^{\frac{i2\pi j}{N}}$,
$\alpha^{\ast}_{k}=|\alpha|e^{\frac{-i2\pi k}{N}}$ and
$L_{r}\left(-\alpha_{j}\alpha^{\ast}_{k}\right)$ being the Laguerre polynomial
of order $r$. We expand the coherent state into the Fock basis and operate the
raising operator $(a^{\dagger})^{r}$. The photon distribution is obtained by
finding the contribution of the $n$-th level.

Figure 1:  a) PND of GCS with fixed $|\alpha|=4$ for a coherent state (dark
circle), a Schödinger cat with $N=2$ (star), $N=3$ (square), Compass state
with $N=4$ (diamond), $N=5$ (empty circle) and for $N=8$ (triangle). All the
finite probabilities for getting photons lie on the Poissonian curves (dashed
lines). b) PND of the quantum state with $N=6$ for varying $\alpha$:
$|\alpha|=1$ (dot), $2.45$ (short dash), $3.0$ (dot-dash-dot), $3.46$ (larger
dash), and $4.24$ (dot-dash).

We adopt similar derivation as the case of GCS and arrive at the final
expression of PND for GPACS as

$\displaystyle P_{n}^{r}=$
$\displaystyle|\mathcal{N}_{pa}|^{2}Ne^{-|\alpha|^{2}}\frac{{|\alpha|^{2(n-r)}}{n!}}{[(n-r)!]^{2}},$
for $n=SN+r$ $\displaystyle P_{n}^{r}=$ $\displaystyle P_{n}^{r}=$
$\displaystyle 0,$ for $n\neq SN+r$ (9)

Here, $S$ is a non-negative integer. The final expression of the PND is
physically constituted by the contributions from $N+r,\;2N+r\;...$ levels.
Moreover, the PND of a GPACS gradually deviates from the Poisson envelop
($r=0$) with the addition of photons to the constituent states. The effect of
photon addition on the variance of the state _w.r.t._ the mean is also studied
through the Fano factor. With increasing $\alpha$, it rises from zero and
oscillates around unity. In this case, the sub-Poissonian nature becomes more
pronounced for higher order mesoscopic superposition states and larger number
of photon addition.

Fock state | GCS ($N$) | GPACS ($N$) | Elliptical geometry
---|---|---|---
$|n\big{\rangle}$ |  |  | (Both GCS and GPACS)
$|0\big{\rangle}$ |  All $N$ |  All $N$ for $r=0$ |  Null
$|1\big{\rangle}$ |  Null |  All $N$ for $r=1$ |  Null
$|2\big{\rangle}$ |  Null |  All $N$ for $r=2$ |  Null
$|3\big{\rangle}$ |  Null |  All $N$ for $r=3$ |  Null
$|4\big{\rangle}$ |  Null |  All $N$ for $r=4$ |  Null
$|5\big{\rangle}$ |  Null |  All $N$ for $r=5$ |  Null
$|6\big{\rangle}$ |  Null |  All $N$ for $r=6$ |  Null
$|7\big{\rangle}$ |  Null |  All $N$ for $r=7$ |  Null
$|8\big{\rangle}$ |  Null |  All $N$ for $r=8$ |  Null
$|9\big{\rangle}$ |  Null |  All $N$ for $r=9$ |  Null
$|10\big{\rangle}$ |  10 |  $N=9$ to $6$; $r=1$ to $4$ |  Null
$|11\big{\rangle}$ |  11 |  $N=10$ to $6$; $r=1$ to $5$ |  Null
$|12\big{\rangle}$ |  12 |  $N=10$ to $6$; $r=2$ to $6$ |  Null
$|13\big{\rangle}$ |  13 |  $N=12$ to $6$; $r=1$ to $7$ |  Null
$|14\big{\rangle}$ |  14 |  $N=13$ to $6$; $r=1$ to $8$ |  Null
$|15\big{\rangle}$ |  15 |  $N=14$ to $6$; $r=1$ to $9$ |  Null
$|16\big{\rangle}$ |  16 |  $N=15$ to $6$; $r=1$ to $10$ |  Null
Table 1: Production of the Fock states by superposing $N$-CSs and $N$-PACSs in
circular and elliptic geometries from $|0\rangle$ to $|16\rangle$. A GCS can
not produce a Fock state below $|n_{c}\rangle$, where $n_{c}=9$. For PACSs,
$r$ signifies the number of photon addition. Elliptic geometry never generates
a Fock state. The results are calculated with $99\%$ accuracy for taking
$P_{n}\simeq 1$.

## Quantum Scissor Operations from the Obtained PNDs

### PND of a GCS and Methodology of Truncation

It is worthy to start with the illustration of the derived modulated PND for
one of the above cases. Particularly, the PND (normalized to unity) of the GCS
from Eq.(7) is depicted in Fig.1, where Fig.1(a) is shown for a fixed value of
$|\alpha|=4$ and Fig.1(b) is shown for a given state, $N=6$. One can observe
in Fig.1(a) that, the contribution from the energy levels in PND is governed
by the integer multiple rule i.e., $n=SN$ and the amount of contribution is
guided by the Poissonian envelops, as obtained through the analytical
derivation. A reduction of the number of contributing levels with increasing
the number of constituent states, $N$ (from $N=1$ to $8$), amounts to the
amplification of the Poissonian envelops, which helps to maintain the
conserved photon number (decided by $|\alpha|^{2}$). Null contribution of the
PND from $n\neq SN$ can also be understood directly from Eq.(7). In the second
case (Fig.1(b)), we demonstrate an $\alpha$-scanning of the PND for a benzene-
like GCS ($N=6$) [28] for instance. For this particular state, one can involve
higher energy levels by increasing $|\alpha|$. The state will also comprise of
more states for higher $|\alpha|$. For all such quantum states with different
physical parameters, the PND will follow the analytically obtained Poisson
envelop, thereby making it an universal entity. We have illustrated our result
for a specific cases ($|\alpha|=4$ for Fig.1(a) and $N=6$ for Fig.1(b)), which
is actually applicable for a wide quantum state combinations. In general,
these states imply mesoscopic superposition states, which is widely used in
quantum information processing. In Fig.2, we have demonstrated it for $N=16$.
The specific $\alpha$-instances depicted through the vertical bars are
relevant for the states, which will be explained in the following subsections.
Notably, all the $\alpha$-values excepting such special instances produce
mesoscopic superposition states of order-$16$, separability of which will
increase with increasing $\alpha$. One of the salient spooky properties of
quantum physics is nonlocal quantum superposition, which is the general
representation of the states under consideration. Such mesoscopic
superposition states are highly studied in various aspects of quantum
technology and known to manifest sub-Planck phase-space interference
structures, which provide the suitable tool for quantum metrology [26, 27, 28,
29, 30, 32, 33, 34]. The required number of constituent mesoscopic quantum
states is unravelled by the calculated PND. The analytical results for PNDs in
Eq.(7) and Eq.(9), not only probe into the fundamental aspects of quantum
optics, will also help to engineer various quantum states, which are relevant
for quantum optics and quantum information.

### Truncating to Fock States

Figure 2: Important $\alpha$-instances of the PND for $N=16$ showing the
generation of various quantum states. The numbers alongside the cylindrical
bars are the corresponding values of the PND with particular $n$ and
$|\alpha|$. $P_{n}$ is normalized to unity. Figure 3: State overlap for GCS of
order $N=16$ for equal superposed state with $S=0$ (solid line), $S=1$ (long-
dash line), $S=2$ (short-dash line), and $S=3$ (dash-dot-dash line).
Corresponding decrease of the overlap maxima for $S=0$, $1$, $2$ and $3$, is
shown in the inset plot.

In addition to the demonstration of the modulated PND for mesoscopic
superposition states, we emphasize on the superposition of $N$ coherent
states, which can produce Fock state. However, neither the said possibility is
trivially understood, nor clearly reported till date. In this section, we will
explore the same, which involves a crucial inter-relation between the number,
type of the constituent states and the coherent state parameter. Here, we
summarize the possibilities in tabular form (Table 1) for both GCS and GPACS
when the states are positioned along a circle or along an ellipse. Table 1
implies that a vacuum state ($|0\rangle$) can be produced from GCS of any
order, but not GPACS. One can correlate the result from the bar-chart
illustration in Fig.2 for $N=16$, which shows the generation of Fock-states,
$|0\rangle$ and $|16\rangle$, for which $P_{n}$ becomes unity with
$|\alpha|=1$ and $4$, respectively. It is clear from column-II in Table 1 that
Fock states $|1\rangle$-$|9\rangle$ can’t be produced from a GCS, whatsoever
be the experimental accuracy and tunability. On the contrary, these Fock
states can be manufactured from GPACS (column-III) for $r=1$ to $9$,
respectively. GCS again becomes capable of producing the Fock state beyond
$n=9$. The latter domain is also relevant for a GPACS, where the fundamental
condition becomes $N+r=n$. However, it is interesting to note from column-III
that, producing Fock states, $|10\rangle$-$|16\rangle$, essentializes a lowest
order of GPACS, which is $N=6$ or a benzine-like GPACS. Throughout the
manuscript, the results are provided with $99\%$ accuracy of the analytically
obtained PND. We have also examined the Fock-state generation with a deviation
from the circular geometry and denoted in column-IV, particularly for an
elliptic geometry, which conveys incapability of both GCS and GPACS to
manufacture any of the Fock states.

Figure 4: Photon number window for generating Fock states, represented by the
width of the rectangular sheets along $|\alpha|$-axis. $P_{n}=1$ situations
are illustrated for discrete $N$’s: $N=4,\;8,\;10,\;12,\;16,\;20,\;24$, where
$P_{n}$ is taken with $99\%$ accuracy. Vacuum state, $|0\rangle$, appears for
all $N$ and the contribution from the next allowed level starts at $N=10$.

### Truncating to various Fock State superpositions

Superposition of two Fock states is of paramount interest, especially due to
their use as computational basis in quantum algorithms. As an illustration of
a specific GCS for $N=16$ in Fig.2, we plot the analytically obtained PND upto
$|\alpha|=6$. Linear superposition of two Fock states can be obtained for a
variety of $\alpha$ in the form, $c_{1}|SN\rangle+c_{2}|(S+1)N\rangle$, such
that $c^{2}_{1}+c^{2}_{2}=1$. We have depicted only three cases in Fig.2 as
follows.
$i)$ $|\alpha|=2.5$, for which the obtained state will be

$\displaystyle|\Psi\rangle=\sqrt{\frac{4}{5}}\;|16\rangle+\sqrt{\frac{1}{5}}\;|32\rangle;$

$ii)$ $|\alpha|=4.9$, for which the obtained state will be a $50-50$
superposition:

$\displaystyle|\Psi\rangle=1/\sqrt{2}\;\;\left(|16\rangle+|32\rangle\right);$

$iii)$ $|\alpha|=6$, for which the obtained state will be

$\displaystyle|\Psi\rangle=\sqrt{\frac{17}{20}}\;|32\rangle+\sqrt{\frac{3}{20}}\;|48\rangle.$

We have also studied the fidelity between the obtained state and the desired
state for a equal Fock state superposition, such that the desired state is
taken as

$\displaystyle|\psi^{\prime}\big{\rangle}=\frac{1}{\sqrt{2}}\big{(}|SN\big{\rangle}+|(S+1)N\big{\rangle}\big{)},$
(10)

whose scalar product with the GCS from Eq.(1),

$\displaystyle|\psi\big{\rangle}=\frac{\mathcal{N}}{\sqrt{N}}e^{\frac{-|\alpha|^{2}}{2}}\sum_{j=1}^{N}\sum_{n=0}^{\infty}\frac{\alpha^{n}}{\sqrt{n!}}e^{\frac{i2\pi
jn}{N}}|n\big{\rangle},$ (11)

becomes

$\displaystyle F=$ $\displaystyle\big{\langle}\psi^{\prime}|\psi\big{\rangle}$
$\displaystyle=$
$\displaystyle\frac{\mathcal{N}e^{\frac{-|\alpha|^{2}}{2}}}{\sqrt{2N}}\sum_{j=1}^{N}\Bigg{[}\frac{\alpha^{n}e^{\frac{i2\pi
jn}{N}}}{\sqrt{n!}}\delta_{n,SN}+\frac{\alpha^{n}e^{\frac{i2\pi
jn}{N}}}{\sqrt{n!}}\delta_{n,(S+1)N}\Bigg{]}$ $\displaystyle=$
$\displaystyle\frac{\mathcal{N}e^{\frac{-|\alpha|^{2}}{2}}}{\sqrt{2N}}\sum_{j=1}^{N}\Bigg{[}\frac{\alpha^{SN}e^{i2\pi
jS}}{\sqrt{(SN)!}}+\frac{\alpha^{(S+1)N}e^{i2\pi
j(S+1)}}{\sqrt{((S+1)N)!}}\Bigg{]}$ (12)

We have provided the plots of this function in Fig.3, where $|F|^{2}$ is known
as the fidelity. The maxima imply the values of $|\alpha|$, only for which the
generations of equal superposition states may be possible. However, it is
worth observing in Fig.3 that, the maxima of the overlap $F$ diminish slightly
for higher order GCS, as shown in the inset plot. For example,
$1/\sqrt{2}\;\left(|0\rangle+|16\rangle\right)$ (solid line curve) has higher
overlap maximum than $1/\sqrt{2}\;\left(|16\rangle+|32\rangle\right)$ (long-
dash curve) and so on. Hence, the equal superposed state with highest fidelity
becomes $1/\sqrt{2}\;\left(|0\rangle+|N\rangle\right)$ for any $N$.

## Identifying the Parameter Domains for Realization

In the previous sections, we have thoroughly discussed the possibilities for
obtaining the quantum states in Table 1, Fig.2, and Fig.3 along with Eq.(7)
and Eq.(9). However, it is extremely important to examine the allowed laser
intensity parameter ($\alpha$) for their experimental generations. Below, we
will elaborate the allowed domains of $\alpha$ for Fock states from a GCS,
equal superposition of two Fock states from a GCS, and Fock states from a
GPACS. Beyond these parameter domains, the quantum states (both GCS and GPACS)
will display a mesoscopic quantum superpositions for larger $\alpha$ to make
the constituent CSs distinguishable.

### Parameter Domains for Truncating to Fock States from a GCS

A numerical study of the PND for a large number of quantum states from Eq.(7)
is shorted out for $P_{n}=1$, to obtain the parameter domain for the Fock
state $|n\rangle$. These photon number windows are represented in Fig. 4 by
the width (along $|\alpha|$-axis) of the rectangular vertical sheets for
discrete $N$’s: $N=4,\;8,\;10,\;12,\;16,\;20,\;24$. Vacuum state, $|0\rangle$,
appears for all $N$ with gradually increasing domain for higher order
superpositions. However, generating the Fock state, $|N\rangle$, is possible
only for $N\geq 10$, which is in agreement with Table 1. A further analysis of
the PND reveals that the Fock states, $|2N\rangle$ and $|3N\rangle$ _etc_ ,
are also possible for even higher order superpositions with $N\geq 21$, $N\geq
32$ _etc_ , respectively. This is better delineated in Fig.5(a) by the shaded
regions with $r=0$. It is also interesting to observe that, the parameter
domain for a specific Fock state gets wider with increasing $N$. However, for
a given $N$, the window for $|2N\rangle$ is narrower as compared to the window
for $|N\rangle$ and this trend continues. It is also intriguing to cite two
specific cases from Fig.5(a): $N=12$ and $N=24$. First case implies that a
superposition of $12$-CSs can produce vacuum state $|0\rangle$ for
$0\leq|\alpha|\leq 1.9$ and also $|12\rangle$ for $2.79\leq|\alpha|\leq 3.51$,
but not the other higher order Fock state beyond $|12\rangle$. On the other
hand, $24$-CSs can produce vacuum state $|0\rangle$ for $0\leq|\alpha|\leq
2.84$, $|24\rangle$ for $3.45\leq|\alpha|\leq 5.43$, and $|48\rangle$ for
$6.6\leq|\alpha|\leq 7.04$, but not the other higher order Fock state beyond
$|48\rangle$. Similar observation can be extracted from Fig.5(a) as and when
required.

Figure 5: (a) Graphical format of photon number window for the generation of
Fock states $|r\big{\rangle}$, $|N+r\big{\rangle}$, $|2N+r\big{\rangle}$ and
$|3N+r\big{\rangle}$. The shaded regions correspond to the GCS ($r=0$),
whereas the region in between the pair of dotted lines correspond to GPACS
($r=1$). (b) Effect of photon addition ($r$) on the photon number window,
$\Delta\alpha$, for $N$-th order superposition state, $|N+r\big{\rangle}$.
$\Delta\alpha$ saturates for higher order superposition (inset plot) with
varying $r$.

In the illustrations, we have taken the $P_{n}$ value with $99\%$ accuracy in
the state overlap, regarding which, there are two aspects: i) the obtained
analytical results are exact and require no accuracy. However, while trying to
quantify the domain of $\triangle\alpha$ from the plot, we need $P_{n}=1$, but
numerically it is never exactly one, as it includes machine precision. Hence,
for demonstrating the results, one needs to uniformly fix an upper limit of
$P_{n}$, beyond which we will conclude $P_{n}\sim 1$, and consider obtaining
the desired state. ii) Experimental accuracy is also an important factor.
Depending on the situation, one can change this accuracy limit, which will
make $\triangle\alpha$ to slightly vary in practical situation. The present
model will be applicable to any such scenario, depending on the experimental
accuracy, relying on several aspects, like detection efficiency, experimental
environment, techniques _etc_. Some related experiments have been performed to
create $1$, $2$ or multiple photon Fock states with fidelity $70\%$-$95\%$
[77, 78, 79]. Single photon source is also created with $99\%$ fidelity in a
cavity QED [80].

### Parameter Domain for Truncating to Equal Fock State Superpositions

We have already explained in the previous section that, the analytically
derived PND is capable of identifying the $\alpha$-value also for an arbitrary
linear superposition of two allowed Fock states. Equally superposed Fock
state, having a special physical importance, can be generated for specific
value of $|\alpha|$, allowed by Eq.(7). The corresponding condition from
Eq.(7) becomes

$\displaystyle P_{n=SN}=P_{n=(S+1)N}$
$\displaystyle\Rightarrow|\alpha|^{2N}=\frac{((S+1)N)!}{(SN)!}$
$\displaystyle\Rightarrow|\alpha|$ $\displaystyle=$
$\displaystyle\bigg{(}{}^{SN+1}P{}_{N}\bigg{)}^{\frac{1}{2N}},$ (13)

where ${}^{SN+1}P{}_{N}$ is the Pochhammer symbol, which is defined as
${}^{x}P{}_{n}=\frac{(x+n-1)!}{(x-1)!}$. One can solve $|\alpha|$ from Eq.(13)
for which a $50-50$ Fock-state superposition is obtained. This value depends
on $S$. For example, a GCS of order $N=16$ generates equal superposition of
$|0\rangle$ and $|16\rangle$ for $S=0$ at $|\alpha|=2.6$; $|16\rangle$ and
$|32\rangle$ for $S=1$ at $|\alpha|=4.9$ (shown in Fig.2); $|32\rangle$ and
$|48\rangle$ for $S=2$ at $|\alpha|=6.34$; and $|48\rangle$ and $|64\rangle$
for $S=3$ at $|\alpha|=7.5$. We also verify that the maxima of the fidelity in
Fig.3 match with the obtained $|\alpha|$ values from this analysis, which is
in conformity with the PND in Eq.(7).

### Parameter Domain for Truncating to Fock States from a GPACS

Table 1 suggests that, unlike GCS, GPACS can produce Fock states,
$|0\rangle$-$|9\rangle$, where the resultant Fock state is equal to the photon
addition, $|r\rangle$. On the contrary, Fock states $|10\rangle$ onward are
obtained when it is equal to $|N+r\rangle$. Hence, in the latter case, a
particular Fock state can be produced with lesser number of PACSs, as compared
to a GCS, which establishes an advantage to work with GPACS. The laser
parameter domain is depicted in Fig.5(a) by the area between the pair of
dashed curves for single photon added ($r=1$) GPACS. Regions for generating
Fock states $|r\big{\rangle}$, $|N+r\big{\rangle}$, $|2N+r\big{\rangle}$ and
$|3N+r\big{\rangle}$ are included till $N=40$. It is interesting to notice the
deviation of the parameter domain with respect to GCS. The domains get broader
with photon addition. The same is quite clear in Fig.5(b), where only
$\Delta\alpha$ is plotted with $N$ for given photon addition $r$ (Here,
$r=0,\;1,\;2,\;3$). $\Delta\alpha$ increases with the addition of photon, $r$,
for a fixed $N$ and $\Delta\alpha$ also increases with $N$ for a fixed $r$.
Inset plot in Fig.5(b) is delineated to manifest the saturation, occurred for
very large $N$. Merging the points of different $r$’s for very large $N$
signifies no effect of the photon addition on $\Delta\alpha$.

## A Deviation from Circular Geometry: Elliptical State

Figure 6: A deviation from the usual circular geometrical arrangement for a
$N$-th order GCS. Circular and elliptical configurations are taken with equal
area for comparison: $\pi|\alpha|^{2}=\pi ab$, with $a=5.0$, $b=3.2$ and
$|\alpha|=4.0$.

So far, we have been considering the mostly studied circular configuration for
both GCS and GPACS. However, it is worthy to know whether there will be any
significant change in physics by altering the geometry, as far as quantum
state engineering is concerned. We have checked it for various geometries and
found to have analogous results. Here, it is illustrated for an elliptic
geometry. Elliptical states are studied in the context of quantum non-
classicality [81, 82, 83]. A quantum state of $N$-CSs, situated along an
ellipse with equal phase difference, can be represented by

$|\psi_{e}\big{\rangle}=\frac{\mathcal{N}_{e}}{\sqrt{N}}\sum_{j=1}^{N}|\alpha_{j}e^{\frac{i2\pi
j}{N}}\big{\rangle}$ (14)

where the distance of the $j$-th state from the origin becomes

$\displaystyle|\alpha_{j}|=\left[\frac{\cos{\frac{2\pi
j}{N}}}{a^{2}}+\frac{\sin{\frac{2\pi j}{N}}}{b^{2}}\right]^{-\frac{1}{2}}.$

$a$ and $b$ are real numbers, indicating the major and the minor axis of the
ellipse, respectively. $\mathcal{N}_{e}$ is the normalization constant defined
by

$\displaystyle\mathcal{N}_{e}=\sqrt{N}\left[\sum_{j,k=1}^{N}e^{-\frac{(|\alpha_{j}|^{2}+|\alpha_{k}|^{2})}{2}}\exp\left({|\alpha_{j}|}|\alpha_{k}|e^{\frac{i2\pi(k-j)}{N}}\right)\right]^{-\frac{1}{2}}.$

Figure 7: (a) PND for $N=16$, where $P_{n}=1$ for a circular GCS (filled
circle) and $P_{n}=0.83$ for elliptical GCS (filled square). (b) Maximum value
of the PND with respect to $N$, where the circular state $P_{n}$ saturates
after getting maximum value at $n=16$ for $N=16$, while in elliptical state
$P_{n}$ is reduced (filled squares) after $n=16$. Here, $|\alpha|$ is taken as
$4.0$ with $a=5.0$ and $b=3.2$: $|\alpha|=\sqrt{ab}$.

Figure 6 shows the comparison between the circular and elliptical
configurations by taking equal area: $\pi|\alpha|^{2}=\pi ab$, with $a=5.0$,
$b=3.2$ and $|\alpha|=4.0$. To obtain the PND for the elliptical state (ES),
we follow similar steps and write

$\displaystyle P_{n}$
$\displaystyle=\frac{|\mathcal{N}_{e}|^{2}}{N}\sum_{j,k=1}^{N}e^{\frac{-(|\alpha_{j}|^{2}+|\alpha_{k}|^{2})}{2}}\left[2\frac{|\alpha_{j}|^{n}|\alpha_{k}|^{n}}{n!}\right.$
(15) $\displaystyle\left.\times\cos\big{(}\frac{2\pi
n(j-k)}{N}\big{)}\right].$

The PNDs of the ES are plotted in Fig.7, corresponding to the configuration
shown in Fig. 6. We take the elliptic state, such that a circular state of CS-
parameter $\alpha$ and elliptical state with major and minor axes, $a$ and
$b$, have equal area: $(\pi|\alpha|^{2}=\pi ab)$. For $a=b$, the elliptical
state changes to circular state. The condition ($|\alpha|=\sqrt{ab}$) will
allow a variety of ellipse with many combinations of $a$-$b$ for a fixed
$|\alpha|$. Here, we illustrate a particular case for $|\alpha|=4.0$ with
$a=5.0$ and $b=3.2$. Figure 7(a) shows the PND for $N=16$, where $P_{n}=1$
value appears at $n=16$ for a circular GCS (filled circle). However, the
maximum value of PND for the elliptical GCS never reaches unity, but
$P_{n}=0.83$, denoted by filled squares. An extension of this analysis is
carried out for the maximum $P_{n}$ values with respect to $N$ in Fig. 7(b),
where the circular state $P_{n}$ saturates after getting maximum value at
$n=16$ for $N=16$, while in elliptical state $P_{n}$-maximum (filled squares)
goes down after $n=16$ for $|\alpha|=4.0$. Hence, we can infer that an
elliptic configuration is incapable of producing any Fock states and their
combinations, which ascertains the essence of circular configuration for
quantum state engineering.

## Conclusions

We have reported a novel quantum scissor operation, mediated by the
analytically derived photon distribution of both GCS and GPACS. We have
demonstrated the scissor operations for generating vacuum State, Fock States,
superposition of two Fock states and mesoscopic superposition states. The
specific conditions and the corresponding allowed domains of laser intensity
parameter are crucial for their experimental generations, which are addressed
by the reported photon number statistics. We reveal that a GCS can produce a
vacuum state, Fock states (beyond $|9\rangle$), and mesoscopic superposition
states in different domains of $\alpha$. A GPACS supports all Fock state
generations, unlike a GCS. The allowed laser intensity domain can also be
controlled by photon addition. The underlying connection between a
overcomplete basis (for CSs) and a complete basis (for Fock states) is
physically intriguing. We also establish the fact that circular arrangement
will be beneficial in experiment. All the conditions and parameter domains,
which are reported in this work, are fundamentally imposed by the quantum
system. Hence, the present work provides a lot of insights on quantum scissor
operations, paving diverse applications in quantum technology. This can be
further applied to many useful cases beyond the demonstrated ones, such as to
get three Fock-state superposition, other two-state superposition, and
applications to quantum information and quantum computing.

## Methods

Analytical derivation of the photon number statistics for GCS and GPACS are
performed. Then, these expressions are used for selecting contributing energy
levels, profiled by the PNDs in a given parameter range and various quantum
states for quantum scissor operations. The precise laser intensity windows for
realizing a variety of quantum scissors are provided. In addition to
demonstrating few cases, the importance of circular geometry is also
delineated for efficient quantum scissor operations.

## Acknowledgement

The authors acknowledge Prof. G.S Agarwal for useful discussions. UR
acknowledges the support from SERB-CRG, GoI. PKP and SG acknowledge support
from DST (No. DST/ICPS/QuST/Theme-1/2019/2020-21/01), India.

## References

  * [1] Sanders, B. C. Review of entangled coherent states. J. Phys. A: Math. Theor. 45, 244002 (2012).
  * [2] Sun, J., Wang, J. and Wang, C. Generation of orthonormalized eigenstates of the operator a k (for $k\geq 3$) from coherent states and their higher-order squeezing. Phys. Rev. A 46, 1700 (1992).
  * [3] Yurke, B. and Stoler, D. Generating quantum mechanical superpositions of macroscopically distinguishable states via amplitude dispersion. Phys. Rev. Lett. 57, 13 (1986).
  * [4] Janszky, J. and Vinogradov, A. V. Squeezing via one-dimensional distribution of coherent states. Phys. Rev. Lett. 64, 2771 (1990).
  * [5] Orszag, M., Ram´ırez, R., Retamal, J. and Saavedra, C. Superposition of coherent states and squeezing. Phys. Rev. Lett. 68, 3815 (1992).
  * [6] Buzek, V. and Knight, P. L. The origin of squeezing in a superposition of coherent states. Opt. Commun. 81, 331–336 (1991).
  * [7] Hillery, M. Amplitude-squared squeezing of the electromagnetic field. Phys. Rev. A 36, 3796 (1987).
  * [8] Agarwal, G. and Simon, R. A new representation for squeezed states. Opt. Commun. 92, 105–107 (1992).
  * [9] Solomon, A. I. A characteristic functional for deformed photon phenomenology. Phys. Lett. A 196, 29–34 (1994).
  * [10] Wigner, E. P. On the quantum correction for thermodynamic equilibrium. In Part I: Physical Chemistry. Part II: Solid State Physics, 110–120 (Springer, 1997).
  * [11] I.L. Chuang, M.A. Nielsen, Quantum Computation and Quantum Information,Cambridge University Press, Cambridge, (2000).
  * [12] Jeong, H., Kim, M. and Lee, J. Quantum-information processing for a coherent superposition state via a mixedentangled coherent channel. Phys. Rev. A 64, 052308 (2001).
  * [13] Ralph, T. C., Gilchrist, A., Milburn, G. J., Munro, W. J. and Glancy, S. Quantum computation with optical coherent states. Phys. Rev. A 68, 042319 (2003).
  * [14] Bergmann, M. and van Loock, P. Quantum error correction against photon loss using multicomponent cat states. Phys. Rev. A 94, 042332 (2016).
  * [15] Lee, R.-K., Lai, Y. and Malomed, B. A. Generation of photon-number-entangled soliton pairs through interactions. Phys. Rev. A 71, 013816 (2005).
  * [16] Lee, R.-K., Lai, Y. and Kivshar, Y. S. Quantum correlations in soliton collisions. Phys. Rev. A 71, 035801 (2005).
  * [17] Chuang, Y.-L., Ite, A. Y. and Lee, R.-K. Quantum theory for pulse propagation in electromagnetically-induced-transparency media beyond the adiabatic approximation. Phys. Rev. A 91, 063818 (2015).
  * [18] Chuang, Y.-L., Lee, R.-K. and Ite, A. Y. Generation of quantum entanglement based on electromagnetically induced transparency media. Opt. Express 29, 3928–3942 (2021).
  * [19] Deb, B. and Agarwal, G. Tripartite entanglement in a bose-einstein condensate by stimulated bragg scattering. Phys. Rev. A 65, 063618 (2002).
  * [20] Deb, B. and Agarwal, G. Entangling two bose-einstein condensates by stimulated bragg scattering. Phys. Rev. A 67, 023603 (2003).
  * [21] Deb, B. Entanglement of two distant bose-einstein condensates by detection of bragg-scattered photons. Phys. Rev. A 78, 013639 (2008).
  * [22] Horoshko, D., De Bi‘evre, S., Kolobov, M. I. and Patera, G. Entanglement of quantum circular states of light. Phys. Rev. A 93, 062323 (2016).
  * [23] Horoshko, D., Patera, G. and Kolobov, M. Quantum teleportation of qudits by means of generalized quasi-bell states of light. Opt. Commun. 447, 67–73 (2019).
  * [24] Suelzer, J. S., Prasad, A., Ghosh, R. and Vemuri, G. Effects of quantum noise on the nonlinear dynamics of a semiconductor laser subject to two spectrally filtered, time-delayed optical feedbacks. Opt. Commun. 370, 209–221 (2016).
  * [25] Fischer, A., Yousefi, M., Lenstra, D., Carter, M. W. and Vemuri, G. Experimental and theoretical study of semiconductor laser dynamics due to filtered optical feedback. IEEE J. selected topics quantum electronics 10, 944–954 (2004).
  * [26] Ghosh, S., Chiruvelli, A., Banerji, J. and Panigrahi, P. Mesoscopic superposition and sub-planck-scale structure in molecular wave packets. Phys. Rev. A 73, 013411 (2006).
  * [27] Ghosh, S., Roy, U., Genes, C. and Vitali, D. Sub-planck-scale structures in a vibrating molecule in the presence of decoherence. Phys. Rev. A 79, 052104 (2009).
  * [28] Roy, U., Ghosh, S., Panigrahi, P. K. and Vitali, D. Sub-planck-scale structures in the p¨oschl-teller potential and their sensitivity to perturbations. Phys. Rev. A 80, 052115 (2009).
  * [29] Ghosh, S. and Roy, U. Enhanced quantum sensitivity in a vibrating diatomic molecule due to a rotational amendment. Phys. Rev. A 90, 022113 (2014).
  * [30] Ghosh, S., Bera, J., Panigrahi, P. K. and Roy, U. Sub-fourier quantum metrology through bright solitary trains in bose–einstein condensate. Int. J. Quantum Inf. 17, 1950019 (2019).
  * [31] Akhtar, N., Sanders, B. C. and Navarrete-Benlloch, C. Sub-planck structures: Analogies between the heisenberg-weyl and su (2) groups. Phys. Rev. A 103, 053711 (2021).
  * [32] Agarwal, G. and Davidovich, L. Quantifying quantum-amplified metrology via fisher information. Phys. Rev. Res. 4, L012014 (2022).
  * [33] Bera, J., Ghosh, S., Salasnich, L. and Roy, U. Matter-wave fractional revivals in a ring waveguide. Phys. Rev. A 102, 063323 (2020).
  * [34] Bera, J., Halder, B., Ghosh, S., Lee, R.-K. and Roy, U. Quantum sensing with sub-planck structures for the dynamics of bose-einstein condensate in presence of engineered potential barriers inside a harmonic trap. Phys. Lett. A 453, 128484 (2022).
  * [35] Seveso, L. and Paris, M. G. Quantum enhanced metrology of hamiltonian parameters beyond the cramer–rao bound. Int. J. Quantum Inf. 18, 2030001 (2020).
  * [36] Garbe, L., Bina, M., Keller, A., Paris, M. G. and Felicetti, S. Critical quantum metrology with a finite-component quantum phase transition. Phys. Rev. Lett. 124, 120504 (2020).
  * [37] Bonalda, D., Seveso, L. and Paris, M. G. Quantum sensing of curvature. Int. J. Theor. Phys. 58, 2914–2935 (2019).
  * [38] Albert, V. V. et al. Holonomic quantum control with continuous variable systems. Phys. Rev. Lett. 116, 140502 (2016).
  * [39] Asboth, J., Adam, P., Koniorczyk, M. and Janszky, J. Coherent-state qubits: entanglement and decoherence. The Eur. Phys. J. D-Atomic, Mol. Opt. Plasma Phys. 30, 403–410 (2004).
  * [40] Jeong, H., Son, W., Kim, M., Ahn, D. and Brukner, C . Quantum nonlocality test for continuous-variable states with dichotomic observables. Phys. Rev. A 67, 012106 (2003).
  * [41] Lund, A. P., Ralph, T. C. and Haselgrove, H. L. Fault-tolerant linear optical quantum computing with small-amplitude coherent states. Phys. Rev. Lett. 100, 030503 (2008).
  * [42] Miranowicz, A., Tanas, R. and Kielich, S. Generation of discrete superpositions of coherent states in the anharmonic oscillator model. Quantum Opt. J. Eur. Opt. Soc. Part B 2, 253 (1990).
  * [43] Praxmeyer, L., Wasylczyk, P., Radzewicz, C. and Wodkiewicz, K. Time-frequency domain analogues of phase space sub-planck structures. Phys. Rev. Lett. 98, 063901 (2007).
  * [44] Praxmeyer, L., Chen, C.-C., Yang, P., Yang, S.-D. and Lee, R.-K. Direct measurement of time-frequency analogs of sub-planck structures. Phys. Rev. A 93, 053835 (2016).
  * [45] Vogel, W. Nonclassical states: An observable criterion. Phys. Rev. Lett. 84, 1849 (2000).
  * [46] Mikheev, E. V., Pugin, A. S., Kuts, D. A., Podoshvedov, S. A. and An, N. B. Efficient production of large-size optical schrodinger cat states. Sci. Reports 9, 14301 (2019).
  * [47] Tyagi, G., Panigrahi, P. K. et al. Photon added cat state: phase space structure and statistics. Opt. Lett. 46, 1177–1180 (2021).
  * [48] Choudhury, S. and Panigrahi, P. K. A proposal to generate entangled compass states with sub-planck structure. AIP Conf. Proc. 1384, 91 (2011).
  * [49] Rivera-Dean, J. et al. Strong laser fields and their power to generate controllable high-photon-number coherent-state superpositions. Phys. Rev. A 105, 033714 (2022).
  * [50] Thekkadath, G., Bell, B., Walmsley, I. A. and Lvovsky, A. Engineering schrodinger cat states with a photonic even-parity detector. Quantum 4, 239 (2020).
  * [51] Molnar, E., Adam, P., Mogyorosi, G. and Mechler, M. Quantum state engineering via coherent-state superpositions in traveling optical fields. Phys. Rev. A 97, 023818 (2018).
  * [52] Agarwal, G. and Tara, K. Nonclassical properties of states generated by the excitations on a coherent state. Phys. Rev. A 43, 492 (1991).
  * [53] Zavatta, A., Viciani, S. and Bellini, M. Quantum-to-classical transition with single-photon-added coherent states of light. science 306, 660–662 (2004).
  * [54] Yan, L., Hui, J. and Ming-Sheng, Z. An optical scheme for conditional generation of w state and photon-added coherent state. Chin. Phys. 16, 1883 (2007).
  * [55] Ramos-Prieto, I., Rodr´ıguez-Lara, B. and Moya-Cessa, H. Engineering nonlinear coherent states as photon-added and photon-subtracted coherent states. Int. J. Quantum Inf. 12, 1560005 (2014).
  * [56] Li, J., Groblacher, S., Zhu, S.-Y. and Agarwal, G. Generation and detection of non-gaussian phonon-added coherent states in optomechanical systems. Phys. Rev. A 98, 011801 (2018).
  * [57] Shringarpure, S. and Franson, J. Generating photon-added states without adding a photon. Phys. Rev. A 100, 043802 (2019).
  * [58] Francis, J. and Tame, M. Photon-added coherent states using the continuous-mode formalism. Phys. Rev. A 102, 043709 (2020).
  * [59] Zavatta, A., Viciani, S. and Bellini, M. Single-photon excitation of a coherent state: catching the elementary step of stimulated light emission. Phys. Rev. A 72, 023820 (2005).
  * [60] Hong-Chun, Y., Xue-Xiang, X. and Hong-Yi, F. Generalized photon-added coherent state and its quantum statistical properties. Chin. Phys. B 19, 104205 (2010).
  * [61] Ren, G. and Zhang, W.-h. Entanglement of a new type of two-mode photon-added entangled coherent state. J. Mod. Opt. 66, 1408–1415 (2019).
  * [62] Braun, D., Jian, P., Pinel, O. and Treps, N. Precision measurements with photon-subtracted or photon-added gaussian states. Phys. Rev. A 90, 013821 (2014).
  * [63] Barnett, S. M., Ferenczi, G., Gilson, C. R. and Speirits, F. C. Statistics of photon-subtracted and photon-added states. Phys. Rev. A 98, 013809 (2018).
  * [64] Pegg, D. T., Phillips, L. S. and Barnett, S. M. Optical state truncation by projection synthesis. Phys. Rev. Lett. 81, 1604–1606 (1998).
  * [65] Barnett, S. M. and Pegg, D. T. Optical state truncation. Phys. Rev. A 60, 4965–4973 (1999).
  * [66] Ozdemir, i. m. c. K., Miranowicz, A., Koashi, M. and Imoto, N. Quantum-scissors device for optical state truncation: A proposal for practical realization. Phys. Rev. A 64, 063818 (2001).
  * [67] Koniorczyk, M., Kurucz, Z., G´abris, A. and Janszky, J. General optical state truncation and its teleportation. Phys. Rev. A 62, 013802 (2000).
  * [68] Leonski, W. and Miranowicz, A. Quantum-optical states in finite-dimensional hilbert space. ii. state generation. Adv. Chem. Phys. 119, 195–213 (2002).
  * [69] Lee, S.-Y. and Nha, H. Quantum state engineering by a coherent superposition of photon subtraction and addition. Phys. Rev. A 82, 053812 (2010).
  * [70] Leo´nski, W. and Kowalewska-Kudłaszyk, A. Quantum scissors–finite-dimensional states engineering. In Progress in Optics, vol. 56, 131–185 (Elsevier, 2011).
  * [71] Abo, S. et al. Hybrid photon–phonon blockade. Sci. Reports 12, 17655 (2022).
  * [72] Wang, L., Wang, J.-S., Zhang, X.-Y., Meng, X.-G. and Yu, Z.-X. Statistical properties of non-gaussian quantum states generated via thermal state truncation. Phys. A: Stat. Mech. its Appl. 596, 127127 (2022).
  * [73] Ghosh, S., Sharma, R., Roy, U. and Panigrahi, P. K. Mesoscopic quantum superposition of the generalized cat state: A diffraction limit. Phys. Rev. A 92, 053819 (2015).
  * [74] Gerry, C. and Knight, P. Quantum superpositions and schr¨odinger cat states in quantum optics. Am. J. Phys. 65, 964–974 (1997).
  * [75] Dong, C.-h. Superposition coherent states and their properties. J. Shanghai Univ. (English Ed. 4, 112–115 (2000).
  * [76] Zwillinger, D. and Jeffrey, A. Table of integrals, series, and products (Elsevier, 2007).
  * [77] Huisman, S. et al. Instant single-photon fock state tomography. Opt. Lett. 34, 2739–2741 (2009).
  * [78] Magana-Loaiza, O. S. et al. Multiphoton quantum-state engineering using conditional measurements. npj Quantum Inf. 5, 80 (2019).
  * [79] Cooper, M., Wright, L. J., S¨oller, C. and Smith, B. J. Experimental generation of multi-photon fock states. Opt. Express 21, 5309–5317 (2013).
  * [80] Zhang, X., Xu, C. and Ren, Z. High fidelity heralded single-photon source using cavity quantum electrodynamics. Sci. Reports 8, 3140 (2018).
  * [81] Wang, Y., Liao, Q., Liu, Z., Wang, J. and Liu, S. Nonclassical properties of odd and even elliptical states. Opt. Commun. 284, 282–288 (2011).
  * [82] Miry, S., Shahpari, M. and Tavassoly, M. Nonlinear elliptical states: generation and nonclassical properties. Opt. Commun. 306, 49–56 (2013).
  * [83] Miry, S. R., Tavassoly, M. K. and Roknizadeh, R. On the generation of number states, their single-and two-mode superpositions, and two-mode binomial state in a cavity. JOSA B 31, 270–276 (2014).

##  1 Data Availability

All data generated or analysed during this study are included in this
published article.

## Author contributions statement

All authors have equally contributed in the research and manuscript
preparation.

## Additional information

Competing financial interests: The authors declare that they have no competing
interests.


#  Tree Methods for Hierarchical Classification in Parallel

Franz A. Heinsen
<EMAIL_ADDRESS>

(September 17, 2022)

###### Abstract

We propose methods that enable efficient hierarchical classification in
parallel. Our methods transform a batch of classification scores and labels,
corresponding to given nodes in a semantic tree, to scores and labels
corresponding to all nodes in the ancestral paths going down the tree to every
given node, relying only on tensor operations that execute efficiently on
hardware accelerators. We implement our methods and test them on current
hardware accelerators with a tree incorporating all English-language synsets
in WordNet 3.0, spanning 117,659 classes in 20 levels of depth. We transform
batches of scores and labels to their respective ancestral paths, incurring
negligible computation and consuming only a fixed 0.04GB of memory over the
footprint of data.111Source code and instructions for replicating our results
are online at https://github.com/glassroom/heinsen_tree.

##  1 Introduction

Hierarchical classification is a common application of machine learning and
artificial intelligence in which models classify data into classes that are
nodes of a semantic tree. For illustration, say we want to classify video
clips of two kinds of pets, dogs and cats, as either “dog” or “cat”, and
further, classify those pets that are dogs as “small” or “big” and those that
are cats as “sleepy” or “curious,” and further yet, those pets that are dogs
that are big as “happy,” “moody,” or “Hound of Hades.” We would train a
model—say, a deep neural network pretrained on a large volume of video data,
with a new classification head—to learn to classify those video clips into
nine classes, each a node of the semantic tree in Figure 1.

[.Classes [.$1$

“dog” [.$3$

“small dog” ] [.$4$

“big dog” [.$7$

“happy big dog” ] [.$8$

“moody big dog” ] [.$9$

“Hound of Hades” ] ] ] [.$2$

“cat” [.$5$

“sleepy cat” ] [.$6$

“curious cat” ] ] ]

Figure 1: A semantic tree spanning nine nodes in three levels of depth.

A simple approach to hierarchical classification is to train models to
classify data into only those classes that are leaf nodes in the tree. In our
example (Figure 1), we would train a model to classify data into only six of
nine classes: $(3,5,6,7,8,9)$. When our model predicts one of those six
classes as most probable, say, $8$, we treat its ancestral path, $[1,4,8]$, as
the hierarchical prediction. The simplicity of this approach makes efficient
execution on hardware accelerators trivial, because we can stack a batch of
classification scores into a matrix and a batch of labels into a vector, and
delegate execution to highly optimized software frameworks for machine
learning. However, there is a significant downside: We cannot use any samples
labeled with an excluded class to train our model. In our example, if many
samples happen to be labeled only at the first level of tree depth, either as
“dog” ($1$) or “cat” ($2$), we would not be able to train our model with those
samples, because it does not predict those two labels.

If we want to train our model with samples labeled at all levels of tree
depth, we must partition the classification space into subspaces, with at most
one class from each ancestral path in each subspace. Classes in the same
ancestral path, like “dog” ($1$) and “small dog” ($3$), cannot be in the same
subspace because they are not mutually exclusive. We could partition the nine
classes in Figure 1 into either three subspaces, $(1,2)\;(3,4,5,6)\;(7,8,9)$,
or four subspaces, $(1,2)\;(3,4)\;(5,6)\;(7,8,9)$, and train our model to
predict a different vector of scores for the classes in each subspace. Alas,
there are now two obstacles to efficient execution on hardware accelerators:
First, each subspace may have different cardinality, so the vectors of scores
may be of different size, and therefore we cannot stack them. Second, if the
tree is more than one level deep, the ancestral paths of classes have varying
lengths, so the number of ancestral labels per sample varies, and therefore we
cannot stack them either.

These two obstacles are not contemplated by the most recent survey of
hierarchical classification methods we could find in the literature Silla and
Freitas (2011), nor by more recent related work.222 We searched for
“hierarchical classification” on arXiv and GitHub, and superficially reviewed
134 preprint abstracts and 118 code repositories matching our search term.  As
far as we can discern, the most common approach to hierarchical classification
on hardware accelerators is recursively to traverse the tree, transform all
scores and labels into score partitions and ancestral labels, respectively,
and then either (a) organize data into groups of equal size, stack the data in
each group, and process one group at a time, or (b) pad data to common
dimensions, stack the padded data, and then process it all at once. The
downside to this approach, in both its (a) and (b) variants, is that hardware
accelerators are not optimized for recursively traversing, transforming,
grouping, and padding irregularly shaped data. Hardware accelerators are
optimized instead for manipulating and transforming data arranged in
multidimensional arrays, or tensors.

Here, we propose methods that transform batches of predicted scores and given
labels to their corresponding partitioned scores and ancestral paths, relying
only on operations algebraically expressible as tensor transformations that
execute efficiently on hardware accelerators. We implement the proposed
methods and test them on a semantic tree with all English-language synsets of
WordNet 3.0 Fellbaum (1998) Miller (1995), spanning 117,659 nodes in 20 levels
of depth. Our implementation transforms batches of scores and labels
efficiently on recent hardware accelerators, incurring negligible computation
and consuming only a fixed modest amount of memory (0.04GB) over the footprint
of data, enabling efficient hierarchical classification in parallel.

###  1.1 Notation

In mathematical expressions of tensor transformations, we show all indices as
subscript text, implicitly assume broadcasting for any missing indices,
perform all operations elementwise, and explicitly show all summations.
Superscript text in parenthesis denotes labels. See Table 1 for examples. We
do not use the notation of Linear Algebra, because it cannot handle more than
two indices. We do not use Einstein’s implicit summation notation either,
because it would require the use of operators for raising and lowering
indices, adding complexity that is unnecessary for our purposes.

Example | Implementation in Python
---|---
$y_{ijk}\longleftarrow x^{{\scriptscriptstyle\tt(1)}}_{ij}+x^{{\scriptscriptstyle\tt(2)}}_{jk}$ | y = x1[:,:,None] + x2
$y_{ijk}\longleftarrow x^{{\scriptscriptstyle\tt(1)}}_{ij}x^{{\scriptscriptstyle\tt(2)}}_{jk}$ | y = x1[:,:,None] * x2
$y_{ik}\longleftarrow\sum_{j}x^{{\scriptscriptstyle\tt(1)}}_{ij}x^{{\scriptscriptstyle\tt(2)}}_{jk}$ | y = x1 @ x2
$y_{ki}\longleftarrow e^{\sum_{j}x^{{\scriptscriptstyle\tt(1)}}_{ij}x^{{\scriptscriptstyle\tt(2)}}_{jk}}$ | y = (x1 @ x2).exp().T
$y_{k}\longleftarrow\sum_{ij}x^{{\scriptscriptstyle\tt(1)}}_{ij}x^{{\scriptscriptstyle\tt(2)}}_{jk}$ | y = (x1 @ x2).sum(dim=0)
Table 1: Examples of the notation we use, with all-subscript indices, implicit
broadcasting, elementwise operations, and explicit summations. In all
examples, $x^{{\scriptscriptstyle\tt(1)}}_{ij}\in\mathbb{R}^{d_{1}\times
d_{2}}$ and $x^{{\scriptscriptstyle\tt(2)}}_{jk}\in\mathbb{R}^{d_{2}\times
d_{3}}$.

##  2 Proposed Methods

For ease of exposition, we describe our methods as we apply them to the tree
in Figure 1. We start by indexing the tree’s classes with an index $c$ and its
levels of depth with an index $l$:

$\displaystyle c$ $\displaystyle=(1,2,3,4,5,6,7,8,9)$ (1) $\displaystyle l$
$\displaystyle=(1,2,3).$

We partition the classification space by level of depth, satisfying the
criteria that at most one class from each ancestral path can be in each
subspace. We obtain three subspaces, indexed by $l$:

$(1,2)\;(3,4,5,6)\;(7,8,9).$ (2)

We index samples in a batch with an index $b$. For concreteness, we shall
assume that every batch in our example has five samples:

$b=(1,2,3,4,5).$ (3)

We assume our model outputs one vector with $|c|$ predicted scores for each
sample in a batch, and we must partition the vector’s elements into $|l|$
vectors for an equal number of subspaces. In our example, there are nine
classes, so each vector of predicted scores has nine elements, and we must
partition them into three levels of depth.

The methods we propose perform two tasks, expressed algebraically as tensor
transformations: First, given a batch of predicted scores $\hat{y}_{bc}$, each
an unnormalized log-probability or logit $\in\mathbb{R}$, the task is to
partition each row $b$’s scores $c$ by level of depth $l$. Second, given a
batch of labels $y_{b}$, each a positive integer $\in c$, the task is to map
them to their corresponding ancestral paths, each a subset of $c$ with up to
$|l|$ classes.

###  2.1 Encoding and Storing the Tree

We encode and store the tree once, in advance, in the form of two matrices.
One is a matrix of masks $M_{lc}$, whose elements are Boolean values True
($1$) or False ($0$), indicating for each subspace $l$ which classes $c$ are
excluded. In our example:

$M_{lc}=\begin{bmatrix}0&0&1&1&1&1&1&1&1\\\ 1&1&0&0&0&0&1&1&1\\\
1&1&1&1&1&1&0&0&0\\\ \end{bmatrix}.$ (4)

The other matrix is a matrix of paths $P_{cl}$, with the ancestral path that
ends in each class $c$ as we go down the tree by level $l$. In our example:

$P_{cl}=\begin{bmatrix}1&\square&\square\\\ 2&\square&\square\\\
1&3&\square\\\ 1&4&\square\\\ 2&5&\square\\\ 2&6&\square\\\ 1&4&7\\\ 1&4&8\\\
1&4&9\\\ \end{bmatrix}\begin{array}[]{l}\text{{// ``dog''}}\\\ \text{{//
``cat''}}\\\ \text{{// ``small dog''}}\\\ \text{{// ``big dog''}}\\\ \text{{//
``sleepy cat''}}\\\ \text{{// ``curious cat''}}\\\ \text{{// ``happy big
dog''}}\\\ \text{{// ``moody big dog''}}\\\ \text{{// ``Hound of Hades''}}\\\
\end{array},$ (5)

where $\square$ is a padding value $\notin c$ (say, $-1$), indicating a path
has already reached its class.

Together, these two matrices consume space that is
$\mathcal{O}\left((s^{{\scriptscriptstyle\tt(bool)}}+s^{{\scriptscriptstyle\tt(int)}})(|l|\cdot|c|)\right)$,
where $s^{{\scriptscriptstyle\tt(bool)}}$ is the space consumed by each
Boolean value in $M_{lc}$, and $s^{{\scriptscriptstyle\tt(int)}}$ is the space
consumed by each integer value in $P_{cl}$. In our example, the matrices
consume
$(s^{{\scriptscriptstyle\tt(bool)}}+s^{{\scriptscriptstyle\tt(int)}})(3\cdot
9)=27(s^{{\scriptscriptstyle\tt(bool)}}+s^{{\scriptscriptstyle\tt(int)}}$).

###  2.2 Partitioning Scores by Level of Depth

We transform a batch of predicted scores $\hat{y}_{bc}$ into a new tensor
$\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}$ with scores per sample $b$,
partitioned by level of depth $l$, for classes $c$, by applying a masked fill
that broadcasts simultaneously over two indices, $b$ and $l$:

$\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}\longleftarrow\begin{cases}\mu,&M_{lc}=1\\\
\hat{y}_{bc},&M_{lc}=0\\\ \end{cases},$ (6)

where $\mu$, a scalar, is the masking value (e.g., the minimum possible score,
$-\infty$, or a sentinel value indicating “not a number,” or NaN for short).
That is, we mask those elements of
$\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}$ whose $lc$ indices coincide
with the $lc$ indices where $M_{lc}=1$, broadcasting over index $b$, and
assign $\hat{y}_{bc}$ to the elements in every slice of
$\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}$ indexed by $bc$ that are not
masked, broadcasting over index $l$.

When implemented with a software framework for machine learning, the masked
fill (6) assigns to each element of
$\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}$ either the score masking value
$\mu$ or a value in $\hat{y}_{bc}$. Such assignments incur negligible
computation and consume only the incremental memory occupied by
$\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}$.

In our example, the model’s predicted scores $\hat{y}_{bc}$ for a batch of
five samples are:

$\hat{y}_{bc}={\begin{bmatrix}\hat{y}_{11}&\hat{y}_{12}&\hat{y}_{13}&\hat{y}_{14}&\hat{y}_{15}&\hat{y}_{16}&\hat{y}_{17}&\hat{y}_{18}&\hat{y}_{19}\\\
\hat{y}_{21}&\hat{y}_{22}&\hat{y}_{23}&\hat{y}_{24}&\hat{y}_{25}&\hat{y}_{26}&\hat{y}_{27}&\hat{y}_{28}&\hat{y}_{29}\\\
\hat{y}_{31}&\hat{y}_{32}&\hat{y}_{33}&\hat{y}_{34}&\hat{y}_{35}&\hat{y}_{36}&\hat{y}_{37}&\hat{y}_{38}&\hat{y}_{39}\\\
\hat{y}_{41}&\hat{y}_{42}&\hat{y}_{43}&\hat{y}_{44}&\hat{y}_{45}&\hat{y}_{46}&\hat{y}_{47}&\hat{y}_{48}&\hat{y}_{49}\\\
\hat{y}_{51}&\hat{y}_{52}&\hat{y}_{53}&\hat{y}_{54}&\hat{y}_{55}&\hat{y}_{56}&\hat{y}_{57}&\hat{y}_{58}&\hat{y}_{59}\\\
\end{bmatrix}},$ (7)

which the masked fill (6) transforms into a tensor
$\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}$ with $5\times 3\times 9$
elements, consisting of the predicted scores for the five samples in the
batch, masked at three levels of depth, for nine possible classes. We show the
three-dimensional tensor here as five stacked slices of $3\times 9$ elements:

$\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}={\begin{bmatrix}\\\\[-6.00006pt]
\begin{bmatrix}\hat{y}_{11}&\hat{y}_{12}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{13}&\hat{y}_{14}&\hat{y}_{15}&\hat{y}_{16}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{17}&\hat{y}_{18}&\hat{y}_{19}\\\
\end{bmatrix}\\\ \\\\[-6.00006pt]
\begin{bmatrix}\hat{y}_{21}&\hat{y}_{22}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{23}&\hat{y}_{24}&\hat{y}_{25}&\hat{y}_{26}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{27}&\hat{y}_{28}&\hat{y}_{29}\\\
\end{bmatrix}\\\ \\\\[-6.00006pt]
\begin{bmatrix}\hat{y}_{31}&\hat{y}_{32}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{33}&\hat{y}_{34}&\hat{y}_{35}&\hat{y}_{36}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{37}&\hat{y}_{38}&\hat{y}_{39}\\\
\end{bmatrix}\\\ \\\\[-6.00006pt]
\begin{bmatrix}\hat{y}_{41}&\hat{y}_{42}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{43}&\hat{y}_{44}&\hat{y}_{45}&\hat{y}_{46}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{47}&\hat{y}_{48}&\hat{y}_{49}\\\
\end{bmatrix}\\\ \\\\[-6.00006pt]
\begin{bmatrix}\hat{y}_{51}&\hat{y}_{52}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{53}&\hat{y}_{54}&\hat{y}_{55}&\hat{y}_{56}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{57}&\hat{y}_{58}&\hat{y}_{59}\\\
\end{bmatrix}\\\ \\\\[-6.00006pt] \end{bmatrix}.}$ (8)

###  2.3 Mapping Labels to Ancestral Paths

We map a batch of given labels $y_{b}$ to a matrix
$y^{{\scriptscriptstyle\tt(tree)}}_{bl}$, consisting of ancestral labels for
each sample $b$ as we go down levels of depth $l$, by referencing the rows of
$P_{cl}$ that are indexed by $y_{b}$ itself:

$y^{{\scriptscriptstyle\tt(tree)}}_{bl}\longleftarrow\begin{bmatrix}\vdots\\\
P_{y^{*}_{b}l}\\\ \vdots\\\ \end{bmatrix}$ (9)

where $P_{y^{*}_{b}l}$ denotes a pointer to rows $y_{b}$ of $P_{cl}$. That is,
we use each class as the index to its own ancestral path in the tree, stored
in $P_{cl}$. Recall that every element of $y_{b}$ is a class $\in c$.

When implemented, the referencing of $P_{cl}$’s rows by their index (that is,
via preexisting pointers) incurs negligible computation and consumes only the
incremental memory occupied by $y^{{\scriptscriptstyle\tt(tree)}}_{bl}$.

In our example, if the given labels $y_{b}$ are, say,

$y_{b}=\begin{bmatrix}4\\\ 7\\\ 2\\\ 6\\\
3\end{bmatrix}\begin{array}[]{l}\text{{// ``big dog''}}\\\ \text{{// ``happy
big dog''}}\\\ \text{{// ``cat''}}\\\ \text{{// ``curious cat''}}\\\ \text{{//
``small dog''}}\\\ \end{array},$ (10)

the corresponding ancestral paths $y^{{\scriptscriptstyle\tt(tree)}}_{bl}$
are:

$y^{{\scriptscriptstyle\tt(tree)}}_{bl}=\begin{bmatrix}P_{y^{*}_{1}l}\\\
P_{y^{*}_{2}l}\\\ P_{y^{*}_{3}l}\\\ P_{y^{*}_{4}l}\\\ P_{y^{*}_{5}l}\\\
\end{bmatrix}=\begin{bmatrix}1&4&\square\\\ 1&4&7\\\ 2&\square&\square\\\
2&6&\square\\\ 1&3&\square\\\ \end{bmatrix}.$ (11)

##  3 Hierarchical Classification in Parallel

###  3.1 Training

For training a model, we flatten indices $bl$ in the tree-dimensional tensor
$\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}$ and the matrix
$y^{{\scriptscriptstyle\tt(tree)}}_{bl}$ to obtain, respectively, a matrix of
masked scores and a vector of ancestral labels and padding values. In our
example, if we flatten indices $bl$ as described in both (8) and (11), we
obtain:

${\begin{bmatrix}\hat{y}_{11}&\hat{y}_{12}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{13}&\hat{y}_{14}&\hat{y}_{15}&\hat{y}_{16}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{17}&\hat{y}_{18}&\hat{y}_{19}\\\
\hat{y}_{21}&\hat{y}_{22}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{23}&\hat{y}_{24}&\hat{y}_{25}&\hat{y}_{26}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{27}&\hat{y}_{28}&\hat{y}_{29}\\\
\hat{y}_{31}&\hat{y}_{32}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{33}&\hat{y}_{34}&\hat{y}_{35}&\hat{y}_{36}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{37}&\hat{y}_{38}&\hat{y}_{39}\\\
\hat{y}_{41}&\hat{y}_{42}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{43}&\hat{y}_{44}&\hat{y}_{45}&\hat{y}_{46}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{47}&\hat{y}_{48}&\hat{y}_{49}\\\
\hat{y}_{51}&\hat{y}_{52}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{53}&\hat{y}_{54}&\hat{y}_{55}&\hat{y}_{56}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{57}&\hat{y}_{58}&\hat{y}_{59}\\\
\end{bmatrix}}{\begin{bmatrix}1\\\ 4\\\ \square\\\ 1\\\ 4\\\ 7\\\ 2\\\
\square\\\ \square\\\ 2\\\ 6\\\ \square\\\ 1\\\ 3\\\ \square\\\
\end{bmatrix}}.$ (12)

We remove all rows in which the vector has a padding value to obtain a smaller
matrix of scores and a vector of labels corresponding to the ancestral paths
going down the tree to every given node:

${\begin{bmatrix}\hat{y}_{11}&\hat{y}_{12}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{13}&\hat{y}_{14}&\hat{y}_{15}&\hat{y}_{16}&\mu&\mu&\mu\\\
\hat{y}_{21}&\hat{y}_{22}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{23}&\hat{y}_{24}&\hat{y}_{25}&\hat{y}_{26}&\mu&\mu&\mu\\\
\mu&\mu&\mu&\mu&\mu&\mu&\hat{y}_{27}&\hat{y}_{28}&\hat{y}_{29}\\\
\hat{y}_{31}&\hat{y}_{32}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\hat{y}_{41}&\hat{y}_{42}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{43}&\hat{y}_{44}&\hat{y}_{45}&\hat{y}_{46}&\mu&\mu&\mu\\\
\hat{y}_{51}&\hat{y}_{52}&\mu&\mu&\mu&\mu&\mu&\mu&\mu\\\
\mu&\mu&\hat{y}_{53}&\hat{y}_{54}&\hat{y}_{55}&\hat{y}_{56}&\mu&\mu&\mu\\\
\end{bmatrix}\begin{bmatrix}1\\\ 4\\\ 1\\\ 4\\\ 7\\\ 2\\\ 2\\\ 6\\\ 1\\\ 3\\\
\end{bmatrix}},$ (13)

enabling us to compute a classification loss (e.g., cross-entropy) at all
levels of depth in parallel. The flattening of two indices and the filtering
of rows by padding values incur negligible computation and consume no
incremental memory.

###  3.2 Inference

At inference, we can obtain predicted probability distributions
$\hat{p}^{{\scriptscriptstyle\tt(tree)}}_{blc}$ for every sample $b$ at each
level of depth $l$ over classes $c$, with a single Softmax function
normalizing over index $c$:

$\hat{p}^{{\scriptscriptstyle\tt(tree)}}_{blc}=\frac{\exp(\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc})}{\sum_{c}\exp(\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc})},$
(14)

which, when implemented, is efficiently executed as long as elements with
masking value $\mu$ (e.g., $-\infty$, NaN) are ignored on-device.

If we naively use the class with the highest predicted probability at each
level of depth as our prediction, we may obtain nonsensical predictions like
$[1,6,7]$ (a “dog” that is a “curious cat” that is a “happy big dog”). To
prevent such nonsense, we can restrict the space of allowed predictions to
only valid paths that exist in $P_{cl}$ (5). We have at our disposal multiple
well-known techniques for finding the paths in $P_{cl}$ that most closely
match the naively predicted paths, including beam search over the top $k$
paths of $P_{cl}$ with highest joint predicted probability in
$\hat{p}^{{\scriptscriptstyle\tt(tree)}}_{blc}$ at each level of depth, or
selection of the top $k$ paths in $P_{cl}$ with the smallest Levenshtein
distance to the naively predicted paths obtained from
$\hat{p}^{{\scriptscriptstyle\tt(tree)}}_{blc}$.

##  4 Implementation and Test

We implement the proposed methods as a composable open-source library, and
test it on a semantic tree of all synsets in WordNet 3.0. Every child-to-
parent connection represents a hyponym-hypernym (child “is a specific instance
of” parent) relationship between two synsets. Some synsets have two or more
possible ancestral paths.333 For example, the synset for the most common
meaning of “dog” has two possible ancestral paths in WordNet 3.0: (a)
[“entity”, “physical entity”, “object”, “whole”, “living thing”, “organism”,
“animal”, “chordate”, “vertebrate”, “mammal”, “placental”, “carnivore”,
“canine”, “dog”], and (b) [“entity”, “physical entity”, “object”, “whole”,
“living thing”, “organism”, “animal”, “domestic animal”, “dog”].  In those
cases, we incorporate only one ancestral path in the tree. The tree has
117,659 synsets, each a class, distributed over 20 levels of depth.

We test our implementation on recent Nvidia GPUs, with batches of 100 samples,
each with a vector of 117,659 predicted scores and a given label, and
transform them on-device into all corresponding partitioned scores and
ancestral paths. Computation is negligible, as expected, as it consists
entirely of assignments that are executed efficiently on-device. Average
execution time is negligible as well: On a single recent Nvidia GPU, it takes
on the order of $1ms$ to transform all score vectors in a batch, and on the
order of $10ns$ to transform all labels in a batch, to their respective
ancestral paths in the WordNet 3.0 tree.

Table 2 shows memory consumption on recent Nvidia GPUs using default data
types (e.g., float32 instead of float16). Our software library consumes only a
fixed 40MB of GPU memory, including the space it uses to store the tree in
advance as matrices $M_{lc}$ and $P_{cl}$, with $20\times 117659$ and
$117659\times 20$ elements, respectively. The only additional memory consumed
is occupied by given data ($\hat{y}_{bc}$, $y_{b}$) and transformed data
($\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}$,
$y^{{\scriptscriptstyle\tt(tree)}}_{bl}$).

Objects | Shape | Type | MB
---|---|---|---
Given data |  |  |
Scores $\hat{y}_{bc}$ | $100\times 117659$ | float32 | 44.9
Labels $y_{b}$ | $100$ | int64 | 0.0
Transformed |  |  |
Scores $\hat{y}^{{\scriptscriptstyle\tt(tree)}}_{blc}$ | $100\times 20\times 117659$ | float32 | 897.7
Labels $y^{{\scriptscriptstyle\tt(tree)}}_{bl}$ | $100\times 20$ | int64 | 0.0
Total for data | – | – | 942.6
Our software* | – | – | 40.0

* Includes memory consumed by matrices $M_{lc}$ and $P_{cl}$.

Table 2: Memory consumption on recent Nvidia GPUs for transforming 100 score
vectors and given labels to a tree spanning 117,659 classes in 20 levels of
depth, using default data types.

## References

  * Fellbaum (1998) Christiane Fellbaum, editor. 1998.  WordNet: An Electronic Lexical Database.  Language, Speech, and Communication. MIT Press, Cambridge, MA.
  * Miller (1995) George A. Miller. 1995.  Wordnet: A lexical database for english.  Commun. ACM 38(11):39–41.
  * Silla and Freitas (2011) Carlos Silla and Alex Freitas. 2011.  A survey of hierarchical classification across different application domains.  Data Mining and Knowledge Discovery 22:31–72.