\section{The SBND Liquid Argon Time Projection Chamber}
\label{sec:sbnd}

The LArTPC is a high resolution, high granularity, scalable particle detector.  Many detailed descriptions of LArTPCs are available \cite{icarus_detector, uboone_detector, argoneut} but we will summarize the key features here.  In this discussion, we will focus on the near detector of the SBN Program at Fermilab, the Short Baseline Near Detector or SBND, since it is the origin of the dataset used here.

A LArTPC is an instrumented volume of purified liquid argon under an approximately uniform electric field.   At one side is the source of the electric field, the cathode.  At the other side, the anode, are readout channels to detect charge.  In SBND, the readout channels are wire-based.

When charged particles traverse the active argon region, they ionize the argon atoms and leave a trail of argon ions and freed electrons.  The freed electrons drift under the influence of the electric field toward the sense wires, where they are detected either via induction or directly collected on the sense wires.  Each wire is digitized continuously, and the time of charge arrival indicates how far the charge drifted.  A very thorough description of the mechanisms and signal processing for wire-based TPCs can be found in \cite{uboone_sigproc_1, uboone_sigproc_2}.

The SBND detector is a dual drift TPC, with a central, shared cathode and two anodes, one at each side of the detector (see Figure~\ref{fig:lartpc_schematic}).  The vertical wire planes each have 1664 wires (plane 2 in images in this work), and each of the induction planes (angled at +/- 60 degrees, planes 0 and 1 in this work) have 1984 wires \cite{apa_paper}.  Each TPC is approximately 5 meters long, 4 meters high, and 2 meters in the drift direction - for a total width of approximately 4 meters.  The entire TPC is located within a cryogenic system, as seen in Figure~\ref{fig:sbnd}.

SBND is also surrounded, nearly entirely, by a solid scintillator-based cosmic-ray muon tracking (CRT) system.  The CRT observes the passing of cosmic muons and provides their time of arrival, in principle allowing a veto of some cosmic ray interactions that have no neutrino interactions.  Additionally, the interior of the LArTPC detector has a photon detection system to collect the prompt scintillation light that is also generated by charged particles traversing the argon.  Both the CRT and photon collection systems could be useful for disentangling cosmic-only and cosmic-with-neutrino events (as described in Section~\ref{sec:problem}), but in this work we focus exclusively on analysis of TPC data in the form of 2D images.

SBND is located in the Booster Neutrino Beam at Fermilab, and will observe neutrino interactions in an energy range from a few hundred MeV to several GeV. The SBND detector is under construction at the time of this writing, and results here use simulations based on the design of the detector.

\begin{figure}
    \centering
    \includegraphics[width=\textwidth]{images/SBND_TPC.pdf}
    \caption{An illustration of the SBND TPC used in this work.  In this image, a neutrino interacts in the left TPC, and the outgoing particles cross the central cathode into the right TPC.  The top-down projection images (vertical wire planes) are shown, which are combined into one image as seen in Figure~\ref{fig:raw_data}.}
    \label{fig:lartpc_schematic}
\end{figure}

\begin{figure}
    \centering
    \includegraphics[width=0.4\textwidth]{images/sbnd_cryostat_open.jpg}
    \caption{Engineering diagram of the SBND LArTPC and its surrounding subsystems.  Here, the TPC is shown lifted above the cryostat for clarity.}
    \label{fig:sbnd}
\end{figure}

\section{Example Analysis on SBND Simulation}
\section{Analysis Results}
\label{sec:analysis}
Figure~\ref{fig:bigger_batch_iou} shows the metric performance as a function of neutrino energy for the best performing network, broken out across three kinds of neutrino interactions: electron neutrino charged current, muon neutrino charged current, and neutral current.

\begin{figure}
    \centering
    \includegraphics[width=0.7\columnwidth]{analysis/biggerbatch_iou.pdf}
    \caption{Metric performance across neutrino interaction types, as a function of neutrino energy.  The solid lines are the Intersection over Union for the neutrino predicted/labeled pixels, while the dashed lines are the Intersection over Union for the cosmic predicted/labeled pixels. Each color in this plot represents the IoU for all events containing that particular neutrino interaction.}
    \label{fig:bigger_batch_iou}
\end{figure}

To demonstrate the utility of this deep neural network in a physics analysis, we perform a very elementary selection of events.  We perform inference on a selection of events from all types of simulated interactions, including events where there is no neutrino interaction.

There are two main objectives of this analysis.  First, on an event by event basis, decide if there is a neutrino interaction present in the measured charge using TPC information only.  It is expected that any additional information from the light collection or cosmic ray tagging systems will further enhance these results.  Second, within an interaction that has been selected as a neutrino interaction, measure the accuracy with which the interaction has been selected from the cosmic backgrounds.

To demonstrate the performance in event-level identification, we apply a simple set of metrics. We require a minimum number of pixels, per image, to be classified as neutrino by the network. Additionally, since the drift direction (Y-axis) of all three images is shared in each event, we apply a matching criterion.  Specifically, we compute the mean Y location of all neutrino-tagged pixels in each plane, and we require that the difference in this mean location is small across all three planes.

Quantitatively, we find good results by requiring at least 100 neutrino-tagged pixels per plane, and a maximum separation of mean Y location of 50 pixels across all three combinations of images.  With these basic cuts, we observe the selection efficiencies of Table~\ref{tab:selection}.  We note that neither 100 pixels per plane, nor a separation distance of 50 pixels, is a well tuned cut.  For some analyses targeting low energy events in the Booster Neutrino Beam, these cuts would be too aggressive.  Instead, the desired goal is to demonstrate that the predictive power of this network can be leveraged in a basic event filtering workflow.

\begin{table}
\centering
\begin{tabular}{rl}
Category & Efficiency \\
$\nu_e$ CC    & 91.5\%     \\
$\nu_\mu$ CC   & 78.6\%     \\
NC       & 37.3\%     \\
Cosmics  & 91.1\% cosmic-only event rejection
\end{tabular}
\caption{Selection efficiencies for sample cuts using the inference output of the best network.}
\label{tab:selection}
\end{table}
The selection efficiencies with these cuts, though not aggressively tuned, do have variation from one type of neutrino interaction to another.  The muon-neutrino events are distinguished by the presence of a long muon from the neutrino interaction, while electron neutrino events have no muons and instead an electro-magnetic shower.  Since the cosmic particles are primarily, though not entirely, composed of high energy muons, it is not surprising that electron neutrino events are more easily distinguished from cosmic-only events, as compared to muon neutrino events.  Additionally, the neutral current events have an outgoing neutrino that carries away some fraction of the energy of the event; on average, these events have much less energy in the TPC and therefore fewer active pixels to use for selection and discrimination of events.  Consequently, neutral current events are harder to reject compared to charged current events.

We do not speculate here on final purity for an analysis of this kind on the BNB spectrum of neutrinos at SBND.  The final analysis will use both scintillation light and cosmic ray tagger information in addition to the TPC data.  However, it is notable that a simple analysis can reduce the cosmic-only interactions by a factor of 10x, and the remaining events have the correct pixels labeled at a 95\% non-background accuracy level.  We believe this is a promising technique for the SBN experiments.

\section{Dataset}
\label{sec:dataset}
The dataset for this application was generated via the \texttt{larsoft} simulation toolkit for LArTPCs~\cite{larsoft} utilizing a SBND geometry description and electronics simulation, as of 2018.  It was known that the geometry description and electronics simulation for SBND were not finalized at that time, but minor changes to the geometry and electronics response are unlikely to lead to significant changes in the performance we report here.

The drift direction in each plane is
digitized at a higher spatial resolution than the wire spacing.  For this dataset, the images are downsampled along the drift direction by a factor of 4 to make vertical and horizontal distances have the same scale.
To better suit downsampling and upsampling operations, the images are centered horizontally into images with a width of 2048 pixels, with each pixel representing one wire. The drift direction is 1260 pixels.
Pixels on the right and left, beyond the original image, are set to 0 in both label and input images.  The cathode is visible in these images as a green horizontal space in the middle of each image.

\begin{figure}
\begin{centering}
    \includegraphics[width=0.6\columnwidth]{images/raw_images/Slide1.png}
    \includegraphics[width=0.6\columnwidth]{images/raw_images/Slide2.png}
    \includegraphics[width=0.6\columnwidth]{images/raw_images/Slide3.png}
    \caption{The raw data for one image in the dataset at full resolution. Charge observed is colored with blue for smaller charge depositions and red for larger charge depositions.  There is an electron neutrino charged current interaction in the Upper TPC.}
    \label{fig:raw_data}
\end{centering}
\end{figure}

Because the images to segment are so large, this work is demonstrating these results on a downsampled version of the images, where each image is at 50\% resolution (640 pixels tall, 1024 pixels wide).

Each interaction in the dataset used here has neutrino interactions simulated with the GENIE software package \cite{genie} (v2.12.8c), and cosmic backgrounds simulated using CORSIKA \cite{corsika} (v1.7i).  The BNB neutrino flux is used to sample neutrinos at the proper energies, however the relative populations of three distinct categories of events ($\nu_\mu$ CC, $\nu_e $ CC, and NC) are balanced in the training set (see Figure~\ref{fig:sbnd_flux}).

The label images are created using truth level information from \texttt{GEANT4}~\cite{geant} (v4.10.3.p01b), where each deposition on a wire is tracked from the particle that created it.  Each particle, in turn, is tracked to its parent particle up to the primary particles.  All depositions that come from a particle (or its ancestor) that originated with GENIE are labeled as neutrino induced, and all depositions that originated from a CORSIKA particle are labeled as cosmics.  In the event of an overlap, as is common, the neutrino label takes precedence.  Approximately 50\% of all events have an overlap in at least one plane.  The label images for the event in Figure~\ref{fig:raw_data} can be seen in Figure~\ref{fig:labeled_data}.

\begin{figure}
\begin{centering}
    \includegraphics[width=0.6\columnwidth]{images/label_images/Slide4.png}
    \includegraphics[width=0.6\columnwidth]{images/label_images/Slide5.png}
    \includegraphics[width=0.6\columnwidth]{images/label_images/Slide6.png}
    \caption{The labels for the images in Figure~\ref{fig:raw_data} in the dataset at full resolution.  White pixels are background, gray pixels are associated with cosmic particles, and red pixels are associated with a neutrino interaction.  Plane 2 shows a case of overlap between cosmic and neutrino pixels.}
    \label{fig:labeled_data}
\end{centering}
\end{figure}

\section{\label{sec:Intro}Introduction}

Liquid argon time projection chambers (LArTPCs) are high resolution, calorimetric imaging particle detectors.  Due to their excellent calorimetric properties and particle identification capabilities \cite{argoneut_nue}, combined with their scalability to kiloton masses \cite{dune-tdr-1}, LArTPCs have been selected for a variety of experiments to detect neutrinos in the MeV to GeV energy range.
Several 100 to 1000-ton-scale LArTPCs have collected substantial amounts of neutrino data (ICARUS at LNGS \cite{Rubbia_2011} and MicroBooNE at Fermilab \cite{uboone_detector}), or been operated in charged particle test beams (ProtoDUNE-SP \cite{protodune-singlephase-tdr} and ProtoDUNE-DP \cite{dune-tdr-3} at CERN). Others are in the commissioning phase (ICARUS at Fermilab \cite{sbn-proposal}) or under construction (SBND at Fermilab \cite{sbn-proposal}).  Coming later this decade, the Deep Underground Neutrino Experiment, DUNE \cite{dune-tdr-2}, will be a $10^4$-ton-scale LArTPC neutrino detector built 1.5 km underground in the Homestake Mine in South Dakota.

LArTPCs running near the Earth’s surface (such as SBND, MicroBooNE, and ICARUS comprising the Short-Baseline Neutrino (SBN) program at Fermilab) are susceptible to backgrounds induced by cosmic interactions, which occur at much higher rates than neutrino interactions.
In this paper, we present novel techniques for the tagging of cosmic-induced, neutrino-induced, and background-noise pixels, using deep learning and image processing techniques applied to simulated data from the SBND LArTPC detector.

We first present, in Section~\ref{sec:sbnd}, a description of the liquid argon time projection chamber technology, particularly in the context of the SBND experiment where this study is performed.  In Section~\ref{sec:problem} we summarize the origin of the problem we solve with convolutional neural networks, including a description of how LArTPC images are created from the raw data for this study.  Section~\ref{sec:related} summarizes the related work on this challenge, and Section~\ref{sec:dataset} describes the details of the dataset used in this study.  Sections~\ref{sec:network} and \ref{sec:training} describe the design and training of the convolutional neural network, respectively, and Section~\ref{sec:analysis} presents a basic analysis based on the trained network.

\section{Conclusions}

In this paper, we have demonstrated a novel technique for pixel level segmentation to remove cosmic backgrounds from LArTPC images.  We have shown how different deep neural networks can be designed and trained for this task, and presented metrics that can be used to select the best versions.
The technique developed is applicable to other LArTPC detectors running at surface level, such as MicroBooNE, ICARUS and ProtoDUNE.
We anticipate future publications studying the hyperparameters of these networks, and an updated dataset with a more realistic detector simulation prior to the application of this technique to real neutrino data.

\section{Acknowledgements}

The SBND Collaboration acknowledges the generous support of the following organizations: the U.S. Department of Energy, Office of Science, Office of High Energy Physics; the U.S. National Science Foundation; the Science and Technology Facilities Council (STFC), part of United Kingdom Research and Innovation, and The Royal Society of the United Kingdom; the Swiss National Science Foundation; the Spanish Ministerio de Ciencia e Innovación (PID2019-104676GB-C32) and Junta de Andalucía (SOMM17/6104/UGR, P18-FR-4314) FEDER Funds; and the S\~{a}o Paulo Research Foundation (FAPESP) and the National Council of Scientific and Technological Development (CNPq) of Brazil. We acknowledge Los Alamos National Laboratory for LDRD funding. This research used resources of the Argonne Leadership Computing Facility, which is a DOE Office of Science User Facility supported under Contract DE-AC02-06CH11357.  SBND is an experiment at the Fermi National Accelerator Laboratory (Fermilab), a U.S. Department of Energy, Office of Science, HEP User Facility. Fermilab is managed by Fermi Research Alliance, LLC (FRA), acting under Contract No. DE-AC02-07CH11359.

\bibliographystyle{unsrt}

\section{Network Architectures and Implementations}
\label{sec:network}

For this work, we present a novel modification of the UResNet architecture for cosmic and neutrino segmentation that aims to meet several criteria:

\begin{itemize}
    \item Discriminate cosmic pixels from neutrino pixels with high granularity.
    \item Segment entire events across all planes simultaneously and efficiently.
    \item Incorporate multi-plane geometrical information.
\end{itemize}

To this end, we present a multi-plane, UResNet style architecture as depicted in Figure~\ref{fig:multiplane-uresnet}.  The input to the network is entire images for each of the 3 planes, each of which is fed through a segmentation network in the shape of a UResNet.  Unique to this work, at the deepest convolutional layer, the per-plane filters are concatenated together into one set of convolutional filters and proceed through convolutions together, in order to learn cross-plane geometrical features.  Without this connection at the deepest layer, this network is exactly a ``standard'' UResNet architecture applied to each plane independently.  We see in our experimental results below that without this connection layer, the network does not perform as well.  After this, the filters are split and up-sampled independently again.

\begin{figure}
    \includegraphics[width=\columnwidth]{images/diagrams/network.png}
    \caption{A representation of the multi-plane UResNet architecture.  Only two of the three planes are shown in this image for clarity.}
    \label{fig:multiplane-uresnet}
\end{figure}

Because each plane has similar properties at a low level (i.e., particles look similar in each plane, even if the geometric projection is different), convolutional weights are shared across all three planes for up-sampling and down-sampling of the network.

The implementation of the network is available in both TensorFlow~\cite{tensorflow2015-whitepaper} and PyTorch \cite{pytorch} on GitHub\footnote{\href{https://github.com/coreyjadams/CosmicTagger}{https://github.com/coreyjadams/CosmicTagger}}.  The basic building blocks of this network are residual convolutional layers \cite{resnet}.  In a residual layer, the input tensor is processed with convolutions, non-linear activations, and (potentially) normalization layers before being summed with the input of residual layer: $R(x) = x + C(x)$, where $R$ is the residual function and $C$ represents the convolution layers.  In this work, we use Batch Normalization \cite{batch_norm} as a normalization layer, and LeakyReLU~\cite{leaky_relu} as a non-linear activation. While there are many configuration parameters, the baseline model has 6 levels of depth and the following properties:

\begin{itemize}
    \item The network operates on each plane independently except at the very deepest layer.
    \item The first layer of the network is a 7x7 convolutional filter that outputs a parametrizable number of filters - the reference models use 16.
    \item Each subsequent layer in the down-sampling pass takes the previous output and applies two residual blocks, described below, followed by a max pooling to reduce the spatial size.  After the max pooling, a bottleneck 1x1 convolution increases the number of filters by a factor of 2.
    \item After the 5th down-sampling pass, the spatial size of the images is (10,16) with 512 filters in each plane.  The images from each plane are concatenated together, and a bottleneck convolution is applied across the concatenated tensor to reduce the number of filters to 256.  Then, 5 residual blocks of size 5x5 are applied, followed by a 1x1 layer to increase the number of filters back to 1536.  The filters are split into three tensors again.
    \item After the deepest layer, each up-sampling layer takes the output of the corresponding downward pass, adds it to the output of the previous up-sampling layer, and performs two residual blocks with 3x3 convolutions.  This pattern of up-sampling/addition/convolutions continues until original resolution is reached.
    \item Once the original resolution has been restored, a single 1x1 convolution is applied to output 3 filters for each image, where the 3 filters correspond to the 3 background classes.
\end{itemize}

The details of each layer are summarized in Table~\ref{tab:network}.  The residual blocks used in the network mirror those in \cite{resnet}, and are the following sequence of operations: convolution, Batch Normalization, LeakyReLU, convolution, Batch Normalization, sum with input, LeakyReLU.

\begin{table}
\begin{centering}
\begin{tabular}{rccccl}
\hline
\multicolumn{1}{|r|}{Layer}      & \multicolumn{1}{c|}{X}   & \multicolumn{1}{c|}{Y}    & \multicolumn{1}{c|}{Filters} & \multicolumn{1}{c|}{Parameters} & \multicolumn{1}{l|}{Operations}                                                 \\ \hline
\multicolumn{1}{|r|}{Initial}    & \multicolumn{1}{c|}{640} & \multicolumn{1}{c|}{1024} & \multicolumn{1}{c|}{1}       & \multicolumn{1}{c|}{416}        & \multicolumn{1}{l|}{conv7x7, BN, LeakyReLU}                                          \\ \hline
\multicolumn{1}{|r|}{Down 0}     & \multicolumn{1}{c|}{640} & \multicolumn{1}{c|}{1024} & \multicolumn{1}{c|}{8}       & \multicolumn{1}{c|}{2576}       & \multicolumn{1}{l|}{Res3x3, Res3x3, MaxPool, Bottleneck 8 to 16}                \\ \hline
\multicolumn{1}{|r|}{Down 1}     & \multicolumn{1}{c|}{320} & \multicolumn{1}{c|}{512}  & \multicolumn{1}{c|}{16}      & \multicolumn{1}{c|}{10016}      & \multicolumn{1}{l|}{Res3x3, Res3x3, MaxPool, Bottleneck 16 to 32}               \\ \hline
\multicolumn{1}{|r|}{Down 2}     & \multicolumn{1}{c|}{160} & \multicolumn{1}{c|}{256}  & \multicolumn{1}{c|}{32}      & \multicolumn{1}{c|}{39488}      & \multicolumn{1}{l|}{Res3x3, Res3x3, MaxPool, Bottleneck 32 to 64}               \\ \hline
\multicolumn{1}{|r|}{Down 3}     & \multicolumn{1}{c|}{80}  & \multicolumn{1}{c|}{128}  & \multicolumn{1}{c|}{64}      & \multicolumn{1}{c|}{156800}     & \multicolumn{1}{l|}{Res3x3, Res3x3, MaxPool, Bottleneck 64 to 128}              \\ \hline
\multicolumn{1}{|r|}{Down 4}     & \multicolumn{1}{c|}{40}  & \multicolumn{1}{c|}{64}   & \multicolumn{1}{c|}{128}     & \multicolumn{1}{c|}{624896}     & \multicolumn{1}{l|}{Res3x3, Res3x3, MaxPool, Bottleneck 128 to 256}             \\ \hline
\multicolumn{1}{|r|}{Down 5}     & \multicolumn{1}{c|}{20}  & \multicolumn{1}{c|}{32}   & \multicolumn{1}{c|}{256}     & \multicolumn{1}{c|}{2494976}    & \multicolumn{1}{l|}{Res3x3, Res3x3, MaxPool, Bottleneck 256 to 512}             \\ \hline
\multicolumn{1}{|r|}{Bottleneck} & \multicolumn{1}{c|}{10}  & \multicolumn{1}{c|}{16}   & \multicolumn{1}{c|}{1536}    & \multicolumn{1}{c|}{393984}     & \multicolumn{1}{l|}{Concat across planes, bottleneck 1536 to 256}               \\ \hline
\multicolumn{1}{|r|}{Deepest}    & \multicolumn{1}{c|}{10}  & \multicolumn{1}{c|}{16}   & \multicolumn{1}{c|}{256}     & \multicolumn{1}{c|}{16391680}   & \multicolumn{1}{l|}{Res5x5, 5 layers}                                           \\ \hline
\multicolumn{1}{|r|}{Bottleneck} & \multicolumn{1}{c|}{10}  & \multicolumn{1}{c|}{16}   & \multicolumn{1}{c|}{1536}    & \multicolumn{1}{c|}{397824}     & \multicolumn{1}{l|}{bottleneck 256 to 1536, split into 3 planes}                \\ \hline
\multicolumn{1}{|r|}{Up 5}       & \multicolumn{1}{c|}{20}  & \multicolumn{1}{c|}{32}   & \multicolumn{1}{c|}{256}     & \multicolumn{1}{c|}{2494208}    & \multicolumn{1}{l|}{Interp., Sum w/ Down 5, Bottleneck, Res3x3, Res3x3} \\ \hline
\multicolumn{1}{|r|}{Up 4}       & \multicolumn{1}{c|}{40}  & \multicolumn{1}{c|}{64}   & \multicolumn{1}{c|}{128}     & \multicolumn{1}{c|}{624512}     & \multicolumn{1}{l|}{Interp., Sum w/ Down 4, Bottleneck, Res3x3, Res3x3} \\ \hline
\multicolumn{1}{|r|}{Up 3}       & \multicolumn{1}{c|}{80}  & \multicolumn{1}{c|}{128}  & \multicolumn{1}{c|}{64}      & \multicolumn{1}{c|}{156608}     & \multicolumn{1}{l|}{Interp., Sum w/ Down 3, Bottleneck, Res3x3, Res3x3} \\ \hline
\multicolumn{1}{|r|}{Up 2}       & \multicolumn{1}{c|}{160} & \multicolumn{1}{c|}{256}  & \multicolumn{1}{c|}{32}      & \multicolumn{1}{c|}{39392}      & \multicolumn{1}{l|}{Interp., Sum w/ Down 2, Bottleneck, Res3x3, Res3x3} \\ \hline
\multicolumn{1}{|r|}{Up 1}       & \multicolumn{1}{c|}{320} & \multicolumn{1}{c|}{512}  & \multicolumn{1}{c|}{16}      & \multicolumn{1}{c|}{9968}       & \multicolumn{1}{l|}{Interp., Sum w/ Down 1, Bottleneck, Res3x3, Res3x3} \\ \hline
\multicolumn{1}{|r|}{Bottleneck} & \multicolumn{1}{c|}{640} & \multicolumn{1}{c|}{1024} & \multicolumn{1}{c|}{16}      & \multicolumn{1}{c|}{2552}       & \multicolumn{1}{l|}{Bottleneck1x1 to 3 output filters.}                         \\ \hline
\multicolumn{1}{|r|}{Final}      & \multicolumn{1}{c|}{640} & \multicolumn{1}{c|}{1024} & \multicolumn{1}{c|}{3}       & \multicolumn{1}{c|}{57}         & \multicolumn{1}{l|}{Final Segmentation Maps}                                    \\ \hline
\multicolumn{1}{l}{}             & \multicolumn{1}{l}{}     & \multicolumn{1}{l}{}      & \multicolumn{1}{l}{}         & \multicolumn{1}{l}{}            &
\end{tabular}
\caption{A description of the multi-plane UResNet architecture used in this work.}
\label{tab:network}
\end{centering}
\end{table}

To summarize, the network architecture used here is taking state-of-the-art segmentation techniques (`UNet'~\cite{UNet} and `UResNet'~\cite{uboone_segmentation}) and enhancing them to learn correlated features across images.

\subsection{Analysis Metrics}

Because of the sparse nature of the images from a LArTPC detector, the per-pixel accuracy does not give good discriminating power to gauge network performance. Simply predicting `background' for all pixels yields a very high accuracy over 99\% - even with every `cosmic' and `neutrino' pixel mislabeled.  To mitigate this, we calculate several metrics that have proven useful for measuring the performance of a cosmic tagging network:

\begin{itemize}
\item {\bf Accuracy} is computed as the total fraction of pixels that are given the correct label by the network, where the predicted label is the highest scoring category in the softmax for that pixel.
\item {\bf Non-background Accuracy} is the same as Accuracy above, but computed only for pixels that have a non-zero label in the truth labels.  In basic terms, this metric is measuring how often the network is predicting the correct pixel on the parts of the image that matter, as background pixels can easily be identified from their lack of charge.
\item {\bf Intersection over Union} (or IoU) is calculated for the neutrino (and cosmic) pixels.  This metric uses the set of pixels that are {\em labeled} (by the simulation) as neutrino (or cosmic) and the set of pixels that are {\em predicted} (by the network) as neutrino (or cosmic).  The metric is the ratio of the number of pixels that are in both sets (intersection) divided by the number of pixels in either set (union).
In basic terms, this metric measures how often the network predicts active categories (neutrino, cosmic) on the correct pixels and {\bf only} the correct pixels.
\end{itemize}

\section{Problem Description}
\label{sec:problem}
We seek in this work to remove background activity generated by cosmic particle interactions in the SBND dataset, and in this section we will describe in more detail how the SBND LArTPC operates and why cosmic interactions are problematic.

During typical operation, a LArTPC digitizes the entire detector for a period of time, usually equal to or larger than the time needed for an ionization electron to drift from the cathode to the anode following a 'trigger'.  A trigger can be caused by any event that would be of interest, such as the arrival of the neutrino beam, the activation of the scintillation detection system above a certain threshold, or a combination of signals from the external CRT system.  One digitization of the detector, comprised of the images of each plane for the same time window as well as all auxiliary subsystems, is referred to as an ``event''. For a typical LArTPC neutrino detector, the maximum drift time is 1-3 ms.

The Booster Neutrino Beam delivers neutrinos to SBND up to 5 times per second, with a neutrino arrival window at the detector that is small (microseconds) compared to the TPC drift time (milliseconds).  The histogram in Figure~\ref{fig:sbnd_flux} shows the energy of interacting neutrinos simulated in SBND (more details on the simulation are in Section~\ref{sec:dataset}).  The neutrino energies range from tens of MeV to several GeV.
When a neutrino interacts with an argon nucleus, it produces an outgoing lepton. For charged current (CC) interactions the outgoing lepton is an electron or muon for an incident electron neutrino or muon neutrino, respectively. For neutral current (NC) interactions the final state lepton is a neutrino, which exits the detector undetected.
Both kinds of interactions could also produce other particles such as pions, protons, and neutrons.  In liquid argon, at energies relevant to this work (see Figure~\ref{fig:sbnd_flux}), these particles can travel up to several meters (for energetic muons) or as little as several millimeters (for low energy protons).

\begin{figure}
    \centering
    \includegraphics[width=0.5\textwidth]{images/energy.png}
    \caption{Neutrino energy of interactions produced for this analysis.  Most neutral current events are produced by muon-type neutrinos, and so the $\nu_\mu$ CC and Neutral Current energy spectra are similar.  The relative populations here are for the dataset used in this paper, while in the neutrino beam the muon neutrino interactions are far more frequent than electron neutrino.}
    \label{fig:sbnd_flux}
\end{figure}
During the few millisecond drift time of the ionization electrons, multiple incident cosmic rays will also traverse the TPC.
Therefore, a typical event captured in coincidence with the neutrino beam has many cosmic particles visualized in the data, as seen in Figure~\ref{fig:raw_data}.

As discussed, the scintillation light and CRT auxiliary detectors are useful for rejection of cosmic particles on a whole-image basis, but they do not have granularity to directly remove cosmic-ray induced pixels from TPC data.  For example, the photon detectors typically have spatial resolution on the order of tens of cm, while TPC data has a resolution on the scale of millimeters.  However, the temporal resolution is significantly better than the TPC. Using this timing information, which can resolve scintillation flashes coincident with the neutrino beam arrival, these detectors can easily reject non-neutrino events that have no scintillation at the right time (the neutrino-beam arrival).

While some cosmic-only events can be rejected with light-only information, for example by requiring a flash of light coincident with the neutrino arrival from the beam, this condition is insufficient to reject every cosmic-only event.  In some cases, a neutrino can interact inside of the cryostat but external to the TPC, which is sufficient to cause a detectable flash of light in coincidence with the neutrino arrival.  However, no neutrino-induced depositions will be visible in the TPC data, even though all of the standard trigger conditions will have been met.

In another case, since each cosmic interaction also produces scintillation light in the TPC, it is possible for a cosmic particle to produce a flash of light in coincidence with the neutrino beam arrival, even if no neutrino interacts in that event.  In this case, the external cosmic ray tagger can identify the cosmic interaction in time with the beam, but these detectors have imperfect coverage and will not distinguish all in-going cosmic muons from outgoing neutrino-produced muons.

Both of these mechanisms cause an event trigger based on a flash of light during the neutrino-arrival window without any neutrino-induced activity in the TPC.  And even in events that have a neutrino interaction, the light collection and cosmic ray tagging subsystems cannot identify the neutrino interaction in the TPC data by themselves.
Pattern recognition algorithms applied to TPC data are needed to discern cosmic-induced from neutrino-induced activity.  Traditional approaches convert TPC wire data into ``hits'' (regions of charge above noise threshold) and use geometric relationships to group hits into higher order 2D and 3D multi-hit objects within the TPC images.  These objects are treated as particles in the detector and can be further grouped with other associated objects before they are classified as being of cosmic or neutrino origin.

In this work, we take a fundamentally different approach from traditional pattern recognition in LArTPCs by tagging the raw TPC data as cosmic-induced or neutrino-induced on a pixel-by-pixel basis.  This tagging, applied early in the analysis of TPC data, can then seed a variety of downstream analysis approaches and provide a significant boost to their performance.

\subsection {LArTPC Imaging Data}

The individual readout ``unit'' of a LArTPC is the signal along each wire as a function of elapsed time since the trigger or event start. We form 2D images (as seen in Figure~\ref{fig:raw_data}) from the 1D wire signals as follows.
Each column of vertical pixels of the 2D image is two individual wires, one from each TPC, with the 1D signals joined at the cathode in the vertical center of the image.  Since the two TPCs drift electrons in opposite directions, away from the central cathode, the 1D signal in the top TPC is inverted compared to the bottom (here, `top' and `bottom' refer to the positions in Figure~\ref{fig:raw_data}).
The signals on each wire are juxtaposed and ordered by increasing wire location, and in this way the collection of 1D readout signals forms a high resolution 2D image.

Each constructed image is effectively a compression of 3D charge locations into a plane that runs perpendicular to every wire in the plane.
For the collection plane, with vertically oriented wires, this amounts to a top-down view of the 3D data, where the vertical information is lost in the projection.
The other two planes give a different projection, $\pm 60$ degrees from vertical, which has the effect of moving the X positions of each charge deposition, while maintaining the Y position, as compared to the vertical projection. Figure~\ref{fig:raw_data} shows the 3 wire views from the same 3D interaction in SBND.

The 3D position of a point of charge uniquely determines its location in all three images, and therefore the 3D locations of charge depositions are exactly determined from the 2D images for point-like charge.  In practice this inversion task is combinatorically hard with extended objects (and occasionally ambiguous in certain pathological topologies), but some algorithms have made excellent progress \cite{wirecell}.

\section{Related Work}
\label{sec:related}
The task of pixel level segmentation has been explored in depth in computer science journals \cite{FCN,UNet}, as well as in neutrino physics \cite{uboone_segmentation}.  In \cite{UNet}, shortcut connections are introduced to a fully convolutional segmentation network for biological images.  The network we present in this paper is similar to the `UNet' architecture in that it has shortcut connections between down-sampled and up-sampled layers of similar resolution.  More details of the building blocks and architecture are given in Section~\ref{sec:network}.

In \cite{uboone_segmentation}, a modified version of UNet, using residual convolution layers, was deployed to perform pixel-level segmentation of particles based on particle topology; electrons and photons exhibited a broader, ``fuzzy'' topology when compared to ``track''-like particles (protons, muons, pions) which typically are seen as thin, line-like objects.\footnote{The ``fuzzy''ness of electromagnetic particles is due to the electromagnetic cascade or shower of particles initiated by an electron or photon with enough energy to produce more particles.}  The network was trained for 512x512 square images of data from the MicroBooNE detector, and the result was a successful first application of UNet style segmentation techniques to  LArTPC neutrino data.  Following \cite{uboone_segmentation}, the network described in this paper also applies a series of residual blocks instead of pure convolutions at each image resolution, hence is referred to as `UResNet'.

Additionally, in \cite{domin2019scalable}, the authors introduce a spatially sparse, UResNet style architecture for particle-wise segmentation labels in both a 2D and 3D LArTPC-like dataset.  Their result is based purely on \texttt{GEANT4}~\cite{geant} information, meaning that the images did not include the simulation of electronic effects, nor drift-induced effects such as diffusion or absorption of electrons.
Nevertheless, this is a novel technique that has broad applicability in neutrino physics.  The results presented here use a dense convolutional network, however it is notable that a sparse implementation of the results presented here could deliver gains in performance and computational efficiency.

In MicroBooNE analyses, classical reconstruction techniques are used to reject cosmic ray particles on a particle-by-particle basis, after particles have been ``reconstructed'' into distinct entities with traditional pattern recognition analyses.  For example, in an analysis of charged current muon neutrino \cite{microboone_numu} there is still a background of approximately 35\% cosmic or cosmic-contaminated interactions at 50\% signal selection efficiency.
The results presented here have been developed with the SBND TPC and geometry in mind, but should apply well to the MircoBooNE or ICARUS geometries, also along the Booster Neutrino Beam and part of the SBN Program.  In general,, the techniques presented here are intended to augment analyses such as \cite{microboone_numu} to gain better background rejection and better signal efficiency.
\section{Training}
\label{sec:training}

\begin{figure}
\begin{centering}
    \includegraphics[width=0.6\columnwidth]{PixelOccupancy.png}
    \caption{Distribution of pixel occupancies, by label, in this dataset.  In general, the cosmic-labeled pixels are less than 1\% of pixels and the neutrino-labeled pixels are less than 0.3\%}
    \label{fig:pixel_occupancy}
\end{centering}
\end{figure}

The network here is trained on a down-sampled version of the full-event images, so each event represents three planes of data at a height of 640 pixels and a width of 1024 pixels, for a total of 655,360 pixels per plane and 3 planes.  Though it would be ideal to train on full-resolution images, this is prohibitive computationally as the network doesn't fit into RAM on current generation hardware.

The number of active (non-zero) pixels varies from image to image. In general the number of pixels which have some activity, either from particle interactions or simulated noise, is approximately 11,000 per plane.  Of these, approximately 2300 per plane on average are from cosmic particles, and merely $\sim$250 per plane are from neutrino interactions, on average.  See Figure~\ref{fig:pixel_occupancy} for more details.

To speed up training and ensure the neutrino pixels, which are the most important scientifically, are well classified, we adopt a weight scaling technique.  The loss for each pixel is a 3 category cross entropy loss, and the traditional loss per plane would be the average over all pixels in that plane. Here, instead, we boost the loss of cosmic pixels by a factor of 1.5, and neutrino pixels by a factor of 10.  The final loss is averaged over all pixels in all three planes.  We also experimented with a loss-balancing technique where, in each image, the weight for each pixel is calculated so the product of the total weight of all pixels in each category is balanced: $weight_{background} \times N_{background} = weight_{cosmic} \times N_{cosmic} = weight_{neutrino} \times N_{neutrino}$. Experimentally, we find that more aggressive loss boosting of neutrino and cosmic pixels leads to blurred images around the cosmic and neutrino pixels, as those pixels are heavily de-weighted as background pixels.  In future studies, we plan to investigate the use of dynamic loss functions such as focal loss~\cite{focal_loss} to allow better balancing of background to significant pixels throughout training.

We report here the performance of several variations of the network, in order to examine the properties of the final accuracy and determine the best network.  We test several variations of the network.  The baseline model is as described above, trained with the mild weight balancing, using an RMSProp \cite{rmsprop} optimizer.  For variations we train the same network with the following modifications:
\begin{itemize}
    \item \textbf{Concatenated Connections} - instead of additive connections across the ``U'', we use concatenation and 1x1 convolutions.
    \item \textbf{Cross-plane Blocked} - the concat operation blocked at the deepest layer (no cross-plane information), effectively using a single-plane network 3 times simultaneously.
    \item \textbf{Batch Size $\times$ 2 } - a minibatch size of 16, instead of 8, is used.
    \item \textbf{Convolutional Upsample} - convolutional up-sampling instead of interpolation up-sampling.
    \item \textbf{Num. Filters / 2} - fewer initial filters (8 instead of 16).
    \item \textbf{No Loss Balance} - all pixels are weighted equally without regard to their label.
    \item \textbf{Larger Learning Rate} - the learning rate is set to 0.003 (10x higher).
    \item \textbf{Non Residual} - no residual connections in the down-sampling and up-sampling pass.
    \item \textbf{Adam Optimizer} - unmodified network trained with Adam Optimizer \cite{Adam}.
    \item \textbf{Full Balance} - a full loss balancing scheme where each category is weighted such that the sum across pixels of the weights for each category is 1/3.
\end{itemize}

All models, except one, are trained with a minibatch size of 8 ($\times$ three images, one per plane).  The learning rate is set to 0.0003, except for the network that uses a higher learning rate.  The other network is trained with a larger batch of 16 images.  Due to the memory requirements of this network, a single V100 instance can accommodate only batch size 1.  These networks were trained in parallel on 4 V100 devices, using gradient accumulation to emulate larger batch sizes.  Figure~\ref{fig:training_metrics} shows the progression of the metrics while training the baseline model.

\begin{figure}
    \centering
    \includegraphics[width=0.49\textwidth]{training_figures/acc_non_bkg.pdf}
    \includegraphics[width=0.49\textwidth]{training_figures/loss.pdf}
    \includegraphics[width=0.49\textwidth]{training_figures/cosmic_iou.pdf}
    \includegraphics[width=0.49\textwidth]{training_figures/neutrino_iou.pdf}
    \caption{The training progression of the baseline model, trained for 25k iterations. The light blue curve is the training performance at each step, overlaid with a smoothed representation of the same data, and a smoothed representation of the test set.}
    \label{fig:training_metrics}
\end{figure}

\begin{table}
\centering
\begin{tabular}{rcccc}
\multicolumn{1}{l}{} & Acc. Non 0 & Cosmic IoU & Neutrino IoU & Mean IoU \\
Baseline             & 0.951      & 0.908      & 0.606        & 0.757    \\
Concat. Connections  & 0.947      & 0.898      & 0.609        & 0.753    \\
Cross-plane Blocked  & 0.942      & 0.898      & 0.571        & 0.734    \\
Batch Size x 2       & 0.956      & 0.914      & 0.698        & 0.806    \\
Convolution Upsample & 0.938      & 0.898      & 0.539        & 0.718    \\
Num. Filters / 2     & 0.930      & 0.887      & 0.457        & 0.672    \\
No Loss Balance      & 0.913      & 0.882      & 0.544        & 0.713    \\
Larger Learning Rate & 0.896      & 0.852      & 0.447        & 0.649    \\
Non Residual         & 0.944      & 0.904      & 0.584        & 0.744    \\
Adam Optimizer       & 0.904      & 0.852      & 0.509        & 0.680    \\
Full Balance         & 0.940      & 0.720      & 0.339        & 0.530
\end{tabular}
\caption{A comparison of the performance metrics for the various networks trained.  The best result in each metric is highlighted.  The ``Mean IoU" is the mean of the cosmic and neutrino IoU values. ``Acc. Non 0'' refers to the non-background accuracy.\label{tab:metrics} }
\end{table}

In Table~\ref{tab:metrics}, we compare the metrics for the different loss schemes and for the network with the concatenate operation blocked.  We see good performance in the baseline model, however the models with fully balanced loss and without a concatenate operation are degraded.  The full loss balancing exhibits a `blurring' effect around the cosmic and neutrino pixels, since the penalty for over-predicting in the vicinity of those points is minimal.  Since nearly half of all events have some overlap between cosmic and neutrino particles, this significantly degrades performance.  We also see that using a less extreme loss weighting performs better than no weighting at all, due to the relatively low number of neutrino pixels.  Notably, the network with the concatenate connections blocked at the deepest layer (therefore, no cross plane correlation), performs more poorly than the baseline model with every other parameter held constant.  Notably, the larger learning rate and use of the adaptive Adam optimizer give poor results with this network.

The larger batch size shows the best performance, including in the average of both IoU metrics.  The cosmic IoU is higher than the neutrino IoU due to the difference in difficulty in these labels: many more cosmic pixels implies that errors of a few pixels have a small effect on the cosmic IoU, and a large detrimental effect on the neutrino IoU.  We speculate that increasing the batch size further will improve results and will investigate this further with the use of a massive computing system needed to accommodate this large network at a high batch size for training.

As a final comment on the training process, we note that this network is expensive to train and has challenging convergence properties.  This has limited the experiments performed on model and training hyperparameters.  We expect a future result to investigate hyperparameters in a systematic way.
In the following section, we use the model trained with a minibatch size of 16, ‘Batch Size x2’, as it had the best performance on the test set.


\section{Introduction}

The Polya's  permanent problem has been studied intensively since 1913. The main idea of the problem is to calculate the permanent of a given matrix via the determinant of the transformed matrix. The following problems are related to Polya's work \cite{GP1913}.

\begin{quote}
	\textbf{Problem 1} For a given $n \times n$ matrix $A=(a_{ij})$, does there exist a uniform way of affixing $\pm$ sign such that $\operatorname{per}(a_{ij})=\det(\pm a_{ij})$?\\
	\textbf{Problem 2} Does there exist a transformation $\phi:M_n(\mathbb{F})\rightarrow M_m(\mathbb{F})$ satisfying $\operatorname{per}(A)=\det(\phi(A))$ for all $A \in M_n(\mathbb{F})$?\\
	\textbf{Problem 3} For a given $n \times n$ $\{0,1\}-$matrix $A$, does there exist a matrix $B$ obtained by changing some of the $1$ entries of $A$ to $-1$ such that $\operatorname{per}(A)=\det(B)$?
\end{quote}

In \cite{GZ1913}, Szego observed that, if $n \neq 2$, the uniform way as in Problem 1 does not exist. In 1961, Problem 2 was also proved negative for $m=n>2$ by Marcus and Minc (cf. \cite{MM1961}).

The motivation of this paper is Problem 3. In \cite{WM2004}, McCuaig showed that Problem 3 has other 24 versions while itself is referred as Version 10. Most of these versions are in the form of graph theoretical questions. Our interest is in the following two versions.

\begin{quote}
	\textbf{Version 11} Does a given digraph have a dicycle of even length?\\
	\textbf{Version 12} For a given square nonnegative matrix $A$, does $\operatorname{per}(A)=\det(A)$?
\end{quote}

These two versions are claimed to be equivalent to each other by the statements a) and b) in Theorem 10 \cite{WM2004} which stated as follow.

\begin{thm}
	Let $A$ be a square nonnegative matrix such that $\det(A)$ has a positive term. Then the bipartite graph $G$ of $A$ has a perfect matching. Let $D$ be a bipartite graph corresponding to $G$. The following statements are equivalent.
	\begin{itemize}
		\item[a)] All dicycles of $D$ have odd length.
		\item[b)] $\operatorname{per}(A)=\det(A)$.
	\end{itemize}
\end{thm}

The digraph $D$ in this theorem is the same graph as $G(A)$ defined in this paper (see Section 3). However, if we choose $\sigma = (1234)(5678)$, we can see that $\operatorname{per}(P_\sigma)=1=\det(P_\sigma)$ while $G(P_\sigma)$ contains 2 cycles of length 4.  Since Theorem 10 \cite{WM2004} contains neither a proof nor a citation, we have no clue about a cause of the slip. Thus, in this paper, we assume one more assumption to make this theorem holds.

In this paper, for every nonnegative matrix $A$ with $\operatorname{per}(A)\neq 0$, a necessary and sufficient condition for $\operatorname{per}(A)=\lvert \det(A) \rvert$ is investigated. We also give a sufficient condition for $\operatorname{per}(A)=\det(A)$ so that the condition does not deal with a graph. Finally, by using those results, a characterization for $\operatorname{per}(A^k) = \det(A^k)$ for all $k \in \mathbb{N}$ is also established.

\section{Preliminaries}

In this section, basic definitions, notations, and properties are given. Firstly, we begin with those of matrices.

For any matrix $A$, we denote $A_{ij}$ the $(i,j)$-entry of $A$. For a given set $S$, a matrix $A$ is called an \textit{$S$-matrix} if each entry of $A$ is an element of $S$. An $S$-matrix $A$ is said to be a \textit{sign pattern matrix} if $S=\{-,0,+\}$. A matrix $A$ is said to be \textit{complex} (resp. \textit{real},\textit{ nonnegative}) if $S$ is the set of all complex (resp. real, nonnegative) numbers. For a sign pattern matrix $\Gamma$, the set $Q(\Gamma)$ denotes the set of real matrices whose each entry has the same sign as $\Gamma$.

The \textit{permanent} and the \textit{determinant} of an $n \times n$ complex matrix $A$, denoted by $\operatorname{per}(A)$ and $\det(A)$, respectively, are defined as
\begin{equation*}
\hbox{$\operatorname{per}(A)=\sum\limits_{\sigma\in S_n}\prod\limits_{i=1}^n A_{i\sigma(i)}$ and $\det(A)=\sum\limits_{\sigma\in S_n}\operatorname{sgn}(\sigma)\prod\limits_{i=1}^n A_{i\sigma(i)}$.}
\end{equation*}
For any $n\times n$ matrices $A,B$, we have $\det(BA)=\det(AB)=\det(A)\det(B)$. However, this property does not hold for the permanent. For convenience, for each positive integer $n$ and each $\sigma\in S_n$, we denote $[n]:=\{1,\dots,n\}$ and $L_\sigma(A):=\prod\limits_{i=1}^nA_{i \sigma(i)}$. Recall that for an $n \times n$ matrix $A$,
$$\det(A)=\sum\limits_{\sigma\in A_n}L_\sigma(A) - \sum\limits_{\sigma\in S_n\setminus A_n}L_\sigma(A)$$
and
$$\operatorname{per}(A)=\sum\limits_{\sigma\in A_n}L_\sigma(A) + \sum\limits_{\sigma\in S_n\setminus A_n}L_\sigma(A).$$

So, we can see that $\operatorname{per}(A) = \det(A)$ if and only if $\sum\limits_{\sigma\in S_n\setminus A_n}L_\sigma(A)=0$. Similarly, $\operatorname{per}(A) = -\det(A)$ if and only if $\sum\limits_{\sigma\in A_n}L_\sigma(A)=0$.

Let $A$ be a square nonnegative matrix. We have that $\operatorname{per}(A)\geq \lvert \det(A) \rvert$. Thus, if $\operatorname{per}(A)=0$, then $\det(A)=0$. The characterization for $\operatorname{per}(A)=0$ can be obtained by Frobenius-K\"{o}nig's Theorem; that is, $\operatorname{per}(A)=0$ if and only if $A$ contains $r \times s$ zero submatrix with $r+s=n+1$. In this paper, we only work with nonnegative matrices whose permanent is not zero.

A \textit{permutation matrix} is a square $\{0,1\}$-matrix whose each row and each column contains exactly one $1$. Let $\mathbb{P}_n$ be the set of all $n \times n$ permutation matrices. We have that $\mathbb{P}_n$ is a group under multiplication and isomorphic to the symmetric group $S_n$. For $\sigma \in S_n$, we denote $P_\sigma$ the permutation matrix obtained by permuting each row $i$ to $\sigma(i)$. This means that
\begin{equation*}\label{pm}
(P_\sigma)_{ij} = \left\{
\begin{array}{ll}
1, & \hbox{if $i=\sigma(j)$,} \\
0, & \hbox{otherwise.}
\end{array}
\right.
\end{equation*}
Thus $\operatorname{per}(P_\sigma) = \prod\limits_{i=1}^n(P_\sigma)_{i\,\sigma^{-1}(i)}$. Because of this fact, we should be careful of a confusion of subscripts in each definition. For any two permutation $\sigma,\tau \in S_n$ and any $n \times n$ matrix $A$, $(P_\sigma A P_\tau)_{ij} = A_{\sigma^{-1}(i)\tau(j)}$ for all $i,j \in [n]$.

Next, some definitions and properties in graph theory are given. In this paper, the results is regarded to a special type of graphs, which are called digraphs. Let $G$ be a graph with a vertex set $V$ and an edge set $E$. A \textit{walk} of length $k$ in $G$ is a finite sequence of vertices and edges $v_1e_1v_2e_2v_3\dots v_{k}e_kv_{k+1}$ such that $v_i$ and $v_{i+1}$ incident with $e_i$ for each $i\in[k]$. If a graph $G$ is simple, we can omit $e_1,\dots,e_k$ from the sequence. Here, $v_1$ is called the \textit{origin vertex} while $v_{k+1}$ is the \textit{terminus vertex}. If $v_1,\dots,v_{k+1}$ are all distinct, a walk $v_1\dots v_{k+1}$ is said to be a \textit{path}. A path $v_1\dots v_{k+1}$, when $k\geq3$, is said to be a \textit{cycle} if $v_{k+1}=v_1$; i.e., it is a path whose the origin vertex and the terminus vertex are the same vertex.

A \textit{digraph} or \textit{directed graph} is a graph in which each edge is assigned a direction. An edge with a direction is called an \textit{arc}. A cycle in a digraph is called a \textit{dicycle}. Let $G$ be a digraph with a vetex set $\{v_1,\dots,v_n\}$. The \textit{adjacency matrix} of $G$ is an $n \times n$ $\{0,1\}$-matrix $A$ such that $A_{ij}=1$ if and only if $v_iv_j$ is an arc of $G$. So, in case $G$ is simple, all diagonal entries of $A$ are 0. The following theorem discusses a relation between the adjacency matrix of a graph and the number of walks.
\begin{thm}[Theorem 2.2 \cite{CLZB}]
	Let $G$ be a graph with a vertex set $\{v_1, \dots, v_n\}$ and $A$ is the adjacency matrix of $G$. For each positive integer $k$, the number of walks of length $k$ from $v_i$ to $v_j$ in $G$ is the $(i,j)$-entry of $A$.
\end{thm}

For a matrix $A$, the support of $A$ is the set $\{(i,j) \mid A_{ij}\neq 0\}$. Let $A,B$ be $n \times n$ nonnegative matrices. If $\operatorname{per}(A) = \lvert \det(A) \rvert$ and the support of $B$ is a subset of the support of $A$, then $\operatorname{per}(B) = \lvert \det(B) \rvert$. Define a function $\phi$ from $M_n(\mathbb{C})$ onto the set of all $n\times n$ $\{0,1\}$-matrices by $(\phi(A))_{ij}=0$ if and only if $A_{ij}=0$. Let $\Gamma$ be a sign pattern matrix. We can see that $\phi(A) = \phi(B)$ for any matrices $A,B\in Q(\Gamma)$. We denote the $\{0,1\}$-matrix $\phi(A)$ by $\phi(\Gamma)$. Then the following Lemma holds.

\begin{lem}\label{cor1}
	Let $\Gamma$ be a sign pattern matrix. Then the following statements are equivalent:
	\begin{enumerate}
		\item $\operatorname{per}(A) = \lvert \det(A) \rvert$ for all $A \in Q(\Gamma)$,
		\item $\operatorname{per}(A) = \lvert \det(A) \rvert$ for some $A \in Q(\Gamma)$,
		\item $\operatorname{per}(\phi(\Gamma)) = \lvert \det(\phi(\Gamma)) \rvert$.
	\end{enumerate}
\end{lem}

Lemma \ref{cor1} can be extended to the version of complex matrices. Let $\Gamma$ be a $\{0,\ast\}$-matrix. We define the set $Q(\Gamma)$ analogue to the version of sign pattern matrix by $Q(\Gamma)=\{A\in M_n(\mathbb{C})\mid A_{ij}=0\text{ if and only if }\Gamma_{ij}=0\}$. The following lemma is also obtained immediately.

\begin{lem}\label{cor22}
	Let $\Gamma$ be a $\{0,\ast\}$-matrix. Then the following statements are equivalent:
	\begin{enumerate}
		\item $\operatorname{per}(A) = \pm\det(A)$ for all $A \in Q(\Gamma)$,
		\item $\operatorname{per}(A) = \pm\det(A)$ for some $A \in Q(\Gamma)$,
		\item $\operatorname{per}(\phi(\Gamma)) = \pm\det(\phi(\Gamma))$.
	\end{enumerate}
\end{lem}

\section{Main Results}

If we have an $n \times n$ matrix $A$, we can construct the digraph $G(A)$ of $A$ with a vertex set $[n]$ and an edge set $\{ij \mid A_{ij}\neq 0 \text{ and } i\neq j\}$.

\begin{thm}\label{lem1}
	Let $A$ be a nonnegative matrix such that $A_{ii}>0$ for all $i\in[n]$. Then $\operatorname{per}(A)=\det(A)$ if and only if the following statements hold:
	\begin{enumerate}
		\item For all distinct $i,j\in[n]$, $A_{ij}=0$ or $A_{ji}=0$.
		\item The digraph $G(A)$ contains no cycle of even length.
	\end{enumerate}
\end{thm}
\begin{proof}
	Assume that $\operatorname{per}(A)=\det(A)$. Then, for each $\sigma \in S_n,$ we have $L_\sigma(A)\neq 0$ implies $\sigma\in A_n$. Suppose that there exists distinct $i,j\in[n]$ such that neither $A_{ij}$ nor $A_{ji}$ is $0$. Because all diagonal entries are not zero, we obtain that $L_{(ij)}(A)\neq 0$. This contradicts with $\operatorname{per}(A)=\det(A)$ since $(ij)$ is not in $A_n$. Thus (1) is true. To prove (2), suppose that $v_1 v_2 \dots v_k v_1$ is a cycle of length $k$ in $G(A)$. Let $c=(v_1 v_2 \dots v_k) \in S_n$. By the definition of $G(A)$, we have $A_{v_k v_1}\neq 0$ and $A_{v_i v_{i+1}}\neq 0$ for all $i\in[k-1]$. Because all diagonal entries of $A$ are not zero, $L_c(A) \neq0$. So, $c \in A_n$; i.e., $k$ is odd. Therefore (2) holds.

	Conversely, suppose that (1) and (2) occur. Let $c$ be a cycle of length $k$ in $S_n$ such that $L_c(A)\neq 0$. Then $c = (i\, c(i)\, \dots \,c^{k-1}(i))$ for some $i \in [n]$. Claim that $k$ is odd. Because $L_c(A)\neq 0$, we can conclude that $$A_{i\, c(i)}, A_{c(i)\,c^2(i)}, \dots, A_{c^{k-2}(i)\, c^{k-1}(i)}, A_{c^{k-1}(i)\, i}$$ are all positive. If $k=2$, then $A_{i \, c(i)}$ and $A_{c(i) \, i}$ are both positive. This contradicts to (1). Thus $k\geq 3$. This means that $i \, c(i) \, \dots \, c^{k-1}(i) \, i$ is a cycle in $G(A)$. Because of (2), $k$ is odd. Let $\tau\in S_n$ such that $L_\tau(A) \neq 0$. If $\tau = c_1 \cdots c_m$ is the disjoint cycles decomposition, then $L_{c_i}(A) \neq 0$ for all $i \in [m]$. Thus each $c_i$ is a cycle of odd length. This implies that $\tau\in A_n$. Since $\tau$ is arbitrary, $\operatorname{per}(A)=\det(A)$.
\end{proof}

By Theorem \ref{lem1}, the following corollary is obtained immediately.

\begin{cor}\label{corthm1}
	Let $A$ be a nonnegative matrix. Then $0\neq \operatorname{per}(A)=\lvert \det(A) \rvert$ if and only if the following statements hold:
	\begin{enumerate}
		\item There exists $\tau \in S_n$ such that $L_\tau(A)\neq 0$.
		\item For all distinct $i,j\in[n]$, $(AP_\tau)_{ij}=0$ or $(AP_\tau)_{ji}=0$.
		\item The digraph $G(AP_\tau)$ contains no cycle of even length.
	\end{enumerate}
	In particular, if $A$ satisfies $(1)$-$(3)$, then $\operatorname{per}(A)=\operatorname{sgn}(\tau)\det(A)$.
\end{cor}
\begin{proof}
	Suppose that $0\neq \operatorname{per}(A) = \lvert\det(A)\rvert$. The statement (1) is obvious because $\operatorname{per}(A)\neq 0$. Note that $A_{i \tau(i)} = (AP_\tau)_{ii}$ for all $i\in[n]$. This means that all diagonal entries of $AP_\tau$ are positive. Note that $\det(AP_\tau) = \operatorname{sgn}(\tau)\det(A)$. Since $\operatorname{per}(A)=\lvert \det(A) \rvert$, we can conclude that $\det(A)=\operatorname{per}(A)$ if and only if $\tau \in A_n$. This implies that $$\operatorname{per}(AP_\tau)=\operatorname{per}(A)=\lvert \det(A) \rvert = \operatorname{sgn}(\tau)\det(A) = \det(AP_\tau).$$
	By Theorem \ref{lem1}, (2) and (3) occur.

	Conversely, suppose that (1)-(3) happen. By Theorem \ref{lem1}, we have $$\operatorname{per}(A)=\operatorname{per}(AP_\tau)=\det(AP_\tau)=\operatorname{sgn}(\tau)\det(A).$$
	Since $\operatorname{per}(A)$ is positive, $\operatorname{per}(A) = \lvert \det(A) \rvert$.
\end{proof}

Note that the number of zero entries in $A$ is the same number as in $AP_\tau$. Therefore, the following corollary is also true.

\begin{cor}\label{corthm2}
	Let $A$ be nonnegative matrix such that $0 \neq \operatorname{per}(A)=\lvert \det(A)\rvert$. Then $A$ contains at least $\frac{n^2-n}{2}$ zero entries.
\end{cor}
The condition 1 of Theorem \ref{lem1} also allows us to conclude that:
\begin{cor}
	Let $A$ be an $n \times n$ positive semidefinite matrix. Then $\operatorname{per}(A)$=$\det(A)$ if and only if $A$ contains a zero rows or $A$ is diagonal.
\end{cor}
\begin{proof}
	Note that every principal submatrix of a positive semidefinite matrix is also positive semidefinite. Suppose that there exists $i\in[n]$ such that $A_{ii}=0$. For each $j\in[n]$ such that $j\neq i$, we have $$\begin{pmatrix}
	A_{ii} & A_{ij}\\
	A_{ji} & A_{jj}
	\end{pmatrix}$$ is positive semidefinite. This implies that the determinant of this matrix is nonnegative. Since $A_{ii}=0$ and $A$ is Hermitian, we have $A_{ij}=0=A_{ji}$. Then all entries in the $i$-th row of $A$ are zero (cf.\cite{FZhangB}). Suppose that $A_{ii}\neq 0$ for all $i\in[n]$. By Theorem \ref{lem1}, for any distinct $i,j\in[n]$, $A_{ij}=0$ or $A_{ji}=0$. Since positive semidefinite matrices are Hermitian, $A$ is diagonal.
\end{proof}

By the construction of $G(A)$, if $A$ is a nonnegative matrix, we can see that $G(A)=G(\phi(A))$. Moreover, $\phi(A)-diag((\phi(A))_{11},\dots,(\phi(A))_{nn})$ is also the adjacency matrix of $G(A)$.
The following Theorem is a sufficient condition for $\operatorname{per}(A)=\lvert \det(A) \rvert$.
\begin{thm}\label{thm1} Let $A$ be a $\{0,1\}$-matrix. Suppose that the following statements hold:
	\begin{enumerate}
		\item There exists $\tau\in S_n$ such that $(AP_\tau)_{ii} = 1$ for all $i\in[n]$.
		\item For each $k = 1,\dots,\lfloor\frac{n}{2}\rfloor$ and each $i\in[n]$, we have $(B^{2k})_{ii}=((B^k)_{ii})^2$, where $B = AP_\tau-I$.
	\end{enumerate}
	Then $0\neq \operatorname{per}(A) = \operatorname{sgn}(\tau)\det(A)$.
\end{thm}
\begin{proof}
	Suppose that (1) and (2) occur. By (1), it is obvious that $\operatorname{per}(A)\neq 0$. Let $\theta\in S_n$ such that $L_\theta(A) = 1$. Since $A_{i \,\tau(i)}=(AP_\tau)_{i\,\tau^{-1}\theta(i)}$ for each $i\in[n]$, $$1=L_\tau(A) = L_{\tau^{-1}\theta}(AP_\tau).$$  Note that $B_{ii}=0$ for all $i\in[n]$. Let $\tau^{-1}\theta = c_1\cdots c_r$ be the disjoint cycles decomposition. If $c_1$ is a transposition, says $(jl)$, then $B_{jl}$ and $B_{lj}$ are positive. This means that $(B^2)_{jj} \geq B_{jl}B_{lj} > 0$. This cannot occur because of (2) with $k=1$. Thus $c_1$ is not a transposition; that is, $c_1$ is a cycle of length at least $3$. Then $G(AP_\tau)$ contains the dicycle that corresponding to $c_1$. We know that $(B^{2k})_{ii}$ is the number of walks of length $2k$ whose origin vertex and terminus vertex are $i$, while $((B^k)_{ii})^2$ is equal to the number of walks of length $2k$ whose origin vertex and terminus vertex are $i$ obtained by joining any two walks of length $k$ whose origin vertex and terminus vertex are $i$. By (2), $G(B)$ contains no cycle of even length. Thus, $c_1$ is a cycle of odd length. Since the composition of any two disjoint cycles is commutative, $c_1$ can be viewed arbitrarily; namely, $c_1,\dots,c_r$ are all cycles of odd length. This implies that $\tau^{-1}\theta$ is an even permutation. So, $\theta$ and $\tau$ have the same sign. Since $\theta$ is arbitrary for which $L_\theta(A)\neq 0$, $\operatorname{per}(A)=\operatorname{sgn}(\tau)\det(A)$.
\end{proof}

By Lemma \ref{cor22}, for a given complex matrix $A$, $\operatorname{per}(A) =  \operatorname{sgn}(\tau)\det(A)$ if $\phi(A)$ satisfies (1) and (2) in Theorem \ref{thm1}.

\begin{exaple}\label{ex1}
	Let
	$$\Gamma=\begin{pmatrix}
	0 & 0 & \ast & \ast & 0\\
	0 & 0 & 0 & \ast & \ast\\
	\ast & 0 & \ast & 0 & \ast\\
	\ast & \ast & 0 & 0 & 0\\
	0 & \ast & \ast & 0 & 0
	\end{pmatrix}.$$

	We have that
	$$\phi(\Gamma)=\begin{pmatrix}
	0 & 0 & 1 & 1 & 0 \\
	0 & 0 & 0 & 1 & 1  \\
	1 & 0 & 1 & 0 & 1 \\
	1 & 1 & 0 & 0 & 0 \\
	0 & 1 & 1 & 0 & 0
	\end{pmatrix}.$$

	Choose $\tau = (13524)$, we can see that
	$$B:=\phi(\Gamma)P_\tau-I = \begin{pmatrix}
	0 & 1 & 0 & 0 & 0 \\
	0 & 0 & 1 & 0 & 0  \\
	1 & 0 & 0 & 1 & 0 \\
	0 & 0 & 0 & 0 & 1 \\
	1 & 0 & 0 & 0 & 0
	\end{pmatrix}.$$

	By calculation, we have
	$$B^2 = \begin{pmatrix}
	0 & 0 & 1 & 0 & 0 \\
	1 & 0 & 0 & 1 & 0  \\
	0 & 1 & 0 & 0 & 1 \\
	1 & 0 & 0 & 0 & 0 \\
	0 & 1 & 0 & 0 & 0
	\end{pmatrix} \text{ and } B^4=\begin{pmatrix}
	0 & 1 & 0 & 0 & 1 \\
	1 & 0 & 1 & 0 & 0  \\
	1 & 1 & 0 & 1 & 0 \\
	0 & 0 & 1 & 0 & 0 \\
	1 & 0 & 0 & 1 & 0
	\end{pmatrix}.$$
	Thus, $(B^{2k})_{ii}=((B^k)_{ii})^2$, where $k =1,2$. Because $\operatorname{sgn}(\tau)=1$, by Theorem \ref{thm1}, $\operatorname{per}(A)=\det(A)$. By Lemma \ref{cor22}, we also have that $\operatorname{per}(A)=\det(A)$ for all $A \in Q(\Gamma)$.
\end{exaple}

Now, if $A$ is a nonnegative matrix such that $\operatorname{per}(A)=\det(A)$, we focus on the equality of $\operatorname{per}(A^k)$ and $\det(A^k)$. We know that $\det(A^k)=(\det(A))^k$. However, this property is not necessarily true for the permanent. So, $\operatorname{per}(A)=\det(A)$ does not mean $\operatorname{per}(A^k)=\det(A^k)$.

\begin{thm}\label{thm2}
	Let $A$ be an $n\times n$ nonnegative matrix such that $\operatorname{per}(A)=\det(A)$ and $A_{ii}\neq 0$ for all $i\in[n]$. Denote $e$ the identity element of $S_n$. Then the following statements are equivalent:
	\begin{enumerate}
		\item $\operatorname{per}(A^k)=\det(A^k)$ for all $k \in\mathbb{N}$.
		\item $\operatorname{per}(A^2)=\det(A^2)$.
		\item $\operatorname{per}(A)=L_e(A)$.
		\item $\operatorname{per}(A^k)=L_e(A^k)$ for all $k\in\mathbb{N}$.
	\end{enumerate}
\end{thm}
\begin{proof}
	It is obvious that (1) implies (2) and (4) implies (1).

	Suppose that (3) is not true. Then there exists a cycle $\tau\in S_n$ such that $L_\tau(A)\neq 0$. Since $\operatorname{per}(A)=\det(A)$, $\tau$ must be a cycle of odd length. So, there exists $i_0 \in [n]$ such that $\tau=(i_0 \, \,\tau(i_0)\, \tau^2(i_0)\, \dots\, \tau^{m-1}(i_0))$, where $m$ is the length of $\tau$. Let $D=diag(A_{11},\dots,A_{nn})$. Define an $n \times n$ matrix $B$ by
	\begin{equation*}
	B_{ij} = \left\{
	\begin{array}{ll}
	A_{ij}, & \hbox{if $i\neq j = \tau(i)$,} \\
	0, & \hbox{otherwise.}
	\end{array}
	\right.
	\end{equation*}
	Then $A$ can be considered as
	$$A=D+B+X$$
	for some nonnegative matrix $X$. So,
	$$A^2 = D^2 + DB + B^2 + Y$$
	for some nonnegative matrix $Y$. Note that $(B^2)_{i_0 \, \tau^2(i_0)} = B_{i_0 \, \tau(i_0)}B_{\tau(i_0)\,\tau^2(i_0)}\neq 0$. It follows that $(A^2)_{i_0 \, \tau^2(i_0)}\neq 0$. For each $i\in[n]$, since $(D^2)_{ii}\neq 0$, we have $(A^2)_{ii}\neq 0$. Similarly, because $B_{\tau^s(i_0) \,\tau^{s+1}(i_0)}\neq 0$ for all $s\in[m-2]$, $DB_{\tau^s(i_0) \,\tau^{s+1}(i_0)}$, and thus $A_{\tau^s(i_0) \,\tau^{s+1}(i_0)}$ are not zero. Let
	$$\theta = (i_0 \tau^2(i_0) \tau^3(i_0) \dots \tau^{m-1}(i_0)).$$
	We deduce that $\theta$ is a cycle of even length such that $L_\theta(A^2)\neq 0$. So, $\operatorname{per}(A^2)\neq\det(A^2)$. Therefore, (2) implies (3).

	Now, suppose that (3) occurs. It is obvious that (4) is true if $A$ is a diagonal matrix. Suppose that $A$ is not diagonal; that is, $A_{ij}\neq 0$ for some distinct $i,j\in[n]$.  For each cycle $c$ in $S_n$, then $c\neq e$.  By the assumption (3) and the assumption that $A_{ii}>0$ for all $i\in [n]$, we conclude that $L_c(A)=0$; namely, there exists $i\in[n]$ such that $A_{i c(i)}=0$. Let $\tau=(i_0\, \tau(i_0)\, \dots\, \tau^{m-1}(i_0))$ be the cycle of length $m$ such that $A_{i_0\, \tau(i_0)}, A_{\tau(i_0)\,\tau^2(i_0)},\dots,A_{\tau^{m-2}(i_0)\,\tau^{m-1}(i_0)}$ are not zero. Now, we write $A = D + X$, where $D = diag(A_{11},\dots,A_{nn})$ and $X = A-D$. Thus, for each positive integer $k \geq 2$,
	$$A^k = (D+X)^k = D^k+D^{k-1}X + Y,$$
	for some nonnegative matrix $Y$. This implies that $(A^k)_{ii} \neq 0$ for all $i \in [n]$. Moreover,  $X_{i_0 \, \tau(i_0)}=A_{i_0\,\tau(i_0)}$ and $X_{\tau^s(i_0)\, \tau^{s-1}(i_0)} = A_{\tau^s(i_0)\, \tau^{s-1}(i_0)} \neq 0$ for all $s \in [m-2]$. These facts and the term $D^{k-1}X$ of $A^k$ implies that $$(A^k)_{i_0\, \tau(i_0)}, (A^k)_{\tau(i_0)\,\tau^2(i_0)},\dots,(A^k)_{\tau^{m-2}(i_0)\,\tau^{m-1}(i_0)}$$ are not zero. Suppose that there exists a positive integer $r \geq 2$ such that $(A^r)_{\tau^{m-1}(i_0), i_0}\neq 0$. There must exist $t_1\in[n]$ such that $(A^{r-1})_{\tau^{m-1}(i_0)\,t_1}$ and $A_{t_1 \,i_0}$ are not zero. By the similar reason, there exists $t_2\in[n]$ such that $(A^{r-2})_{\tau^{m-1}(i_0)\,t_2}$ and $A_{t_2\,t_1}$ are not zero. By repeating this process, there exists $t_1,t_2,\dots,t_{r-1}$ such that $A_{\tau^{m-1}(i_0)\,t_{r-1}}, A_{t_{r-1}\,t_{r-2}},\dots,A_{t_1\,i_0}$ are not zero. Thus,
	$$i_0\,\tau(i_0)\,\dots\,\tau^{m-1}(i_0)\,t_{r-1}\,t_{r-2}\,\dots\,t_1\, i_0$$
	is a walk from $i_0$ to itself in $G(A)$. Since every walk from $u$ to $v$ contains a path from $u$ to $v$ and $A_{\tau(i_0)\,i_0}=0$ (by Theorem \ref{lem1}), there exists a cycle $\theta$ for which $\theta\neq e$ such that $L_\theta(A) \neq 0$. This contradicts to (3). Therefore $(A^k)_{\tau^{m-1}(i_0)\, i_0}= 0$ (i.e., $L_\tau(A^k)=0$) for all positive integer $k$.  Since $\tau$ is arbitrary cycle in $S_n$, $\sigma\neq e$ implies $L_\sigma(A^k)=0$ for all $k\in \mathbb{N}$.  Therefore (4) holds.
\end{proof}

Note that Theorem \ref{thm2} requires the assumption that $A_{ii}\neq 0$. The following theorem is the improvement for which a nonnegative matrix does not need that property.
\begin{thm}\label{thm3}
	Let $A$ be a nonnegative matrix such that $\operatorname{per}(A)\neq 0$. Then there exists $\tau \in S_n$ such that $L_e(AP_\tau)\neq 0$, where $e$ is the identity element of $S_n$. Then $\operatorname{per}(A^k)=\det(A^k)$ for all $k\in\mathbb{N}$ if and only if the following statements hold:
	\begin{enumerate}
		\item $\tau\in A_n$.
		\item $\operatorname{per}(A) = L_\tau(A)$.
		\item $\operatorname{per}(A^s)=L_e(A^s)$, where $s$ is the order of $\tau$.
	\end{enumerate}
\end{thm}
\begin{proof}
	Suppose that $\operatorname{per}(A^k)=\det(A^k)$ for all $k \in \mathbb{N}$. Because $\operatorname{per}(A)=\det(A)$, it is obvious that $\tau \in A_n$. If we consider $A$ as $DP_{\tau^{-1}} + X$ for some nonnegative matrix $X$ and invertible diagonal matrix $D$, we can see that
	$$A^s = (DP_{\tau^{-1}} + X)^s = (DP_{\tau^{-1}})^s+Y,$$
	for some nonnegative matrix $Y$. Note that $DP_{\tau^{-1}} = P_{\tau^{-1}}\acute{D}$ for some invertible diagonal matrix $\acute{D}$. Thus $(DP_{\tau^{-1}})^s = (P_{\tau^{-1}})^s\tilde{D} = \tilde{D}$, for some invertible diagonal matrix $\tilde{D}$. This implies that $(A^s)_{ii}\neq 0$ for each $i \in [n]$. Since $\operatorname{per}(A^k)=\det(A^k)$ for all $k\in\mathbb{N}$, we also have that $\operatorname{per}((A^s)^k)=\det((A^s)^k)$ for all $k \in \mathbb{N}$. By Theorem \ref{thm2}, (3) is true. To prove (2), suppose that there exists $\theta \in A_n$ such that $L_\theta(A)\neq 0$. Then there exists invertible diagonal matrices $D_1,D_2$ and a nonnegative matrix $X$ such that $$A=D_1P_{\tau^{-1}}+D_2P_{\theta^{-1}}+X.$$ Thus, because $$A^s=(D_1P_{\tau^{-1}}+D_2P_{\theta^{-1}}+X)^s = (D_1P_{\tau^{-1}})^{s-1}(D_2P_{\theta^{-1}})+Y= D_3P_{\tau\theta^{-1}}+Y$$ for some nonnegative matrix $Y$ and some invertible diagonal matrix $D_3$. Since (3) holds, $D_3P_{\tau\theta^{-1}}$ must be diagonal; that is, $P_{\tau\theta^{-1}}$ is the identity matrix. This happens if and only if $\theta=\tau$. Hence (2) holds.

	Conversely, suppose that (1)-(3) occur. By Theorem \ref{thm2} again, we have that $L_e((A^s)^m)=\operatorname{per}((A^s)^m)=\det((A^s)^m)$ for all $m\in\mathbb{N}$. This implies that
	\begin{equation}\label{eqpower}
	\hbox{ $\operatorname{per}(A^{ms})=\det(A^{ms})$ for all $m \in \mathbb{N}$.}
	\end{equation}
	Suppose that $\operatorname{per}(A^k)\neq \det(A^k)$ for some $k \in \mathbb{N}$.  Since $\operatorname{per}(A^k)\neq \det(A^k)$, there is an odd permutation $\theta\in S_n$ such that $L_\theta(A^k)\neq 0$. We can consider $A^k$ as
	$$A^k=D_1P_{\theta^{-1}}+X_1$$
	for some invertible diagonal matrix $D_1$ and nonnegative matrix $X_1$. By (2), $A$ can be viewed as $A=D_2P_{\tau^{-1}}+X_2$ for some invertible diagonal matrix $D_2$ and nonnegative matrix $X_2$. By the division algorithm, $k=qs+r$, where $0\leq r <s$. We consider $$A^{s-r}=(D_2P_{\tau^{-1}}+X_2)^{s-r}=(D_2P_{\tau^{-1}})^{s-r}+X_3=D_3P_{(\tau^{-1})^{s-r}}+X_3$$ for some invertible diagonal matrix $D_3$ and nonnegative matrix $X_3$. Since $(q+1)s = k+s-r$, there also exists a invertible diagonal matrix $D_4$ and a nonnegative $X_4$ such that
	$$A^{(q+1)s}=A^kA^{s-r}=(D_1P_{\theta^{-1}}+X_1)(D_3P_{(\tau^{-1})^{s-r}}+X_3)=D_4P_{\theta^{-1}(\tau^{-1})^{s-r}}+X_4.$$
	This yields that $L_\sigma(A^{(q+1)s})\neq 0$, where $\sigma=\theta^{-1}(\tau^{-1})^{s-r}$.
	Since $\tau$ is even and $\theta$ is odd, we have $\sigma=\theta^{-1}(\tau^{-1})^{s-r}$ is an odd permutation.  Consequently, $\operatorname{per}(A^{(q+1)s})\neq \det(A^{(q+1)s})$, which is a contradiction to (\ref{eqpower}) . Hence (2) holds.
\end{proof}

\begin{exaple}\label{ex2}

	Let $$A=\begin{pmatrix}
	0 & 0 & 0 & 1 & 0 & 0 \\
	1 & 0 & 0 & 0 & 0 & 0 \\
	1 & 1 & 0 & 1 & 1 & 0 \\
	0 & 1 & 0 & 0 & 0 & 0 \\
	1 & 1 & 0 & 1 & 0 & 1 \\
	1 & 1 & 1 & 1 & 0 & 0
	\end{pmatrix}.$$ We can see that $\operatorname{per}(A)=\det(A)=L_\sigma(A)=1$, where $\sigma = (142)(356)$. By the calculation, we have
	$$A^{3}=\begin{pmatrix}
	1 & 0 & 0 & 0 & 0 & 0 \\
	0 & 1 & 0 & 0 & 0 & 0 \\
	3 & 3 & 1 & 3 & 0 & 0 \\
	0 & 0 & 0 & 1 & 0 & 0 \\
	3 & 3 & 0 & 3 & 1 & 0 \\
	3 & 3 & 0 & 3 & 0 & 1
	\end{pmatrix}.$$
	Since $\operatorname{per}(A^{3})=\det(A^{3})=L_e(A^3)=1$, by Theorem \ref{thm3}, $\operatorname{per}(A^k) = \det(A^k)$ for all $k \in \mathbb{N}$.
\end{exaple}

By Lemma \ref{cor22}, we can remark that, if $\operatorname{per}(A^k)=\det(A^k)$,  $\operatorname{per}(B^k)=\det(B^k)$ every matrix $B$ with the same support as $A$; that is, if $B$ is the matrix of the pattern
$$A=\begin{pmatrix}
0 & 0 & 0 & \ast & 0 & 0 \\
\ast & 0 & 0 & 0 & 0 & 0 \\
\ast & \ast & 0 & \ast & \ast & 0 \\
0 & \ast & 0 & 0 & 0 & 0 \\
\ast & \ast & 0 & \ast & 0 & \ast \\
\ast & \ast & \ast & \ast & 0 & 0
\end{pmatrix},$$
we can conclude that $\operatorname{per}(B^k)=\det(B^k)$ for every $k\in[n]$.

It is well-known that $\det(A^k)=(\det(A^k))$ for each square matrix $A$. So, if we assure that $A$ satisfies (1)-(3) in Theorem \ref{thm3}, the permanent of $A^k$ can be obtained from $\operatorname{per}(A)$ for each $k \in \mathbb{N}$. However, when the size of a matrix is larger, verifying those conditions also seem to be more difficult. The following theorem may help in this situation.

\begin{thm}
	Let $A$ be an $n\times n$ nonnegative matrix such that $\operatorname{per}(A)\neq 0$. Then $\operatorname{per}(A)=L_\tau(A)$ for some $\tau \in S_n$ if and only if there exists permutation matrices $P,Q$ such that $PAQ$ is upper triangular.
\end{thm}
\begin{proof}
	Suppose that $\operatorname{per}(A)=L_\tau(A)$ for some $\tau \in S_n$. If each row and each column of $A$ contain at least 2 nonzero entries, then there exists $\sigma \in S_n$ such that $\sigma \neq \tau$ and $L_\sigma(A)\neq 0$, a contradiction. Thus, $A$ must have a row or column that contains exactly one nonzero entry. If it is a row, choose permutation matrices $P_1,Q_1$ those permute that entry to $(P_1AQ_1)_{nn}$. In case it is a column, choose $P_1,Q_1$ so that the nonzero entry is permuted to $(P_1AQ_1)_{11}$. Now, consider the principal submatrix of $P_1AQ_1$ obtained by deleting that entry. Denote $B$ be this principal submatrix of $P_1AQ_1$. Since $\operatorname{per}(A)=L_\tau(A)$ for some $\tau \in S_n$, we have that $\operatorname{per}(B)=L_\theta(B)$ for some $\theta \in S_{n-1}$. So, $B$ also contains a row or column with exactly one nonzero entry. Choose $P_2,Q_2$ in the same way. By repeating this method, we derive permutation matrices $P,Q$ such that $PAQ$ is upper triangular. The converse statement of this theorem is obvious. Thus the proof is completed.
\end{proof}

By Example \ref{ex2}, we can see that, if $\tau=(16)(2453)$ and $\theta=(1364)(25)$, $P_\tau A P_\theta$ is upper triangular.

\section*{Acknowledgements}
The authors would like to thank anonymous referee(s) for reviewing this manuscript.