text
stringlengths 1
7.94M
| lang
stringclasses 5
values |
---|---|
यूपी अंडर १९ टीम में चुने हाथरस के तीन खिलाड़ी - अमर उजाला हिन्दी न्यूज
यूपी अंडर १९ टीम में चुने हाथरस के तीन खिलाड़ी
शिवम, जयंत और दीपक का यूपी अंडर १९ में चयन
उत्तर प्रदेश की अंडर १९ क्रिकेट टीम के ट्रायल कैंप मैच के लिए हाथरस क्रिकेट एसोसिएशन के तीन क्रिकेटर चुने गए हैं। हाथरस क्रिकेट एसोसिएशन की अध्यक्ष प्रतिमा सिंह ने बताया कि पिछले दो सालों से उत्तर प्रदेश की अंडर १६ टीम के सदस्य शिवम सारस्वत, जयंत चौधरी और दीपक चौधरी समेत मथुरा मंडल के कुल सात खिलाड़ी उत्तर प्रदेश की अंडर १९ क्रिकेट टीम के ट्रायल कैंप मैच के लिए चुने गए हैं।
सभी मैच कानपुर के ग्रीन पार्क स्टेडियम और कमला क्लब मैदान पर छह से ११ जून के मध्य खेले जाएंगे। उन्होंने बताया कि पिछले दिनों मथुरा मंडल के गाजियाबाद में हुए उत्तर प्रदेश की अंडर १९ अंतर मंडल क्रिकेट स्पर्धा में मथुरा अपने सभी मैच जीत कर जोनल विनर रहा था।
इसमें शिवम सारस्वत ने शानदार अर्धशतक लगाया था तो वहीं जयंत चौधरी और दीपक चौधरी ने शानदार गेंदबाजी से चयनकर्ताओं को प्रभावित किया था। उन्होंने उम्मीद जताई के सभी क्रिकेटर अपने शानदार प्रदर्शन को कानपुर में भी जारी रखेंगे। चयनित खिलाड़ियों को हाथरस क्रिकेट एसोसिएशन के चेयरमैन स्वप्निल जैन, सचिव सुमित शर्मा, उपाध्यक्ष ऋषभ जैन, योगेंद्र शर्मा योगा पंडित और नवीन सारस्वत आदि ने बधाई दी है।
लखनऊ के इस बीटेक स्टूडेंट ने बनाया सोशल मीडिया प्लेटफॉर्म, ऐसे करेगा काम
|
hindi
|
گۅڈنۍ ٲس وارہ گامژ خرچ پرٲنس گریٹ وارس منز
|
kashmiri
|
योग दिवस पर वैंकेया नायडू ने लाल किले से दिया एकता और शांति का संदेश
विश्व को शांति एवं एकता के सूत्र में बांधने के उद्देश्य से ब्रह्माकुमारी संस्था एवं आयुष मंत्रालय ने लाल किले पर अंतरराष्ट्रीय योग दिवस के अवसर पर एक विशाल योग कार्यक्रम का आयोजन किया। इसमें ४० हजार से अधिक लोगों ने सहभागिता की।
कार्यक्रम के मुख्य अतिथि उपराष्ट्रपति वैंकेया नायडू रहे जिन्होंने न केवल योग विषय पर चर्चा की बल्कि योग एवं व्यायाम करके उपस्थित लोगों का उत्साह भी बढ़ाया। उन्होंने देश के प्रधानमंत्री नरेंद्र मोदी के योग को बढ़ावा देने के प्रयास की प्रशंसा की।
उपराष्ट्रपति ने विशेष रूप से युवाओं से योग को उनकी दैनिक दिनचर्या का हिस्सा बनाने की अपील की। उन्होंने कहा कि योग से पूर्ण मानव व्यक्तित्व पर एक सकारात्मक प्रभाव पड़ता है। इससे जीवन में शांति आती है और ऊर्जा बढ़ती है। यह हमें आंतरिक शांति प्रदान करता है जो वर्तमान में बहुत जरूरी है। कार्यक्रम में सभी धर्म के लोगों ने भाग लिया।
हैदराबाद के मौलाना आजाद राष्ट्रीय उर्दू विश्वविद्यालय के कुलपति फिरोज बख्त अहमद ने कहा कि जहां विज्ञान समाप्त हो जाता है, वहां पर योग काम करता है। यह विज्ञान से कहीं आगे है। उन्होंने ओम शब्द की महत्वता पर प्रकाश डालते हुए कहा कि यह एक शब्द प्रदर्शित करता है कि ईश्वर एक ही है वह किसी धर्म के लिए अलग नहीं है।
उन्होंने कहा कि योग के बल पर धर्म और मजहब के मकड़जाल से छूट समाज एकजुट हो सकता है। उन्होंने ब्रह्माकुमारी संस्था की प्रशंसा करते हुए कहा कि यहां अल्लाह का सत्य परिचय पाकर उनका जीवन ही बदल गया।
भारत स्थित बहाई सम्प्रदाय एवं लोटस टेम्पल के राष्ट्रीय न्यासी डॉ. ए.के. मर्चेंट ने प्रभु से एकता का वर मांगा। दिल्ली यहूदी सम्प्रदाय सिनागोग के मुख्य पुजारी व सचिव राबी आइजैक ने सभी से राजयोग को जीवन शैली में शामिल करने का अनुरोध किया। बीके ब्रजमोहन ने गीता में वर्णित योग का सार समझाते हुए इसमें लिखे संदेश लोगों को ध्यान दिलाए।
कार्यक्रम में योग के विभिन्न आसन भी लोगों को सिखाए गए। पंडित शिवा नंद मिश्रा ने मंत्रोच्चारण किए। इससे पूर्व बीके चक्रधारी दीदी ने उपराष्ट्रपति का स्वागत करते हुए उनको तुलसी का पौधा भेंट किया। बीके आशा ने योग को बढ़ावा देने के सरकार के प्रयास की प्रशंसा की। कार्यक्रम में बीके पुष्पा,बीके सपना आदि का मुख्य योगदान रहा।
जब ब्सफ जवानों संग योग करते नजर आया डॉग सक्वाड, देखें विडियो
म्प ने कहा बंदरों से परेशान हूं तो उपराष्ट्रपति बोले मैं भी दुखी हूं
अंतर्राष्ट्रीय योग दिवस: योग शरीर-मन और सांस को जोड़ने का काम करता है
सजायाफ्ता कैदी बना योग गुरु, दूसरों को सिखा रहा योग
कुछ लोग विदेशों में बदनाम कर रहे भारत की धर्मनिरपेक्षता: वेंकैया
|
hindi
|
\begin{document}
\title{Finite Sums of Arithmetic Progressions}
\author{Shahram Mohsenipour}
\address{School of Mathematics, Institute for Research in Fundamental Sciences (IPM)
P. O. Box 19395-5746, Tehran, Iran}\email{[email protected]}
\subjclass [2010] {05D10}
\keywords{van der Waerden's theorem, Hindman's theorem, finitary Hindman's theorem}
\begin{abstract} We give a purely combinatorial proof for a two-fold generalization of van der Waerden-Brauer's theorem and Hindman's theorem. We also give tower bounds for a finite version of it.
\end{abstract}
\maketitle
\section{Introduction}
Let $l\geq 3$ be a positive integer and let $P=\{a_1,\dots,a_l\}$ be an $l$-term arithmetic progression with $a_1<\dots<a_l$, we denote the $s$th term of $P$ by $P[s]=a_s$. Now let $P$ and $Q$ be two $l$-term arithmetic progressions, we define their pointwise sum (or briefly their sum) $P\oplus Q$ as the $l$-term arithmetic progression with $P\!\oplus\! Q \,[s]=P[s]+Q[s]$ for $1\leq s\leq l$. Hence for the $l$-term arithmetic progressions $P_1,P_2,\dots,P_m$, their finite sum $P_1\oplus P_2\oplus\dots \oplus P_m$ has unambiguous meaning. The following pleasant two-fold generalization of van der Waerden-Brauer's theorem and Hindman's theorem, can be deduced form either Furstenberg's theorem (\cite{furs} Proposition 8.2.1) or Deuber-Hindman's theorem \cite{dubhind}. \\
{\em For any positive integers $c$ and $l\geq3$, if $\mathbb{N}$ is $c$-colored, then there exist a color $\gamma$ and infinitely many $l$-term arithmetic progressions $Q_i$, $i\in\mathbb{N}$ such that all of their finite sums (with no repetition) are monochromatic with the color $\gamma$ and all the common differences of the above finite sums have also the color $\gamma$ too}.\\
It would be pleasant too if we have a purely combinatorial proof of such a statement avoiding topological dynamics as well as the theory of ultrafilters. In Theorems \ref{maintheorem} and \ref{secondtheorem} of this paper we give such a proof. It is interesting to see whether the method of the proof can be generalized to give a combinatorial proof of Deuber-Hindman's theorem \cite{dubhind}. We are also interested in a finite version of the above theorem. It is well known that through a compactness argument we can have a finite version. For instance we have the following theorem which is a two-fold generalization of van der Waerden's theorem and a finite version of Hindman's theorem.\\
{\em For positive integers $c,n$ and $l\geq3$ there is a positive integer $m$ such that whenever $\{1,2,\dots,m\}$ is $c$-colored, then there exist $l$-term arithmetic progressions $P_1,P_2,\dots,P_n\subset\{1,2,\dots,m\}$ such that $\sum_{i=1}^{n}P_i[l]$ is not bigger than $m$ and all finite sums of $P_i$ (with no repetition) are monochromatic with the same color.}\\
If we denote the least such $m$ by $f(l,n,c)$ then the proof given through the compactness argument does not give us upper bounds for $f(l,n,c)$. But it is not hard to see that the proof given for Theorem \ref{maintheorem} can be made finitary (which may be regarded as an advantage of the proof over its counterparts using dynamical system or ultrafilters) to give us a primitive recursive upper bound for $f(l,n,c)$. To do so we use the finitary Hindman numbers $\textrm{Hind}(n,c)$ which is a tower function \cite{dodos}. However due to its iterated use of the function $\textrm{Hind}(n,c)$, it gives us an upper bound belonging to the class of WOW functions \cite{grs}. In Theorem \ref{thirdtheorem}, we do a better job by giving a different proof which uses the function $\textrm{Hind}(n,c)$ just one time and thus obtaining tower bounds for $f(l,n,c)$. Also note that according to the Gowers elementary bounds for the van der Waerden theorem, we don't worry about the van der Waerden part of the proof.
\section{Preliminaries}
Let's fix some notations. For $n$ a positive integer put $[n]=\{1,2,\dots,n\}$. Let $S$ be an infinite set, we denote the collection of finite nonempty subsets of $S$ by $\mathcal{P}_{f}(S)$. For a finite set $A$, $\mathcal{P}^+(A)$ denotes the collection of nonempty subsets of $A$. Also $FS(S)$ will denote the set of all finite sums of elements of $S$ with no repetition. Let $A,B\in\mathcal{P}_{f}(\mathbb{N})$, by $A<B$ we mean that $\max A < \min B$. We also denote the common difference of the arithmetic progression $P$ by $\add{P}$. We use the following notation for finite sums of arithmetic progressions
\[
\displaystyle\bigoplus_{i\in B}P_i=P_1\oplus P_2\oplus\dots \oplus P_m
\]
where $B=\{1,2,\dots,m\}$. Obviously we have
\[
\displaystyle\bigoplus_{i\in B}\!P_i\,[s]=\displaystyle\sum_{i\in B} P_i[s].
\]
We define a partial ordering between $l$-term arithmetic progressions by putting $P\prec Q$ whenever $P[s]<Q[s]$ for all $1\leq s\leq l$.
Let's state van der Waerden's theorem and van der Waerden-Brauer's theorem \cite{grs}.
\begin{theorem}[van der Waerden]
For positive integers $c$ and $l\geq 3$ there is a positive integer $n$ such that whenever $[n]$ is $c$-colored, then there is a monochromatic $l$-term arithmetic progression $P\subseteq[n]$. We denote the least such $n$ by $W(l,c)$.
\end{theorem}
\begin{theorem}[van der Waerden-Brauer]
For positive integers $c$ and $l\geq 3$ there is a positive integer $n$ such that whenever $\mathbf{c}$ is a $c$-coloring of $[n]$, then there are $d, a, a+d,\dots, a+(l-1)d$ in $\{1,2,\dots,n\}$ such that
\[
\mathbf{c}(d)=\mathbf{c}(a)=\mathbf{c}(a+d)=\dots=\mathbf{c}(a+(l-1)d).
\]
We denote the least such $n$ by $WB(l,c)$.
\end{theorem}
We will use the following strong version of Hindman's theorem \cite{taylor2}.
\begin{theorem}
Let $a_1<a_2<\dots<a_m<\dots$ be an infinite strictly increasing sequence of positive integers. Let $c$ be a positive integer and $FS(\{a_1,a_2,\dots\})$ be $c$-colored. Then there are $B_1<B_2<B_3<\dots$ in $\mathcal{P}_{f}(\mathbb{N})$ such that whenever
\[
b_1=\displaystyle\sum_{i\in B_1}a_i\,\,,\,\,\, b_2=\displaystyle\sum_{i\in B_2}a_i\,\,,\,\,\,\dots\,\,\,, b_m=\displaystyle\sum_{i\in B_m}a_i\,\,,\dots
\]
then $FS(\{b_1,b_2,\dots\})$ is monochromatic.
\end{theorem}
We say that the two positive integers $a,b$ are {\em power-disjoint}, if the powers occurring in the expansions of $a,b$ in base $2$ are disjoint sets, more precisely if we write $a=2^{k_1}+\dots+2^{k_m}$ and $b=2^{l_1}+\dots+2^{l_n}$, then the two sets $\{k_1,\dots,k_m\}$ and $\{l_1,\dots,l_n\}$ are disjoint. We denote the set $\{k_1,\dots,k_m\}$ by $\pow(a)$. We will use the following finitary version of Hindman's theorem \cite{dodos} which strengthens the Disjoint Unions Theorem. First we introduce a notation. If $T$ is a collection of pairwise disjoint sets, then $NU(T)$ will denote the set of non-empty unions of elements of $T$.
\begin{theorem}\label{dut}
For positive integers $n,c$ there is a positive integer $m$ such that for any $m$-element set $A=\{a_1,\dots,a_m\}$ of pairwise power-disjoint positive integers, whenever $\mathbf{c}$ is a $c$-coloring of $FS(A)$, then there exist $\gamma\in[c]$ and $B_1,\dots,B_n$ in $\mathcal{P}^+([m])$ such that
$B_1<\cdots<B_n$ and for all $C\in NU\{B_1,\dots,B_n\}$ we have
\[
\mathbf{c}\big{(}\displaystyle\sum_{i\in C}a_i\big{)}=\gamma.
\]
Moreover if $Hind(n,c)$ denotes the least such $m$, then $Hind(n,c)$ is a tower function.
\end{theorem}
\section{Purely Combinatorial Proofs}
In the following theorem we give a purely combinatorial proof of the two-fold generalization van der Waerden's theorem and Hindman's theorem mentioned in the introduction.
\begin{theorem}\label{maintheorem}
Let $c$ and $l\geq 3$ be positive integers. Let $\mathbf{c}$ be a $c$-coloring of $\mathbb{N}$, then there are $l$-term arithmetic progressions $Q_1, Q_2,Q_3,\dots$ such that
\begin{itemize}
\item[(i)] $Q_1\prec Q_2\prec Q_3\prec\cdots$,
\item[(ii)] there is $\gamma\in[c]$ such that for all $C\in\mathcal{P}_{f}(\mathbb{N})$ and all $s\in\{1,\dots,l\}$ we have
\[
\mathbf{c}\big{(}\displaystyle\bigoplus_{i\in C}Q_i\,[s]\big{)}=\gamma.
\]
\end{itemize}
\end{theorem}
\begin{proof}
Let $n=W(l,c)$ and let $a_1<a_2<\cdots<a_m<\cdots$ be a strictly increasing sequence of positive integers with $a_{m+1}>a_1+\dots+a_m+mn$. For $i\in\mathbb{N}$ we put
\[
P^{0}_{i}=\{a_i, a_i+1,\dots,a_i+(n-1)\}.
\]
Obviously $P^{0}_{i}$ is an $n$-term arithmetic progression and we have
\[
P^{0}_{1}\prec P^{0}_{2}\prec P^{0}_{3}\prec\cdots
\]
In fact it is easily seen that for any $C_1<C_2$ in $\mathcal{P}_{f}(\mathbb{N})$ we have
\begin{equation}\label{new}
\displaystyle\bigoplus_{i\in C_1}P_i^0\prec\displaystyle\bigoplus_{i\in C_2}P_i^0.
\end{equation}
Now for $1\leq k\leq n$ we inductively define the $n$-term arithmetic progressions $P_1^k,P_2^k,P_3^k,\ldots$ so that there are $\alpha_1^k,\alpha_2^k,\dots,\alpha_k^k\in[c]$ such that the following two conditions are satisfied
\begin{itemize}
\item[(a)] for all $C\in\mathcal{P}_{f}(\mathbb{N})$ and all $s\in\{1,\dots,k\}$ we have
\[
\mathbf{c}\big{(}\displaystyle\bigoplus_{i\in C}P_i^k\,[s]\big{)}=\alpha_s^k,
\]
\item[(b)] for all $C_1<C_2$ in $\mathcal{P}_{f}(\mathbb{N})$ we have
\[
\displaystyle\bigoplus_{i\in C_1}P_i^k\prec\displaystyle\bigoplus_{i\in C_2}P_i^k.
\]
\end{itemize}
Suppose we have defined $P_1^k,P_2^k,P_3^k,\ldots$ with the above properties. We do the job for $k+1$. The second condition implies that
\[
P_1^k[k+1]<P_2^k[k+1]<\cdots<P_m^k[k+1]<\cdots\cdot
\]
Now by Hindman's theorem there are $B_1<B_2<\cdots<B_m<\cdots$ in $\mathcal{P}_{f}(\mathbb{N})$ such that if we put
\[
b_1=\displaystyle\sum_{i\in B_1}P^k_i[k+1],b_2=\displaystyle\sum_{i\in B_2}P^k_i[k+1],\ldots,b_m=\displaystyle\sum_{i\in B_m}P^k_i[k+1],\dots
\]
then $\mathbf{c}$ has a constant value on $FS(\{b_1,b_2,\dots\})$, which we denote it by $\alpha$. Now we set
\[
P_1^{k+1}=\displaystyle\bigoplus_{i\in B_1} P_i^{k}, P_2^{k+1}=\displaystyle\bigoplus_{i\in B_2} P_i^{k},\ldots, P_m^{k+1}=\displaystyle\bigoplus_{i\in B_m} P_i^{k},\ldots.
\]
as well as we set
\[
\alpha_{1}^{k+1}=\alpha_{1}^{k}, \alpha_{2}^{k+1}=\alpha_{2}^{k},\dots, \alpha_{k}^{k+1}=\alpha_{k}^{k},\alpha_{k+1}^{k+1}=\alpha.
\]
We check the conditions (a) and (b) for $k+1$. Let $C\in\mathcal{P}_{f}(\mathbb{N})$ and $1\leq s\leq k+1$, hence we have
\[
\displaystyle\bigoplus_{i\in C}P_i^{k+1}\,[s]=\displaystyle\bigoplus_{i\in C}\displaystyle\bigoplus_{j\in B_i}\!P_j^{k}\,[s]=\displaystyle\bigoplus_{i\in D}P_i^{k}\,[s],
\]
where $D=\bigcup_{i\in C}B_i$. Suppose $1\leq s\leq k$, from the induction hypothesis it follows that
\begin{equation}\label{eq1}
\mathbf{c}\big{(}\displaystyle\bigoplus_{i\in D}P_i^{k}\,[s]\big{)}=\alpha_s^k=\alpha_s^{k+1}.
\end{equation}
Also for $s=k+1$ we have
\[
\displaystyle\bigoplus_{i\in C}\displaystyle\bigoplus_{j\in B_i}\!P_j^{k}\,[k+1]=\displaystyle\sum_{i\in C}\displaystyle\sum_{j\in B_i} P_j^{k}[k+1]=\displaystyle\sum_{i\in C}b_i\in FS(\{b_1, b_2,\dots\}),
\]
which implies that
\begin{equation}\label{eq2}
\mathbf{c}\big{(}\displaystyle\bigoplus_{i\in C}\displaystyle\bigoplus_{j\in B_i}\!P_j^{k}\,[k+1]\big{)}=\mathbf{c}\big{(}\displaystyle\sum_{i\in C}b_i\big{)}=\alpha=\alpha_{k+1}^{k+1}.
\end{equation}
Now putting (\ref{eq1}) and (\ref{eq2}) together we deduce
\[
\mathbf{c}\big{(}\displaystyle\bigoplus_{i\in C}P_i^{k+1}\,[s]\big{)}=\alpha_s^{k+1}
\]
for $1\leq s\leq k+1$. This finishes the proof of the condition (a). Now we turn to checking (b). Let $C_1<C_2$ be in $\mathcal{P}_{f}(\mathbb{N})$. We must show that
\[
\displaystyle\bigoplus_{i\in C_1}P_i^{k+1}\prec\displaystyle\bigoplus_{i\in C_2}P_i^{k+1}
\]
which is equivalent to
\begin{equation}\label{eq3}
\displaystyle\bigoplus_{i\in C_1}\displaystyle\bigoplus_{j\in B_i}\!P_j^{k}\prec\displaystyle\bigoplus_{i\in C_2}\displaystyle\bigoplus_{j\in B_i}\!P_j^{k}.
\end{equation}
Letting $D_1=\bigcup_{i\in C_1}B_i$, $D_2=\bigcup_{i\in C_2}B_i$, we get $D_1<D_2$ and (\ref{eq3}) becomes
\[
\displaystyle\bigoplus_{i\in D_1}P_i^{k}\prec\displaystyle\bigoplus_{i\in D_2}P_i^{k}
\]
which is exactly our induction hypothesis. This proves the condition (b).
Now consider $P_1^n[1],P_1^n[2],\dots,P_1^n[n]$ and recall that $n=W(l,c)$. By construction we have
\[
\mathbf{c}(P_1^n[1])=\alpha^n_1,\dots,\mathbf{c}(P_1^n[n])=\alpha^n_n.
\]
Through induced coloring, it follows from van der Waerden's theorem that there exist $\gamma\in[c]$ and positive integers $a, d$ such that
\[
\alpha^n_a=\alpha^n_{a+d}=\cdots=\alpha^n_{a+(l-1)d}=\gamma.
\]
We define the desire arithmetic progressions $Q_i, i\in\mathbb{N}$ as follows
\[
Q_i=\big{\{}P_i^n[a],P_i^n[a+d],\dots, P_i^n[a+(l-1)d]\big{\}}.
\]
It is easily seen by condition (b) that $Q_1\prec Q_2\prec Q_3\prec \cdots\,\cdot$ Also for all $C\in\mathcal{P}_f(\mathbb{N})$ and all $1\leq s\leq l$ we have
\[
\mathbf{c}\big{(}\displaystyle\bigoplus_{i\in C}\!Q_i\,[s]\big{)}=\mathbf{c}\big{(}\displaystyle\sum_{i\in C}Q_i[s]\big{)}=\mathbf{c}\big{(}\displaystyle\sum_{i\in C}P_i^n[a+(s-1)d]\big{)}=\alpha^n_{a+(s-1)d}=\gamma.
\]
This finishes the proof of Theorem \ref{maintheorem}.
\end{proof}
Now we turn to the two-fold generalization of van der Waerden-Brauer's theorem and Hindman's theorem.
\begin{theorem}\label{secondtheorem}
Let $c$ and $l\geq 3$ be positive integers. Let $\mathbf{c}$ be a $c$-coloring of $\mathbb{N}$, then there are $l$-term arithmetic progressions $Q_1, Q_2,Q_3,\dots$ such that
\begin{itemize}
\item[(i)] $Q_1\prec Q_2\prec Q_3\prec\cdots$,
\item[(ii)] there is $\gamma\in[c]$ such that for all $C\in\mathcal{P}_{f}(\mathbb{N})$ and all $s\in\{1,\dots,l\}$ we have
\[
\mathbf{c}\big{(}\!\displaystyle\bigoplus_{i\in C}\!Q_i\,[s]\big{)}=\mathbf{c}\big{(}\!\add\displaystyle\bigoplus_{i\in C}\!Q_i\big{)}=\gamma.
\]
\end{itemize}
\end{theorem}
\begin{proof}
We start with $n=WB(l,c)$ and a strictly increasing sequence of positive integers $a_1<a_2<\dots<a_m<\cdots$ with $a_{m+1}>n(a_1+\dots+a_m)$. For $i\in\mathbb{N}$, We put
$P^{0}_{i}=\{a_i, a_i+a_i,\dots,a_i+(n-1)a_i\}$. In this case for all $1\leq k\leq n$ and all $C\in\mathcal{P}_f(\mathbb{N})$ we will have
\begin{equation}\label{eq4}
\add\displaystyle\bigoplus_{i\in C}\!P^k_i=\displaystyle\bigoplus_{i\in C}\!P^k_i\,[1].
\end{equation}
We prove (\ref{eq4}) by induction on $k$. First observe that
\begin{eqnarray*}
\add\displaystyle\bigoplus_{i\in C}\!P^0_i=\displaystyle\bigoplus_{i\in C}\!P^0_i\,[2]-\displaystyle\bigoplus_{i\in C}\!P^0_i\,[1]
&=&\displaystyle\sum_{i\in C}P^0_i[2]-\displaystyle\sum_{i\in C}P^0_i[1]\\
&=&\displaystyle\sum_{i\in C}(a_i+a_i)-\displaystyle\sum_{i\in C}a_i\\
&=&\displaystyle\sum_{i\in C}a_i=\displaystyle\sum_{i\in C}P^0_i[1]
=\displaystyle\bigoplus_{i\in C}\!P^0_i\,[1].
\end{eqnarray*}
Also for $k+1$, recall the subsets $B_i$ in definition of the arithmetic progressions $P^{k+1}_i$, so we have
\begin{eqnarray*}
\add\displaystyle\bigoplus_{i\in C}\!P^{k+1}_i&=&\add\displaystyle\bigoplus_{i\in C}\!\displaystyle\bigoplus_{j\in B_i}\!P^{k}_j
=\add\displaystyle\bigoplus_{i\in D }\!P^{k}_i\\
&=&\displaystyle\bigoplus_{i\in D }\!P^{k}_i\,[1]=\displaystyle\bigoplus_{i\in C}\!P^{k+1}_i\,[1]
\end{eqnarray*}
where $D=\bigcup_{i\in C}B_i$. This proves (\ref{eq4}). The proof now proceeds as in the proof of Theorem \ref{maintheorem}, in particular (\ref{new}) can be proved easily for these new $P^0_i$. Now recall $P_1^n[1],P_1^n[2],\dots,P_1^n[n]$ so that for $s\in\{1,\dots,n\}$ and $C\in\mathcal{P}_f(\mathbb{N})$ we have
\[
\mathbf{c}\big{(}\displaystyle\bigoplus_{i\in C}P_i^{n}\,[s]\big{)}=\alpha_s^{n}.
\]
Through induced coloring and this time using $=WB(l,c)$ we obtain $\gamma\in[c]$ and positive integers $a, d$ such that
\[
\alpha^n_d=\alpha^n_a=\alpha^n_{a+d}=\cdots=\alpha^n_{a+(l-1)d}=\gamma.
\]
Again define the desire arithmetic progressions $Q_i, i\in\mathbb{N}$ by
\[
Q_i=\big{\{}P_i^n[a],P_i^n[a+d],\dots, P_i^n[a+(l-1)d]\big{\}}.
\]
Thus for all $C\in\mathcal{P}_f(\mathbb{N})$ we have
\begin{eqnarray*}
\add\displaystyle\bigoplus_{i\in C}\!Q_i&=&\displaystyle\bigoplus_{i\in C}\!Q_i\,[2]-\displaystyle\bigoplus_{i\in C}\!Q_i\,[1]
=\displaystyle\sum_{i\in C}Q_i[2]-\displaystyle\sum_{i\in C}Q_i[1]\\
&=&\displaystyle\sum_{i\in C}P_i^n[a+d]-\displaystyle\sum_{i\in C}P_i^n[a]=\displaystyle\sum_{i\in C}\big{(}P_i[a+d]-P_i[a]\big{)}\\
&=&\displaystyle\sum_{i\in C}\displaystyle\sum_{t=1}^d\big{(}P_i^n[a+t]-P_i^n[a+(t-1)]\big{)}=\displaystyle\sum_{i\in C}\displaystyle\sum_{t=1}^d\add P_i^n\\
&=&\displaystyle\sum_{i\in C}d.\add P_i^n=d\displaystyle\sum_{i\in C}\add P_i^n=d.\add\displaystyle\bigoplus_{i\in C}\!P^n_i\\
&=&\displaystyle\bigoplus_{i\in C}\!P^n_i\,[1]+(d-1)\add\displaystyle\bigoplus_{i\in C}\!P^n_i=\displaystyle\bigoplus_{i\in C}\!P^n_i\,[d].
\end{eqnarray*}
Note that in the second and third equations from the end we have respectively used (\ref{eq4}) and the easily checked fact $\displaystyle\sum_{i\in C}\add P_i^n=\add\displaystyle\bigoplus_{i\in C}\!P^n_i$. So we conclude that
\[
\mathbf{c}\big{(}\!\add\displaystyle\bigoplus_{i\in C}\!Q_i\big{)}=\mathbf{c}\big{(}\!\displaystyle\bigoplus_{i\in C}\!P^n_i\,[d]\big{)}=\alpha^n_d=\gamma,
\]
and the rest of the proof is the same as the proof of Theorem \ref{maintheorem}.
\end{proof}
\section{Tower Bounds for the Finite Case}
In this section we prove
\begin{theorem}\label{thirdtheorem}
For positive integers $n,c$ and $l\geq3$, let $f(n,l,c)$ be the least positive integer $p$ such that whenever $\mathbf{c}$ is a $c$-coloring of $[p]$, then there are $l$-term arithmetic progressions $Q_1,Q_2,\dots,Q_n$ such that
\begin{itemize}
\item[(i)] $Q_1\prec\cdots\prec Q_n$,
\item[(ii)] $\max (Q_1\oplus\cdots\oplus Q_n)\leq p$,
\item[(iii)] there is $\gamma\in[c]$ such that for all $C\in\mathcal{P}^{+}([n])$ and all $s\in\{1,\dots,l\}$ we have
\[
\mathbf{c}\big{(}\!\displaystyle\bigoplus_{i\in C}\!Q_i\,[s]\big{)}=\gamma.
\]
Then $f(n,l,c)$ is a tower function.
\end{itemize}
\end{theorem}
\begin{proof}
Let $q=W(l,c^{2^{\hind(n,c)}})$, we will show that $f(n,l,c)\leq 2^{q^3}$. So from Gower's elementary bounds for the van der Waerden numbers \cite{gowers} and Theorem \ref{dut}, it follows that $f(n,l,c)$ is a tower function. Suppose that $p\geq 2^{q^3}$ and $\mathbf{c}$ is a $c$-coloring of $[p]$. We show that $p$ satisfies the requirements of the theorem. Put $m=\hind(n,c)$. Let $h_i, 1\leq i\leq m$ be positive integers defined by $h_i=(m+i)+(i-1)q$. For $1\leq i\leq m$, we define the $q$-term arithmetic progressions $P_i$ as follows
\[
P_i=\{2^i,2^i+2^{h_i},2^i+2.2^{h_i},\dots,2^i+(q-1)2^{h_i}\}.
\]
Clearly $P_1\prec P_2\prec\cdots\prec P_m$. We claim that for each $1\leq s\leq q$, the positive integers $P_1[s],P_2[s],\dots,P_m[s]$ are pairwise power-disjoint. Let $1\leq s\leq q$, $2^u\leq q-1< 2^{u+1}$ and $s-1=2^{u_1}+\dots+2^{u_k}$ with $u_1<u_2<\cdots<u_k$, hence $u_k\leq u\leq q-1$. Also from $i\leq m<h_1\leq h_i$ and
\[
P_i[s]=2^{i}+(s-1)2^{h_i}=2^{i}+2^{u_1+h_i}+\dots+2^{u_k+h_i}
\]
it follows that
\[
\pow(P_i[s])\subseteq\{i,h_i,h_i+1,\dots,h_i+(q-1)\}=:A_i
\]
for $1\leq i\leq m$. Now to prove the claim it would be enough to show that $A_1,\dots,A_m$ are pairwise disjoint. In fact we show that
\[
\{1,2,\dots,m\}<A_1-\{1\}<A_2-\{2\}<\cdots<A_m-\{m\}
\]
which easily implies the disjointness of $A_1,\dots,A_m$. First observe that
\[
\min(A_1-\{1\})=h_1=m+1>m.
\]
Also for $1\leq i\leq m-1$ we have
\begin{eqnarray*}
\min(A_{i+1}-\{i+1\})=h_{i+1}&=&(m+i+1)+iq\\
&>&(m+i)+(i-1)q+(q-1)\\
&=&h_i+(q-1)\\
&=&\max(A_{i}-\{i\}),
\end{eqnarray*}
thus the claim is proved. Also we have
\begin{eqnarray*}
\max\displaystyle\bigoplus_{i\in[m]}\!\!P_i=\displaystyle\bigoplus_{i\in[m]}\!\!P_i\,[q]=\displaystyle\sum_{i\in[m]}P_i[q]
&\leq& m2^m+m(q-1)2^{h_m}\\
&\leq& q.2^q+q^{2}.2^{2m+(m-1)q}\\
&\leq& 2^{2q}+q^2. 2^{2q+q^{2}}\\
&\leq& 2^{2q}+2^q. 2^{2q^{2}}\\
&\leq& 2^{q+1}.2^{2q^{2}}\leq2^{q^3}\leq p.
\end{eqnarray*}
Now we define a coloring $\mathbf{c}^{*}$ on $[q]$ as follows. For $u,v\in[q]$, we put $\mathbf{c}^{*}(u)=\mathbf{c}^{*}(v)$ if for all $B\in\mathcal{P}^+([m])$ we have
\[
\mathbf{c}\big{(}\!\bigoplus_{i\in B}\!P_i\,[u]\big{)}=\mathbf{c}\big{(}\!\bigoplus_{i\in B}\!P_i\,[v]\big{)}.
\]
Obviously the number of colors is $c^{2^m-1}$, so from $q=W(l,c^{2^m})$ it follows that there are $a, a+d,\dots, a+(l-1)d$ in $\{1,2,\dots,q\}$ such that
\[
\mathbf{c}^{*}(a)=\mathbf{c}^{*}(a+d)=\cdots=\mathbf{c}^{*}(a+(l-1)d)
\]
which means that for all $B\in\mathcal{P}^+([m])$ and all $k_1,k_2\in\{0,\dots,l-1\}$ we have
\[
\mathbf{c}\big{(}\!\bigoplus_{i\in B}\!P_i\,[a+k_1d]\big{)}=\mathbf{c}\big{(}\!\bigoplus_{i\in B}\!P_i\,[a+k_2d]\big{)}.
\]
We denote the above color by $\pi(B)$. So we have the well-defined function
\[
\pi\colon\mathcal{P}^+([m])\longrightarrow[c].
\]
Now consider the following $m$-elements set of power-disjoint (due to the claim) positive integers
\[
\big{\{}P_1[a],P_2[a],\dots,P_m[a]\big{\}}.
\]
From $m=\hind(n,c)$ we infer that there exist $B_1<B_2<\cdots<B_n$ in $\mathcal{P}^+([m])$ and $\gamma\in[c]$ so that for all $C\in NU\{B_1,\dots,B_n\}$ we have
\[
\pi(C)=\mathbf{c}\big{(}\!\sum_{i\in C}P_i[a]\big{)}=\gamma.
\]
The desired arithmetic progressions $Q_1,\dots,Q_n$ are defined as follows. For $1\leq i\leq n$, we set
\[
Q_i=\big{\{}\!\!\bigoplus_{j\in B_i}\!P_j\,[a],\bigoplus_{j\in B_i}\!P_j\,[a+d],\ldots,\bigoplus_{j\in B_i}\!P_j\,[a+(l-1)d]\big{\}}.
\]
Obviously $Q_1\prec Q_2\prec\cdots\prec Q_n$ and from $B_1<B_2<\cdots<B_n$ it is easily seen that
\[
\max(Q_1\oplus\cdots\oplus Q_n)\leq\max(P_1\oplus\cdots\oplus P_m)\leq p.
\]
Now for $C\in\mathcal{P}^+([n])$ and $1\leq s\leq l$ we have
\begin{eqnarray*}
\mathbf{c}\big{(}\!\bigoplus_{i\in C}\!Q_i\,[s]\big{)}=\mathbf{c}\big{(}\!\sum_{i\in C}Q_i[s]\big{)}
&=&\mathbf{c}\big{(}\!\sum_{i\in C}\bigoplus_{j\in B_i}\!P_j\,[a+(s-1)d]\big{)}\\
&=&\mathbf{c}\big{(}\!\sum_{i\in C}\sum_{j\in B_i}P_j[a+(s-1)d]\big{)}\\
&=&\mathbf{c}\big{(}\!\sum_{i\in D}P_i[a+(s-1)d]\big{)}=\pi(D)=\gamma,
\end{eqnarray*}
where $D=\bigcup_{i\in C}B_i\in NU\{B_1,\dots,B_n\}$. This finishes the proof of the theorem.
\end{proof}
\end{document}
|
math
|
निदाहास ट्रॉफी का फाइनल मैच बांग्लादेश और भारत के बीच हुआ, इस मैच को भारत के विकेटकीपर बल्लेबाज दिनेश कार्तिक ने आखिरी ओवर की अंतिम बॉल में छक्का जड़कर भारत के नाम जीत दर्ज कर दी. वहीं कप्तान रोहित शर्मा ने इस मैच में दिनेश कार्तिक की नाराजगी के बारे में भी बताया.
इस रोमांचक जीत के बाद हर कोई खुशी मना रहा है, लेकिन कप्तान रोहित शर्मा ने भी दिनेश कार्तिक की तारीफ करते हुए उनकी नाराजगी के बारे में बताया. रोहित शर्मा ने कहा कि दिनेश कार्तिक को बल्लेबाजी के लिए ऊपरी क्रम में नहीं भेजा गया उनकी जगह विजय शंकर को भेजा. इस कारण कार्तिक मुझसे नाराज थे और इस बात का अंदाजा मुझे तब हुआ जब में आउट हुआ और डगआउट में बैठा था तो कार्तिक थोड़ा नाराज था कि उसे छठे नंबर पर बल्लेबाजी के लिये नहीं भेजा गया.
१ ऑफ ९ बांग्लादेश के खिलाफ रोहित शर्मा ने लगाया पंच, बना डाला त२० का नया रिकॉर्ड
२ ऑफ ९ इंड व्स बन फाइनल लाइव: टीम इंडिया के स्पिनर चमके, बांग्लादेश की हालत खराब
३ ऑफ ९ इंड व्स बन फाइनल लाइव: टीम इंडिया ने टॉस जीतकर बांग्लादेश को दी बल्लेबाजी की चुनौती
४ ऑफ ९ जयसूर्या के बाद बांग्लादेश क्रिकेट बोर्ड ने कबूली अपने खिलाड़ियों की ये करतूत
५ ऑफ ९ इंड व्स बन निदाहास ट्रॉफी: क्या भारत को फाइनल में हराकर इतिहास रच पाएगी बांग्लादेश
६ ऑफ ९ निदाहास ट्रॉफीः बांग्लादेश के ये ५ खिलाड़ी रोक सकते हैं भारत का विजय रथ
७ ऑफ ९ स्ल व्स बन: बांग्लादेशी कप्तान ने बताया क्यों श्रीलंका से जीत के बाद उसके खिलाड़ी करने लगे थे 'हुड़दंग'
८ ऑफ ९ स्ल व्स बन, लाइव: नाटकीय मैच में श्रीलंका को हराकर बांग्लादेश फाइनल में, मोहम्मदुल्लाह ने छक्का मारकर दिलाई जीत
वहीं रोहित शर्मा की नाराजगी को देखते हुए में कार्तिक के पास गया और मैंने उससे कहा, " मैं चाहता हूं कि आप हमारे लिये मैच को जीतो, क्योंकि आपके अनुभव की टीम को अंतिम तीन या चार ओवरों में जरूरत पड़ेगी." फिर क्या था कि इसके बाद रोहित का गुस्सा बांग्लादेशी टीम के उपर टूट पड़ा. मैदान में आते ही विकेटकीपर बल्लेबाज कार्तिक ने ८ गेंद पर नाबाद २९ रन बनाए. इस नाबाद पारी में उनके अंतिम बॉल के छक्के ने हारे हुए मैच को भारत को झोली में डाल दिया, कार्तिक को इस शानदार पारी के लिए 'मैन ऑफ द मैच' के खिताब से भी नवाजा गया.
अन्य बड़ी कहानियों >> आरुषि-हेमराज हत्याकांड: स्क ने हेमराज की पत्नी की याचिका मंजूर की, तलवार दंपत्ति को भेजा नोटिस
|
hindi
|
How well do you know your famous literary detectives? Pick up an activity sheet from the CYS Command Center and have fun matching up the sleuths with the clues given. Don't forget to go online and claim your Sleuth It - On the Scene badge when you're done!
Stop by the Children's Help Desk and pick up your Library I Spy sheet! Walk around the library and check off each item as you spot it. Then turn your sheet back in to receive a sticker. Don't forget to go online and claim your Sleuth it badge!
By conducting research and using the fewest number of clues possible, solve a mystery related to World War II. Geared towards children in grades 3-8, this is a great way to earn your Sleuth It badge. Complete the mystery and then return to our website to claim your badge!
Do you love word searches? Do you find yourself looking for more mystery authors to read? Earn your Sleuth It badge by completing either our adult or children's mystery author word search! Pick up your copy at either Help Desk. No need to turn it back in. Save it so you'll have a list of authors that you may have never read before. Once you finish it, make sure you visit our website and claim your badge!
It's that time of year to start making plans for Halloween! Whether you're throwing a party, going trick-or-treating, or passing out candy, you can never have enough spooky treats around to snack on. Check out The Halloween Cooking Blog and Food Network's Halloween Cooking page for some great recipes, as well as our own collection of Halloween cooking and idea books.
Do you love jokes? How about jokes specifically related to libraries? Well, here's a great website that is full of library jokes and cartoons.
Do you enjoy keeping up with the films that play on the festival circuit? Do you like strange, art house thrillers? If so, you may just want to check out Rubber. Rubber, originating from France, featured prominently during 2010, playing Cannes, Fantastic Fest, AFI, and others, and is finally getting a U.S. release! The story centers around Robert, an inanimate tire, who discovers that he has destructive telepathic powers. He soon sets his sights on a desert town and a beautiful woman who becomes the focus of his obsession. Creating a path of destruction, Robert may just be the most interesting movie villain yet.
Are you a fan of Louise Rennison's book series that began with Angus, Thongs and Full-Frontal Snogging? If you are, you may have been disappointed when she published her last book in the series in 2009. That is why I was so excited to hear that she is beginning a new series revolving around the misadventures of Georgia's younger cousin, Tallulah Casey! Withering Tights is due to be released on June 28, 2011 and promises to be just as fun and hilarious as the previous books. And if you haven't read any of the books, and want to feel good and laugh out loud, give them a try!
Read more about Louise Rennison Fans!
|
english
|
Know Williamsport HS Class of 1957 graduates that are NOT on this List? Help us Update the 1957 Class List by adding missing names.
More 1957 alumni from Williamsport HS Williamsport, MD have posted profiles on Classmates.com®. Click here to register for free at Classmates.com® and view other 1957 alumni.
The Williamsport High Williamsport, MD class of '57 alumni are listed below. These are former students from WHS in Williamsport, MD who graduated in 1957. Alumni listings below have either been searched for or they registered as members of this directory.
If you are an alumn of Williamsport HS you should register now in the alumni directory. We also encourage you to interact with the rest of the alumni on this site. You can find old friends, share photos and stay updated on the latest school news.
|
english
|
संजय दत्त की फिल्म 'प्रस्थानम' का टीज़र अभी कुछ दिनों पहले ही जारी किया गया था। वहीं, अब मेकर्स ने इस पॉलिटिकल थ्रिलर फिल्म का नया पोस्टर लॉन्च किया है। फिल्म के इस नए पोस्टर को संजय दत्त ने भी अपने सोशल मीडिया अकाउंट पर शेयर किया है।
फर्स्ट लुक: प्रस्थानम का फर्स्ट लुक रिलीज़, एक बार फिर दमदार लुक में नज़र आए संजय दत्त
बॉलीवुड एक्टर संजय दत्त की अपकमिंग फिल्म प्रस्तानम का फर्स्ट लुक पोस्टर रिलीज कर दिया गया है। फिल्म में संजय दत्त के अलावा मनीषा कोईराला, जैकी श्रॉफ, चंकी पांडेय, अमायरा दस्तूर और अली फ़ज़ल भी मुख्य भूमिका में नज़र आएंगे। फिल्म के इस पोस्टर
संजय दत्त ने अपने जन्मदिन पर लॉन्च किया फिल्म प्रस्थानम का टीज़र
मुंबई में संजय दत्त ने अपनी फिल्म प्रस्थानम का टीज़र लॉन्च किया जिसके लॉन्च फिल्म की कास्ट से मनीषा कोइराला, जैकी श्रॉफ, मान्यता दत्त, संजय दत्त, सत्यजीत दुबे और निर्देशक देवा कट्टा शामिल हुए. यहीं नहीं संजय दत्त ने इस लॉन्च में अपना बर्थडे
संजय दत्त के बर्थडे पर रिलीज़ हुआ कफ चाप्टर-२ का फर्स्ट लुक, अधीरा के रोल में आएंगे नज़र
संजय दत्त के बर्थडे पर उनके फैंस को भी तोहफा मिला है। खबर है कि वह #क्गफ्चाप्टर२ में #अधीरा का रोल निभाएंगे। फिल्म से संजय दत्त का फर्स्ट लुक भी सामने आ चुका है। वहीं, ट्विटर पर #संजयदुत्तसाधीरा भी ट्रेंड कर रहा है। आपको बता दें, कि
विडियो: संजय दत्त ने फैमिली संग इस तरह सेलिब्रेट किया बर्थडे, देखें वीडियो
बॉलीवुड स्टार संजय दत्त ने अपने परिवार संग मुंबई में अपना बर्थडे सेलिब्रेट किया। इस दौरान उनकी पत्नी मान्यता दत्त और दोनों बच्चे भी दिखाई दिए। इस दौरान संजय दत्त ने काले रंग का पठानी कुर्ता-पजामा पहना हुआ था। वहीं, मान्यता दत्त और दोनों
बर्थडे स्पेशल: जेल में रहते हुए संजय दत्त को इस लड़की से हो गया था प्यार
बॉलीवुड के सुपरस्टार संजय दत्त आज ६० साल के हो गए हैं। संजय दत्त आज अपना ६०वां बर्थडे मना रहे हैं। अपने अबतक के फिल्मी करियर में संजय दत्त १८७ फिल्मों में काम कर चुके हैं। संजय को उनके फिल्मों के लिए फिल्मफेयर से लेकर कई 'स्क्रीन अवार्ड' तक
संजय दत्त और मान्यता दत्त ने मुंबई में लॉन्च किया अपनी पहली मराठी फिल्म बाबा का ट्रेलर
मुंबई में एक निर्माता के रूप में संजय दत्त ने अपनी पत्नी मान्यता दत्त के साथ अपनी पहली मराठी फिल्म 'बाबा' के ट्रेलर को लॉन्च किया। इस लॉन्च में मराठी अभिनेता अभिजीत खांडेकर, दीपक डोबरियाल, नंदिता धूरी, कास्ट और निर्देशक राज आर गुप्ता के साथ
संजय दत्त की बेटी त्रिशाला के बॉयफ्रेंड की हुई मौत इंस्टाग्राम के जरिये ब्यान किया दिल का हाल
बॉलीवुड के संजू बाबा यानि संजय दत्त की बेटी त्रिशाला के बॉयफ्रेंड की हाल ही में मौत हो गई है. इस खबर की जानकारी खुद त्रिशाला के सोशल मीडिया अकाउंट के जरिए दी है. अपने बॉयफ्रेंड की हुई अचानक मौत से त्रिशाला काफी टूट गयी है और अपने दिल का हाल
|
hindi
|
/*
* Copyright (c) 2014 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#include <IOKit/IOInterruptAccountingPrivate.h>
#include <IOKit/IOKernelReporters.h>
uint32_t gInterruptAccountingStatisticBitmask =
#if !defined(__arm__)
/* Disable timestamps for older ARM platforms; they are expensive. */
IA_GET_ENABLE_BIT(kInterruptAccountingFirstLevelTimeIndex) |
IA_GET_ENABLE_BIT(kInterruptAccountingSecondLevelCPUTimeIndex) |
IA_GET_ENABLE_BIT(kInterruptAccountingSecondLevelSystemTimeIndex) |
#endif
IA_GET_ENABLE_BIT(kInterruptAccountingFirstLevelCountIndex) |
IA_GET_ENABLE_BIT(kInterruptAccountingSecondLevelCountIndex);
IOLock * gInterruptAccountingDataListLock = NULL;
queue_head_t gInterruptAccountingDataList;
void interruptAccountingInit(void)
{
int bootArgValue = 0;
if (PE_parse_boot_argn("interrupt_accounting", &bootArgValue, sizeof(bootArgValue)))
gInterruptAccountingStatisticBitmask = bootArgValue;
gInterruptAccountingDataListLock = IOLockAlloc();
assert(gInterruptAccountingDataListLock);
queue_init(&gInterruptAccountingDataList);
}
void interruptAccountingDataAddToList(IOInterruptAccountingData * data)
{
IOLockLock(gInterruptAccountingDataListLock);
queue_enter(&gInterruptAccountingDataList, data, IOInterruptAccountingData *, chain);
IOLockUnlock(gInterruptAccountingDataListLock);
}
void interruptAccountingDataRemoveFromList(IOInterruptAccountingData * data)
{
IOLockLock(gInterruptAccountingDataListLock);
queue_remove(&gInterruptAccountingDataList, data, IOInterruptAccountingData *, chain);
IOLockUnlock(gInterruptAccountingDataListLock);
}
void interruptAccountingDataUpdateChannels(IOInterruptAccountingData * data, IOSimpleReporter * reporter)
{
uint64_t i = 0;
for (i = 0; i < IA_NUM_INTERRUPT_ACCOUNTING_STATISTICS; i++) {
if (IA_GET_STATISTIC_ENABLED(i))
reporter->setValue(IA_GET_CHANNEL_ID(data->interruptIndex, i), data->interruptStatistics[i]);
}
}
void interruptAccountingDataInheritChannels(IOInterruptAccountingData * data, IOSimpleReporter * reporter)
{
uint64_t i = 0;
for (i = 0; i < IA_NUM_INTERRUPT_ACCOUNTING_STATISTICS; i++) {
if (IA_GET_STATISTIC_ENABLED(i))
data->interruptStatistics[i] = reporter->getValue(IA_GET_CHANNEL_ID(data->interruptIndex, i));
}
}
|
code
|
\begin{document}
\title{Erasing Quantum Distinguishability via Single-Mode Filtering}
\author{Monika Patel,$^1$ Joseph B. Altepeter,$^2$ Yu-Ping Huang,$^2$ Neal N. Oza,$^2$ and Prem Kumar$^{1,2}$}
\affiliation{Center for Photonic Communication and Computing, \\
$^1$Department of Physics and Astronomy, $^2$Department of Electrical Engineering and Computer Science,\\
Northwestern University, 2145 Sheridan Road, Evanston, IL, 60208-3118, USA}
\begin{abstract}
Erasing quantum-mechanical distinguishability is of fundamental interest and also of practical importance, particularly in subject areas related to quantum information processing. We demonstrate a method applicable to optical systems in which single-mode filtering is used with only linear optical instruments to achieve quantum indistinguishability. Through ``heralded'' Hong-Ou-Mandel interference experiments we measure and quantify the improvement of indistinguishability between single photons generated via spontaneous four-wave mixing in optical fibers. The experimental results are in excellent agreement with predictions of a quantum-multimode theory we develop for such systems, without the need for any fitting parameter.
\pacs{ 42.50.Dv, 42.81.-i, 03.67.-a.}
\end{abstract}
\maketitle
Quantum indistinguishability is inextricably linked to several fundamental phenomena in quantum mechanics, including interference, entanglement, and decoherence \cite{ent, decoh1, decoh2}. For example, only when two photons are indistinguishable can they show strong second-order interference \cite{indis}. From an applied perspective, it forms the basis of quantum key distribution \cite{bb84}, quantum computing \cite{KniLafMil01}, quantum metrology \cite{quantummetrology}, and many other important applications in modern quantum optics. In practice, however, the generation and manipulation of quantum-mechanically indistinguishable photons is quite challenging, primarily due to their coupling to external degrees of freedom.
In this Letter, we experimentally investigate a pathway to erasing quantum distinguishability by making use of the Heisenberg uncertainty principle. This method, although designed specifically for optical systems, might be generalizable to other physical systems, including those of atoms and ions. It uses a filtering device that consists of only linear optical instruments, which in our present rendering is a temporal gate followed by a spectral filter. The gate's duration $T$ and the filter's bandwidth $B$ (in angular-Hertz) are chosen to satisfy $BT<1$ so that any photon passing through the device loses its temporal (spectral) identity as required by the Heisenberg uncertainty principle. In this sense, the device behaves as a single-mode filter (SMF) that passes only a single electromagnetic mode of certain temporal profile while rejecting all other modes. Hence, applying such a SMF to distinguishable single photons can produce output photons that are indistinguishable from each other \cite{HuaAltKum10, HuaAltKum11}. Our calculations show that for appropriate parameters very high levels of quantum indistinguishability can be achieved with use of the SMF, while paying a relatively low cost in terms of photon loss. This method is superior to using tight spectral or temporal filtering alone for similar purposes \cite{ZeiHorWei97, FioVosSha02}, where the photon loss is much higher. In fact, in Refs.~\cite{HuaAltKum10, HuaAltKum11} we have shown that the use of a SMF can significantly improve the performance of heralding-type single-photon sources made from optical fibers or crystalline waveguides \cite{Heralded-Single-Photon-SPDC86,Single-Photon-PCF05, Single-Photon-Fiber09, Single-Photon-PDC-99}.
In our experiment, pairs of signal and idler photons are generated in two separate optical-fiber spools via spontaneous four-wave mixing. By detecting the idler photons created in each spool, we herald the generation of their partner (signal) photons. To quantify their indistinguishability, we mix the signal photons generated separately from the two spools on a 50:50 beamsplitter and perform Hong-Ou-Mandel (HOM) interference measurements. We find that the HOM visibility is quite low when the signal photons have a temporal length $T>1/B$, owing to the presence of photons with many distinguishable degrees of freedom. However, when $T<1/B$, for which a SMF is effectively realized, a much higher HOM visibility is obtained. This result clearly shows that the SMF can be used to erase the quantum distinguishability of single photons. To quantitatively examine the degree of improvement, we develop a comprehensive theoretical model of light scattering and detection in optical fiber systems, taking into account multi-pair emission, Raman scattering, transmission loss, dark counts, and other practical parameters. The experimental data are in good agreement with predictions of the model without the need for any fitting parameter.
To understand our approach for erasing quantum distinguishability, we consider amplitude profiles $f(t)$ and $h(\omega)$ for the time gate and the spectral filter, respectively. The number operator for output photons is then given by
$\hat{a}t{n}=\frac{1}{(2\pi)^2}\int d\omega d\omega' \kappa(\omega,\omega')\hat{a}^\dag(\omega)\hat{a}(\omega')$ \cite{PrSp61,ZhuCav90}, where $\hat{a}(\omega)$ is the annihilation operator for the
incident photons of angular-frequency $\omega$, satisfying
$[\hat{a}(\omega),\hat{a}^\dag(\omega')]=2\pi\delta(\omega-\omega')$.
$\kappa(\omega,\omega')=\int dt~ h^\ast(\omega) h(\omega') |f(t)|^2
e^{i(\omega-\omega')t}$ is a Hermitian spectral correlation
function, which can be decomposed onto a set of
Schmidt modes as
$
\kappa(\omega,\omega')=\sum^{\infty}_{j=0} \chi_{j} \phi^\ast_{j}(\omega)\phi_{j}(\omega'),
$
where $\{\phi_{j}(\omega)\}$ are the
mode functions satisfying $\int d\omega
\phi^\ast_{j}(\omega)\phi_{k}(\omega)=2\pi\delta_{j,k}$ and
$\{\chi_{j}\}$ are the decomposition coefficients satisfying
$1\ge \chi_0 >\chi_1>...\ge 0$. Introducing an infinite set
of mode operators via $\hat{a}t{c}_{j}=\frac{1}{2\pi}\int d\omega
\hat{a}(\omega) \phi_{ j}(\omega)$ ($j=0,1,...$) that satisfy
$[\hat{a}t{c}_{j},\hat{a}t{c}_{k}^\dag]=\delta_{jk}$, the output operator for the filtering device can be
rewritten as
\begin{equation}
\hat{a}t{n}=\sum^{\infty}_{j=0} \chi_j~ \hat{a}t{c}^\dag_{j} \hat{a}t{c}_{j}.
\end{equation}
This result indicates that $\{\phi_{j}(\omega)\}$ have an intuitive physical
interpretation: as ``eigenmodes'' with eigenvalues $\{\chi_{j}\}$ of the filtering device. In this physical
model, the filtering device projects incident photons onto
the eigenmodes, each of which are passed with a probability
given by the eigenvalues. Specifically, for $\chi_{0}\sim 1$ and
$\chi_{j\neq 0} \ll 1$ (achievable with an appropriate
choice of spectral and temporal filters, as shown below)
only the fundamental mode is transmitted while all the other
modes are rejected. In this way, truly \emph{single-mode} filtering
can be achieved. Combined with single-photon detectors, this can be
extended to a single-mode, single-photon detection system.
Regardless of the type of spectral and temporal filters used to
achieve this kind of single-mode filtering, such a system is
capable of separating photons which, even though they may exist in the
same spectral band and the same time-bin, have different mode structures.
As an example, in Fig.~\ref{fig1}(a) we plot $\chi_{0},\chi_{1},\chi_{2}$
versus $c\equiv BT/4$ for a rectangular-shaped spectral filter with bandwidth $B$ and a rectangular-shaped time window of duration $T$ \cite{PrSp61,SasSuz06}. For $c<1$, we have $\chi_0\approx 1$ whereas
$\chi_1,\chi_2\ll 1$, giving rise to approximately single-mode
filtering. Note that this behavior is true for any $B$, as
long as $T<4/B$. In other words, $\{\chi_j\}$ depend only on the
product of $B$ and $T$, rather than on their specific values.
Consequently, even a broadband filter can lead to a single-mode measurement over
a sufficiently short detection window, and vice-versa. To understand
this, consider the case where a detection event announces the
arrival of a signal photon at an unknown time within the window
$T$. In the Fourier domain, this corresponds to a detection
resolution of $1/T$ in frequency. Given $c<1$ or $1/T>B/4$,
the detector is thus unable to, even in principle, reveal the
frequency of the signal photon. Therefore, the signal photon
is projected onto a quantum state in a coherent superposition of
frequencies within $B$ \cite{HuaAltKum11}. This can be seen
in Fig.~\ref{fig1}(b), where the fundamental detection mode has
a nearly flat profile over the filter band $[-B/2, B/2]$. Lastly,
since $T<4/B$ is required, the pass probability of the fundamental
mode will be sub-unity, but not significantly less than one.
\begin{figure}
\caption{(Color online) (a) $\chi_0$, $\chi_1$, and $\chi_2$ as functions of $c$. (b) Plots of $\phi_0$, $\phi_1$, and $\phi_2$ for $B=\pi/T$ (corresponding to $c=\pi/4$). \label{fig1}
\label{fig1}
\end{figure}
To verify this theory of erasing quantum distinguishability via single-mode filtering, we perform a heralded two-photon interference experiment \cite{gisin03, zeilingerentswp09, rarity07, takesue07} in both multimode ($c>1$) and single-mode ($c<1$) regimes. Hong-Ou-Mandel interference between two photons originating from independent
photon-pair sources provides a test of indistinguishability. Appropriate choices of wavelength-division multiplexers (spectral filters which select $B$) and the width of pulses pumping the photon-pair sources (which effectively sets the temporal window $T$ in which photon pairs are born) allow a transition from the single-mode to the multimode regime.
\begin{figure}
\caption{(Color online) Experimental setup. A,B,C,D: single-photon detectors.}
\label{experimentalsetup}
\end{figure}
The experimental setup is shown in Fig.~\ref{experimentalsetup}. Both heralded photon-pair sources are pumped using the same system, consisting of 50-MHz repetition-rate pulses carved from the output of either a continuous-wave (CW) laser (for the multimode heralding experiment) or a mode-locked laser (for the single-mode heralding experiment). The pulse-carver is an optical amplitude modulator (EOSPACE, Model AK-OK5-10) driven by the output of a 20-Gbps 2:1 selector (Inphi, Model 20709SE), which is clocked at 50 MHz by an electrical signal source that also triggers the single-photon detectors (NuCrypt, Model CPDS-4) used in the experiment. The carved pulses are then amplified and fed to a 50:50 fiber splitter. Each output branch of the splitter leads to a four-wave-mixing (FWM) fiber spool (500 m of standard single-mode fiber cooled to 77 K) in a Faraday-mirror configuration \cite{HuaAltKum09}. The Faraday mirror effectively doubles the length of fiber available for four-wave mixing while simultaneously compensating for any polarization changes which may occur in the spooled fiber. The signal and idler photons are created via spontaneous four-wave mixing. Along with the residual pump photons, they enter two cascaded filtering stages which provide $\approx$100-dB of isolation. The filtered signal and idler photons then pass through fiber polarization controllers (not shown in Fig.~\ref{experimentalsetup}) and the signal photons are led to the two input ports of an in-fiber 50:50 coupler. Adjusting the polarization controllers and careful temporal alignment with use of a variable delay stage in the path of one of the signal photons ensures that the signal photons arriving at the 50:50 coupler are identical in all degrees of freedom: polarization, spectral/temporal, and spatial. Note that even though these signal photons are identical, they may still be partially or completely distinguishable (particularly in the multimode regime described above). This distinguishability may arise from entanglement with \emph{different} idler photons (heralds) or from the presence of background photons that originate in the FWM fiber owing to Raman scattering. Four InGaAs-based single-photon detectors are used to count photons, one each at the outputs of the idler arms and the 50:50 coupler. These detectors are gated at 50-MHz repetition rate synchronous with the arrival of photons and have a dark-count probability of $1.6\times10^{-4}$ per pulse. Their quantum efficiencies are approximately 20\%. The delay stage is used to vary the temporal overlap of the signal photons while the photon counts are recorded.
In the multimode experimental configuration, where a CW laser (Santec, model TSL-210V) is used as the pump, the temporal duration of the carved pulses is specified by the width of the electrical pulses provided to the modulator, which is measured to be 100~ps, giving $T=10^{-10}$~s. The signal and idler filters each consist of a free-space diffraction-grating filter [full-width at half-maximum (FWHM) $\approx$ 0.14 nm] followed by a dense wavelength-division-multiplexing (DWDM) filter (FWHM $\approx$ 0.4 nm). The resulting optical transmission spectra are shown in Fig.~3(a), from which the effective bandwidth of the signal and idler filters is determined to be approximately 0.14 nm. In units of frequency, this gives $B/2\pi=24.6$ GHz so that $BT=2.5\times2\pi$. Therefore, $c=3.8$ and from Fig.~\ref{fig1}, $\chi_0\approx1$, $\chi_1\approx0.9$ and $\chi_2\approx 0.5$. Because $\chi_1$ and $\chi_2$ are not neglible, this case corresponds to a multimode measurement.
\begin{figure}
\caption{(Color online) Optical transmission spectra for each stage of the pump, signal, and idler filters. Each filter is composed of two separate stages and provides $>$100 dB of isolation. The stages are either fiber-coupled free-space double-pass transmission-grating filters or DWDM filters (custom-made by AC Photonics, Inc.). (a) Spectra for the pump filter (formed by two grating filters) and the signal and idler filters (each formed by a grating and a DWDM filter) used in the multimode experiment. (b) Spectra for the pump, signal, and idler filters used in the single-mode experiment, each formed by two DWDM filters centered at the respective wavelength. In both plots, solid (green) and dashed (blue) traces correspond to the filters used in source 1 and source 2, respectively.
\label{filters}
\label{filters}
\end{figure}
In the single-mode experimental configuration, a 10-GHz mode-locked laser (U2T, model TMLL1310) emitting a train of 2-ps duration, transform-limited pulses is used as the pump. The signal and idler photons along with the pump pulses are each filtered by two stages of DWDM filters. The resulting optical transmission spectra of these filters are shown in Fig.~3(b). The bandwidth of the pump filter is measured to be $68.3$ GHz, from which the pump-pulse width and thus the effective $T$ is derived to be $6.4$ ps. The bandwidths of the signal and the idler filters, on the other hand, are both approximately 0.4 nm, which give $BT\approx 0.4\times 2\pi$ or $c=0.7$. In this case, $\chi_0\approx0.4$, and $\chi_1$ and $\chi_2$ are nearly zero, giving rise to a single-mode measurement.
In practice it is experimentally convenient to analyze the behavior of non-heralded two-photon coincidence counts to precisely path-match the two signal arms. This is because there are many more twofold coincidences than fourfold coincidences in the system, which allows us to study the quantum interference effect with much smaller error bars and a much shorter measurement time. To this end we define a twofold coincidence count to be when detectors A and B (c.f. Fig. 1) fire in the same time slot. We define a twofold accidental-coincidence count to be when detectors A and B fire in adjacent time slots. Finally, we define a fourfold coincidence, the quantity of primary experimental interest, to occur when all four detectors fire simultaneously in the same time slot. Figure~\ref{trues} shows the variation in accidental-subtracted coincidences on detectors A and B as the relative delay between the signal photons from the two FWM sources is varied.
\begin{figure}
\caption{(Color online) (a) Accidental-subtracted A-B coincidences recorded per $5\times 10^7$ pump pulses as a function of the relative delay between signal photons in the multimode configuration; and (b) in the single-mode configuration. Error bars are of the same size as the data markers. The red curve is a Gaussian least-square fit to the data.}
\label{trues}
\end{figure}
The recorded fourfold coincidence counts as a function of the relative delay in the heralded HOM interference experiment are plotted in Fig.~\ref{expresults}. For the multimode experimental configuration, as shown in Fig.~\ref{expresults}(a), the interference visibility is only $19\pm2\%$. In contrast, for the single-mode configuration, a high visibility of $72\pm7\%$ is obtained, as shown in Fig.~\ref{expresults}(b). This is the highest HOM interference visibility reported thus far for fiber-based single-photon sources in the telecommunications band. For these results, the transmission efficiencies of the signal and idler photons from their generation site in the FWM spools to the detectors are measured for each arm and are found to be 3.4\% (5.5\%) for the signal arms and 5.0\% (7.0\%) for the idler arms in the multimode (single-mode) configuration. The photon-pair production probabilities per pump pulse are measured to be 12.5\% and 3.9\% for the multimode and single-mode configurations, respectively.
Although these experiments show a clear difference between the single-mode and multimode regimes, the theory of single-mode detection presented above---in the absence of any systematic sources of noise---seems to predict much higher visibilities, particularly for the single-mode experiment where it seems that any entanglement with the idler photons should be eliminated by the SMF. In fact, systematic sources of noise---from multi-pair production, stimulated Raman emission, loss, and dark counts---do significantly affect the results. In order to determine the extent to which these experimental results verify the theory of SMF presented above, it is necessary to create a complete theoretical model of multi-pair production, Raman emission, loss, dark-count noise, and the interference between two real experimental systems. For this goal, we adopt the standard quantum-mechanical description (assuming phase matching and undepleted pump) of light scattering in optical fibers at a few-photon level \cite{FWM-Raman07}:
$ \hat{a}^{r(\ell)}_{s,a}(\omega)= \int d\omega' \alpha(\omega-\omega') \hat{b}^{r(\ell)}_{s,a}(\omega') +i\gamma L \int\int d\omega_1 d\omega' A_p(\omega_1) A_p(\omega'+\omega-\omega_1) (\hat{b}^{r(\ell)}_{a,s})^\dag(\omega')+i \int^L_0 dz \int d\omega' \hat{m}^{r(\ell)}(z,\omega') A_p(\omega-\omega'),
$
where $\hat{b}^{r(\ell)}_{s,a}$ ($\hat{a}^{r(\ell)}_{s,a}$) are the input (output) annihilation operators for the Stokes and anti-Stokes photons, respectively, in the right (left) fiber spool. $A_p(\omega)$ is the spectral amplitude of the pump in each fiber spool, with $2\pi\int d\omega |A_p(\omega)|^2$ giving the pump-pulse energy; $\alpha(\omega-\omega')$ is determined self-consistently to preserve the commutation relations of the output operators; $\gamma$ is the fiber SFWM coefficient, which we have assumed to be constant; $L$ is the effective length of the fiber spool; and $\hat{m}^{r(\ell)}(z,\omega)$ is the phonon-noise operator accounting for the Raman scattering, which satisfies $[\hat{m}^{r(\ell)}(z,\omega),\hat{m}^{r(\ell)\dag}(z',\omega')]=2\pi
g(\omega) \delta(z-z')\delta(\omega-\omega')$,
where $g(\omega)>0$ is the Raman gain coefficient
\cite{KarDouHau94,RamanMeasured05}. For a phonon bath in
equilibrium at temperature $T$, we have the expectation
$\langle \hat{m}^{r(\ell)\dag}(z,\omega)\hat{m}(z',\omega') \rangle=2\pi
g(\omega) \delta(z-z')\delta(\omega-\omega') n_T(\omega)$, where
$n_T(\omega)=\frac{1}{e^{\hat{b}ar |\omega|/k_B T}-1}+\theta(-\omega)$
with $k_B$ the Boltzman constant, and $\theta(\omega)=1$ for
$\omega\ge 0$, and $0$ otherwise.
\begin{figure}
\caption{(Color online) (a) Fourfold coincidence counts per 20 billion pulses recorded as a function of timing delay,
using the continuous-wave laser as pump, and (b) fourfold coincidence counts per 10 billion pulses recorded as a function of timing delay, using the mode-locked laser as pump. In both figures, the error bars are computed following the standard manner of estimating statistical randomness assuming Poissonian distributions of the recorded coincidence and singles counts.}
\label{expresults}
\end{figure}
For the fourfold coincidence measurement depicted in Fig.~\ref{expresults}, the photon-number operators for detectors A, B, C, D are given by $ \hat{a}t{n}_M=\sum_{j_M} \eta_M \chi_{j_M}\hat{a}^\dag_{j_M}\hat{a}_{j_M}+\zeta_{M} \hat{a}t{d}^\dag_M\hat{a}t{d}_M$,
for $M$ = A, B, C, D. Here, $\eta_M$ is the total detection
efficiency taking into account propagation losses and the detector
quantum efficiency. $\eta_{jM}$ is the $j$-th eigenvalue of
the filtering system for detector $M$. $\zeta_M$ measures
the quantum-noise level of the detector as a result of the dark
counts and the after-pulsing counts. $\hat{a}t{d}_M$ is a noise operator
obeying $[\hat{a}t{d}_M,\hat{a}t{d}^\dag_{M'}]=\delta_{M,M'}$. By this
definition, the mean number of dark counts for detector $M$
is then given by the expectation $\zeta_M\langle\hat{a}t{d}^\dag_M
\hat{a}t{d}_{M'}\rangle$. The bosonic operators
$ \hat{a}_{j_\mathrm{A}(j_\mathrm{B})}=\frac{1}{2\sqrt{2}\pi} \int_{\mathrm{A(B)}} d\omega\left[e^{\frac{i\tau \omega}{2}}\hat{a}^{r}_{s}(\omega)\pm e^{\frac{-i\tau \omega}{2}} \hat{a}^\ell_s(\omega)\right]\phi_{j_\mathrm{A}(j_\mathrm{B})}(\omega)$, and
$\hat{a}_{j_\mathrm{C}(j_\mathrm{D})}= \frac{1}{2\pi} \int_{\mathrm{C(D)}} d\omega~\hat{a}^{r(\ell)}_{a} \phi_{j_\mathrm{C}(j_\mathrm{D})}$
where $\tau$ is the amount of signal delay and $``\int_M d\omega''$ represents integral over the detection spectral band of the detector $M$. With $\hat{a}t{n}_M$, the positive operator-valued measure
for the detector $M$ to click is calculated to be
$\hat{a}t{P}_M=1-:\!\exp(-\hat{a}t{n}_M)\!:$, where ``:~:'' stands for normal ordering of all the embraced
operators. The four-fold coincidence probability is then given by
$\langle :\!\hat{a}t{P}_\mathrm{A} \hat{a}t{P}_\mathrm{B} \hat{a}t{P}_\mathrm{C} \hat{a}t{P}_\mathrm{D}\!:\rangle$.
Applying the above theory to the experimental configurations presented
above, we find the predicted visibilities of 17\% (multimode regime) and
72\% (single-mode regime)---in excellent agreement with the experimental
results. Note that because the theoretical fits shown in Fig.~\ref{expresults} are
generated from the complete theory described above, they require \emph{no
fitting parameter}. As a result, we conclude that the theories of both
single-mode filtering and SFWM in the presence of noise are able to
accurately model our experiments in both the single-mode and multimode
regimes, and provide an important new tool for the study of
distinguishability in photonic systems.
This research was supported in part by the Defense
Advanced Research Projects Agency (DARPA) under
the Zeno-based Opto-Electronics (ZOE) program (Grant
No. W31P4Q-09-1-0014) and by the United States Air
Force Office of Scientific Research (USAFOSR) (Grant
No. FA9550-09-1-0593).
\end{document}
|
math
|
\begin{document}
\baselineskip 22pt
\begin{center}
{\Large HOW UNCONDITIONALLY SECURE QUANTUM \\
BIT COMMITMENT IS POSSIBLE} \\
\vspace*{.4in}
{\Large Horace P. Yuen} \\ {\large Department of Electrical and
Computer Engineering \\ Department of Physics and Astronomy\\
Northwestern University \\ Evanston IL 60208-3118 \\ email:
[email protected]}
\end{center}
\vspace*{.4in}
\begin{abstract}
Bit commitment involves the submission of evidence from one party to
another so that the evidence can be used to confirm a later revealed
bit value by the first party, while the second party cannot determine
the bit value from the evidence alone. It is widely believed that
unconditionally secure quantum bit commitment is impossible due to
quantum entanglement cheating, which is codified in a general
impossibility theorem. In this paper, the scope of this general
impossibility proof is analyzed, and gaps are found. Two
variants of a bit commitment scheme utilizing anonymous
quantum states and decoy states are presented. In the first variant, the exact verifying measurement is
independent of the committed bit value, thus the second party can make
it before the first party opens, making possible an unconditional security proof based on no-cloning. In the second variant, the impossibility proof fails because quantum entanglement purification of a mixed state does not render the protocol determinate. Whether impossibility holds in this or similar protocols is an open question, although preliminary results already show that the impossibility proof cannot work as it stands.
\vspace*{.2in}
\noindent PACS \#: 03.67Dd, 03.65Bz
\end{abstract}
\vspace*{.5in}
Note:
We have made a few clarifications and elaborations in this revision.
\renewcommand{\Roman{section}}{\Roman{section}}
\tableofcontents
\section{\hspace{.2in}Introduction}
\indent
Quantum cryptography \cite{bennett}, the study of information security
systems involving quantum effects, has recently been associated almost
exclusively with the cryptographic objective of key distribution.
This is due primarily to the nearly universal acceptance of the general
impossibility of secure quantum bit commitment (QBC), taken to be a
consequence of the Einstein-Podolsky-Rosen (EPR) type entanglement
cheating which rules out QBC and other quantum protocols that have
been proposed for various other cryptographic objectives
\cite{brassard}. In a bit commitment scheme, one party, Adam,
provides another party, Babe, with a piece of evidence that he has
chosen a bit b (0 or 1) which is committed to her. Later, Adam would
``open'' the commitment: revealing the bit b to Babe and convincing
her that it is indeed the committed bit with the evidence in her
possession. The usual concrete example is for Adam to write down the
bit on a piece of paper which is then locked in a safe to be given to
Babe, while keeping for himself the safe key that can be presented
later to open the commitment. The evidence should be {\em binding},
i.e., Adam should not be able to change it, and hence the bit, after
it is given to Babe. It should also be {\em concealing}, i.e., Babe
should not be able to tell from it what the bit b is. Otherwise,
either Adam or Babe would be able to cheat successfully.
In standard cryptography, secure bit commitment is to be achieved
either through a trusted third party or by invoking an unproved
assumption on the complexity of certain computational problem. By
utilizing quantum effects, various QBC schemes not involving a third
party have been proposed that were supposed to be unconditionally
secure, in the sense that neither Adam nor Babe can cheat with any
significant probability of success as a matter of physical laws. In
1995-1996, a general proof on the impossibility of unconditionally
secure QBC and the insecurity of previously proposed protocols were
described \cite{mayers1}-\cite{lo}. Henceforth, it has been generally
accepted
that secure QBC and related objectives are impossible as a matter of
principle \cite{lo1}-\cite{lo4}.
There is basically just one impossibility proof, which gives the EPR
attacks for the cases of equal and unequal density operators that Babe
has for the two different bit values. The proof shows that if Babe's
successful cheating probability $P^B_c$ is close to the value 1/2,
which is obtainable from pure
guessing of the bit value, then Adam's successful cheating probability $P^A_c$ is
close to the perfect value 1. This result is stronger than the mere impossibility of unconditional security, namely that it is
impossible to have both $P^B_c \sim 1/2$ and $P^A_c \sim 0$. Since
there is no known characterization of all possible QBC protocols,
logically there can really be no general impossibility proof even if
it were indeed impossible to have an unconditionally secure QBC
protocol.
In this paper, the formulation within which the general impossibility
proof was developed will be analyzed. The mechanism for the success
of the impossibility proof within a limited scope will be delineated.
It is shown that the use of classical randomness unknown to one of the
two parties, common in many standard cryptographic protocols, is not
properly accounted for in the previous impossibility proof
formulation. In particular, the turning of classical randomness into
quantum determinateners via quantum purification of a mixed quantum
state does {\em not} render a quantum protocol determinate with no
further role for classical randomness, as described in the
impossibility proof. Specifically, a scheme utilizing anonymous
states and decoy states will be presented, and the different ways in which the impossibility proof fails for
these variants will be explicitly pinpointed. The results are
developed within nonrelativistic quantum mechanics, unrelated to relativistic
protocols \cite{kent} or cheat-sensitive protocols \cite{hardy}.
Since bit commitment leads to ``coin-tossing'' and other cryptographic protocols, our present results have
immediate impact on many recent works on quantum coin-tossing and multiparty computation.
To provide a foretaste of the failure of the impossibility proof, the
following two points may be mentioned. First, the impossibility proof
has {\em no} role for any possible classical randomness that Babe may
introduce, which, even after quantum purification, would actually be
explicitly used by her in her verification of the bit. If the use of
such randomness by Babe is taken into account, it is not hard to see
that the success of Adam's EPR cheat may depend on knowing the actual
value of such random numbers. Secondly, there are concealing
protocols for which Babe can make all the measurements for
verification {\em before} Adam opens because the verifying measurement is independent of the
bit value, with no consequent possibility that an
information carrying state needs to be discarded due to measurement
basis mismatch. This kind of protocol is one of several types outside the impossibility proof formulation. Indeed, a general formulation of all possible QBC protocols is not yet available that includes a proper expression of just the concealing condition, not to mention both concealing and binding with corresponding expressions for the cheating probabilities.
In section II, the impossibility proof would be described and
extended. The mechanism of its success within its limited scope will
be highlighted. In section III, the use of anonymous states in QBC
will be developed, in which Babe uses classical random numbers in the
most direct way in protocols involving two-way quantum communication.
It is explicity demonstrated that the impossibility proof,
specifically the use of the doctrine ``Church of Larger Hilbert
Space,'' fails to cover such situations in two different ways. In section IV, our basic scheme is introduced in a
preliminary form which is not yet unconditionally secure but which
already invalidates the impossibility proof. Two variants of
the scheme are described. One of which, QBCp3m, allows Babe to make
perfect verifying measurements before Adam opens. The reader is urged to first
read Appendix D for a concise presentation of this basically rather
simple protocol, as it confirms our statement
above that there can be no general impossibility proof without a
characterization of all possible QBC protocols. In section V, the
protocol QBCp3m is extended to fully unconditionally secure
ones together with their security proofs. Some general and practical
observations are made in the last section VI. Note that the same
index may denote different quantities in different sections, and
the notation $ \otimes$ is often omitted for brevity.
\section{\hspace{.2in}The Impossibility Proof}
\indent
In this Section we review the standard formulation of the
impossibility proof, present some pertinent new results, and explain the
precise mechanism of the EPR cheating.
According to the impossibility proof, Adam would generate $|\Phi _0
\rangle$ or $|\Phi _1 \rangle$ depending on b = 0 or 1,
\begin{equation}
|\Phi _0 \rangle = \sum_i \sqrt{p_i} | e_i \rangle | \phi _i \rangle,
\label{ent1}
\end{equation}
\begin{equation}
|\Phi _1 \rangle = \sum_i \sqrt{p'_i} | e'_i \rangle | \phi ' _i
\rangle
\label{ent2}
\end{equation}
where the states $\{ | \phi_i \rangle \}$ and $\{ | \phi'_i \rangle
\}$ in ${\mathcal H}^B$ are openly known, $i \in \{1, \ldots, M \}$,
$\{ p_i \}$ and $\{ p'_i \}$ are known probabilities, while $\{ | e_i
\rangle \}$ and $\{ | e'_i \rangle \}$ are two complete orthonormal
sets in ${\mathcal H}^A$. All Dirac kets are normalized in this
paper. Adam sends Babe ${\mathcal H}^B$ while keeping ${\mathcal H}^A$
to himself. He opens by measuring the basis $\{ | e_i \rangle \}$ or $\{
| e'_i \rangle \}$ in $\mathcal{H}^A$ according to his committed state
$| \Phi_0 \rangle$ or $| \Phi_1 \rangle$, resulting in a specific $|
\phi_i \rangle$ or $| {\phi'}_i \rangle$ on $\mathcal{H}^B$, and
telling Babe which $i$ he has obtained. Babe verifies by measuring
the corresponding projector and will obtain the value 1 (yes) with
probability 1. In this formulation, Adam can switch between $|\Phi _0
\rangle$ and $|\Phi _1 \rangle$ by operation on ${\mathcal H}^A$
alone, and thus alter the evidence to suit his choice of b before
opening the commitment. In the case $\rho^B_0 \equiv {\rm tr}_A |\Phi
_0 \rangle \langle \Phi _0 | = \rho ^B _1 \equiv {\rm tr}_A |\Phi _1
\rangle \langle \Phi _1|$, the switching operation is to be obtained
by using the so-called ``Schmidt decomposition
\cite{schmidt_decomp},'' the expansion of $|\Phi _0 \rangle$ and
$|\Phi _1 \rangle$ in terms of the eigenstates $|\hat{\phi}_k \rangle$
of $\rho^B_0 = \rho^B_1$ with eigenvalues $\lambda_k$ and the eigenstates $|\hat{e}_k \rangle$ and
$|\hat{e}'_k \rangle$ of $\rho^A_0$ and $\rho^A_1$,
\begin{equation}
|\Phi _0 \rangle = \sum _k \sqrt{\lambda_k} |\hat{e}_k \rangle
|\hat{\phi}_k \rangle, \hspace*{.2in} |\Phi _1 \rangle = \sum _k
\sqrt{\lambda_k} |\hat{e}'_k \rangle |\hat{\phi}_k \rangle
\end{equation}
By applying a unitary $U^A$ that brings $\{ |\hat{e}_k \rangle \}$ to
$\{ |\hat{e}'_k \rangle \}$, Adam can select between $|\Phi_0 \rangle$
or $|\Phi_1 \rangle$ any time before he opens the commitment but after
he supposedly commits. When $\rho_0^B$ and $\rho_1^B$ are not equal
but close, it was shown that one may transform $| \Phi _0 \rangle$ by
an $U^A$ to a $| \tilde{\Phi} _0 \rangle$ with $|\langle \Phi _1 |
\tilde{\Phi} _0 \rangle |$ as close to 1 as $\rho ^B_0$ is close to
$\rho ^B_1$ according to the fidelity F chosen, and thus the state $|
\tilde{\Phi} _0 \rangle$ would serve as the effective EPR cheat.
In addition to the above quantitative relations, the gist of the
impossibility proof is supposed to lie in its generality -- that any
QBC protocol could be fitted into its formulation, as a consequence of
various arguments advanced in \cite{mayers1}-\cite{lo4}. Among
other reasons, it appeared to the
present author from his development of a new cryptographic tool,
anonymous quantum key technique \cite{yuen_capri}, that the
impossibility proof is not sufficiently general. Since there
is no need for Adam to entangle anything in an honest protocol.
Adam can just send Babe a state $| \phi_i \rangle$
with probability $p_i$ when he picks b=0. When he picks b=1, he sends $| \phi'_i
\rangle$ with probability $p'_i$. If the anonymous key technique is
employed, $| \phi_i \rangle$ and $| \phi'_i \rangle$ are to be
obtained from applying $U_{0i}$ or $U_{1i}$ from some fixed openly known
set of unitary operators $\{ U_{0i} \}$ and $\{ U_{1i} \}$ on ${\mathcal
H}^B$ by Adam to the states $| \psi \rangle$ sent to him by Babe and
known only to her. As a consequence, Adam would not be able to
determine the cheating unitary transformation $U^A$. This use of anonymous states is {\em not}
explicitly accounted for in the open literature, and the role of
classical random numbers in the problem formulation is not clearly and
fully laid out in the impossibility proof. However, it seems the
prevailing opinion is that the impossibility proof covers classical
randomness in essence, basically through the use of quantum
purification of classical
randomness \cite{mayers}, \cite{lo3}, \cite{miller-quade}. This claim that the impossibility proof covers all
classical randomness has never been explicitly demonstrated, and it is
one major purpose of this paper to show that such a claim is
erroneous. The gap in the reasoning, to be delineated in section
III, is best appreciated after a careful quantitative development of
the impossibility proof to be presently given.
In a QBC protocol, the $\{ | \phi_i \rangle \}$ and $\{ | \phi'_i \rangle \}$
are chosen so that they are concealing as evidence, i.e. Babe cannot
reliably distinguish them in optimum binary hypothesis testing
\cite{helstrom}. They would also be binding if Adam is honest and sends them as they
are above, which he could not change after Babe receives them. Babe
can always guess the bit with a probability of success $P^B_c = 1/2$,
while Adam should not be able to change a committed bit at all.
However, it is meaningful and common to grant {\em unconditional
security} when the best $\bar{P}^B_c$ Babe can achieve is arbitrarily
close to 1/2 and Adam's best probability of successfully changing a
committed bit $\bar{P}^A_c$ is arbitrarily close to zero even when both parties have perfect technology and unlimited resources
including unlimited computational power \cite{mayers}.
The operation of unitary transformation with subsequent measurement of
an orthonormal basis is equivalent to the mere measurement of another
orthonormal basis $\{ |\tilde{e}_i \rangle \}$ on the system. Thus,
the net cheating operation can be described by writing
\begin{equation}
| \Phi_0 \rangle = \sum_i \sqrt{\tilde{p}_i} | \tilde{e}_i \rangle |
\tilde{\phi}_i \rangle,
\end{equation}
\begin{equation}
\sqrt{\tilde{p}_i}|\tilde{\phi}_i \rangle \equiv \sum_j \sqrt{p_j}
V_{ji} |\phi_j \rangle
\end{equation}
for a unitary matrix V defined by $| e_i \rangle = \sum_j V_{ij} |
\tilde{e}_j \rangle$, and then measuring $|\tilde{e}_i\rangle$. For
convenience, we may still in the rest of the paper refer to the
cheating operation as a $U^A$ transformation described at the
beginning of this Section, with $| e_i \rangle = U^A
|\tilde{e}_i \rangle$. From (5), the $| \tilde{\phi}_i \rangle$ obtainable by operation on
${\mathcal H}^A$ alone are some unitary linear combinations of the $|
\phi_i \rangle$. The quantitative expression
for $P^A_c$ can
now be given. If Babe verifies the individual $| \phi'_i \rangle$,
the Adam's successful cheating probability is
\begin{equation}
P^A_c = \sum_i \tilde{p}_i | \langle \tilde{\phi}_i | \phi'_i \rangle
|^2.
\end{equation}
When randomness from Babe is present, further averaging is needed to yield the final $P^A_c$. The EPR cheating mechanism is clear from (5)---via entanglement and
measurement of a different basis, Adam can generate {\em unitary linear
combinations of the committed states} $|\phi_i \rangle $ to
approximate the states $|\phi'_i \rangle $. The approximation is
guaranteed to be good when the protocol is concealing, as follows.
In general, the optimal cheating probability $\bar{P}^B_c$ for Babe is
given by the probability of correct decision for optimally discriminating between two density operators $\rho^B
_0$ and $\rho^B _1$ by any quantum measurement. For equal a priori probabilities,
\begin{equation}
\bar{P}^B_c = \frac{1}{4} (2 + \| \rho^B _0 - \rho^B _1 \| _1)
\end{equation}
where $\| \cdot \| _1$ is the trace norm, $\| \tau \| _1 \equiv
tr(\tau ^{\dagger} \tau )^{1/2}$, for a trace-class operator $\tau$
\cite{schatten}. In terms of a security parameter $n$ that can be
made arbitrarily large, the statement of unconditional security (US) can be
quantitatively expressed as
\begin{equation}
{\rm (US)} \quad \qquad \lim _n \bar{P} ^B _c = \frac {1} {2} \quad {\rm
and} \quad \lim _n \bar{P} ^A _c = 0.
\end{equation}
Condition (US) is equivalent to the statement that for any $\epsilon > 0$, there exists an
$n_0$ such that for all $n > n_0$, $\bar{P}^B_c - \frac{1}{2} <
\epsilon$ and $\bar{P}^A_c < \epsilon$, i.e. $\bar{P}^B_c -
\frac{1}{2}$ and $\bar{P}^A_c$ can both be made arbitrarily small for
sufficiently large $n$. The impossibility proof claims more
than the mere impossibility of (US), it asserts \cite{mayers1} the
following statement (IP):
\begin{equation}
{\rm (IP)} \qquad\bar{P}^B_c = \frac{1}{2} + O(\frac{1}{n}) \Rightarrow \bar{P}^A_c = 1
- O(\frac{1}{n})
\end{equation}
Condition (9) implies the following limiting statement
\begin{equation}
{\rm (IP')} \qquad \lim _n \bar{P} ^B _c = \frac {1} {2} \quad
\Rightarrow \quad \lim _n \bar{P} ^A _c = 1.
\end{equation}
that directly contradicts (8). One may regard (IP') as the general
impossibility statement, independently of the specific convergence rate of (9). In the $\rho ^B _0 = \rho ^B _1$ case, the EPR cheat shows that
$\bar{P}^B_c=\frac{1}{2}$ implies $\bar{P}^A_c=1$. Thus (IP')
generalizes it to the assertion that the function
$\bar{P}^A_c(\bar{P}^B_c)$, obtained by varying $n$, is {\em
continuous} from above at $\bar{P}^B_c = \frac{1}{2}$. Note the
difference between the truth of (IP') and the weaker statement that (US) is impossible. In the middle ground
that $\lim_n \bar{P}^B_c = \frac{1}{2}$ implies just $0 < \lim_n
\bar{P}^A_c < 1$, the protocol would be concealing for Babe and
quantitatively cheat-sensitive for Adam. However, it may be
expected that if $\bar{P}^A_c $ is not close to $1$, it may be made close
to $0$ in an extension protocol which thus becomes unconditionally
secure.
The cheating transformation for the $\rho^B_0 \neq \rho^B_1$ case is
determined from ref. \cite{jozsa} according to the impossibility proof [3]-[4], which would
proceed as follows. Let $|\lambda_i\rangle$ and $|\mu_i\rangle$ be the eigenstates of
$\rho^B_0$ and $\rho^B_1$ with eigenvalues $\lambda_i$ and $\mu_i$.
The Schmidt normal forms of the purifications $|\Phi_0\rangle$ and $|
\Phi_1 \rangle$ of $\rho^B_0$ and $\rho^B_1$ are given by
\begin{equation}
|\Phi_0\rangle = \sum_i \sqrt{\lambda_i} |f_i\rangle |\lambda_i\rangle,
\end{equation}
\begin{equation}
|\Phi_1\rangle = \sum_i \sqrt{\mu_i} |g_i\rangle |\mu_i\rangle
\end{equation}
for complete orthonormal sets $\{|f_i\rangle\}$ and $\{|g_i\rangle\}$
on ${\mathcal H}^A$. Define the unitary operators $U_0$, $U_1$ and
$U_2$ by
\begin{equation}
U_0|\lambda_i\rangle = |\mu_i\rangle,
\end{equation}
\begin{equation}
U_1|\lambda_i\rangle = |f_i \rangle,
\end{equation}
\begin{equation}
U_2|\mu_i\rangle=|g_i \rangle.
\end{equation}
Let $U$ be the unitary operator for the polar decomposition of
$\sqrt{\rho^B_0} \sqrt{\rho^B_1}$ ,
\begin{equation}
\sqrt{\rho^B_0} \sqrt
{\rho^
B_1} = \left| \sqrt{\rho^B_0}
\sqrt{\rho^B_1} \right| U.
\end{equation}
Then $\left| \langle \Phi_0 | \Phi_1 \rangle \right|$ assumes its
maximum value $F(\rho^B_0,\rho^B_1), F(\rho_0,\rho_1) \equiv {\rm
tr} \sqrt{\sqrt{\rho_0} \rho_1 \sqrt{\rho_0}}$, when
\begin{equation}
U U^T_2 U_0 U_0^T U^{T^\dagger}_1 = I
\end{equation}
where $T$ denotes the transpose operation. Thus, when $\rho^B_0$, $\rho^B_1$, and $|e_i\rangle$ are given,
$|g_i \rangle = |e'_i\rangle$ of $|\Phi_1\rangle$ is determined from (12) via solving for $U_2$
from (17). In general, these $U$'s are isometries, but the above relations still hold.
The above formulation (11)-(17), utilizing Jozsa's proof \cite{jozsa} of
Uhlmann's theorem, covers both the $\rho^B_0 = \rho^B_1$ case and the
$U^A = I$ (i.e., $|\Phi_0 \rangle = | \Phi_1 \rangle$) situation as
special cases. Apparently form these equations, knowledge of the
eigenstates of $\rho^B_0$ and $\rho^B_1$ is required to find the
cheating transformation $U^A$ that brings $|e_i \rangle$ to $| \tilde{e}_i
\rangle$. Actually, both (11)-(17) and the Schmitt decomposition obscure the
underlying mechanism of the EPR cheating given by (5). In the present
context, they suggest that knowledge of the $\rho^B_b$ eigenstates is
needed to determine $U^A$, which is actually much simpler determined
by the following
\noindent
{\em Theorem} 2:
\indent
The $U^A$ that maximizes $|\langle \tilde{\Phi}_0 | \Phi_1 \rangle |$,
defined through the matrix ${\bf U}, U_{ij} \equiv \langle e_i | U^A
|e_j \rangle$, is determined by
\begin{equation}
{\bf \Lambda U} = | {\bf{\Lambda}} |
\end{equation}
where
\begin{equation}
{\Lambda}_{ij} \equiv {\sqrt{p'_i p_j}}
\langle \phi'_i | \phi_j \rangle, \quad
|{\bf{\Lambda}}| \equiv ({\bf{\Lambda \Lambda^\dagger}}
)^{\frac12}
\end{equation}
When $p_i = p'_i$, the corresponding
\begin{equation}
\tilde{P}^{A}_{c} = \sum_i
\left( |{\bf{\Lambda}}|_{ii} \right)^2
\end{equation}
which satisfies
\begin{equation}
F^2 \leq \tilde{P}^A_c \leq F
\end{equation}
\noindent
The lower bound in (21) is valid also for $p_i \neq p'_i$.
Theorem 2 is proved in Appendix A. Note that in terms of the
${\bf V}$ in (5), ${\bf U} = {\bf V}^T$. The
bounds (21) simply characterize $\tilde{P}^{A}_{c}$ in terms of $F$, and yield
$\bar{P}^A_c \geq F^2$ for the actual optimal probability $\bar{P}^A_c$ that
maximizes (6). This lower bound yields the usual impossibility proof \cite{mayers1} or (IP)
of (9) when combined with the lower bound on $|| \cdot ||_1$ in terms of $F$ \cite{fuchs}.
When ${\bf \Lambda}$ is invertible, ${\bf U} = {\bf \Lambda}^{-1}
|{\bf \Lambda}|$ from (18). In general, one
does not need to compute the eigenstates of $\rho^B_b$ to find $U^A$,
which is determined through ${\bf \Lambda}$ that is given directly in
terms of the known states and probabilities.
\section{\hspace{0.2in}The Impossibility Proof and Anonymous
States}
\indent
The use of anonymous states by Babe as briefly described in the last
section is just one obvious way to introduce classical randomness for
her in a QBC protocol, which appears to thwart Adam's EPR cheating by
denying him the knowledge to find the proper cheating transformation.
The ways in which the impossibility proof fails in this situation are
detailed in this section.
In general, such use of anonymous states by Babe can be described as
follows. She sends Adam a state $|\psi \rangle \in \mathcal{H}^B$ known only to
herself. Depending on b = 0 or 1, Adam applied to $|\psi \rangle$ a unitary
operator $U_{bi} , i \in \{1; \ldots , M \}$ with probabilities $p_i$ or $p'_i$. In the notation
of section II,
\begin{equation}
| \phi_i \rangle = U_{0i} | \psi \rangle, \quad |\phi'_i \rangle = U_{1i} |
\psi \rangle
\end{equation}
\noindent
Adam sends the modulated state back to Babe, and opens by revealing
b and $i$. He can form the entangled $ | \Phi_0 \rangle$ by
applying the unitary operator $U_0$ on $\mathcal{H}^A \otimes
\mathcal{H}^B$,
\begin{equation}
U_0 = \sum_i |e_i \rangle \langle e_i | \otimes U_{0i}
\end{equation}
with initial state $|A \rangle \in \cal{H}^A$ satisfying
$\langle e_i | A \rangle = \sqrt{p_i}$. It appears
from Theorem 2 above that the cheating transformation $U^A$ as
determined by
$\langle \phi'_{i} |
\phi_j \rangle = \langle \psi | U^{\dagger}_{1i} U_{0j} | \psi
\rangle$ would depend on $|\psi \rangle$ in general, thus cannot
be found by Adam. The impossibility proof handles this situation rather explicitly in
\cite{mayers}, \cite{lo1}, \cite{lo4}, and \cite{miller-quade}, in the following way.
The state $|\psi \rangle$ is supposed to be picked by Babe from a set $\{| \psi_k \rangle\}, k \in \{ 1, \ldots, L \}$ with
probabilities $\lambda_k$ that are all openly known. The associated classical
randomness is then purified by having Babe generate the entangled
state
\begin{equation}\label{label.B} \label{eq23}
| \Psi \rangle = \sum_k \sqrt{\lambda_k} | \psi_k \rangle | f_k \rangle,
\end{equation}
where the $|f_k \rangle$'s are complete orthonormal in
$\mathcal{H}^C$, send $\mathcal{H}^B$ to Adam
while keeping $\mathcal{H}^C$ to herself. At the end of the commitment phase she
would measure $\{ | f_k \rangle \}$ to pin down a specific $| \psi_k \rangle$. The proof, however,
is {\em not} carried to the end, and the above description is
considered sufficient to ensure that the impossibility proof works in
the presence of classical randomness introduced by Babe---from
quantum entanglement purification of a mixed state and postponement of
all measurements to end of commitment, the classical randomness is
rendered quantum-mechanically determinate and everything is known to
Adam again for him to find the cheating transformation $U^A$.
While Babe may not actually form $| \Psi \rangle$, the so-called ``Church of Larger Hilbert Space'' doctrine \cite{gottesman} is used to justify the equivalence.
In the following, it will be shown that the equivalence does not hold when Babe does something else to cheat, and that theimpossibility proof does not go through even when Babe actually forms
$|\Psi \rangle$ and postpone her measurement on $\mathcal{H}^C$ until after
Adam opens.
To spell out the impossibility proof argument, one actually needs to show that $U^A$
is independent of $\{ |f_k \rangle \}$ in $\mathcal{H}^C$ and
Adam only needs $\mathcal{H}^B$, not the full $| \Psi \rangle$ of (24), to form his entanglement. These turn out to be true as a
consequence of (18) in Theorem 2 above. However, it is against common
probabilistic intuition that randomness would altogether disappear (to
Adam) upon a quantum interpretation. There is no reason why Babe has
to generate (24) instead of any specific $|\psi_k \rangle$. More generally, to
form $| \Psi \rangle$, Babe can choose any probability
distribution on $\{| \psi_k \rangle \}$, not
the $\{ \lambda_k \}$ that Adam believes. It is not a meaningful formulation to assume that Adam knows $\{ \lambda_k \}$. Thus, one {\em cannot} eliminate via quantum
purification what is nonrandom to Babe (upon her choice or measurement) and random to
Adam \cite{adam1}. Indeed, Babe can generate any state $| \psi \rangle \in \mathcal{H}^B$, or any entangled state $| \Phi \rangle \in {\cal H}^B \otimes {\cal H}^C$ for any ${\cal H}^C$ that she keeps to herself. A
careful formulation for the concealing condition needs to be
developed.
To show the inadequacy of the formulation of the impossibility proof,
assume that $\rho^B_0 (\Psi)$ and $\rho^{B}_{1} (\Psi)$ are indeed close from the
use of (22) and (24) with $\lambda_k = 1/L$ for $L$ large.
Let $|\psi_1 \rangle$ be such that $\rho^B_0 (\psi_1 )$ and $\rho^B_1
(\psi_1 )$ are far apart, being possible even though $\rho^B_0 (\Psi)$
and $\rho^B_1 (\Psi)$ are
close because $1/L$ is small. Then Babe can cheat by using
$\lambda_1 = 1$ instead of $\lambda_k = 1/L$. To ensure a
concealing protocol, one must impose the uniformity condition
\begin{equation}
\rho^B_0 (\psi) \approx \rho^B_1 (\psi), \quad \forall \psi \in{\mathcal{H}}^B,
\end{equation}
or, more generally,
\begin{equation}
\rho^{BC}_0 (\Psi) \approx \rho^{BC}_1(\Psi),\quad \forall \Psi \in {\cal H}^B \otimes {\cal H}^C
\end{equation}
for any ${\cal H}^C$ Babe can use to entangle, with $\approx$ being taken in the sense of trace norm from
(7). Such a concealing condition has not been given in the literature,
but it is needed whenever a state is passed from Babe to Adam
in a proper formulation of the problem. From the condition $\rho^{BC}_0
(\Psi ) \approx \rho^{BC}_1 (\Psi )$ for a fixed $\Psi$, one may at best conclude that
$\rho^B_0 (\psi_k ) \approx \rho^B_1 (\psi_k )$ for those $k$ where
$\lambda_k \not\approx 0$. Thus, the impossibility proof {\em errs} in
asserting that Adam can cheat under the above condition---he cannot,
and Babe can instead. In Appendix B, an example is given in which
$\rho^{BC}_0(\Psi) = \rho^{BC}_1(\Psi)$ for a given $\Psi$, but Adam cannot cheat even when no $\lambda_k$ is small.
Assuming that condition (25) is satisfied, let us examine how Adam's
EPR cheating works. If one follows the impossibility proof, it would
work if Babe verifies on the state $|\Psi \rangle$ of (24), i.e., depending on
b = 0 or 1 she checks whether $|\Psi \rangle$ becomes
\begin{equation}
U_{bi}| \Psi \rangle = \sum_k \sqrt{\lambda_k} U_{bi} |
\psi_k \rangle | f_k \rangle
\end{equation}
for the $i$ opened by Adam. However, that is {\em not} the way she verifies
according to the protocol. She would make a preliminary measurement of $\{| f_k
\rangle \}$ first
with result $j$ and then check whether the state is $U_{bi} |
\psi_j \rangle$. She can in
fact postpone her measurement on $\mathcal{H}^C$ until after Adam opens. The
important point is that she is going to make a measurement and use the
result in the verification. While such measurement does not allow her to cheat any better, it
may help defeat Adam's EPR cheating.
In the impossibility proof there is {\em no} role given to any
classical randomness other than $\{ p_i \}$
and $\{ p'_i \}$---it is implicitly assumed that Babe's random
number known only to herself is {\em not} used in her verification as just described.
Such lack of utilization of possible classical randomness represents
a huge gap in the impossibility proof, making it severely limited in
scope and {\em incorrect} as a general proof. The doctrine of the
``Church of Larger Hilbert Space'' is {\em irrelevant} to the protocol
behavior as it should be; it would not make the protocol determinate. It is clear that
classical random numbers can be generated by both Adam and Babe in a
general quantum protocol, which are kept secret from the other party
and used in an essential way as in many standard cryptographic
protocols. The impossibility proof does not begin to incorporate such
possibilities.
We examine more exactly how the impossibility proof fails in the
present situation. The cheating transformation $U^A$ is taken
to be the one that maximizes $|\langle \Phi_1 | U^A |
\Phi_0 \rangle |$, not the {\hspace{.25in}one that maximizes $P^A_c$
of (6). However, in addition to the
lower bound in (21) that applies also to ${\bar P}^A_c$,
in general $U^A$ is determined by the inner product matrix $\langle
\phi'_i | \phi_j \rangle$, apart from the a priori probabilities. Any
such cheating {\bf U} is thus determined via $\sum_k \lambda_k \langle
\psi_k | U^{\dagger}_{1i} U_{0j} | \psi_k \rangle \equiv
{\bar{u}}_{ij}$ for $|\Psi \rangle$,
but via $\langle \psi_k | U^{\dagger}_{1i}U_{0j} | \psi_k \rangle
\equiv u^k_{ij}$ for
each $|\psi_k \rangle$. There is no reason to
expect that the {\bf U} as determined by ${\bar{u}}_{ij}$ would be
close to the {\bf U} determined by
$u^k_{ij}$, whatever the $\lambda_k$'s are.
Actually, one does not
need to transform among the maximizing {\bf U} in order for
impossibility to hold. The general problem can be cast as follows. From (22) and (5), we have
dependence of the committed and cheating states on the anonymous
state $|\psi \rangle$, to be simply denoted by $\phi_i (\psi )$, $\phi'_i
(\psi )$, and $\tilde{\phi_i} (\psi )$ for notational simplicity
dropping the Dirac kets, as already done occasionally above. In the present formulation with only
anonymous states from Babe in the form (22), all of Adam's possible attacks are described by local
measurements and announcing a different b. For this attack to
succeed with $\bar{P}^A_c \sim 1$ given $|\Phi_0 \rangle$ is
committed, one presumably wants
\begin{equation}
\tilde{\phi}_i(\psi) \approx \phi'_i (\psi) , \quad \forall
\psi \in \mathcal{H}^B
\end{equation}
or
\begin{equation}
\tilde{\phi}_i(\Psi) \approx \phi'_i(\Psi), \quad \forall \Psi \in {\cal H}^B \otimes {\cal H}^C
\end{equation}
for some fixed $U^A$ or {\bf V} independent of $\psi$, the $\approx$ in (28)-(29) taken in the sense of state inner product.
Condition (28) expresses the requirement that as the anonymous state
$|\psi \rangle$ changes, the approximate state $\tilde{\phi_i}(\psi )$
must follow the b = 1 states $\phi'_i(\psi )$.
Strictly, the condition is only that there exists a {\bf V}
such that the $P^A_c \left( \psi \right)$ given by (6) satisfies
\begin{equation}
P^A_c (\psi) \approx 1 \quad , \quad \forall
\psi \in \mathcal{H}^B
\end{equation}
where the $\psi$-dependence enters through $\phi_i (\psi)$ and $\phi'_i (\psi)$.
The problem of impossibility (IP') becomes whether (30) holds when (25) is
satisfied. A similar condition is obtained for $\Psi$ that includes Babe's possible entanglement of the anonymous state in ${\cal H}^B$.
In the case of perfect security, the above use of anonymous states
cannot prevent the success of EPR attacks due to
\noindent
{\em Theorem} 3 \cite{quick}:
\indent
The condition
\begin{equation}
\rho^B_0 (\psi) = \rho^B_1(\psi) \;\;\;\;, \quad \forall \psi \in \mathcal{H}^B
\end{equation}
implies, for every $i$,
\begin{equation}
\tilde{\phi}_i (\psi) = \phi'_i (\psi) \;\;\;\;, \quad \forall \psi \in \mathcal{H}^B
\end{equation}
The proof is simple---by writing out (31) in terms of $U_{{\rm b}i}$,
it follows from theorem 8.2 of \cite{nielsen} on the freedom of CP-map
decomposition that
\begin{equation}
\sqrt{p'_{i}} U_{1i} = \sum_j \sqrt{p_j} V_{ji} U_{0j}
\end{equation}
for a unitary matrix {\bf V}. This operator relation guarantees that the
state relation (32) is satisfied for all $| \psi \rangle$.
When (31) is satisfied and (18) is used to compute the cheating $U^A (\psi )$ according to Theorem 2,
it is found to be independent of $| \psi \rangle$ and is given by the {\bf
V} of (33) due to the fact that the matrix $\langle \phi'_i | \phi_j \rangle$ becomes ${\bf V}$ multiplied by the inner product matrix $\langle \phi_i |
\phi_j \rangle$ which is nonnegative. Indeed, the {\bf V} in (33) is
also determined by following the usual impossibility proof for any
$\psi$. (Note
that the Schmidt decomposition plays no role in the proofs of
theorems 2 and 3 and in the results used in their proofs. Indeed,
Jozsa's proof of Ulhmann's theorem in \cite{jozsa}, which involves the
Schmidt decomposition, can also be simplified along the line in the
proof of Theorem 2 in Appendix A.) Theorem 3 is significant in that
it shows it is operator, not state, entanglement that is needed in the
presence of state randomness.
Under the condition
\begin{equation}
\rho^{BC}_0 (\Psi) = \rho^{BC}_1(\Psi)
\end{equation}
for one fixed $| \Psi \rangle$ of the form (24), one obtains similar to the proof of Theorem 3 that
\begin{equation}
\rho^{B}_0(\psi) = \rho^B_1(\psi) \quad \forall \psi \in {\rm span} \{ | \psi_k \rangle \}.
\end{equation}
Equation (35) implies, in particular, that $\rho^B_0(\psi_k) =
\rho^B_1(\psi_k)$ for each $| \psi_k \rangle$ and a fixed cheating transformation is available as above. The restriction on the validity of (35), and hence the possibility of Adam's successful cheating, to states in the subspace spanned by $\{ |\psi_k\rangle \}$ is indispensable as shown in the example of Appendix B. We can summarize our two major criticisms of the impossibility proof. First and foremost, it is not properly formulated so that under (34) or
\begin{equation}
\rho^{BC}_0(\Psi) \approx \rho^{BC}_1(\Psi)
\end{equation}
for one fixed $| \Psi \rangle$ of (24), it may be Babe but not Adam
who can cheat, either because she may sent $| \psi \rangle \not \in
{\rm span} \{ | \psi_k \rangle \}$, or there is a $\lambda_k \approx
0$ for which $\rho^B_0(\psi_k) \not \approx \rho^B_1(\psi_k)$. Secondly, even assuming $|\Psi \rangle$ is formed by Babe, there is no proof that there is any cheating transformation that would work for all $| \psi_k \rangle$.
Another way to formulate
the problem at hand is to use CP-map or superoperator to characterize
the transition from $\psi$ to $\rho^B_{\rm b}$, similar to the proof
of Theorem 3. If two general CP-maps between operators on
${\mathcal{H}}_1$ and ${\mathcal{H}}_2$ are approximately equal in the
sense of (25) with $\psi \in {\mathcal{H}}_1$, the question is what
approximate relation would obtain between the positive operators in
their respective decompositions. This question is a complicated one
for application to our present problem, partly because when $\epsilon = \| \rho^B_0(\psi) - \rho^B_1(\psi)\|_1$ gets small, the security parameter $n$ grows unbounded and the resulting ${\cal H}^B$ and $\rho^B_b$ change profoundly. An infinite-dimensional nonseparable Hilbert space formulation of the problem appears necessary at the beginning. Until the question is settled in favor
of impossibility, there is no general impossibility proof for
protocols employing anonymous states even just in the simple fashion
of (22).
The QBC formulation in this section, while more general than that of
the impossibility proof which is a proper formulation only if the
randomness in the protocol are all in (1)-(2), is still quite limited in scope. Indeed, the
protocols of the following sections IV and V already do not fit into
the present framework exactly. There are many other ways to introduce
classical randomness in a protocol. Even though they can be
represented quantum-mechanically, once measurements are made to pin
them down they would function just as in a classical protocol,
manifesting in the different ways the measurement results can be
utilized. Just in the case of classical protocols, it does not appear
possible to characterize all QBC protocols to a useful extent that
something general can be said about the corresponding cheating
probabilities. We will present elsewhere a general formulation of the
QBC problem. It will be evident that the situation is far more
intricate than the impossibility proof formulation (1)-(2).
\section{\hspace{.2in}Bit Commitment Scheme that Contradicts the
Impossibility Proof}
In this section, a protocol will be given that contradicts the quantitative claim of the impossibility
proof, (IP) of (9) or (IP') of (8), without yet being
unconditionally secure in the sense (US) of (8). Its extensions
to unconditionally secure protocols will be given in the next section
V. An intuitive description on how the QBC scheme may be
developed is first provided to explain the underlying logic.
According to the impossibility proof formulation, there is a state
$|\Phi_{\rm b} \rangle$ of (1) - (2) shared by Adam and Babe.
The most general attack by Adam
after $|\Phi_{0} \rangle$ is committed is to apply a local $U^A$ on
$\mathcal{H}^{A}$ and then make a
measurement on $\mathcal{H}^{A}$, or just to make a measurement on
$\mathcal{H}^{A}$ as in (4)-(5), and opens b = 1. It is evident, from the way states in $\mathcal{H}^{B}$ can be
affected this way as given by (5), that
if $M = 1$ in (1) Adam cannot affect $\rho^{B}_{0} = | \phi \rangle
\langle \phi |$ in $\mathcal{H}^{B}$ at
all. Unconditional security is impossible in this case because $\bar{P}^{B}_{c} \sim \frac12$
implies $| \langle \phi | \phi' \rangle | \sim 1$ and thus
$\bar{P}^{A}_{c} \sim 1$ by simply announcing b = 1. If one lets $| \langle \phi | \phi' \rangle | \not\sim 1$
then Babe can cheat by measurement and the protocol is not
concealing. Our protocols are to be developed form the following
sequence of steps in general. To be specific, qubits will be used in
this section.
To begin, let $| \phi \rangle$ and $| \phi' \rangle$ corresponding to
${\rm b} = 0,1$ be orthogonal so that
Adam cannot cheat. To defeat Babe's cheating, Adam may send to Babe
the information qubit among many
random {\em decoy} states, named for example by their temporal order, and
announce the information qubit position when he opens. To prevent
Adam from the obvious cheating of sending in both
$| \phi \rangle$ and $| \phi' \rangle$ and opening accordingly, an {\em anonymous} state $| \psi \rangle$ is first
sent by Babe, with Adam generating $|\phi \rangle = U_0 | \psi \rangle
, | \phi' \rangle = U_1 | \psi \rangle$ for $U_0 = I, U_1, = R(\theta, C)$ a rotation by an angle $\theta$ on
some great circle $C$ on the qubit Bloch-Poincare sphere. The rotation
can be applied by Adam without knowing $|\psi \rangle$ assuming, as usual, that
the orientations of all the qubit Bloch spheres are known to both Adam
and Babe. Thus, $\langle \phi | \phi' \rangle = 0$ for $|\psi \rangle
\in C$ and $\theta =\pi$. It can be intuitively expected
that Babe cannot then determine ${\rm b}$ with $\bar{P}^{B}_{c} \sim
\frac12$ in the presence of
sufficiently many decoy states. It should also be clear that Babe
cannot improve his $\bar{P}^{B}_{c}$ by entanglement to $| \psi \rangle$, because she already
chooses a $| \psi \rangle$ that allows her to make perfect
discrimination if she
knows which qubit is the one she sent, and so she has no need to change
$|\psi \rangle$ when she tries to cheat.
How about Adam's new
possibilities of cheating at this stage? In all uses of anonymous
states, the other party can always try to determine the state by
measurement on the single copy. It is characteristics of quantum
physics that the state cannot be determined and cannot be cloned
\cite{wootters}-\cite{yuen4} arbitrarily accurately, if it is drawn
from a nonorthogonal set of
states. However, Adam has a significant probability of success in such
attempts, thereby such single use of qubit cannot yield an
unconditionally secure protocol---$\bar{P}^{B}_{c} \sim
\frac12$ and $\bar{P}^{A}_{c} \not\sim 1$ but not $\bar{P}^{A}_{c} \sim 0$. More
precisely, with $n$ being the number of decoys states plus $| \psi \rangle$, one would have
\begin{equation}
\lim_n \bar{P}^{B}_{c} = \frac12, \;\;\;\; 0 < \lim_n \bar{P}^{A}_{c} <1
\end{equation}
The protocol is thus concealing and quantitatively cheat-sensitive for Adam.
If Adam indeed cannot do better than cloning, the impossibility proof is contradicted with (37) and thus is incorrect
as a general proof.
A way to achieve (37), which has important practical significance, is for
Babe to make verifying measurements on all the qubits before Adam
opens. She would choose the basis corresponding to $\{|\psi \rangle,
R(\pi, C) |\psi \rangle \}$ for all $n$
qubits. Babe can evidently check whether Adam opens correctly in a
perfect fashion when he
identifies the qubit. It is intuitively clear, and will be explicitly
proved below, that the protocol is concealing. By entangling to the
qubit in state $|\psi \rangle$ in the form
\begin{equation}
\lambda_0 U_0 |\psi \rangle | e_0 \rangle + \lambda_1 U_1 | \psi \rangle | e_1
\rangle
\end{equation}
Adam can find out Babe's measurement result but he cannot change it for
cheating, as a matter of course---whatever operations and measurements
he performs cannot affect the result Babe already obtained. A precise treatment of the above
protocol QBCp3m, a preliminary (not yet unconditionally secure)
protocol with Babe's
measurement before opening, is detailed presently, to be followed by the security proof.
\addcontentsline{toc}{section}{\hspace{.45in}{Protocol QBCp3m}}
\noindent
{\em PROTOCOL} QBCp3m
\indent
(i) Babe sends Adam a state $|\psi \rangle$ known only to herself, randomly picked
from a fixed known great circle $C$ on the Bloch sphere of the qubit
${\cal{H}}^{B}_{2}$.
(ii) Adam modulates $|\psi \rangle$ by $U_0 = I$ or $U_1 = R(\pi , C)$, rotation of $|\psi \rangle$ to its orthogonal
state on $C$, for $b = 0$ or $b = 1$. He then picks $n-1$ qubits with
states independently and randomly chosen among all possible ones, and
places the modulated qubit ${\cal{H}}^{B}_{2}$ randomly among them. He sends the
$n$ resulting qubits to Babe, each named by its position in the qubit
sequence from $1$ to $n$.
(iii) Babe measures $\{ |\psi \rangle, R (\pi, C) | \psi \rangle \}$
on each qubit. Adam opens by revealing the
position of ${\cal{H}}^{B}_{2}$ and the bit value. Babe verifies by
checking her measurement result on ${\cal{H}}^{B}_{2}$.
We first show that this QBCp3m is concealing. For each possible $i$th
position for ${\cal{H}}^{B}_{2}$ in the qubit sequence sent back by
Adam, the state is of the form, in ${\mathcal{H}}^B$,
\begin{equation}
\begin{array}{c}| \phi_{1} \rangle \cdots \cdots {U_b | \psi \rangle}
\;\cdots | \phi_{n} \rangle \\ \quad i \end{array}
\end{equation}
where each $|\phi_{j} \rangle , j \in \{1,\cdots, n \}$ and $j\neq i$, is, say, one of the four BB84 states on $C$ randomly
and independently chosen. The index ``i'' underneath the state
$U_{\rm b} |\psi \rangle$ in (39)
indicates that it occupies the $i$th position. Thus, the state to Babe
is of the form, in ${\mathcal{H}}^B$
\begin{equation}
\begin{array}{c}\rho^B_{\rm b} = \frac{1}{n} \sum \frac{I}{2} \otimes \ldots \otimes
{\sigma_{\rm b}} \otimes \ldots \otimes \frac{I}{2}, \\ i \qquad
\qquad \quad \; i \quad \; \end{array}
\label{babe_do}
\end{equation}
with $\sigma_{\rm b} = U_{\rm b} \sigma U^\dagger_{\rm b}$ when Babe send a
state $\sigma$ to Adam without entanglement. Note that it is
sufficiently for Adam to choose among two orthogonal states instead of
all possible ones for each qubit, and for Babe to choose among four
BB84 states instead of all in a great circle. While it should be clear
that Babe gains nothing with entanglement,
that situation will be dealt with later. From (40), one can evaluate
$\bar{P}^{B}_{c}$ straightforwardly since $\rho^{B}_{0} -\rho^{B}_{1}$ is diagonal in the product basis that
diagonalized $\sigma_0 - \sigma_1$ on each qubit. Let $n = 2\ell + 1$ and $\lambda_+ \leq
1$ be the positive eigenvalue of $\sigma_0 - \sigma_1$, it is shown in
Appendix C that
\begin{equation} \label{label.D} \label{eq36}
\bar{P}^{B}_{c} - \frac12 = \frac{\lambda_+}{2^n}
\left( \begin{array}{c} 2 \ell \\ \ell \end{array} \right)
\end{equation}
\noindent The optimal probability (41) is obtained with $\lambda_+ = 1$ when the
above product basis is measured and b is set to be 0 or 1 according
to a majority rote on the positive and negative outcomes corresponding
to the eigenvectors $|\lambda_+ \rangle$ and $|\lambda _- \rangle$.
From the standard bounds on binomial coefficients,
\begin{equation} \label{label.E} \label{eq37}
\frac{1}{4 \sqrt{\ell}}
< \bar{P}^{B}_{c} - \frac12
< \frac{1}{2 \sqrt{\pi \ell}}
\end{equation}
\noindent The optimal strategy is thus still concealing with $\lim_n
\bar{P}^{B}_{c} = \frac12$, but it is better than guessing at the
qubit sent and then measure and decide on it alone, which yields ${P}^{B}_{c} = \frac12 (1+ 1/n)$.
To show that entanglement does not change the above situation in the
simplest possible way, we would merely give a detailed proof that concealing is not
affected by Babe's entanglement. When she entangles
${\cal{H}}^{B}_{2}$ to a ${\cal{H}}^{C}$ she
would attach ${\mathcal{H}}^{C}$ to one of the qubits sent back by Adam. The
resulting density operator is the same independently of which
particular qubit position she attaches $\mathcal{H}^{C}$ to, from symmetry. From
the triangle inequality for trace norm [18], the distance between the
resulting $\bar{P}^{B}_{\rm b}$ is bounded by
\begin{equation} \label{label.E} \label{eq38}
n\parallel \rho^{B}_{0}- \rho^{B}_{1} \parallel_1 \;\; \leq \;\; 2+\parallel
\bar{\rho}^{B}_{0}-\bar{\rho}^{B}_{1} \parallel_1
\end{equation}
where the term 2 is the maximum possible [23, App A] distance
$\parallel \rho_{0} - \rho_{1} \parallel_1$ for any states
$\rho_0$ and $\rho_1$, corresponding to the case where ${\mathcal{H}}^{C}$ is attached
correctly to ${\mathcal {H}}^{B}_{2}$. The $\bar{\rho}^{B}_{\rm b}$ are
the same as (40) because the mismatched ${\mathcal{H}}^C$
state does not affect the trace distance as a consequence of
\begin{equation} \label{label.E} \label{eq40}
\parallel \left( \rho - \rho' \right) \otimes \sigma \parallel_1 =
\parallel \rho
- \rho' \parallel_1
\end{equation}
Equation (44) follows immediately from evaluating the left-hand side in the
diagonal representation of $\left( \rho - \rho' \right) \otimes \sigma$.
Thus, the protocol is still
concealing from (42) and (43). Actually, it can be shown that the
optimal $\bar{P}^{B}_{c}$ of (41) without entanglement remains optimal with
entanglement. Note that our proof shows that the protocol is
concealing for any
$|\psi \rangle \in {\mathcal{H}}^{B}_{2}$
even though we may impose restriction on $|\psi \rangle$ in the binding proof or for
ease of implementation.
Since Babe's verifying measurement can be perfectly made before Adam opens, a ``no-clone" argument can be developed for binding. Adam cannot find out what
measurement basis, not to mention $|\psi \rangle$, Babe used by entangling the qubits to ${\cal{H}}^A$---the state on ${\cal{H}}^A$ is obtained by tracing over ${\mathcal{H}}^B$ and is independent, not only of $|\psi \rangle$,
but of the specific measurement basis Babe uses (or no
measurement from her at all). Thus, he can gain no information from Babe's measurement
to help him cheat in any way. One way for Adam to cheat is by cloning, as it is the same whether one wants to get $\{ | \psi \rangle, |\psi \rangle \}$ or $\{ |\psi \rangle, U |\psi \rangle \}$ for a known $U$.
The optimal cloning performance is a fixed number $p_A < 1$
independent of $n$.
The optimal one-to-two clone has been worked out for a variety of
criteria and state sets. In the present situation, the state set is $C$
or the four BB84 states. If the cloning is described by $|\psi
\rangle \rightarrow | \psi_{a{\rm b}}\rangle$ over two
qubits with marginal states $\rho_a$ and $\rho_{\rm b}$, the criterion
here corresponds to
\begin{equation} \label{label.C} \label{eq41}
F_c = \frac12 \langle\psi|\rho_{a}|\psi\rangle_{av}+ \frac12
\langle\psi|U_{1}^{\dagger}\rho_{\rm b} U_{1}|\psi\rangle_{av}
\end{equation}
with average over a uniform distribution on the state set from which $|\psi
\rangle$ is drawn. It seems that the existing results \cite{keyl}-\cite{ariano}
almost cover this case exactly \cite{circle}. Now, it appears that
Adam cannot do better than this optimum by {\em any} action because if
he could, he should have succeeded in cloning better than the optimal
cloner, a contradiction, according to the following reasoning. He
would have, by an objective physical procedure, succeeded in producing
clones among $n$ qubits, where he could identify which ones are the
clones. If Babe did not measure first, this would not be surprising
because the two copies are obtained on two different conditional (upon
Adam's measurement result) states for Babe. The fact that Adam can
identify both means that he could not just spread $n-1$ qubit states
uniformly on $C$, one of which would be close to $U | \psi \rangle$,
but he wouldn't be able to tell which one. That he is not able to
identify both simulatneously does not alter the fact he has cloned.
Alternatively consider the following situation with the
cloning of one copy of $| \psi \rangle \otimes | \psi \rangle$ into
$\{ |\psi \rangle \otimes |\psi \rangle, |\psi \rangle \otimes | \psi
\rangle \}$, for a criterion as (41), with optimum $p_A < 1$. If Babe
gets identical measurement results on two sets of $n$ qubits sent back
to her by Adam, each obtained by the same procedure as above, Adam
would have succeeded in cloning $| \psi \rangle \otimes | \psi
\rangle$ by carrying out the two different identification procedures
on the two $n$-qubit sets and applying the results to both sets. To
ensure that Babe could have the identical measurement results almost
surely, consider the following Gedankenexperiment. Babe sends a large
number $N$ of identical states $|\psi \rangle$ to Adam, who carries
out the same objective physical preparation (cheating) procedure on
her $N$ $n$-qubit sets. Babe performs her measurement on each and
every set, obtaining, with probability exponentially close to 1, pairs
of identical results that total $N'$ sets with $N'/N$ close to 1 for
sufficiently large $N$. Adam would then have, via the above separate
identification procedure on each pair, succeeded in cloning in almost
all of the original $N$ sets. Both the above single-set argument and
the present $N$-set argument are valid, but a complete formalization of the arguments will be given elsewhere.
Note that, in this protocol, Adam cannot cheat any better by generating decoy states other than $I/2$. Thus we have covered all
possible actions by Adam and Babe, and can summarize the above results as
\noindent
{\em Theorem} 4:
In protocol QBCp3m, Babe's optimal cheating probability can be made
arbitrarily close to $\frac{1}{2}$ for large number of qubits $n$,
while Adam's optimal cheating probability remains fixed and not
arbitrarily close to $1$.
What would happen to Adam's EPR attack in the above scheme
if Babe performs her verifying measurement after he opens?
One may have the protocol ``QBC3'' in reference \cite{yuen3} in which Babe disregards
the $n-1$ qubits not first sent by her. It is simpler to consider the following
variant more in line with the impossibility proof formulation.
Let $|\psi\rangle \in S = \{ |1\rangle, |2\rangle, |3\rangle,
|4\rangle \}$ where $|1 \rangle$ and $|2 \rangle$ are the vertical
and horizontal states on $C$, and $|3 \rangle$ and $|4 \rangle$ are the two
orthogonal diagonal ones, so together they make up the four standard
BB84 states on $C$. Consider the case where each of the other $n-1$
qubits sent by Adam has to be in $S' = \{|1 \rangle, |2 \rangle \}$. Adam modulates $| \psi
\rangle$ by $U_b$ and opens by identifying the ${\mathcal{H}}^{B}_{2}$ position and the
states of all the qubits. Babe verifies by performing the corresponding
projection measurements. Let $| \psi \rangle$ be purified as
\begin{equation} \label{label.B} \label{eq42}
\frac14 \begin{array}{c} 4 \\ \sum \\ {\ell =1} \end{array} | \ell \rangle
| f_{\ell} \rangle
\end{equation}
for $| \ell \rangle \in S \subset {\mathcal{H}}^{B}_{2}$ and orthonormal$| f_{\ell}
\rangle \in {\mathcal{H}}^{C}$. Let $U_{1j}, j \in \{ 2, \cdots, n \}$ be the unitary operator that swaps
qubit position 1 and $j$ on ${\mathcal{H}}^{B} = {\mathcal{H}}^{B}_{2}
{\bigotimes^{n}_{j=2}} {\mathcal{H}}^{j}_{2}$.
On ${\mathcal{H}}^A \otimes {\mathcal{H}}^B$, Adam can form the
entanglement by employing orthonormal $| e_i \rangle \in
{\mathcal{H}}^{A},i \in \{ 1, \cdots, n \cdot 4^{n-1} \}$,
with uniform or whatever probabilities, using $U_{1j}$
and $S'$. In analogy with QBCp3m, we have a preliminary protocol QBC p3u which is
close to a usual one in which Adam can launch EPR attacks.
\addcontentsline{toc}{section}{\hspace{.45in}{\bf Protocol QBCp3u}}
\noindent
{\em PROTOCOL} QBCp3u
\indent
(i) Babe sends Adam a state $| \psi \rangle$ known only to herself,
randomly picked form the four BB84 states on a fixed great circle C of
the qubit ${\cal H}^B_2$.
(ii) Adam modulates $| \psi \rangle$ by $U_0 = I$ or $U_1 = R(\pi,
C)$ for b = 0 or 1. He then picks $n-1$ qubits with states
independently and randomly from two orthogonal states known to Babe, places the modulated qubit ${\cal H}^B_2$ randomly among them, and sends
the $n$ qubits to Babe in a named order.
(iii) Adam opens by revealing the state of all the qubits and
identifying ${\cal H}^B_2$. Babe verifies by checking the corresponding
projections.
\noindent
This protocol is concealing exactly as in QBCp3m. As shown in section III, the impossiblity proof does not cover this
protocol. Indeed, assuming Adam opens perfectly for ${\rm b}=0$ as in the impossibility proof, it can be shown that he cannot then cheat with $\bar{P}^A_c \sim 1$. The basic reason is that he can only identify correctly on the decoy states, for arbitrary $|\psi \rangle$, by not involving $|\psi \rangle$ in the entanglement of the decoy states. However, he cannot then rotate $|\psi \rangle$ to its orthogonal complement on $C$. The full security proof covering the situation in which Adam does not open perfectly is being developed.
\section{\hspace{.2in}Unconditionally Secure Bit Commitment Schemes}
The QBC protocol in the previous section that invalidates the
impossibility proof can be extended to fully unconditionally secure
protocols as described in the following. This may be expected because
if Adam cannot cheat nearly perfectly on one qubit, his cheating
probability can be brought exponentially close to zero in a sequence of
independent qubits. To extend the above protocols in this
manner, first consider the case where ${\mathcal{H}}^B_2$ in QBCp3m
is replaced by ${\bar{\mathcal{H}}}^B= \otimes^m_{k=1}
{\mathcal{H}}^B_{2k}$. Let Babe send Adam a sequence of $m$ qubits
\begin{equation}
|\psi \rangle =|\psi^1 \rangle \otimes \cdots \otimes | \psi^{j} \rangle \cdots
\otimes | \psi^m \rangle, \qquad j \in \{1, \cdots, m \}
\end{equation}
Each $| \psi^j \rangle$ is randomly and independently chosen from the
same fixed great circle $C$ for all the $m$ qubits, and named by its
sequence position $j$ within ${\bar{\mathcal{H}}}^{B}$. Adam applies $U_b$ to each of these qubits and
then randomly places ${\bar{\mathcal{H}}}^{B}$ among a sequence of $N-1$ quantum spaces
${\mathcal{H}}^{B}_{\ell}$, each a product of $m$ qubits, with states
on all the $m \left( N-1 \right) $ qubits randomly
and independent chosen from a fixed great circle $C'$.
The total sequence or product state
\begin{equation}
| \chi_1 \rangle \cdots | \chi_{\ell} \rangle \cdots | \chi_N \rangle,
\qquad \ell \in \{1, \cdots, N \}
\end{equation}
is re-named by the new position
$\ell$ and sent back to Babe. Apart from the modulated state in
${\bar{\mathcal{H}}}^{B}$,
each of the other $N-1$ $| \chi_{\ell} \rangle$ in ${\mathcal{H}}^{B}_ {\ell}$ is a
product of $m$ qubit states. Each of the $N$ state spaces would be referred to
as a {\em qumode}. Similar to (35),
Adam knows, but Babe does not,
which $| \chi_{\ell} \rangle$ is the modulated $| \psi \rangle$, and he opens
by giving Babe this information,
but he does not know what the $| \psi^j
\rangle$'s are. Before Adam opens, Babe measures on every qumode the product qubit
basis given by $\{ |\psi^j \rangle , R \left( \pi, C \right) |\psi^j \rangle \}$
across the $m$ qubits, which diagonalizes $\rho^B_0 - \rho^B_1$. She
optimally decides on ${\rm b}$ by the majority of the two patterns of $| \psi^j \rangle$
and $R \left( \pi, C \right) |\psi^j \rangle$, the other patterns occurring with
equal probability.
To prove concealing, the following argument is used in lieu of evaluating
directly the trace distance. For any fixed $m$, let $N$ be chosen large enough
that the number of times a particular pattern of $|\psi^j \rangle$ in (47)
shows up in Babe's
measurement on a random qumode is at least $(N-1) \left( 2^{-m} - \delta \right)$
for a small $\delta >0$, where $(N-1)2^{-m}$ is the average. This is possible with a
probability exponentially close to 1 from the Chernov bound. The situation then
becomes the same as the qubit case of section IV, with $n$ replaced by $N \left(
2^{-m} - \delta \right)$ for the upper bound in (42), which can then be set
to any desired small level by further increasing $N$. Babe's possible
entanglement can be handled as in (43). Thus, the protocol is concealing. Adam's
optimal cheating probability is given by $\bar{P}^A_c = p^m_A$, which fixes $m$
for given ${\bar{P}}^A_c < \epsilon$. We summarize the results.
\addcontentsline{toc}{section}{\hspace{.45in}{\bf Protocol QBC3m1}}
\noindent
{\em PROTOCOL} QBC3m1
\indent
(i) Babe sends Adam a product state (47), each $|\psi^j \rangle$ named by its position
and independently and randomly chosen from a BB84 state set $S$ in $C$.
(i) Adam modulates each and all $|\psi^j \rangle$ by $U_0 = I$ or $U_1
= R(\pi, C)$, then independently and
randomly place the exact sequence among $N-1$ qumodes, each a product of
$m$ qubits randomly distributed on $S$. He
sends the $N$ qumodes to Babe in a named order.
(iii) Babe measures the $m \;\;\{ | \psi^j \rangle, R \left( \pi,C \right) |\psi^j \rangle \}$
on each of the $N$ qumodes. Adam opens by announcing which qumode is the modulated
$|\psi \rangle$ and the bit value. Babe verifies by checking her measurement result.
\noindent
{\em Theorem} 5:
\indent
Protocol QBC3m1 is unconditionally secure.
Variations of the protocol can be easily created without affecting the unconditional
security. For example, consider the case where Babe sends (47) to Adam which he
returns in $m$ segments of $N$ qubits each, the $j$th one containing exactly
one $|\psi^j \rangle$ from (47).
Babe can then make a uniform
measurement on each $N$-sequence, deciding whether each such
$N$-sequence corresponds to a 0 or 1 by a majority vote, and the
overall b by a majority vote on the $m$ outcomes.
To show that such a protocol is concealing, one may first take care of Babe's
entanglement possibility to ${\mathcal H}^C$ by, similar to (43),
\begin{equation}
\parallel \rho^B_0 - \rho^B_1 \parallel_1 \leq [1-p(N,\!m)] \cdot
2+p(N,\!m) \cdot \parallel \bar{\rho}^B_0 - \bar{\rho}^B_1 \parallel_1
\label{}
\end{equation}
where $p(N,m)=(1- \frac{1}{N})^m$ is the probability
that none of the $m$ attached entangled qubits in ${\mathcal H}^C$ matches
the actual qubit position, which can be made arbitrarily close to 1 for
any fixed $m$ by making $N$ large. Then one argues that independent qubit probability distributions
are obtained because for optimal $P^B_c$ Babe should not entangle across the qubits in
(47) as that would create additional randomness for the individual qubit measurements
she would make, the latter needed since she has a vanishingly small
probability to locate her own qubits. (Indeed, there is no point for her to correlate
the $| \psi^j \rangle$ in the first place, as an involved classical probabilistic
argument would show.)
From the independence of $| \chi_\ell \rangle$
and the $| \psi^j \rangle$ positions in the $m$ $N$-sequences, the optimal
decision Babe can make is to decide on 0 or 1 on each of the $N$-sequences as the
$m=1$ case, and then take a majority vote to decide on $b$.
Let $p$ be the probability
of Babe's correct decision in each $N$-sequence. Then $p$ is given by
(41) and bounded as in (42) with $n$ replaced by $N$. The overall
$\bar{P}^B_c = \sum^{{(m-1)}/2}_{k=0} (^m_{\:k} ) p^k(1-p)^{m-k}$
can be made, for any fixed $m$, arbitrarily close to 1/2 by making $p$
arbitrarily close to 1/2, i.e., with $N$ sufficiently large, because
this $\bar{P}^B_c$ is a continuous function of $p$.
The value of $m$ is determined from $p^m_A < \epsilon$ from
cloning. With ${\bar{P}}^B_c - \frac{1}{2} < \epsilon$, the
unconditional security proof is completed for the following
\addcontentsline{toc}{section}{\hspace{.45in}{\bf Protocol QBC3m2}}
\noindent
{\em PROTOCOL} QBC3m2
\indent
(i) Babe sends Adam a sequence of $m$ qubits, each
$|\psi^j \rangle$ named by its position and independently and randomly
chosen from a great circle $C$.
(ii) Adam modulates each and all $|\psi^j \rangle$ by $U_0 = I$ and
$U_1 = R(\pi,C )$, then places each $U_b | \psi^j \rangle$
independently and randomly among the $j$th of $m$ succeeding
$N$-sequences of qubits, the states of all the other qubits independently
and randomly chosen. He sends the $n=mN$ succeeding qubits with their position names to Babe.
(iii) Babe measures $\{|\psi^j \rangle, R(\pi, C)|\psi^j \rangle \}$
on the $N$ qubits of the $j$th sequence for all $j$. Adam
opens by revealing the positions of $U_{b}|\psi^j \rangle$ and the
bit valve. Babe verifies by checking her measurement results on these qubits.
\noindent
{\em Theorem} 6:
\noindent
Protocol QBC3m2 is unconditionally secure.
Protocols QBC3u1 and QBC3u2 can be introduced similar to the last
section. They are omitted here since their full security proofs are not yet available.
\section{\hspace{.2in}Conclusion}
In this paper we have explicitly detailed two major ways in which the
QBC impossibility proof fails as a general proof. There are two
corresponding significant general issues concerning the impossibility proof. One is
that classical randomness and the corresponding information flow
between the two parties may play a significant role in a general
protocol. Such a role has not been completely characterized for the
classical case, and cannot be simply eliminated by quantum
purification. This points to the more general, second issue: how one
can characterize all possible QBC protocols at all when one has not been
able to do that for any type of classical cryptographic protocols. In particular,
there are many possible protocols with random numbers generated by Adam and
Babe during various stages of a protocol, necessitating uniformity conditions similar to (25)
that would intertwine in a complicated classical way that is not resolved by quantum purification. As things stand, it is even open whether a
perfectly secure QBC protocol is possible, given the limited scope of Theorem 3.
In any event, it is possible to have unconditionally secure quantum
bit commitments, as protocols QBC3m1 and QBC3m2 demonstrate. Equally
significantly, these protocols can be carried out without any quantum
memory to be used between commitment and opening. In applications to
key management or identification/authentication, such required quantum
memory would be very long on microscopic scale, at least for network
type situations. It is unrealistic to expect that such quantum memory
would become available in any reasonable amount of time. Thus, these
protocols represent
a major step in advancing the possible practical use of quantum bit
commitment. Moreover, each qubit in the protocol can be replaced by a
full optical field mode and qubit state by large-energy coherent
state, without affecting the essential underlying operations, thus
making the protocol even easier to implement. A full description
of such protocols and quantitative tradeoffs between security
and complexity will be given in a future paper.
\addcontentsline{toc}{section}{Acknowledgment}
\section*{Acknowledgment}
I would like to thank M. D'Ariano and M. Ozawa for useful discussions.
This work was supported in part by the Defense Advanced Research
Project Agency and in part by the Army Research Office.
\addcontentsline{toc}{section}{Appendix A: Proof of Theorem 2}
\renewcommand{D\arabic{equation}}{A\arabic{equation}}
\setcounter{equation}{0}
\section*{Appendix A \\
Proof of Theorem 2}
By choosing $|e_i \rangle = | e^{'}_1 \rangle$ in (1)-(2), one obtains
\begin{equation}
|\langle \Phi_1 | U^A| \Phi_0 \rangle |= | tr {\bf U \Lambda} |
\end{equation}
\noindent
The maximum of $| tr {\bf U \Lambda} |$ over all unitary ${\bf U}$ is
attained when ${\bf U \Lambda}$ is
nonnegative definite with maximum value given by $tr |{\bf \Lambda}|$
[17, p.43]. Thus ${\bf U}$ is
determined by the polar decomposition (generalization to infinite
dimensional space can be obtained via maximal partial isometry) of ${\bf \Lambda}=|{\bf \Lambda}|{\bf U}^\dagger$.
With $p_i = p^{'}_i , {\bar{P}}^A_c$ is given by (20) and is thus
bounded above by $\sum_i |{\bf \Lambda} |_{ii}$ which is just $tr |
{\bf \Lambda} | = {F}$. For a
set of probabilities $\alpha_i$ and complex numbers $\lambda_i$, one has
\begin{equation}
\sum_i \alpha_i | \lambda_i |^2 \geq | \sum_i \alpha_i \lambda_i |^2
\end{equation}
as a consequence of Jensen's inequality and the concavity of the
function $x \mapsto x^2$. The lower bound of (21) follows from (A2)
with $\alpha_i = p_i$ and $\lambda_i = \sqrt{\tilde{p}_i / p_i} \langle
\tilde{\phi}_i | \phi^{'}_i \rangle$, valid for $p_i \neq p^{'}_i$.
\addcontentsline{toc}{section}{Appendix B: Example on Proper Concealing}
\renewcommand{D\arabic{equation}}{B\arabic{equation}}
\setcounter{equation}{0}
\section*{Appendix B \\
Example on Proper Concealing}
In the notations of sections II-III, the following example shows that for (24), even with no small $\lambda_k$, the condition (34) does not imply that Adam can cheat as claimed by the impossibility proof.
Consider 2-qubit ${\cal H}^B = {\cal H}_2 \otimes {\cal H}_2$ and $|\Psi \rangle \in {\cal H}^B \otimes {\cal H}^C$ given by
\begin{equation}
| \Psi \rangle = \frac{1}{\sqrt{2}} (|a \rangle |a' \rangle |f_1 \rangle + |a' \rangle |a \rangle |f_2 \rangle )
\end{equation}
where $|a \rangle$ and $|a' \rangle$ are two openly known orthogonal
states in ${\cal H}_2$, and $|f_i \rangle$ are orthonormal in ${\cal
H}^C$, which is also a qubit. The operations are taken to be $p_1 =
p'_1 = p_2 = p'_2 = \frac{1}{2}$, $U_{01}=I$, $U_{02} = P$ the
permutation operator switching the two qubit positions in ${\cal
H}^B$, $U_{11}=R$ a rotation that brings $|a \rangle$ to $|a' \rangle$
and $|a' \rangle$ to $|a \rangle$, $U_{12} = RP$. It follows easily
that, after entanglement by Adam, $\rho^{BC}_0(\Psi) =
\rho^{BC}_1(\Psi)$ and he can cheat perfectly when Babe forms (B1).
However, it is Babe who can actually cheat perfectly in this
situation. Instead of sending (B1) she can send $|a \rangle |a
\rangle \in {\cal H}^B$ instead, which would defeat Adam's cheating
and allows herself to cheat. The underlying reason is, of course,that
(31) or (25) is not satisfied, and $|a \rangle | a \rangle \not \in
{\rm span}\{ |a \rangle |a' \rangle, |a' \rangle |a \rangle \}$,
violating the condition required for (34)-(35). Clearly, there is no
reason why Babe wants to be honest so Adam can cheat. Thus, the
impossibility proof formulation, which does not have a condition such as (36), is not a meaningful one in the presence of random numbers, with consequent incorrect claim on same situation.
\addcontentsline{toc}{section}{Appendix C: Evaluation of Trace Distance}
\renewcommand{D\arabic{equation}}{C\arabic{equation}}
\setcounter{equation}{0}
\section*{Appendix C \\
Evaluation of Trace Distance}
One straightforward way to evaluate $|| \rho^B_0 - \rho^B_1
\parallel_1$ for $\rho_{\rm b}$ of (40) is to directly compute the
trace norm in the product basis spanned by $\{ |\lambda + \rangle , |
\lambda - \rangle \}$ for each qubit. Let $k$ be the number of
$|\lambda - \rangle$ in a product-basis vector. One has, from a
direct counting calculation,
\begin{equation}
\parallel \rho^B_0 - \rho^B_1 \parallel_1 = \frac{\lambda_+}{n2^{n-1}}
\begin{array}{c} n \\ \sum \\ k=0 \end{array}
\left(
\begin{array}{c}
{n} \\ k
\end{array} \right) | n-2k |
\end{equation}
The binomial sum in (C1) can be evaluated in closed form. With $n=2
\ell +1$,
\begin{equation}
\begin{array}{c}
n \\ \sum \\ k=0 \end{array}
\left( \begin{array}{c}
n\\k
\end{array} \right)
| n-2k |=2 (2 \ell +1)
\left( \begin{array}{c}
2 \ell \\ \ell
\end{array} \right)
\end{equation}
\noindent
Equation (41) follows from (C1)-(C2).
\addcontentsline{toc}{section}{Appendix D: Simple Summary of
Protocols QBCp3m, etc.}
\renewcommand{D\arabic{equation}}{D\arabic{equation}}
\setcounter{equation}{0}
\section*{Appendix D \\
Simple Summary of Protocols QBCp3m, etc.}
The statement, underlying logic, and security of protocol QBCp3m can be simply presented as follows. The detailed proofs are given
in the paper.
Let Babe send Adam a qubit in state $| \psi \rangle$ known only to herself,
$|\psi \rangle \in C \subset {\mathcal{H}}^{B}_{2}$ in a fixed great circle
$C$ of the qubit Bloch sphere. Depending on b = 0 or 1, Adam leaves it
alone or rotates it to its orthogonal state $| \psi' \rangle$, then
sends it back to Babe among a number $n-$1 of random decoy qubit states.
Independently of b, Babe can make the same qubit measurement of the
basis $\{ | \psi \rangle, | \psi' \rangle \}$ on every of the $n$
qubits before
Adam opens. The protocol is still concealing with $\bar{P}^B_c
\rightarrow \frac12$ as $n \rightarrow \infty$,
because she does not know which qubit is the one she sent. It is
clear that Babe cannot determine b any better by sending $| \psi \rangle
\notin C$ or by entangling $|\psi \rangle$. Because Adam cannot gain any information on Babe's
measurement basis via entanglement, his optimal cheating probability $\bar{P}^A_c$ is given by
an appropriate one-to-two clone fidelity $p_A$, which is independent of $n$
and not arbitrarily close to 1. As he has to open 0 and 1 on two
different qubits given Babe already measures, the optimality of $p_A$
would be contradicted if he can do any better. Thus far, the
quantitative claim of the impossibility proof, (IP) of (9) or (IP$'$) of
(10), has been invalidated by the above protocol QBCp3m. More
significantly, it shows that the impossibility proof
formulation misses a whole class of protocols in which Babe can make
the verifying measurement independently of b before Adam opens.
It is straightforward to extend QBCp3m to unconditionally secure
protocols, such as QBC3m1 and QBC3m2, by having Babe send Adam a sequence of $m$ independent $|
\psi_i \rangle$'s with $p^m_A$ set to any arbitrarily small
value $\epsilon$. Adam sends back each of the m uniformly modulated qubits
in different restricted ways among $n$ qubits. Babe makes the corresponding measurements
before Adam opens. The resulting protocols are concealing with $n$
sufficiently large for any fixed $m$, which is determined by Adam’s
optimal cheating probability $\bar{P}^A_c = p^m_A$, and are thus
fully unconditionally secure in the sense (US) of (8).
\addcontentsline{toc}{section}{References}
\end{document}
|
math
|
Melissa from Mel’s Art Buffet is an office manager by day, creative whirlwind by night. She’s turned Celiac disease from a burden to inspiration by re-imagining her favorite foods with seed beads and polymer clay. Self-diagnosed with AADD (Artistic Attention Deficit Disorder), Mel always has three or four project in progress and pushes herself to try new techniques.
What made you turn to food for inspiration?
Some people pull a fabric swatch for inspiration, drawing from the beautiful colors and exotic designs. Food is my fabric swatch. I love to pull a color palette from a mouth-watering dish you can’t take your eyes off of. The dark, cheesy corner of a casserole; the vibrant, fresh greens in a bundle of asparagus. Food is beautiful and undeniably inspiring. I find unexpected color combinations fresh out of the oven or picked from the garden.
I was diagnosed with Celiac disease in 2004. The disease is auto-immune, which means the body attacks itself with an immune system response. Celiac disease is triggered by gluten, which is found in wheat, rye, barley and oats. Many of my life-long favorite foods are off-limits now. I eat visually what I’m not allowed physically. Thankfully I’ve always had a passion for cooking, so I have a bookshelf full of cookbooks with amazing photos. I enjoy the challenge of adapting recipes and I crave the visual candy.
Tell us about your process from inspiration to finished piece.
I draw sketches throughout the day at work. Some days I’ll leave work with a handful of sketches covered in notes. I have hundreds of sketches waiting for a chance to come to life. A concept will pop into my head – if I close my eyes and concentrate, I can see the construction process from start to finish.
Food photos inspire me, especially from Foodgawker. The layout and placement of food is equally as stimulating as the colors. Food artists have so much to offer, I admire their work as much as a conventional artist. I put the sketches, ideas and color palette together and see what happens. Not all my pieces are so carefully orchestrated – many happy accidents happen at my workbench.
Tell us about the transition from seed beads to polymer clay.
I was ready for a change of pace. I love the freedom of polymer clay. I remember leaving work one day and telling my best friend, “I’m gonna do it. I’m jumping on the polymer clay train.” There’s been no looking back. I feel like I will stay with polymer for a while; it gives me everything I want, and is so friendly with the materials I throw at it.
You’re able to create such unique designs – what tools do you use to sculpt the polymer clay?
I wish I had a ton of secret tools to share, but really I just find myself trying to construct a mini Michael’s in my home studio. I use a 40-50% coupon every week and buy one item – though I’ve been known to buy more than one! I find myself using tools to compensate for my lack of skill with polymer clay. I have a long way to go and so much to learn about the medium. I’ll immediately grab a texture tool to hide flaws instead of learning to avoid or work around the flaws. But texture is so exciting – I love that it can be found anywhere. My favorite texture tool is a ball of aluminum foil.
I have another clay tool that I love, although I’m not sure what it’s called. It’s a fan of metal bristles. I love the affect it creates – it can cover more area than poking holes one at a time. If you put your texture eyes on, you can find options anywhere and everywhere. Also, don’t be tied to clay tools. Many fondant, icing and baking tools from the food section can become your best friends with polymer clay.
I see on your blog that you’re making a ring a week – where did you get the idea?
I came across the the Ring a Day group on Flickr and I remember thinking, “You have to be kidding me.” These amazing artists are creating one ring a day for a entire year. So very impressive, what an amazing commitment. I was reading through the discussions in the group about the 2011 project for Ring a Week (RAW). Now we’re talking, that’s more my speed. I decided to make the commitment to challenge myself and participate. It has been a huge undertaking, but so worth it. I love mingling with talented artists I might not otherwise meet. Most importantly, it has tested my creativity and forced me to think outside of the box. Submitting my first RAW ring was so scary; I felt so out of place and nervous, but I was welcomed with wonderfully kind comments and felt right at home.
You’re on ring 32 of your 52-week journey, yet there are only 2 rings in your Etsy shop – where do they all go?
I created the two rings in my Etsy shop before the RAW journey. I’d only made two rings when starting RAW, so I was a little outside of my comfort zone. The rings, now 34 strong, are hanging on bent paperclips on the side of a bookshelf. I hope to gradually migrate them to Etsy, but it can take me 10 to 20 days to prepare Etsy listings. That is so embarrassing but true. Working 60+ hours a week at my day job leaves little time to foster my passion. It pains me that I’m not able to do more.
Do you find that the stresses of your day job impact your creativity when you get home?
It greatly affects my creativity, motivation and energy level. Time is a huge issue. I spend all day thinking about crafting and counting the seconds until I go home; then once I’m home the time pressure makes it hard to get in the zone. After work I exercise and meditate, then there’s only so much time before going to bed early enough to do it all again. It’s a vicious cycle, I’m chasing my tail at work and at home. My favorite part of Etsy is the QYDJ series – I read each story with concentration and vigor. I check to see if there is a new post almost every day.
What new materials are you working with?
I love mixing materials. I find myself drawn to recyclable or throwaway items. I like to see common materials transform into unrecognizable beauties. I’m so excited to get the Torch-Fired Enamel Jewelry book. Enamel jewelry, no kiln required. I can’t even tell you how excited I am. I’ve always had big love for enamel pieces.
The bead creations in your ECrater shop are not in your Etsy shop – why the separation?
I had brief moments of success on Ecrater, but I mainly focus on Etsy. My brain is extremely sequential and compartmental. It threw my head into a tailspin to imagine one piece of jewelry listed on two different venues. Maybe one day I’ll be able to work it out. No doubt it would be beneficial to show these works in my Etsy shop.
If you had just one wish for your Etsy shop, what would it be?
My huge wish is for my Etsy shop to take off, faster and wider than I could ever imagine. I want to be plagued with the burden of struggling to keep up with orders. It’s been my lifelong dream to be able to support myself from making things. I have to make things to survive, so I would like to be able to survive because I make things. This is my passion. I want it so bad it hurts.
Check out Mel’s Art Buffet on Etsy for more of her beautiful clay jewelry. Melissa is also on Facebook and posts her RAW challenge to the Mel’s Art Buffet blog. She leaves me hungry for both food and success.
|
english
|
Kochi: The Detailed Project Report (DPR) of the second phase development of Vyttila mobility hub is fast nearing completion with authorities focusing on world-class security features, hassle-free pedestrian flow, green spaces, which can serve as leisure spots for not only commuters but also residents, and commercial spaces for generating profit. The DPR would be finalized by November-end and the work is likely to begin in the next couple of months. Vyttila Mobility Hub Society (VMHS) is yet to decide whether it should be a public-private-partnership (PPP) or a project of VHMS.
“It is up to VMHS to decide on the financial model for the second phase. Kochi Metro Rail Ltd (KMRL) is the implementing agency. KMRL will complete the construction and hand it over to VMHS,” an official with KMRL said.
Sources said VHMS wants to start its own project and seek financial aid from international funding agencies later.
The consultants for the project have prepared three designs, which was selected, to enhance security and other features.
“The first design was dropped as commuters would have to use staircases or elevators. The defect of the second one was that it had more intercepting points for vehicles and pedestrians,” sources with VHMS said.
As per the selected design, the building will have two stories above the ground floor. “About 39% of the 24-acre area earmarked for the project would be retained as green space while 34% would be utilized for the terminal, which will have passenger amenities, the Metro station, water Metro jetty and space for commercial establishments. The ground floor would have terminal and passenger amenities while the first and second floors would be for commercial space,” sources said.
The bus terminal would have two separate areas, one for city buses and the other for regional buses. There would be 16 bus bays for city buses. The area for regional buses will have 76 boarding bays and nine alighting bays. As many as 78 bus bays would be built for parking the buses. The multi-level car parking facility, to be set up at the mobility hub, would be able to accommodate 700 vehicles. Lots will be made available to park 456 motorcycles and 50 autorickshaws as well. Dormitories for passengers, petrol bunks and CNG outlets, effluent treatment plant and rainwater harvesting facilities are some other proposed features of the hub. Meanwhile, the government has appointed urban affairs director R Girija as the new managing director of VMHS. She will assume office on Friday. District collector K Mohammed Y Safirulla has been holding the charge of MD so far.
|
english
|
<!DOCTYPE html>
<html lang="ja" class="chrome__sashikomi">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="dist/inject.bundle.css">
<title>Sashikomi | Insertion error</title>
</head>
<body>
<div id="InsertionErrorContainer"></div>
<script src="dist/inject.bundle.js"></script>
</body>
</html>
|
code
|
Thierry Lasry Sexxy 101 Made from Black gloss Mazzucchelli acetate finished using gold titanium to add strength and luxury finish. To give an upgrade to a wayfarer style.
The Thierry Lasry 'Sexxxy' are a subtle squarer catseye. Made using the highest grade vintage Italian acetate. Handmade using traditional techiques in France to the highest standards. The style like all of Thierry Lasry frames celebrates the marriage of bygone eras of fashion to create a present day understated high glamour look.
With the contrast of the gold bar arms against the high gloss black is a statement of luxury as standard and is coveted by celebrities just like a magpie is drawn to shiny objects. Create a storm when you walk into a room in this extra special frame. Feel a million dollars or more in this classic it has its own unique identification number and includes all certificates of authenticity.
|
english
|
बी जे पी के सीनियर क़ाइदीन की नशिस्तें तबदील करने पर दिग्विजय सिंह का एतराज़ - थे शियासत डेली
बी जे पी के सीनियर क़ाइदीन की नशिस्तें तबदील करने पर दिग्विजय सिंह का एतराज़
कांग्रेस के जनरल सेक्रेटरी दिग्विजय सिंह ने बी जे पी के सीनियर क़ाइदीन के इंतेख़ाबी हलक़ों को तबदील करदेने पर एतराज़ करते हुए कहा कि अगर मुल्क में मोदी लहर चल रही है तो इंतेख़ाबी हलक़ों के तबदील करने की क्या वजह है।
सीनियर क़ाइदीन जैसे मुरली मनोहर जोशी, नवजोत सिंह सिद्धू और लाल जी टंडन के इंतेख़ाबी हलक़े क्यों तबदील करदिए गए हैं। उन्हों ने बी जे पी के नामवर क़ाइद जसवंत सिंह को बारमीर की नशिस्त से महरूम करदेने का भी तज़किरा किया और कहा कि जसवंत सिंह को निशाना क्यों बनाया जा रहा है।
जसवंत सिंह ने बरहम होकर मौजूदा बी जे पी को जाली बी जे पी और सीनियर क़ाइदीन की बी जे पी को हक़ीक़ी बी जे पी क़रार दिया है।
|
hindi
|
कोराना पर सुप्रीम कोर्ट की चिंता, कहा वायरस के आगे इंसानी कोशिशें बौनी कोराना पर सुप्रीम कोर्ट की चिंता, कहा वायरस के आगे इंसानी कोशिशें बौनी
होम लाटेस्ट न्यूज कोराना पर सुप्रीम कोर्ट की चिंता, कहा वायरस के आगे इंसानी कोशिशें बौनी
कोराना पर सुप्रीम कोर्ट की चिंता, कहा वायरस के आगे इंसानी कोशिशें बौनी
दुनिया में फैले कोरोना वायरस के कहर पर सुप्रीम कोर्ट ने भी चिंता जताई है । इस सम्बंधी जस्टिस अरुण मिश्रा ने कहा कि सौ साल में ऐसी महामारी फैलती है। हम इस वायरस से नहीं लड़ सकते। ऐसे वायरस के आगे इंसानी कोशिशें छोटी पड जाती हैं इनसे अपने स्तर पर लड़ने की जरूरत है। सरकार के स्तर पर इसका मुकाबला नहीं हो सकता । इक मौके जस्टिस एमआर शाह ने वरिष्ठ वकील अपने साथ सिर्फ एक वकील ही लाए। यह हमारे भले के लिए ही है।
कोरोनावायरस से संक्रमण हर दिन बढ़ता ही जा रहा है। इसके खतरे को देखते हुए उद्योगपति और स्टार्ट अप्स कंपनियों के समूह ने प्रधानमंत्री नरेंद्र मोदी से अपील की है कि वे कोरोनावायरस से निपटने के लिए इस हफ्ते प्रमुख शहरों में लॉकडाउन करें। उनका कहना है कि वायरस राष्ट्रीयता के आधार पर भेदभाव नहीं करता। ठोस और आक्रामक कार्रवाई की जानी महत्वपूर्ण है। प्रमुख शहरों में दो हफ्तों के लिए धारा १४४ और सख्त लॉकडाउन होना चाहिए । कहा गया है कि महामारी से बचाव के लिए रोकथाम के प्रयासों को जारी रखना चाहिए। इससे ३० दिनों के बाद पांच गुना मौतों को कम किया जा सकता है। इससे करीब दस हजार लोगों की जान बच सकती है।यह भी कहा गया है कि भारत ने इससे निपटने के लिए अच्छी शुरुआत की है। सरकार सार्वजनिक जगहों को बंद कर रही है। लोगों को भीड़ जुटाने से रोका जा रहा है। साथ ही कर्मचारियों को घर से ही काम करने के लिए प्रोत्साहित किया जा रहा है। इसमें यह चेतावनी दी गई है सरकार को भोजन, दवा अन्य जरूरी चीजों की आपूर्ति सुनिश्चित करनी चाहिए।
प्रेवियस पोस्टअलर्ट : कोरोना के बारे में प्रधानमंत्री देश को करेंगे संबोधन नेक्स्ट पोस्टकोरोना कारण माता वैष्णो देवी यात्रा हुयी बंद
|
hindi
|
गुजरात ने पहली पारी में ३ विकेट पर ३99 रन बनाए | गुजरात ने पहली पारी में ३ विकेट पर ३99 रन बनाए
गुजरात ने पहली पारी में ३ विकेट पर ३99 रन बनाए
थिम्मापाह स्मृति चार दिवसीय क्रिकेट टूर्नामेंट के सेमीफाइनल मुकाबले के दूसरे दिन सोमवार को गुजरात ने पहली पारी...
थिम्मापाह स्मृति चार दिवसीय क्रिकेट टूर्नामेंट के सेमीफाइनल मुकाबले के दूसरे दिन सोमवार को गुजरात ने पहली पारी में तीन विकेट पर ३९९ रन बनाकर मैच में अपनी पकड़ बना ली है। टीम के बल्लेबाजों ने शानदार बल्लेबाजी कर छत्तीसगढ़ के गेंदबाजों को विकेट से दूर रखा। मैच के दूसरे दिन छत्तीसगढ़ के अजय मंडल और विशाल कुशवाहा को १-१ विकेट मिला।
गुजरात ने दिन का खेल समाप्त होने तक तीन विकेट पर ३९९ रन बना लिए हैं। केशितज पटेल (२७५ गेंद, १७५ रन, २० चौके, ३ छक्के) और मनप्रीत जुनेजा १७ गेंद, ६ रन पर खेल रहे हैं। छत्तीसगढ़ की पहली पारी में 2३1 रनों पर ढेर हुई। गुजरात ने पहली पारी में 1६8 रनों की बढ़त बना ली है। टीम इससे आगे की पारी मंगलवार को शुरू करेगी।
दूसरे विकेट के लिए जोड़े २०० रन : कर्नाटक में खेले जा रहे मैच के दूसरे दिन सोमवार को एक विकेट पर ३२ रनों से आगे की पारी गुजरात ने शुरू की।
भार्गव मेरारी (२०६ गेंद, ९१ रन) और केशितज पटेल (१७९ गेंद, १०७ रन) ने दूसरे विकेट के लिए २०० रन जोड़कर टीम के स्कोर को २१७ रनों तक पहुंचाया। भार्गव मेरारी ९१ रनों को अजय मंडल ने अमनदीप के हाथों कैच कराकर गुजरात को दूसरा झटका दिया।
चौथे विकेट के लिए १८ रन जोड़े: केशितज एक ओर से जमे हुए थे। उन्होंने मनप्रीत (१७ गेंद, ६ रन) के साथ १८ रन जोड़कर टीम के स्कोर को ३९९ रनों तक पहुंचाया। दिन का खेल समाप्त होने तक केशितज पटेल (२७५ गेंद, १७5 रन, २० चौके, ३ छक्के) खेल रहे हैं। उनके साथ मनप्रीत (६) रन क्रीज पर जमें हैं।
छत्तीसगढ़ के खिलाफ शतक से चूके पार्थिव
२१७ रनों पर दो विकेट गिरने के बाद पार्थिव पटेल ने पारी को संभाला। पार्थिव (९८ रन, ११६ गेंद) और केशितज (८४ गेंदे, ५६) रनों के बीच तीसरे विकेट के लिए १६४ रनों की साझेदारी ने टीम को मजबूत स्थिति में पहुंचा दिया। पार्थिव को शतक पूरा करने के लिए मात्र दो रनों की जरूरत थी। १००वां ओवर लेकर आए विशाल ने पहली गेंद पर पार्थिव को मनोज के हाथों कैच कराकर पवेलियन का रास्ता दिखाया। छत्तीसगढ़ की टीम को दिन की दूसरी सफलता भी दिलाई।
|
hindi
|
زیادٕ تر کیلکولیٹرن منٛز چُھ امہٕ قسمکہ اظہارُک دأخلہٕ غلطی ہیند پیغام پٔدٕ کران۔
|
kashmiri
|
تِمَن کاغزَن پؠٹھ کٔرِو دستخط تہٕ پتہٕ تھٲیِو حوالہٕ دِنہٕ باپتھ پانَس نِش اکھ کاپی
|
kashmiri
|
کنیو ہال بناونہٕ سۭتۍ بنیو نہٕ سُوٛ نارٕ نش محفوظ تیکیازِ اتھ چِھ امہٕ پتہٕ تہٕ دارٕ تہٕ لکڑیو دروازٕ۔
|
kashmiri
|
class ZshNavigationTools < Formula
desc "Zsh curses-based tools, e.g. multi-word history searcher"
homepage "https://github.com/psprint/zsh-navigation-tools"
url "https://github.com/psprint/zsh-navigation-tools/archive/v2.2.7.tar.gz"
sha256 "ee832b81ce678a247b998675111c66aa1873d72aa33c2593a65626296ca685fc"
bottle do
cellar :any_skip_relocation
sha256 "2ca507bf832d34b63b9bf4f60b76158ad0e8980622f78de8fd8e3f771d4df5d2" => :catalina
sha256 "292a200717412253b03f654162da7ce1c0994455c07fdf65fa348189a18217b5" => :mojave
sha256 "5122287e2fb30bde73acb7174e1310ea41ef049d201203bc559edf02555a2e33" => :high_sierra
sha256 "fca68610ba67c19d8516719d03ed5074a5611ba01941dcb135c87d6d561f3cb1" => :sierra
sha256 "fca68610ba67c19d8516719d03ed5074a5611ba01941dcb135c87d6d561f3cb1" => :el_capitan
sha256 "fca68610ba67c19d8516719d03ed5074a5611ba01941dcb135c87d6d561f3cb1" => :yosemite
end
def install
system "make", "install", "PREFIX=#{prefix}"
end
def caveats
<<~EOS
To run zsh-navigation-tools, add the following at the end of your .zshrc:
source #{HOMEBREW_PREFIX}/share/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
You will also need to force reload of your .zshrc:
source ~/.zshrc
EOS
end
test do
# This compiles package's main file
# Zcompile is very capable of detecting syntax errors
cp pkgshare/"n-list", testpath
system "zsh", "-c", "zcompile n-list"
end
end
|
code
|
\begin{document}
\title{\bf A generalised linear Ramsey graph construction}
\author{Fred Rowley\thanks{formerly of Lincoln College, Oxford, UK.}}
\Addr{West Pennant Hills, \\NSW, Australia.\\{\tt [email protected]}}
\date{\dateline{6 June 2019}{DD Mmmmm CCYY}\\
\small Mathematics Subject Classification: 05C55}
\maketitle
\begin{abstract}
A construction described by the current author in 2017 uses two general linear graphs as `prototypes' to build a linear compound graph with inherited Ramsey properties.
This paper describes a generalisation of that construction which has produced improved lower bounds for multicolour Ramsey numbers in many cases. The resulting compound graphs are linear, as before, and under certain particular conditions, they can be cyclic.
The mechanism of the new construction requires that the first prototype contains a triangle-free `template', with defined properties, in one colour. This paper shows that in the compound graph, clique numbers in the colours of the first prototype may exceed those of the prototype. However, it proves necessary only to test for a limited subset of the possible cliques using these colours, in order to evaluate the relevant clique numbers for the entire graph. Clique numbers in the colours of the second prototype are equal to those of that prototype. It has also been found that there are a number of useful cases in which the clique numbers of the first prototype are not increased by the compounding process. These attributes enable the efficient searching of a new family of graphs of unlimited size.
As a result of this construction many lower bounds can be improved. The improvements include $R_4(5) \ge 4073$, $R_5(5) \ge 38914$, $R_3(6) \ge 1106$, $R_4(6) \ge 21302$, $R_4(7) \ge 84623$ and $R_3(9) \ge 14034$. Furthermore, it is shown that $R_3(9) \ge 14081$ using a non-linear construction.
The construction also enables improved lower bounds on $\lim_{\substack{r \rightarrow \infty}} R{_r}(k)^{1/r}$ for many values of $k$.
\noindent
\noindent \textbf{Keywords:} graph colouring; clique number; Ramsey graph.
\end{abstract}
\section{Introduction}
This paper addresses the properties of undirected loopless graphs with edge colourings in an arbitrary number of colours, and the corresponding multicolour classical Ramsey numbers, by describing a powerful construction for multicolour Ramsey graphs.
We first define a {\it Ramsey graph} $U(k_1, {\dots} \, ,k_r; m)$, with all $k_s \ge 2$, as a complete graph of order $m$ with a colouring such that for each colour $s$, where $1 \leq s \leq r$, there exists no monochrome copy of a complete graph $K_t$ which is a subgraph of $U$ in the colour $s$ for any $t \geq k_s$. Equivalently, the maximum order of any such copy of $K_t$ in any colour $s$ is strictly less than $k_s$. Such a graph $U$ may conveniently be described as a $(k_1, {\dots} , k_r; m)${\it-graph}.
The {\it Ramsey number} $R(k_1, \dots \, , k_r)$ is the unique lowest integer $m$ such that no \newline
$U(k_1, {\dots} \, , k_r; m)$ exists, and its existence is proved by Ramsey's Theorem. When all the $k_i$ are equal, this may be written $R_r(k)$ and is referred to as a {\it diagonal} Ramsey number.
The construction described in \cite{Rowley1} extended a previous construction of Giraud \cite{Giraud1}. It allows the creation of linear Ramsey graphs with specific properties by combining the distance sets of two linear graphs, which we will refer to as {\it prototypes}. We may refer to graphs constructed in this way generically as {\it compound graphs}.
In \cite{Giraud1}, by identifying symmetrical Schur partitions with the corresponding 'regular colourings' of Kalbfleisch \cite{Kalb}, Giraud effectively established that various infinite series of Ramsey graphs could be constructed, adding one colour at a time, and that the orders of those graphs could be determined by a simple formula based on the number of colours. His results set lower bounds for a wide range of multicolour Ramsey numbers $R_r(k)$ of unlimited size, and for any $k$.
In the diagonal case, the growth rate of the orders of the graphs in such series can often be seen to approach a fixed limit as the number of colours tends to infinity, which we will refer to as the {\it limiting growth rate} of the series. Where the series arises from the repeated use of the same construction with the same prototype graph, we may associate the limiting growth rate with that combination.
Giraud's results effectively established lower bounds on $\lim_{\substack{r \rightarrow \infty}} R{_r}(k)^{1/r}$ which for convenience we may write as $\Gamma(k)$. The existence of $\Gamma(k)$ had been proved already in \cite{AbbM}.
For $k = 3$, we note here that Giraud's work was strongly foreshadowed, many years before, by a closely related result of Schur published in \cite{Sch1}. In fact, for the specific case $k = 3$, it had already been somewhat bettered by Abbott and Moser in \cite{AbbM} who proved (after adjusting terminology) that $R{_r}(3) \ge 89^{(r/4-c.log(r))}$ for some fixed constant $c$, from which it follows that $\Gamma(3) \ge 3.071\dots$. Much later, and after other significant work including \cite{AbbH}, it was proved in \cite{XXER} that $\Gamma(3) \ge 3.199\dots$.
Building on this background, section 3 of this paper describes a generalisation of the construction demonstrated in \cite{Rowley1}, which produces superior lower bounds in many cases. It can be applied to produce diagonal or non-diagonal Ramsey graphs. The resulting graphs are always linear, and under particular conditions, they are cyclic.
This in turn allows us to extend the construction of infinite series of Ramsey graphs, aiming in particular to throw more light on lower bounds for $\Gamma(k)$ for any value of $k$.
We also establish improved lower bounds on a range of `small' diagonal multicolour Ramsey numbers. Section 4 records some selected computational results for individual Ramsey graphs. These establish improved lower bounds for a range of graphs, including $R_4(5)$ and $R_5(5)$, $R_3(6)$ and $R_4(6)$, $R_4(7)$, and $R_3(9)$.
In section 5, the key Tables from \cite{Rowley1} are updated to reflect the limiting growth rates implied by these improved results in particular cases for the previous construction. Lower bounds for some specific $\Gamma(k)$ are derived by taking selected maxima of these growth rates, or extended using the new construction.
Section 6 draws some conclusions from this work.
We begin with some further definitions of required notation in section 2.
\section{Definitions and Notation}
In this paper,
$K_n$ denotes the complete graph with order $n$.
If $U$ denotes a complete graph $K_m$ with $m$ vertices $\{u_0, {\dots} , u_{m-1}\}$, then:
A {\it (q-)colouring} of $U$ is a mapping of the edges $({u_i}, {u_j})$ of $U$ into the set of integers $s$ where $1\le s \le q$.
The {\it length} of the edge $({u_i}, {u_j})$ is defined as $\mid j - i \mid$. A length is often referred to as an {\it edge-length} in this paper, for clarity.
A colouring of $U$ is {\it linear} if and only if the colour of any edge $({u_i}, {u_j})$ depends only on the length of that edge. In such a case the colour of an edge of length $l$ may be written $c(l)$, or $c(l,U)$ where necessary to avoid ambiguity.
A colouring of $U$ is {\it cyclic} if and only if (a) it is linear, and (b) $c(l)=c(m-l)$ for all $l$ such that $1 \le l \le m-1$.
A colouring of $U$ is {\it repeating} in a colour $s$ with period $\pi$ if and only if (a) it is linear, and (b) $c(l)=s$ implies $c(l)=c(l + \pi)$ for all $l$ such that $1 \le l \le m-1-\pi$.
The {\it clique number} of graph $U$ in colour $s$ is the largest integer $i$ such that $U$ contains a subgraph which is a copy of $K_i$ in that colour.
\section{Generalised Linear Graph Construction}
We shall set out general conditions for compounding two linear prototypes using a {\it triangle-free template}, or {\it tf-template}, in a relatively simple construction process, which includes that described in \cite{Rowley1} as a special case.
We first define a suitable form for the template, which denotes a subset of the first prototype with specified properties. We go on to describe the construction and colouring of a graph $W$ in terms of the sets of its edge-lengths, as derived from the prototypes. For each of the colours of the first prototype, we prove that the clique number of $W$, however large, does not exceed that of $W'$, where $W'$ is derived from the graph $W$ by removing vertices. Then, for all the colours of the second prototype, we prove that the clique-number of $W$ is the same as for the prototype.
The construction is thus shown to give rise to a family of graphs of essentially unlimited size, the properties of which can be tested by searching only a limited subgraph, covering only a subset of their colours. We note that, once tested in this way, the first prototype can be re-used with any second prototype without further testing. This property radically limits the computing resources needed for establishing lower bounds using this method.
\begin{definition}
\label{Def:Def-1}
If the subset $\Theta$ comprising all the edge-lengths of a linear Ramsey graph $U(k_1, {\dots} \, ,k_{q-1}, 3; m)$ with colour $q$ contains the edge-length $m-1$, it is a {\it tf-template} for $U$.
\end{definition}
The subset and the corresponding induced subgraph of $U$ can be identified with each other without confusion. It should be clear that this definition makes $\Theta$ triangle-free.
\begin{theorem}
\label{C-Thm3}
(Generalised Construction Theorem)\\
Given linear Ramsey graphs $U(k_1, {\dots} \, ,k_{q-1}, 3; m)$ and $V(k_{q+1}, {\dots} \, ,k_{q+r}; n)$, where $U$ contains a tf-template $\Theta$, it is possible to construct a linear Ramsey graph $W$ of order $(m-1)(n-1)+1+\phi$, for some $\phi$, where $0 \le \phi < m-1$. The colour of the template is eliminated during construction: and if the maximum clique number in $U$ is $Q$, then the clique number of $W$ in any of the remaining colours of $U$ is no greater than the clique number of that colour in the subgraph of $W$ induced by the first $Q.(m-2)$ edge-lengths of $W$. The clique number of $W$ in any of the colours of $V$ is the same as that of $V$.
\end{theorem}
In intuitive terms, the theorem depends on a relatively simple construction process, building repeated copies of $U$, except that the colour of the template within each copy varies according to the colours of $V$, and so the colour $q$ is eliminated. A partial copy of $U$ of order $\phi$, which cannot include any part of the template, is added as a final step.
\begin{proof}
We begin by considering the set of lengths of all the edges of $U$, which we call $L$, consisting of the integers $\{\, l \mid 1 \le l \le m-1 \,\}$. We know that a linear colouring gives rise to a natural partition of that set into subsets $L_s$ containing the lengths of edges of each colour $s$. That is, for $1 \leq s \leq q \,$:
\hspace{80pt} $L_s = \{\, l \in L \mid c(l) = s \}.$
As proved by Giraud in \cite{Giraud0}, if such a linear graph $U$ contains a copy of $K_{k_s}$ in colour $s$, then there exists a subset of the set $L_s$ of order $k_s-1$ such that each of the members of the subset and all of their non-zero pairwise absolute differences are contained in $L_s$. That paper is presented in French, but it is simple to demonstrate that result and its converse, following his reasoning.
We first select a copy of $K_{k_s}$ and then reduce the indices of its vertex set by a uniform amount, so that the modified vertex set includes $u_0$. The differences $(u_i - u_0)$ constitute the necessary subset of $L_s$. Conversely, if a subset exists as described, in $L_s$, one can construct a set of all the vertices $u_i \in U$ having index-numbers $i$ in the subset. Taking the union of that set of vertices with $u_0$ gives us the vertices of a copy of $K_{k_s}$ in $U$. This result provides the basis for our proof.
The construction builds new subsets $L''_s$ of the edge-lengths of $W$.
For $1 \leq s \leq q-1 \,$, this proceeds as follows:
\hspace{80pt} $L'_s = \{\, l + (\mu - 1)(m-1) \mid l \in L_s, 1 \le \mu \le n-1 \}$.
Now let $\phi$ be the largest integer such that $\phi < \inf(l \in L_q)$ and for $1 \leq s \leq q-1$, define
\hspace{80pt} $L''_s = L'_s \cup \{\, l + (n-1)(m-1) \mid l \in L_s, 1 \le l \le \phi \}$.
Then for $1 \leq s \leq r$,
\hspace{80pt} $L''_{q+s} = \{\, l + (\mu - 1)(m-1) \mid l \in L_q$, $1 \le \mu \le n-1$, $c(\mu, V) = q + s \}$.
It is simple to verify that the new graph $W$ is of the required order, is well-defined and linear; and that it is repeating with period $m-1$ in all the colours of $U$ except for $q$, which has been eliminated in the construction -- so that there is no $L'_q$ or $L''_q$.
We wish to know if there is a subset of the edge-lengths of $W$ that leads to a monochromatic copy of $K_{k_{s}}$ in colour $s$, where $1 \le s \le q-1$. We aim to prove that if there is such a subset, then the edge-lengths contained in it must be less than a known bound.
Assume now that there is such a subset, containing edge-lengths $\{h_1, h_2, \dots, h_{k_s - 1}\}$, and assume without loss of generality that these are strictly increasing.
We can see from the definition that if the edge-length $h_1$ is greater than $m-1$ we can reduce all the edge-lengths by $m-1$ without changing the colour of any edge-length, or any difference between any pair of edge-lengths. If any consecutive pair $h_{i_1}, h_{i_2}$ of these edge-lengths has a difference greater than $m-1$, we can reduce all the edge-lengths from $h_{i_2}$ upwards by $m-1$ without changing the colour of those edge-lengths, or any difference between any pair of edge-lengths. As a result of repeating these steps, we can ensure that $h_{k_s - 1}$ does not exceed $(k_s - 1)(m-1)$: and since we also know that the colour of an edge-length which is any multiple of $(m-1)$ in $W$ is a colour derived from $V$, we can say that $h_{k_s - 1} \le (k_s - 1)(m-2)$.
We have thus proved that when searching for potential copies of $K_{k_{s}}$ in the colour $s$ of $U$, it is not necessary to examine sets in $W$ containing edge-lengths in excess of $(k_s - 1)(m-2)$. So if $Q = \sup\{k_s-1 \mid 1 \le s \le q-1 \}$, we have shown that the clique number of $W$ in any of the colours of $U$ is no greater than the clique number of that colour in the subgraph of $W$ induced by the first $Q.(m-2)$ edge-lengths of $W$, as required.
We now consider the colours of $V$. Assume that for any s, there are two edge-lengths $\mu_1$ and $\mu_2$ in $V$, both of colour $q+s$. Assume that $\mu_1 < \mu_2$, and that their difference is also of that colour. It follows directly from the definitions above that the edge-lengths $\mu_1(m-1)$, $\mu_2(m-1)$ and $(\mu_2 - \mu_1)(m-1)$ are all members of the subset $L''_{q+s}$. Thus if there is a triangle of that colour in $V$, there is a triangle of the same colour in $L''_{q+s}$, and hence the same for any larger $K_n$.
It is slightly more complex to prove the converse. We assume there are two edge-lengths in $L''_{q+s}$, $l_i = h_i +(\mu_i-1)(m-1)$ for $i = 1, 2$, where $1 \le \mu_i \le n-1$ and $1 \le h_i \le m-1$. Obviously they are both of colour $q+s$, and both $\mu_i$ are of the same colour in V. We are interested in the possible colours of $\mid l_2 - l_1 \mid$ in $W$.
Assume without loss of generality that $h_1 \le h_2$. We note that, because the template $\Theta$ is triangle-free, the colour of $h_2 - h_1$ is not a colour of $V$.
If $\mu_2 \ge \mu_1$, then $l_2 \ge l_1$, and the colour of $l_2 - l_1$ is the same as the colour of $h_2 - h_1$, so it is not a colour of $V$. Therefore $l_2 - l_1$ is not a member of $L''_{q+s}$.
Assume now that $\mu_2 < \mu_1$. The difference $l_1 - l_2$ is now positive and equal (after some rearrangement) to $((\mu_1 - \mu_2)-1)(m-1) + ((m-1) - (h_2 - h_1))$. It is clear that $1 \le h_2 - h_1 \le m-2$, and if $c(l_1 - l_2) = q+s$, it follows that the colour of $(\mu_1 - \mu_2)$ in $V$ must also be $q+s$. So if there is such a triangle in $W$, then there must be a triangle of the same colour in $V$, since it contains the edge-lengths $\mu_1$, $\mu_2$ and their difference. Again, it follows easily that the same applies for any larger $K_n$.
This completes the proof that the clique number of $W$ in any colour of $V$ is the same as the clique number of $V$ in that colour, which proves the theorem.
\end{proof}
This very general result has also been of some practical use in improving lower bounds for some significant `small' multicolour Ramsey numbers. In addition it has improved our knowledge of the orders of many larger linear Ramsey graphs.
It has been observed that there are many useful cases where the upper bound $Q.(m-2)$ is not tight, and also cases that can be found by simple searches where the clique number of $W$ in any of the colours of $U$ is the same as in $U$.
It is also observed that when the subgraph of $U$ induced by the first $\phi$ edge-lengths is cyclic; when the colours of the last $(m-1)-\phi$ edge-lengths of $U$ are also symmetrically arranged (by reflection); and when $V$ is cyclic; then the constructed graph $W$ is also cyclic. These conditions are illustrated pictorially by Figure 2 below.
Lastly, we note that if the prototype graph $U$ is taken to have even order, say $2p$, and the template is taken as the set $\{ p, p+1, p+2, \dots , 2p-1\}$, then the construction is identical to the construction in \cite{Rowley1} and $\phi = p-1$.
\section{New Lower Bounds for Several $R_r(k)$}
The method above has been used to construct a cyclic $(6,6,6; 1105)$-graph and a\\ $(5,5,5,5; 4072)$-graph. For the first construction, the graph $U$ was taken as a very simple $(6,3; 12)$-graph and for the second a closely related $(5,3; 10)$-graph. In the first case, the graph $V$ was taken as the $(6,6; 101)$-graph created by Kalbfleisch \cite{Kalb}, and in the second case an unpublished $(5,5,5; 453)$-graph derived by Exoo, which supersedes the results in \cite{XXER}. Each graph $U$ has a tf-template as defined, and the constructed graphs have been verified completely, without relying on the theorem. These two values improve on the best lower bounds quoted in \cite{RadzDS}.
The graphs $U$ can be represented in the following manner, which shows the colour to which each edge-length is mapped. The tf-templates in Figure 1 are in colour 2 (blue).
\begin{figure}
\caption{\label{Fig:01}
\label{Fig:01}
\end{figure}
An intuitive picture of the compound colouring can be gained by illustrating the colours for each edge-length in a two-dimensional table. Figure 2 shows the result of compounding the first template above with the unique $(3,4; 8)$-graph, purely to show the pattern of the colours. The resulting $(3,4,6; 82)$-graph is useful as an illustration of the patterns involved, but not remarkable in itself.
\begin{figure}
\caption{\label{Fig:02}
\label{Fig:02}
\end{figure}
\FloatBarrier
Table 1 shows the orders of a range of compound graphs constructed using first prototypes with two or three colours. Note that the ` \& ' symbol denotes the compounding described in this paper, and ` * ' denotes the construction in \cite{Rowley1}.
It is noted that certain values in Table 1 are highlighted to show improvements that exceed the values in the 2017 edition of the Radziszowski Dynamic Survey \cite{RadzDS}. Many of these values are now included in the 2021 edition.
\begin{table}[!ht]
\begin{center}
\includegraphics{Table1_Calcs_GLGC.pdf}
\end{center}
\caption{\label{Table:01} Calculations of graph orders to support lower bounds for $R_r(k)$.}
\end{table}
\FloatBarrier
\section{Updated Tables of Results}
The tables below update the results of the previous paper \cite{Rowley1}, allowing for the inclusion of many new graphs constructed using the method mentioned above. They show the revised linear graph orders and associated `growth factors'. These growth factors represent the limiting growth rates of an infinite series of graphs which can be produced by the construction set out in \cite{Rowley1}, by repeatedly using the graph concerned in the compounding process. Numbers revised since the publication of \cite{Rowley2} are shown in green or blue. Orders above 10 million have been excluded. Bold text indicates numbers exceeding those shown in the 2017 Radziszowski Dynamic Survey \cite{RadzDS}, although some have been included in the 2021 edition.
All these graphs have been computer-tested to the extent implied by the theorem, and in some cases fully, up to 3000 vertices or more.
\begin{table}[!ht]
\begin{center}
\includegraphics{Table2_Orders_GLGC.pdf}
\end{center}
\caption{\label{Table:02} Highest order of linear Ramsey graphs $U_r(k)$ known to the author.}
\end{table}
\FloatBarrier
The factors $g_r(k)$ in Table 3 are defined as $(2m-1)^{1/r}$ where m is the order of the relevant graph in Table 2. Those highlighted in bold indicate are most effective as lower bounds for $\Gamma(k)$.
\begin{table}[!ht]
\begin{center}
\includegraphics{Table3_Growth_GLGC.pdf}
\end{center}
\caption{\label{Table:03} Growth factors $g_r(k)$ calculated from the data in Table 2.}
\end{table}
\FloatBarrier
In fact, the lower bounds on $\Gamma(k)$ derived from Table 3 can be improved somewhat by the application of the construction in this paper and some simple arithmetic. For example, it can be shown that the sequence of increasing values for $k = 6$, and even $r$, leads into an infinite sequence of graphs whose growth rate converges to the square root of $m-1$, where $m$ is the order of the original first prototype (graph $H$ in Table 1). In this way, we see that $\Gamma(6) \ge \sqrt{212} = 14.560\dots$, $\Gamma(7) \ge \sqrt{420} = 20.493\dots$, $\Gamma(8) \ge \sqrt{599} = 24.474\dots$ and $\Gamma(9) \ge \sqrt{1176} = 34.292\dots$, etc.
The same reasoning, given the existence of a favourable $(3,3,3,3,3,3; 377)$-graph, shows that $\Gamma(3) \ge \sqrt[5]{376} = 3.273\dots$\,. Although this graph produces no corresponding improvements in lower bounds for Ramsey numbers $R_r(3)$ below $R_8(3)$, it is noted that the techniques described in this paper enable construction of graphs establishing that $R_8(3) \ge 5288$, $R_9(3) \ge 17696$, $R_{10}(3) \ge 60322$, $R_{11}(3) \ge 201698$ and $R_{12}(3) \ge 631842$.
Rearranging, we see that the same graph also provides an improved lower bound for $\Gamma(3)$, since it demonstrates that $R{_r}(3) > c.(3.273)^r$, for some fixed $c$ and for $r$ sufficiently large.
An interesting special case depends on a formula derived in \cite{Abbott} and mentioned in \cite{AbbH} -- namely that $R_r(5) \ge (R_r(3) - 1)^2 + 1$. It follows that $\Gamma(5) \ge 10.717\dots$.
\section{Some Conclusions}
Constructive approaches to graph colouring based on compounding linear graphs have the favourable property that they restrict the need to search for occurrences of $K_n$ within the compound graph. There is a trade-off between this favourable property and the complexity of the prototypes that can be used in the compounding process.
The generalised construction above expands the range of prototypes that can be used in the compounding, at the cost of increasing the search requirements. Even so, the resulting graphs mentioned here can be tested in quite manageable times. Although there is an added need to search for suitable prototypes containing tf-templates, it is useful in practice that prototypes with tf-templates can be freely used in conjunction with any other linear prototype graph.
A great strength of the current construction -- like that in \cite{Rowley1} -- is that it can be applied to any linear prototype graphs with the desired Ramsey properties, irrespective of their clique numbers (with the notable exception of the tf-template).
Its power is demonstrated by the fact that many values of $R_r(k)$, and the corresponding lower bounds on $\Gamma(k)$, can be improved using this construction. This paper contains a range of examples. This improvement arises because the previous construction cannot increase the limiting growth rate of any series of derived graphs beyond the maximum growth factor for its prototypes, since it produces a weighted mean of their factors. In contrast, the current construction gains an advantage by eliminating the template colour, so that in many cases, further improved bounds on $\Gamma(k)$ can be derived as mentioned in section 5, by taking roots.
In a particular case noted above, the current construction provides an improved lower bound for the limiting growth rate of $R{_r}(3)$, by demonstrating that $R{_r}(3) > c.(3.273)^r$, for some fixed $c$ and sufficiently large $r$, which is equally relevant to the corresponding Schur numbers.
The most obvious exception to these improvements is the case of $k = 4$, where the current construction has not yet yielded any improvement in the smaller graph orders. It may be that this results from the high criticality of the $(4,4; 17)$- and $(4,4,4; 127)$-graphs, which seems to inhibit the construction of large first prototypes with useful templates.
Finally, it is interesting to consider the improvements to the lower bounds on $R_3(6)$ to $1106$, and on $R_3(9)$ to $14034$, relative to non-linear graphs. The previous value of $1070$ on $R_3(6)$ was established by Mathon in \cite{Mathon} based on a cyclic graph. By contrast, the lower bounds on $R_3(k)$ in the Dynamic Survey were established using non-linear graphs for $k > 6$. Although the order of the new linear $R_3(9)$-graph exceeds the previous best lower bound, the existing bounds for $k = 7, 8$ remain above those achieved so far using linear constructions. Indeed, the existence of the graph $H(8,8,3)$ in Table 1 shows the existence of a graph with order 880, which (by `quadrupling' twice in succession to produce a non-linear graph) shows that $R_3(9) \ge 14081$.
\end{document}
|
math
|
Dr. Carl Peter (* 27. September 1856 in new house/Elbe; † 10. September 1918 in bath Harzburg) was a German politician, journalist, a colonialist and an Africa researcher. It is considered as the founders of the colony German East Africa.
Peter came of to an Evangelist minister family and studied and. A. with the national liberal and for his socialviennaistic and anti-Semitic ideas historians admitted Heinrich of Treitschke. It attained a doctorate to the doctor of philosophy, aimed at however no career in the training or university service, but was involved to London to its uncle and occurred its import business. Into England he came for the first time to own indication into contact with colonialism and world power politics, which controlled from now to its conception of the world.
From 1882 to 1883 Carl Peter employed intensively in London with the policy of England in overseas and sketched themselves similar plans for Germany. Its thought world was coined/shaped of the social viennaism. It tended to call the “non-white races in such a way specified” in the colonial-political Correspondenz published by him inferior. As only right of existence it approved of them an existence as workers under the rule of white Pflanzer too. Among the race ideologists of the Wilhelmini age it belonged to the radical wing.
1884 created the Peter's “society for German Kolonisation “and acquired first areas of master heads in the area of today's Tanzania, still without support of the realm government. To 27. It received a charter to February 1885 from the German emperor, in which the realm government commits itself to the protection of the areas.
Starting from 1891 was Peter's realm commissioner for the Kilimandscharogebiet. Because of its brutal procedure against the African population and executions 1895 were determined against it in Germany. 1897 of its office were relieved of Peter and removed discipline-bad-arranged after a process before dishonorably from the government service.
1899 it led a successful Forschungsreise to the Sambesi. It wanted to prove that the Biblical gold country Ophir had lain in southeast Africa, although this of the professional world as untenable theory was rejected. Primarily it concerned Peter to win with the help of its theory of shareholders for its finance company to acquire and dig for gold the country there in Portuguese Mocambique should. Its Ophir theory enriched Peter with violent Diffamierungen opposite the black African and demanded the introduction of the general hard labour in the colonies.
From 1896 to 1914 it lived in England. Peter based in London the Dr. Carl Peter Estates and exploration of cost., the later South East Africa Ltd., which operated the gold mining in South Africa. In several journeys it explored further Goldlagerstätten in Südrhodesien and Angola.
Its grave is on the city cemetery Engesohde in Hanover. During the 3. Realm one honoured Peter as a mental father of the national socialism “rediscovered” and in numerous books and a feature with Hans Albers in the title part. Also in numerous cities roads were designated after it. Also a warship carried its names.
Norbert carrion, Werena Rosenke (Hg.): Colonial history in the family album. Early photos from the colony German East Africa. ISBN 392830013X - Werena Rosenke deals in this volume with a detailed essay with Carl Peter.
Hermann Krätschell: Carl Peter 1856 - 1918. A contribution for journalism of the imperialistic nationalism in Germany, Berlin Dahlem 1959. - Thesis; Working the journalistic effect Peters' out with line of sight on the later national socialism.
Arne Perras: Carl Peter and German Imperialism 1856-1918. A political Biography, Clarendon press, Oxford 2004. ISBN 0199265100 - Exhaustive biography Peters' with treatment of its political meaning also in regard to the colonial policy of Bismarck; investigated in among other things newly accessible sources.
|
english
|
# git stash
Save changes since the last commit.
This is useful if you want to change branches without needing to commit
your current changes.
## Save current changes
git stash save
## Apply changes
git stash apply
To apply then delete the stash, use `pop` instead of `apply`.
### Create new branch
git stash branch my_new_branch
Creates the new branch `my_new_branch` and applies the last stash.
Drops the stash after this.
## View
### List of stashes
git stash list
### Single stash diff
Shows diff between previous commit and the stash contents.
git stash show
Accepts all `git diff` parameters.
|
code
|
मध्य प्रदेश डिस्ट्रिक्ट न्यूज़ पोर्टल : नरसिंहपुर : १३-जून-२०१८ : दस्तक अभियान १४ जून से ३१ जुलाई तक : जिले में दस्तक अभियान १४ जून से ३१ जुलाई तक चलाया जायेगा। इस अभियान के तहत घर- घर दस्तक देकर ५ वर्ष से कम आयु के बच्चों को स्वास्थ्य
दस्तक अभियान १४ जून से ३१ जुलाई तक
बच्चों की सेहत की बेहतरी के लिए घर-घर दी जायेगी दस्तक
नरसिंहपुर | १३-जून-२०१८
जिले में दस्तक अभियान १४ जून से ३१ जुलाई तक चलाया जायेगा। इस अभियान के तहत घर- घर दस्तक देकर ५ वर्ष से कम आयु के बच्चों को स्वास्थ्य एवं पोषण सेवायें मुहैया कराई जायेंगी। साथ ही इस उम्र के बच्चों को होने वाली बीमारियों की पहचान एवं उनका निदान किया जायेगा। कलेक्टर द्वारा इस अभियान को सुव्यवस्थित ढंग से आयोजित करने के निर्देश दिये गये हैं।
बच्चों की सेहत की बेहतरी और बाल मृत्यु दर को कम करने के मकसद से आयोजित हो रहे अभियान के तहत लोक स्वास्थ्य एवं परिवार कल्याण और एकीकृत बाल विकास सेवायें के संयुक्त दल घर- घर दस्तक देंगे। इन दलों में खासतौर पर एएनएम, आशा व आंगनबाड़ी कार्यकर्ता शामिल रहेंगी। अभियान को सुव्यवस्थित ढंग से अंजाम देने के लिए मैदानी अमले को प्रशिक्षित किया जा चुका है।
मुख्य चिकित्सा एवं स्वास्थ्य अधिकारी डॉ. जीसी चौरसिया ने बताया कि दस्तक अभियान के तहत बाल्यकालीन बीमारियों का समुदाय स्तर पर त्वरित निदान किया जायेगा। खासतौर पर निमोनिया, दस्त जैसी बीमारियों पर फोकस रहेगा। अभियान के दौरान ओआरएस एवं जिंक के उपयोग के बारे में समझाइश दी जायेगी। कुपोषित बच्चों की पहचान, रेफरल एवं प्रबंधन का काम भी प्रमुखता से होगा। बच्चों में एनीमिया की स्क्रीनिंग व प्रबंधन किया जायेगा। इसके अलावा बच्चों में होने वाली जन्मजात विकृतियों की पहचान की जायेगी। ९ माह से ५ वर्ष तक के बच्चों को विटामिन- ए की खुराक दी जायेगी। टीकाकरण से वंचित रह गये बच्चों को चिन्हित कर उनका टीकाकरण किया जायेगा। बाल आहार पूर्ति के उपाय बताये जायेंगे। एसएनसीयू एवं एनआरसी से छुट्टी प्राप्त बच्चों में बीमारी की स्क्रीनिंग एवं फालोअप का काम भी इस दौरान होगा।
दस्तक अभियान के अंतर्गत आंगनबाड़ी व आशा कार्यकर्ताओं के सहयोग से सर्वेक्षण कर जन्म से ५ वर्ष तक के बच्चों की नामवार सूची तैयार की जायेगी। इस सूची को ऑनलाइन पोर्टल पर अपलोड किया जायेगा।
|
hindi
|
When it comes to beauty, there are things only a professional could manage. Wrinkles, sun spots and other skin problems can only be solved by a cosmetics specialist. Now Barbie is your patient. Do your best to heal her!
|
english
|
*bish* - Dreams are what you wake up from.
wow..that is the shortest entry i ever see!!
wildy is a copy cat!
"Heal the world... make it a better place... "
not knowin what a *bish* is?
lack of imagination. hav we all sunk too deep, hav we all forgotten how it feels to be young n carefree. hav we all lost the ability to imagine n fantasize? i believe in fairies, do you?
|
english
|
/*
* music_pcm.c music server PCM part
*
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <[email protected]>
* 1998- <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* $Id: music_pcm.c,v 1.16 2003/11/09 15:06:13 chikama Exp $ */
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <SDL_mixer.h>
#include "portab.h"
#include "system.h"
#include "ald_manager.h"
#include "dri.h"
#include "music_pcm.h"
#include "music_private.h"
#include "pcm.sdlmixer.h"
#include "sdl_core.h"
#include "nact.h"
#include "LittleEndian.h"
#include "mmap.h"
#define DEFAULT_AUDIO_BUFFER_SIZE 2048
struct _pcmobj {
Mix_Chunk* chunk;
int slot; // ロードされているスロット番号
int channel; // 再生中のチャネル
boolean playing; // 演奏中
int start_time;
};
typedef struct _pcmobj pcmobj_t;
// 0: S comman 用
// 1-128: wavXXX 用
static pcmobj_t *pcmobj[128 + 1];
#define IS_LOADED(slot) (pcmobj[(slot)])
static int unload(int slot);
static int load_wai();
static mmap_t *wai_map;
// Volume mixer channel
#define WAIMIXCH(no) LittleEndian_getDW(wai_map->addr, 36 + (no -1) * 4 * 3 + 8)
/**
* 指定の番号の .WAV|.OGG をロードする。
* @param no: DRIファイル番号
*/
Mix_Chunk *pcm_sdlmixer_load(int no) {
dridata *dfile = ald_getdata(DRIFILE_WAVE, no -1);
if (dfile == NULL) {
WARNING("DRIFILE_WAVE fail to open %d\n", no -1);
return NULL;
}
Mix_Chunk *chunk = Mix_LoadWAV_RW(SDL_RWFromConstMem(dfile->data, dfile->size), 1);
ald_freedata(dfile);
if (chunk == NULL) {
WARNING("DRIFILE_WAVE %d: not a valid wav file\n", no-1);
return NULL;
}
assert(chunk->allocated);
return chunk;
}
/**
* noL と noR の .WAV をロードし、左右合成
*
* @param noL: 左の WAV ファイルの番号
* @param noR: 右の WAV ファイルの番号
* @return : 合成後の Mix_Chunk
*/
static Mix_Chunk *pcm_mixlr(int noL, int noR) {
Mix_Chunk *chunkL = pcm_sdlmixer_load(noL);
Mix_Chunk *chunkR = pcm_sdlmixer_load(noR);
if (chunkL == NULL || chunkR == NULL) {
if (chunkL)
Mix_FreeChunk(chunkL);
if (chunkR)
Mix_FreeChunk(chunkR);
return NULL;
}
short *lbuf = (short*)chunkL->abuf;
short *rbuf = (short*)chunkR->abuf;
if (chunkL->alen >= chunkR->alen) {
int i;
for (i = 0; i < chunkR->alen / 4; i++) {
lbuf[i * 2 + 1] = rbuf[i * 2 + 1];
}
for (; i < chunkL->alen / 4; i++) {
lbuf[i * 2 + 1] = 0;
}
Mix_FreeChunk(chunkR);
return chunkL;
} else {
int i;
for (i = 0; i < chunkL->alen / 4; i++) {
rbuf[i * 2] = lbuf[i * 2];
}
for (; i < chunkR->alen / 4; i++) {
rbuf[i * 2] = 0;
}
Mix_FreeChunk(chunkL);
return chunkR;
}
}
int muspcm_init(int audio_buffer_size) {
if (!audio_buffer_size)
audio_buffer_size = DEFAULT_AUDIO_BUFFER_SIZE;
Mix_Init(MIX_INIT_MP3 | MIX_INIT_OGG);
if (Mix_OpenAudio(44100, AUDIO_S16LSB, 2, audio_buffer_size) < 0)
return NG;
load_wai();
return OK;
}
int muspcm_exit(void) {
Mix_CloseAudio();
Mix_Quit();
return OK;
}
// 番号指定のPCMファイル読み込み
int muspcm_load_no(int slot, int no) {
if (IS_LOADED(slot)) unload(slot);
Mix_Chunk *chunk = pcm_sdlmixer_load(no);
if (chunk == NULL) {
return NG;
}
// if has .wai file
if (wai_map) {
int ch = WAIMIXCH(no);
prv.vol_pcm_sub[slot] = ch < 0 ? 0: ch;
} else {
prv.vol_pcm_sub[slot] = 0;
}
return pcm_sdlmixer_load_chunk(slot, chunk);
}
int muspcm_load_mixlr(int slot, int noL, int noR) {
/* mix 2 wave files */
Mix_Chunk* chunk = pcm_mixlr(noL, noR);
if (chunk == NULL) {
puts("mixlr fail");
return NG;
}
return pcm_sdlmixer_load_chunk(slot, chunk);
}
int muspcm_unload(int slot) {
return unload(slot);
}
int pcm_sdlmixer_load_chunk(int slot, Mix_Chunk *chunk) {
if (IS_LOADED(slot)) unload(slot);
pcmobj_t *obj = calloc(1, sizeof(pcmobj_t));
obj->chunk = chunk;
obj->slot = slot;
obj->playing = FALSE;
pcmobj[slot] = obj;
return OK;
}
// PCMデータを再生
int muspcm_start(int slot, int loop) {
pcmobj_t *obj;
// printf("pcm start slot = %d, loop = %d\n", slot, loop);
obj = pcmobj[slot];
if (obj == NULL) return NG;
obj->channel = Mix_PlayChannel(-1, obj->chunk, loop - 1);
if (obj->channel < 0)
return NG;
obj->playing = TRUE;
obj->start_time = sdl_getTicks();
return OK;
}
// PCMデータの再生停止
int muspcm_stop(int slot) {
pcmobj_t *obj;
obj = pcmobj[slot];
if (obj == NULL) return NG;
if (obj->playing) {
Mix_HaltChannel(obj->channel);
obj->playing = FALSE;
}
return OK;
}
// 指定時間のフェードアウトの後に再生停止
int muspcm_fadeout(int slot, int msec) {
if (msec == 0)
return muspcm_stop(slot);
pcmobj_t *obj = pcmobj[slot];
if (obj == NULL) return NG;
if (obj->playing) {
Mix_FadeOutChannel(obj->channel, msec);
obj->playing = FALSE; // FXIME: 停止後にFALSEにするべき
}
return OK;
}
// PCMデータのメモリ上からのアンロード
static int unload(int slot) {
pcmobj_t *obj;
obj = pcmobj[slot];
if (obj == NULL) return NG;
if (obj->playing) muspcm_stop(slot);
Mix_FreeChunk(obj->chunk);
free(obj);
pcmobj[slot] = NULL;
return OK;
}
// PCMデータ再生一時停止
int muspcm_pause(int slot) {
if (pcmobj[slot] != NULL) {
Mix_Pause(pcmobj[slot]->channel);
}
return OK;
}
// PCMデータ再生一時停止解除
int muspcm_unpause(int slot) {
if (pcmobj[slot] != NULL) {
Mix_Resume(pcmobj[slot]->channel);
}
return OK;
}
// 現在の再生位置を返す
int muspcm_getpos(int slot) {
pcmobj_t *obj;
obj = pcmobj[slot];
if (obj == NULL) return 0;
if (!obj->playing) return 0;
long len = obj->chunk->alen * 1000 / (44100 * 4);
int pos = sdl_getTicks() - obj->start_time;
if (pos == 0)
pos = 1; // because 0 means "not playing"
if (pos > len)
pos = 0;
return pos;
}
// PCMオブジェクトに対してボリュームをセット
int muspcm_setvol(int dev, int slot, int lv) {
pcmobj_t *obj;
obj = pcmobj[slot];
if (obj == NULL) return NG;
Mix_VolumeChunk(obj->chunk, lv * MIX_MAX_VOLUME / 100);
return OK;
}
// PCMデータの長さを取得
int muspcm_getwavelen(int slot) {
pcmobj_t *obj;
obj = pcmobj[slot];
if (obj == NULL) return 0;
long len = obj->chunk->alen * 1000 / (44100 * 4);
return len > 65535 ? 65535 : len;
}
// 指定のスロットが現在演奏中かどうかを取得
boolean muspcm_isplaying(int slot) {
pcmobj_t *obj;
obj = pcmobj[slot];
if (obj == NULL) return FALSE;
return obj->playing;
}
// 指定のチャンネルの再生が終了するまで待つ
int muspcm_waitend(int slot) {
printf("%s not implemented\n", __func__);
return NG;
}
static int load_wai() {
if (wai_map) {
unmap_file(wai_map);
wai_map = NULL;
}
if (nact->files.wai == NULL)
return NG;
wai_map = map_file(nact->files.wai);
if (!wai_map)
return NG;
char *adr = wai_map->addr;
if (*adr != 'X' || *(adr+1) != 'I' || *(adr+2) != '2') {
WARNING("not WAI file\n");
unmap_file(wai_map);
wai_map = NULL;
return NG;
}
return OK;
}
|
code
|
نیٖلَم مُنیر چھِ اَکھ پاکِستٲنؠ اَداکارہ یۄس فِلمَن مَنٛز چھِ کٲم کَران۔
زٲتی زِندگی
فِلمی دور
== حَوالہٕ ==
|
kashmiri
|
विराट कोहली नए मुकाम पर, १०० खास खिलाड़ियों की लिस्ट में हैं अकेले भारतीय - बिग न्यूज
कोहली फिर नए मुकाम पर.
न्यूयॉर्क, पीटीआइ। टीम इंडिया के कप्तान विराट कोहली को फोर्ब्स लिस्ट में सबसे ज्यादा कमाई करने वाले १०० शीर्ष खिलाड़ियों में जगह मिली है। इस लिस्ट में कोहली अकेले भारतीय हैं। दुनिया के १०० सबसे ज्यादा कमाई करने वाले खिलाड़ियों की सूची में पहले नंबर पर पुर्तगाली फुटबॉल स्टार क्रिस्चियानो रोनाल्डो हैं।
वहीं, कोहली की बात करें तो केवल २८ साल के इस खिलाड़ी को २०१७ की लिस्ट में ८९वां नंबर मिला है। कोहली ने २.२ करोड़ डॉलर की कमाई की है, जिसमें से ३० लाख डॉलर तो उन्होंने मैच फीस से कमाए हैं और बाकी की १.९ करोड़ डॉलर की रकम इनामों और विज्ञापनों से कमाई गई है।
फोर्ब्स की लिस्ट में कोहली को भारतीय क्रिकेट का सितारा कहा गया है और बताया गया है कि कम समय में ही उनकी तुलना सचिन तेंदुलकर से की जाने लगी है।
आपको बता दें कि कोहली ने पिछले साल १० लाख डॉलर की कमाई मैच फीस से की थी। इसके अलावा आइपीएल में खेलने पर उन्होंने २३ लाख डॉलर की कमाई की थी।
इस लिस्ट में शीर्ष के खिलाड़ियों की बात करें तो रोनाल्डो की कमाई ९.३ करोड़ डॉलर है। अमेरिकी बास्केटबॉल स्टार लेब्रॉन जेम्स दूसरे नंबर पर हैं और उनकी कमाई ८.६२ करोड़ डॉलर है। इसके बाद रोनाल्डो के प्रतिद्वंद्वी कहे जाने वाले अर्जेंटीनी फुटबॉल स्टार लियोनेल मेसी का नंबर आता है। उनकी कमाई ८ करोड़ डॉलर है। चौथे नंबर पर स्विस टेनिस स्टार रोजर फेडरर हैं, जिनकी कमाई ६.४ करोड़ डॉलर है।
हमेशा की तरह इस लिस्ट में महिला खिलाड़ी कमाई के मामले में पीछे छूट गई हैं। खेल जगत में लैंगिक असमानता का अंदाज इससे ही लगाया जा सकता है कि सबसे ज्यादा कमाई करने वाले शीर्ष १०० खिलाड़ियों में केवल एक महिला खिलाड़ी शामिल है। यह महिला खिलाड़ी अमेरिकी टेनिस स्टार सेरेना विलियम्स है, जिन्होंने २.७ करोड़ डॉलर की कमाई के साथ ५१वां नंबर हासिल किया है।
अमेरिकी गोल्फ स्टार टाइगर वुड्स १७वें नंबर हैं। सर्बियन टेनिस स्टार नोवाक जोवोकिच १६वें और स्पेनिश टेनिस खिलाड़ी राफेल नडाल ३३वें नंबर पर हैं। बास्केटबॉल खिलाड़ी एंथनी डेविस ४४वें और इंग्लिश फुटबॉल स्टार वेन रूनी ७०वें स्थान पर हैं। इस लिस्ट में २१ देशों के खिलाड़ी शामिल हैं, लेकिन ६३ खिलाड़ी केवल अमेरिका से ही हैं।
|
hindi
|
@charset "utf-8";
/* CSS Document */
/*.head {padding:0; margin:0; border-top:1px ; */
/*
...............HEADER CSS
*/
body {
margin: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 20px;
color: #333333;
background-color: #F2F2F2;
}
.head{
padding-top:1px;
height:100px;
background-color: #36454F;
}
.head h1{
margin-top: 33px;
margin-left:80px;
font-style: normal;
font-weight: 300;
font-variant: small-caps;
font-family:Lucidatypewriter, monospace ;
color: #ffffff;
font-size:50px;
}
#contact-form{
padding-top:1px;
height:80px;
background-color: #62B1F6;
}
#contact-form h1{
margin-top:30px;
font-style: normal;
font-weight: 100;
font-variant: small-caps;
font-family:Andale Mono, monospace ;
color: #ffffff;
font-size:43px;
}
.tablediv{
padding-top:50px;
padding-bottom:100px;
}
#table tr td input{
height:38px;
padding:5px;
width:250px;
border-radius:4px;
border:#c7ced2 1px solid;
color:#777b7e;
font-size:18px;
font-family: 'Raleway', sans-serif;
}
#table tr td textArea{
height:90px;
width:230px;
padding:5px;
border-radius:4px;
border:#c7ced2 1px solid;
color:#777b7e;
font-size:14px;
font-family: 'Raleway', sans-serif;
}
#table tr td label{
padding-top:30px;
padding-right:30px ;
font-size:16px;
color:#333333;
font-family: Helvetica Narrow, sans-serif;
font-weight:200;
margin:0;
}
#submit{
height:38px;
padding:5px;
width:250px;
border-radius:4px;
border:#c7ced2 1px solid;
background-color:#62B1F6;
font-size:18px;
font-family: 'Raleway', sans-serif;
}
#support{
height:40px;
background-color: #C0D9D9;
line-height: 40px;
}
#support h1{
margin-left:300px;
margin-top:30px;
font-style: normal;
font-weight: 100;
font-variant: small-caps;
font-family:Andale Mono, monospace ;
color: #8B8B83;
font-size:20px;
}
|
code
|
package com.github.dockerjava.client.command;
import javax.ws.rs.core.MediaType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.dockerjava.client.DockerException;
import com.google.common.base.Preconditions;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;
/**
* Stop a running container.
*
* @param containerId - Id of the container
* @param timeout - Timeout in seconds before killing the container. Defaults to 10 seconds.
*
*/
public class StopContainerCmd extends AbstrDockerCmd<StopContainerCmd, Void> {
private static final Logger LOGGER = LoggerFactory.getLogger(StopContainerCmd.class);
private String containerId;
private int timeout = 10;
public StopContainerCmd(String containerId) {
withContainerId(containerId);
}
public StopContainerCmd withContainerId(String containerId) {
Preconditions.checkNotNull(containerId, "containerId was not specified");
this.containerId = containerId;
return this;
}
public StopContainerCmd withTimeout(int timeout) {
Preconditions.checkArgument(timeout >= 0, "timeout must be greater or equal 0");
this.timeout = timeout;
return this;
}
@Override
public String toString() {
return new StringBuilder("stop ")
.append("--time=" + timeout + " ")
.append(containerId)
.toString();
}
protected Void impl() throws DockerException {
WebResource webResource = baseResource.path(String.format("/containers/%s/stop", containerId))
.queryParam("t", String.valueOf(timeout));
try {
LOGGER.trace("POST: {}", webResource);
webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).post();
} catch (UniformInterfaceException exception) {
if (exception.getResponse().getStatus() == 404) {
LOGGER.warn("No such container {}", containerId);
} else if(exception.getResponse().getStatus() == 304) {
//no error
LOGGER.warn("Container already stopped {}", containerId);
} else if (exception.getResponse().getStatus() == 204) {
//no error
LOGGER.trace("Successfully stopped container {}", containerId);
} else if (exception.getResponse().getStatus() == 500) {
throw new DockerException("Server error", exception);
} else {
throw new DockerException(exception);
}
}
return null;
}
}
|
code
|
چابیاں دیکھیں
|
kashmiri
|
آ مےٚ پوٚر یہِ اَخبار
|
kashmiri
|
newcastle
=========
JBoss Build System
|
code
|
The kitchen is the heart of the home, and often the place where families gather to spend time together and talk about the day. If your kitchen is too small, or you feel you could use an update, Select Home Remodeling is the place to call for your kitchen remodel.
Because of old building trends, many kitchens aren’t functional and are completely out of date. Modern kitchens are more open, lighter and have a more welcoming environment. We are a kitchen remodeling contractor that can help you create the perfect kitchen, from the beginning to the end of the remodel process.
Our kitchen remodeling team is not just here to help you build your perfect kitchen. We’re also here to help you create and design the perfect space for your growing family.
At Select Home Remodeling, we want to help you create a space which fits your personality and style but is also updated with current trends to make your home more valuable. Your kitchen renovation will increase the value of your home when it’s done right, and we guarantee 100% satisfaction to all of our clients.
Here at Select Home Remodeling, we’ve discovered many clients have parts they love about their home, and parts they would love to change. Because the same may be true of your kitchen, we offer all different types of services to update your kitchen.
We have helped a lot of customers achieve beautiful updated kitchens while on a strict budget. There are times when refinishing or refacing your current cabinets will be a good option and save a lot of money over buying new cabinets. You may already have appliances that you love or aspects of the kitchen that you don't want to change. We can design a space that fits your needs and your budget while keeping the parts of the kitchen you have grown to love.
Enjoy the benefits of an organized building process on every job when you call us at 610-924-5000 or contact us online.
|
english
|
अगर आप भी चाहते है की आप एक ब्लॉग्जर बने और खुद का एक ब्लॉग बनाये और काफी सारे लोगो तक अपनी जानकारी को इंटरनेट के माध्यम से लोगो तक पहुचाये तो में आप को पूरी तरह से मदद करने वाला हु ब्लॉग कैसे स्टार्ट करे आपका पहला कदम ब्लॉगिंग के तरफ क्या होना चाहिए में एक ब्लॉग के सिरीज के माध्यम से आप को ब्लॉगिंग के बाड़े आ तू ज़ बताने की पूरी कोशिस करूंगा अगर आप को बिलकुल भी ब्लॉगिंग के बड़े में नहीं पता है और आप चाहते है की ब्लॉगिंग कैसे स्टार्ट करू तो में आप को जीरो से स्टार्ट करवा के स्टेप बाय स्टेप मदद करने वाला है अगर आप को गूगल फेसबुक और व्हाट्सप्प चलाने आता है तब भी आप ब्लॉगिंग सुरु कर सकते है ब्लॉगिंग स्टार्ट करने में कितना पैस लगेगा ब्लॉग पोस्ट को कैसे लिखूंगा कैसे एडिट करूंगा सब कुछ आप को इस ब्लॉग मे बताने वाला हु
आज कल के बढ़ते इंटरनेट के उपयोग दौर में सभी ब्याक्ति के पास इंटरनेट है सभी को सभी चीज़ की जानकारी नहीं जैसे की अगर आप को फिल्म क्रिकेट या डांस के बाड़े जानकारी है तो मुझे इन सब टॉपिक के बाड़े जानकारी नहीं नहीं है अगर मुझे इस सब टॉपिक के बाड़े में जानकारी लेना होगा तो मै इंटरनेट या किताब का मदद ने की कोशिस करूंगा लेकिन सभी के पास सभी टॉपिक का किताब नहीं है तब एक हे ऑप्शन बचता है इंटरनेट पे हम उस टॉपिक को सर्च करते है इंटरनेट एक ऐसा माध्यम है जिस से पढ़ा भी जा सकता है और पढ़ाया भी जा सकता है अगर आप को किसी भी विषय की अच्छी जानकारी है तो आप उसे इंटरनेट के माध्यम से फैला कर अच्छा पैसा कमा सकते है
अभी तक आप ने जाना की ब्लॉगिंग क्या होता है इसके क्या क्या फायदे है अब आप को निचे ब्लॉगिंग किस प्लेटफॉर्म पे करे इस के बाड़े में जानकारी मिलने वाला है
ब्लॉग्जर - यह एक गूगल के द्वारा बनाया गया एक ब्लॉग लिखने का एक प्लेटफॉर्म है जिस में आप अपने हिसाब से फ्री मे ब्लॉग बना सकते है । यह २३ आग १९९९ को बनाया गया था जो की पैथों (कंप्यूटर भाषा में लिखा गया है ) । इस पे कोई भी शुल्क नहीं लगता है रजिस्ट्रेशन का आप अपने हिसाब से ब्लॉग लिख सकते है । जैसा की आप को पहले बतया की ब्लॉगर में आप ब्लॉग बिलकुल फ्री में बना सकते है इस लिए आप को पहले फ्री में ब्लॉग बनाना सिखाने वाले हु आप को स्टेप बाय स्टेप को को प्रोफैशनल वेबसाइट बनाना सीखने वाला हु।
वॉर्डप्रेस- भी एक ओपन सोर्स कंटेंट क्रिएटर प्लेटफॉर्म है जिस में हम अपने हिसाब से अपने ब्लॉग या कोई भी वेबसाइट बना सकते है । यह एक ओपन सोर्स है जो की कंप्यूटर के फ्प भाषा में बना हुआ हुआ है । यह २७ मई २००३ को मार्केट में लाया गया था अभी इसका करंट वर्शन ५.० चल रहा है जो की १२ दिसंबर 2०18 को मार्केट में लाया गया था ।अगर आप ब्लॉगिंग वॉर्डप्रेस में करना चकते हो तो आप को एक होस्टिंग और एक डोमेन लेना बहुत ज़रूरी क्युकि वर्डप्रेस एक कॉन्टेंट क्रेटर सॉफ्टवेयर है इसे कही तो होस्ट करना हे होगा। इस लेया इस पे ब्लॉग बनाना बिलकुल भी फ्री नहीं है।
अभी मे आप को ब्लॉगर में ब्लॉग को कैसे शुरू करना है इस के बाड़े में आप को जानकारी देने वाला हु।
गूगल में जा के आप को लिखना है ब्लॉग्जर आप को जो लिंक मिलेगा उस पाय क्लिक करना है।
जब आप इस लिंक पे क्लिक करेंगे तो आप को कुछ इस तरह का एक नया पेज देखने को मिलेगा इस पेज में दो ऑप्शन होगा एक साइन इन और क्रिएट योर ब्लॉग अगर आप के पास पहले से ब्लॉगर पे अकाउंट है तो आप साइन पे क्लिक करे अगर आप नये है तो क्रिएट योर ब्लॉग क्लिक करे
साइन इन या क्रिएट योर ब्लॉग दोनों ऑप्शन पे क्लिक करने के बाद आप को जीमेल भरने करने का ऑप्शन मिलेगा जीमेल से साइन इन करने के बाद आप को अपना ब्लॉग बनाने का मिलेगा
जब आप क्रिएट योर ब्लॉग पे क्लिक करने के बाद साइन इन करने को मिलेगा जिस में आप गूगल के अकाउंट से साइन इन करने के बढ़ आप को अपना टाइटल फील करने का ऑप्शन मिलेगा उसके निचे आप को एक टेम्प्लेट सलेक्ट करने का ऑप्शन मिलेगा ब्लॉग का नाम होगा
निचे दिए हुआ ऑप्शन पे क्लिक करने के बाद आप का ब्लॉग बना गया है नेक्स्ट ब्लॉग मे आप को ब्लॉग को लिखना है कैसे एडिट करना है सब कुछ बताने वाला हु।
अगर आप वीडियो ट्यूटोरियल देखना चाहते है हो निचे पूरा वीडियो का लिंक दिया हुआ है
|
hindi
|
import { BaseBo, IAttributes, Instance } from 'mission.core';
export abstract class AppBaseBo<TModel extends Instance<IAttributes>, TAttributes extends IAttributes>
extends BaseBo<TModel, TAttributes> {
public getUserId(): number {
throw new Error('getUserId method not implemented');
}
}
|
code
|
सूखे से निपटने के लिए कृत्रिम बारिश कराएगी महाराष्ट्र सरकार - कोवराज इंडिया
होम नेशनल सूखे से निपटने के लिए कृत्रिम बारिश कराएगी महाराष्ट्र सरकार
सूखे से निपटने के लिए कृत्रिम बारिश कराएगी महाराष्ट्र सरकार
मुंबई। सूखे की मार झेल रहे किसानों और मॉनसून आने में देरी के चलते फडणवीस सरकार ने कृत्रिम तरह से बारिश कराने का निर्णय लिया है। इस पर करीब ३० करोड़ रुपये खर्च आने का अनुमान है। कृत्रिम तरीके से बारिश कराने की मंजूरी फडणवीस मंत्रिमंडल ने दी है। २०१५ में कृत्रिम तरह से बारिश कराने का प्रयोग किया गया था, जो सफल नहीं रहा था। इससे पहले २००३ में नाशिक में कराया गया कृत्रिम बारिश का प्रयोग सफल रहा था।
इन दिनों महाराष्ट्र भीषण गर्मी से जूझ रहा है। राज्य की १५१ तहसील और २६० मंडलों में ४,९२० गांव और १०,५०६ छोटे गांव सूखे से पीड़ित हैं। इसी बीच मौसम विभाग ने मॉनसून में देरी की भविष्यवाणी की है। इधर, राज्य के २६ जलाशयों में जल भंडारण शून्य के आसपास पहुंच गया था। इससे सरकार के पसीने छूट रहे हैं। आने वाले दिनों में राज्य में विधानसभा के चुनाव भी हैं। सकते में आई सरकार कई दिनों से कृत्रिम बारिश कराने पर विचार कर रही थी और अब उसे वह साकार रूप देना चाहती है। मंगलवार को राज्य मंत्रिमंडल ने इसकी मंजूरी दे दी है।
कैबिनेट ने एरियल क्लाउड सीडिंग का उपयोग कर कृत्रिम बारिश कराने पर अपनी सहमति दी है। इस पर करीब ३० करोड़ रुपये खर्च आएगा। राज्य में सूखाग्रस्त मराठवाडा, विदर्भ और पश्चिम महाराष्ट्र में इस तकनीकी के जरिए बारिश कराकर सूखे से निपटने की तैयारी है। इसके लिए औरंगाबाद में सी बैंड डॉपलर रडार और विमान तैयार हैं। सरकार का कहना है कि कृत्रिम बारिश से काफी मदद मिल सकती है।
|
hindi
|
obj/user/spin.debug: file format elf64-x86-64
Disassembly of section .text:
0000000000800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
// See if we were started with arguments on the stack
movabs $USTACKTOP, %rax
800020: 48 b8 00 e0 7f ef 00 movabs $0xef7fe000,%rax
800027: 00 00 00
cmpq %rax,%rsp
80002a: 48 39 c4 cmp %rax,%rsp
jne args_exist
80002d: 75 04 jne 800033 <args_exist>
// If not, push dummy argc/argv arguments.
// This happens when we are loaded by the kernel,
// because the kernel does not know about passing arguments.
pushq $0
80002f: 6a 00 pushq $0x0
pushq $0
800031: 6a 00 pushq $0x0
0000000000800033 <args_exist>:
args_exist:
movq 8(%rsp), %rsi
800033: 48 8b 74 24 08 mov 0x8(%rsp),%rsi
movq (%rsp), %rdi
800038: 48 8b 3c 24 mov (%rsp),%rdi
call libmain
80003c: e8 07 01 00 00 callq 800148 <libmain>
1: jmp 1b
800041: eb fe jmp 800041 <args_exist+0xe>
0000000000800043 <umain>:
#include <inc/lib.h>
void
umain(int argc, char **argv)
{
800043: 55 push %rbp
800044: 48 89 e5 mov %rsp,%rbp
800047: 48 83 ec 20 sub $0x20,%rsp
80004b: 89 7d ec mov %edi,-0x14(%rbp)
80004e: 48 89 75 e0 mov %rsi,-0x20(%rbp)
envid_t env;
cprintf("I am the parent. Forking the child...\n");
800052: 48 bf 80 3c 80 00 00 movabs $0x803c80,%rdi
800059: 00 00 00
80005c: b8 00 00 00 00 mov $0x0,%eax
800061: 48 ba 1b 03 80 00 00 movabs $0x80031b,%rdx
800068: 00 00 00
80006b: ff d2 callq *%rdx
if ((env = fork()) == 0) {
80006d: 48 b8 55 1e 80 00 00 movabs $0x801e55,%rax
800074: 00 00 00
800077: ff d0 callq *%rax
800079: 89 45 fc mov %eax,-0x4(%rbp)
80007c: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
800080: 75 1d jne 80009f <umain+0x5c>
cprintf("I am the child. Spinning...\n");
800082: 48 bf a8 3c 80 00 00 movabs $0x803ca8,%rdi
800089: 00 00 00
80008c: b8 00 00 00 00 mov $0x0,%eax
800091: 48 ba 1b 03 80 00 00 movabs $0x80031b,%rdx
800098: 00 00 00
80009b: ff d2 callq *%rdx
while (1)
/* do nothing */;
80009d: eb fe jmp 80009d <umain+0x5a>
}
cprintf("I am the parent. Running the child...\n");
80009f: 48 bf c8 3c 80 00 00 movabs $0x803cc8,%rdi
8000a6: 00 00 00
8000a9: b8 00 00 00 00 mov $0x0,%eax
8000ae: 48 ba 1b 03 80 00 00 movabs $0x80031b,%rdx
8000b5: 00 00 00
8000b8: ff d2 callq *%rdx
sys_yield();
8000ba: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
8000c1: 00 00 00
8000c4: ff d0 callq *%rax
sys_yield();
8000c6: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
8000cd: 00 00 00
8000d0: ff d0 callq *%rax
sys_yield();
8000d2: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
8000d9: 00 00 00
8000dc: ff d0 callq *%rax
sys_yield();
8000de: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
8000e5: 00 00 00
8000e8: ff d0 callq *%rax
sys_yield();
8000ea: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
8000f1: 00 00 00
8000f4: ff d0 callq *%rax
sys_yield();
8000f6: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
8000fd: 00 00 00
800100: ff d0 callq *%rax
sys_yield();
800102: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
800109: 00 00 00
80010c: ff d0 callq *%rax
sys_yield();
80010e: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
800115: 00 00 00
800118: ff d0 callq *%rax
cprintf("I am the parent. Killing the child...\n");
80011a: 48 bf f0 3c 80 00 00 movabs $0x803cf0,%rdi
800121: 00 00 00
800124: b8 00 00 00 00 mov $0x0,%eax
800129: 48 ba 1b 03 80 00 00 movabs $0x80031b,%rdx
800130: 00 00 00
800133: ff d2 callq *%rdx
sys_env_destroy(env);
800135: 8b 45 fc mov -0x4(%rbp),%eax
800138: 89 c7 mov %eax,%edi
80013a: 48 b8 3f 17 80 00 00 movabs $0x80173f,%rax
800141: 00 00 00
800144: ff d0 callq *%rax
}
800146: c9 leaveq
800147: c3 retq
0000000000800148 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";
void
libmain(int argc, char **argv)
{
800148: 55 push %rbp
800149: 48 89 e5 mov %rsp,%rbp
80014c: 48 83 ec 10 sub $0x10,%rsp
800150: 89 7d fc mov %edi,-0x4(%rbp)
800153: 48 89 75 f0 mov %rsi,-0x10(%rbp)
// set thisenv to point at our Env structure in envs[].
// LAB 3: Your code here.
thisenv = &envs[ENVX(sys_getenvid())];
800157: 48 b8 83 17 80 00 00 movabs $0x801783,%rax
80015e: 00 00 00
800161: ff d0 callq *%rax
800163: 25 ff 03 00 00 and $0x3ff,%eax
800168: 48 63 d0 movslq %eax,%rdx
80016b: 48 89 d0 mov %rdx,%rax
80016e: 48 c1 e0 03 shl $0x3,%rax
800172: 48 01 d0 add %rdx,%rax
800175: 48 c1 e0 05 shl $0x5,%rax
800179: 48 ba 00 00 80 00 80 movabs $0x8000800000,%rdx
800180: 00 00 00
800183: 48 01 c2 add %rax,%rdx
800186: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
80018d: 00 00 00
800190: 48 89 10 mov %rdx,(%rax)
//cprintf("I am entering libmain\n");
// save the name of the program so that panic() can use it
if (argc > 0)
800193: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
800197: 7e 14 jle 8001ad <libmain+0x65>
binaryname = argv[0];
800199: 48 8b 45 f0 mov -0x10(%rbp),%rax
80019d: 48 8b 10 mov (%rax),%rdx
8001a0: 48 b8 00 60 80 00 00 movabs $0x806000,%rax
8001a7: 00 00 00
8001aa: 48 89 10 mov %rdx,(%rax)
// call user main routine
umain(argc, argv);
8001ad: 48 8b 55 f0 mov -0x10(%rbp),%rdx
8001b1: 8b 45 fc mov -0x4(%rbp),%eax
8001b4: 48 89 d6 mov %rdx,%rsi
8001b7: 89 c7 mov %eax,%edi
8001b9: 48 b8 43 00 80 00 00 movabs $0x800043,%rax
8001c0: 00 00 00
8001c3: ff d0 callq *%rax
// exit gracefully
exit();
8001c5: 48 b8 d3 01 80 00 00 movabs $0x8001d3,%rax
8001cc: 00 00 00
8001cf: ff d0 callq *%rax
}
8001d1: c9 leaveq
8001d2: c3 retq
00000000008001d3 <exit>:
#include <inc/lib.h>
void
exit(void)
{
8001d3: 55 push %rbp
8001d4: 48 89 e5 mov %rsp,%rbp
close_all();
8001d7: 48 b8 47 24 80 00 00 movabs $0x802447,%rax
8001de: 00 00 00
8001e1: ff d0 callq *%rax
sys_env_destroy(0);
8001e3: bf 00 00 00 00 mov $0x0,%edi
8001e8: 48 b8 3f 17 80 00 00 movabs $0x80173f,%rax
8001ef: 00 00 00
8001f2: ff d0 callq *%rax
}
8001f4: 5d pop %rbp
8001f5: c3 retq
00000000008001f6 <putch>:
};
static void
putch(int ch, struct printbuf *b)
{
8001f6: 55 push %rbp
8001f7: 48 89 e5 mov %rsp,%rbp
8001fa: 48 83 ec 10 sub $0x10,%rsp
8001fe: 89 7d fc mov %edi,-0x4(%rbp)
800201: 48 89 75 f0 mov %rsi,-0x10(%rbp)
b->buf[b->idx++] = ch;
800205: 48 8b 45 f0 mov -0x10(%rbp),%rax
800209: 8b 00 mov (%rax),%eax
80020b: 8d 48 01 lea 0x1(%rax),%ecx
80020e: 48 8b 55 f0 mov -0x10(%rbp),%rdx
800212: 89 0a mov %ecx,(%rdx)
800214: 8b 55 fc mov -0x4(%rbp),%edx
800217: 89 d1 mov %edx,%ecx
800219: 48 8b 55 f0 mov -0x10(%rbp),%rdx
80021d: 48 98 cltq
80021f: 88 4c 02 08 mov %cl,0x8(%rdx,%rax,1)
if (b->idx == 256-1) {
800223: 48 8b 45 f0 mov -0x10(%rbp),%rax
800227: 8b 00 mov (%rax),%eax
800229: 3d ff 00 00 00 cmp $0xff,%eax
80022e: 75 2c jne 80025c <putch+0x66>
sys_cputs(b->buf, b->idx);
800230: 48 8b 45 f0 mov -0x10(%rbp),%rax
800234: 8b 00 mov (%rax),%eax
800236: 48 98 cltq
800238: 48 8b 55 f0 mov -0x10(%rbp),%rdx
80023c: 48 83 c2 08 add $0x8,%rdx
800240: 48 89 c6 mov %rax,%rsi
800243: 48 89 d7 mov %rdx,%rdi
800246: 48 b8 b7 16 80 00 00 movabs $0x8016b7,%rax
80024d: 00 00 00
800250: ff d0 callq *%rax
b->idx = 0;
800252: 48 8b 45 f0 mov -0x10(%rbp),%rax
800256: c7 00 00 00 00 00 movl $0x0,(%rax)
}
b->cnt++;
80025c: 48 8b 45 f0 mov -0x10(%rbp),%rax
800260: 8b 40 04 mov 0x4(%rax),%eax
800263: 8d 50 01 lea 0x1(%rax),%edx
800266: 48 8b 45 f0 mov -0x10(%rbp),%rax
80026a: 89 50 04 mov %edx,0x4(%rax)
}
80026d: c9 leaveq
80026e: c3 retq
000000000080026f <vcprintf>:
int
vcprintf(const char *fmt, va_list ap)
{
80026f: 55 push %rbp
800270: 48 89 e5 mov %rsp,%rbp
800273: 48 81 ec 40 01 00 00 sub $0x140,%rsp
80027a: 48 89 bd c8 fe ff ff mov %rdi,-0x138(%rbp)
800281: 48 89 b5 c0 fe ff ff mov %rsi,-0x140(%rbp)
struct printbuf b;
va_list aq;
va_copy(aq,ap);
800288: 48 8d 85 d8 fe ff ff lea -0x128(%rbp),%rax
80028f: 48 8b 95 c0 fe ff ff mov -0x140(%rbp),%rdx
800296: 48 8b 0a mov (%rdx),%rcx
800299: 48 89 08 mov %rcx,(%rax)
80029c: 48 8b 4a 08 mov 0x8(%rdx),%rcx
8002a0: 48 89 48 08 mov %rcx,0x8(%rax)
8002a4: 48 8b 52 10 mov 0x10(%rdx),%rdx
8002a8: 48 89 50 10 mov %rdx,0x10(%rax)
b.idx = 0;
8002ac: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%rbp)
8002b3: 00 00 00
b.cnt = 0;
8002b6: c7 85 f4 fe ff ff 00 movl $0x0,-0x10c(%rbp)
8002bd: 00 00 00
vprintfmt((void*)putch, &b, fmt, aq);
8002c0: 48 8d 8d d8 fe ff ff lea -0x128(%rbp),%rcx
8002c7: 48 8b 95 c8 fe ff ff mov -0x138(%rbp),%rdx
8002ce: 48 8d 85 f0 fe ff ff lea -0x110(%rbp),%rax
8002d5: 48 89 c6 mov %rax,%rsi
8002d8: 48 bf f6 01 80 00 00 movabs $0x8001f6,%rdi
8002df: 00 00 00
8002e2: 48 b8 ce 06 80 00 00 movabs $0x8006ce,%rax
8002e9: 00 00 00
8002ec: ff d0 callq *%rax
sys_cputs(b.buf, b.idx);
8002ee: 8b 85 f0 fe ff ff mov -0x110(%rbp),%eax
8002f4: 48 98 cltq
8002f6: 48 8d 95 f0 fe ff ff lea -0x110(%rbp),%rdx
8002fd: 48 83 c2 08 add $0x8,%rdx
800301: 48 89 c6 mov %rax,%rsi
800304: 48 89 d7 mov %rdx,%rdi
800307: 48 b8 b7 16 80 00 00 movabs $0x8016b7,%rax
80030e: 00 00 00
800311: ff d0 callq *%rax
va_end(aq);
return b.cnt;
800313: 8b 85 f4 fe ff ff mov -0x10c(%rbp),%eax
}
800319: c9 leaveq
80031a: c3 retq
000000000080031b <cprintf>:
int
cprintf(const char *fmt, ...)
{
80031b: 55 push %rbp
80031c: 48 89 e5 mov %rsp,%rbp
80031f: 48 81 ec 00 01 00 00 sub $0x100,%rsp
800326: 48 89 b5 58 ff ff ff mov %rsi,-0xa8(%rbp)
80032d: 48 89 95 60 ff ff ff mov %rdx,-0xa0(%rbp)
800334: 48 89 8d 68 ff ff ff mov %rcx,-0x98(%rbp)
80033b: 4c 89 85 70 ff ff ff mov %r8,-0x90(%rbp)
800342: 4c 89 8d 78 ff ff ff mov %r9,-0x88(%rbp)
800349: 84 c0 test %al,%al
80034b: 74 20 je 80036d <cprintf+0x52>
80034d: 0f 29 45 80 movaps %xmm0,-0x80(%rbp)
800351: 0f 29 4d 90 movaps %xmm1,-0x70(%rbp)
800355: 0f 29 55 a0 movaps %xmm2,-0x60(%rbp)
800359: 0f 29 5d b0 movaps %xmm3,-0x50(%rbp)
80035d: 0f 29 65 c0 movaps %xmm4,-0x40(%rbp)
800361: 0f 29 6d d0 movaps %xmm5,-0x30(%rbp)
800365: 0f 29 75 e0 movaps %xmm6,-0x20(%rbp)
800369: 0f 29 7d f0 movaps %xmm7,-0x10(%rbp)
80036d: 48 89 bd 08 ff ff ff mov %rdi,-0xf8(%rbp)
va_list ap;
int cnt;
va_list aq;
va_start(ap, fmt);
800374: c7 85 30 ff ff ff 08 movl $0x8,-0xd0(%rbp)
80037b: 00 00 00
80037e: c7 85 34 ff ff ff 30 movl $0x30,-0xcc(%rbp)
800385: 00 00 00
800388: 48 8d 45 10 lea 0x10(%rbp),%rax
80038c: 48 89 85 38 ff ff ff mov %rax,-0xc8(%rbp)
800393: 48 8d 85 50 ff ff ff lea -0xb0(%rbp),%rax
80039a: 48 89 85 40 ff ff ff mov %rax,-0xc0(%rbp)
va_copy(aq,ap);
8003a1: 48 8d 85 18 ff ff ff lea -0xe8(%rbp),%rax
8003a8: 48 8d 95 30 ff ff ff lea -0xd0(%rbp),%rdx
8003af: 48 8b 0a mov (%rdx),%rcx
8003b2: 48 89 08 mov %rcx,(%rax)
8003b5: 48 8b 4a 08 mov 0x8(%rdx),%rcx
8003b9: 48 89 48 08 mov %rcx,0x8(%rax)
8003bd: 48 8b 52 10 mov 0x10(%rdx),%rdx
8003c1: 48 89 50 10 mov %rdx,0x10(%rax)
cnt = vcprintf(fmt, aq);
8003c5: 48 8d 95 18 ff ff ff lea -0xe8(%rbp),%rdx
8003cc: 48 8b 85 08 ff ff ff mov -0xf8(%rbp),%rax
8003d3: 48 89 d6 mov %rdx,%rsi
8003d6: 48 89 c7 mov %rax,%rdi
8003d9: 48 b8 6f 02 80 00 00 movabs $0x80026f,%rax
8003e0: 00 00 00
8003e3: ff d0 callq *%rax
8003e5: 89 85 4c ff ff ff mov %eax,-0xb4(%rbp)
va_end(aq);
return cnt;
8003eb: 8b 85 4c ff ff ff mov -0xb4(%rbp),%eax
}
8003f1: c9 leaveq
8003f2: c3 retq
00000000008003f3 <printnum>:
* using specified putch function and associated pointer putdat.
*/
static void
printnum(void (*putch)(int, void*), void *putdat,
unsigned long long num, unsigned base, int width, int padc)
{
8003f3: 55 push %rbp
8003f4: 48 89 e5 mov %rsp,%rbp
8003f7: 53 push %rbx
8003f8: 48 83 ec 38 sub $0x38,%rsp
8003fc: 48 89 7d e8 mov %rdi,-0x18(%rbp)
800400: 48 89 75 e0 mov %rsi,-0x20(%rbp)
800404: 48 89 55 d8 mov %rdx,-0x28(%rbp)
800408: 89 4d d4 mov %ecx,-0x2c(%rbp)
80040b: 44 89 45 d0 mov %r8d,-0x30(%rbp)
80040f: 44 89 4d cc mov %r9d,-0x34(%rbp)
// first recursively print all preceding (more significant) digits
if (num >= base) {
800413: 8b 45 d4 mov -0x2c(%rbp),%eax
800416: 48 3b 45 d8 cmp -0x28(%rbp),%rax
80041a: 77 3b ja 800457 <printnum+0x64>
printnum(putch, putdat, num / base, base, width - 1, padc);
80041c: 8b 45 d0 mov -0x30(%rbp),%eax
80041f: 44 8d 40 ff lea -0x1(%rax),%r8d
800423: 8b 5d d4 mov -0x2c(%rbp),%ebx
800426: 48 8b 45 d8 mov -0x28(%rbp),%rax
80042a: ba 00 00 00 00 mov $0x0,%edx
80042f: 48 f7 f3 div %rbx
800432: 48 89 c2 mov %rax,%rdx
800435: 8b 7d cc mov -0x34(%rbp),%edi
800438: 8b 4d d4 mov -0x2c(%rbp),%ecx
80043b: 48 8b 75 e0 mov -0x20(%rbp),%rsi
80043f: 48 8b 45 e8 mov -0x18(%rbp),%rax
800443: 41 89 f9 mov %edi,%r9d
800446: 48 89 c7 mov %rax,%rdi
800449: 48 b8 f3 03 80 00 00 movabs $0x8003f3,%rax
800450: 00 00 00
800453: ff d0 callq *%rax
800455: eb 1e jmp 800475 <printnum+0x82>
} else {
// print any needed pad characters before first digit
while (--width > 0)
800457: eb 12 jmp 80046b <printnum+0x78>
putch(padc, putdat);
800459: 48 8b 4d e0 mov -0x20(%rbp),%rcx
80045d: 8b 55 cc mov -0x34(%rbp),%edx
800460: 48 8b 45 e8 mov -0x18(%rbp),%rax
800464: 48 89 ce mov %rcx,%rsi
800467: 89 d7 mov %edx,%edi
800469: ff d0 callq *%rax
// first recursively print all preceding (more significant) digits
if (num >= base) {
printnum(putch, putdat, num / base, base, width - 1, padc);
} else {
// print any needed pad characters before first digit
while (--width > 0)
80046b: 83 6d d0 01 subl $0x1,-0x30(%rbp)
80046f: 83 7d d0 00 cmpl $0x0,-0x30(%rbp)
800473: 7f e4 jg 800459 <printnum+0x66>
putch(padc, putdat);
}
// then print this (the least significant) digit
putch("0123456789abcdef"[num % base], putdat);
800475: 8b 4d d4 mov -0x2c(%rbp),%ecx
800478: 48 8b 45 d8 mov -0x28(%rbp),%rax
80047c: ba 00 00 00 00 mov $0x0,%edx
800481: 48 f7 f1 div %rcx
800484: 48 89 d0 mov %rdx,%rax
800487: 48 ba 08 3f 80 00 00 movabs $0x803f08,%rdx
80048e: 00 00 00
800491: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
800495: 0f be d0 movsbl %al,%edx
800498: 48 8b 4d e0 mov -0x20(%rbp),%rcx
80049c: 48 8b 45 e8 mov -0x18(%rbp),%rax
8004a0: 48 89 ce mov %rcx,%rsi
8004a3: 89 d7 mov %edx,%edi
8004a5: ff d0 callq *%rax
}
8004a7: 48 83 c4 38 add $0x38,%rsp
8004ab: 5b pop %rbx
8004ac: 5d pop %rbp
8004ad: c3 retq
00000000008004ae <getuint>:
// Get an unsigned int of various possible sizes from a varargs list,
// depending on the lflag parameter.
static unsigned long long
getuint(va_list *ap, int lflag)
{
8004ae: 55 push %rbp
8004af: 48 89 e5 mov %rsp,%rbp
8004b2: 48 83 ec 1c sub $0x1c,%rsp
8004b6: 48 89 7d e8 mov %rdi,-0x18(%rbp)
8004ba: 89 75 e4 mov %esi,-0x1c(%rbp)
unsigned long long x;
if (lflag >= 2)
8004bd: 83 7d e4 01 cmpl $0x1,-0x1c(%rbp)
8004c1: 7e 52 jle 800515 <getuint+0x67>
x= va_arg(*ap, unsigned long long);
8004c3: 48 8b 45 e8 mov -0x18(%rbp),%rax
8004c7: 8b 00 mov (%rax),%eax
8004c9: 83 f8 30 cmp $0x30,%eax
8004cc: 73 24 jae 8004f2 <getuint+0x44>
8004ce: 48 8b 45 e8 mov -0x18(%rbp),%rax
8004d2: 48 8b 50 10 mov 0x10(%rax),%rdx
8004d6: 48 8b 45 e8 mov -0x18(%rbp),%rax
8004da: 8b 00 mov (%rax),%eax
8004dc: 89 c0 mov %eax,%eax
8004de: 48 01 d0 add %rdx,%rax
8004e1: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8004e5: 8b 12 mov (%rdx),%edx
8004e7: 8d 4a 08 lea 0x8(%rdx),%ecx
8004ea: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8004ee: 89 0a mov %ecx,(%rdx)
8004f0: eb 17 jmp 800509 <getuint+0x5b>
8004f2: 48 8b 45 e8 mov -0x18(%rbp),%rax
8004f6: 48 8b 50 08 mov 0x8(%rax),%rdx
8004fa: 48 89 d0 mov %rdx,%rax
8004fd: 48 8d 4a 08 lea 0x8(%rdx),%rcx
800501: 48 8b 55 e8 mov -0x18(%rbp),%rdx
800505: 48 89 4a 08 mov %rcx,0x8(%rdx)
800509: 48 8b 00 mov (%rax),%rax
80050c: 48 89 45 f8 mov %rax,-0x8(%rbp)
800510: e9 a3 00 00 00 jmpq 8005b8 <getuint+0x10a>
else if (lflag)
800515: 83 7d e4 00 cmpl $0x0,-0x1c(%rbp)
800519: 74 4f je 80056a <getuint+0xbc>
x= va_arg(*ap, unsigned long);
80051b: 48 8b 45 e8 mov -0x18(%rbp),%rax
80051f: 8b 00 mov (%rax),%eax
800521: 83 f8 30 cmp $0x30,%eax
800524: 73 24 jae 80054a <getuint+0x9c>
800526: 48 8b 45 e8 mov -0x18(%rbp),%rax
80052a: 48 8b 50 10 mov 0x10(%rax),%rdx
80052e: 48 8b 45 e8 mov -0x18(%rbp),%rax
800532: 8b 00 mov (%rax),%eax
800534: 89 c0 mov %eax,%eax
800536: 48 01 d0 add %rdx,%rax
800539: 48 8b 55 e8 mov -0x18(%rbp),%rdx
80053d: 8b 12 mov (%rdx),%edx
80053f: 8d 4a 08 lea 0x8(%rdx),%ecx
800542: 48 8b 55 e8 mov -0x18(%rbp),%rdx
800546: 89 0a mov %ecx,(%rdx)
800548: eb 17 jmp 800561 <getuint+0xb3>
80054a: 48 8b 45 e8 mov -0x18(%rbp),%rax
80054e: 48 8b 50 08 mov 0x8(%rax),%rdx
800552: 48 89 d0 mov %rdx,%rax
800555: 48 8d 4a 08 lea 0x8(%rdx),%rcx
800559: 48 8b 55 e8 mov -0x18(%rbp),%rdx
80055d: 48 89 4a 08 mov %rcx,0x8(%rdx)
800561: 48 8b 00 mov (%rax),%rax
800564: 48 89 45 f8 mov %rax,-0x8(%rbp)
800568: eb 4e jmp 8005b8 <getuint+0x10a>
else
x= va_arg(*ap, unsigned int);
80056a: 48 8b 45 e8 mov -0x18(%rbp),%rax
80056e: 8b 00 mov (%rax),%eax
800570: 83 f8 30 cmp $0x30,%eax
800573: 73 24 jae 800599 <getuint+0xeb>
800575: 48 8b 45 e8 mov -0x18(%rbp),%rax
800579: 48 8b 50 10 mov 0x10(%rax),%rdx
80057d: 48 8b 45 e8 mov -0x18(%rbp),%rax
800581: 8b 00 mov (%rax),%eax
800583: 89 c0 mov %eax,%eax
800585: 48 01 d0 add %rdx,%rax
800588: 48 8b 55 e8 mov -0x18(%rbp),%rdx
80058c: 8b 12 mov (%rdx),%edx
80058e: 8d 4a 08 lea 0x8(%rdx),%ecx
800591: 48 8b 55 e8 mov -0x18(%rbp),%rdx
800595: 89 0a mov %ecx,(%rdx)
800597: eb 17 jmp 8005b0 <getuint+0x102>
800599: 48 8b 45 e8 mov -0x18(%rbp),%rax
80059d: 48 8b 50 08 mov 0x8(%rax),%rdx
8005a1: 48 89 d0 mov %rdx,%rax
8005a4: 48 8d 4a 08 lea 0x8(%rdx),%rcx
8005a8: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8005ac: 48 89 4a 08 mov %rcx,0x8(%rdx)
8005b0: 8b 00 mov (%rax),%eax
8005b2: 89 c0 mov %eax,%eax
8005b4: 48 89 45 f8 mov %rax,-0x8(%rbp)
return x;
8005b8: 48 8b 45 f8 mov -0x8(%rbp),%rax
}
8005bc: c9 leaveq
8005bd: c3 retq
00000000008005be <getint>:
// Same as getuint but signed - can't use getuint
// because of sign extension
static long long
getint(va_list *ap, int lflag)
{
8005be: 55 push %rbp
8005bf: 48 89 e5 mov %rsp,%rbp
8005c2: 48 83 ec 1c sub $0x1c,%rsp
8005c6: 48 89 7d e8 mov %rdi,-0x18(%rbp)
8005ca: 89 75 e4 mov %esi,-0x1c(%rbp)
long long x;
if (lflag >= 2)
8005cd: 83 7d e4 01 cmpl $0x1,-0x1c(%rbp)
8005d1: 7e 52 jle 800625 <getint+0x67>
x=va_arg(*ap, long long);
8005d3: 48 8b 45 e8 mov -0x18(%rbp),%rax
8005d7: 8b 00 mov (%rax),%eax
8005d9: 83 f8 30 cmp $0x30,%eax
8005dc: 73 24 jae 800602 <getint+0x44>
8005de: 48 8b 45 e8 mov -0x18(%rbp),%rax
8005e2: 48 8b 50 10 mov 0x10(%rax),%rdx
8005e6: 48 8b 45 e8 mov -0x18(%rbp),%rax
8005ea: 8b 00 mov (%rax),%eax
8005ec: 89 c0 mov %eax,%eax
8005ee: 48 01 d0 add %rdx,%rax
8005f1: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8005f5: 8b 12 mov (%rdx),%edx
8005f7: 8d 4a 08 lea 0x8(%rdx),%ecx
8005fa: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8005fe: 89 0a mov %ecx,(%rdx)
800600: eb 17 jmp 800619 <getint+0x5b>
800602: 48 8b 45 e8 mov -0x18(%rbp),%rax
800606: 48 8b 50 08 mov 0x8(%rax),%rdx
80060a: 48 89 d0 mov %rdx,%rax
80060d: 48 8d 4a 08 lea 0x8(%rdx),%rcx
800611: 48 8b 55 e8 mov -0x18(%rbp),%rdx
800615: 48 89 4a 08 mov %rcx,0x8(%rdx)
800619: 48 8b 00 mov (%rax),%rax
80061c: 48 89 45 f8 mov %rax,-0x8(%rbp)
800620: e9 a3 00 00 00 jmpq 8006c8 <getint+0x10a>
else if (lflag)
800625: 83 7d e4 00 cmpl $0x0,-0x1c(%rbp)
800629: 74 4f je 80067a <getint+0xbc>
x=va_arg(*ap, long);
80062b: 48 8b 45 e8 mov -0x18(%rbp),%rax
80062f: 8b 00 mov (%rax),%eax
800631: 83 f8 30 cmp $0x30,%eax
800634: 73 24 jae 80065a <getint+0x9c>
800636: 48 8b 45 e8 mov -0x18(%rbp),%rax
80063a: 48 8b 50 10 mov 0x10(%rax),%rdx
80063e: 48 8b 45 e8 mov -0x18(%rbp),%rax
800642: 8b 00 mov (%rax),%eax
800644: 89 c0 mov %eax,%eax
800646: 48 01 d0 add %rdx,%rax
800649: 48 8b 55 e8 mov -0x18(%rbp),%rdx
80064d: 8b 12 mov (%rdx),%edx
80064f: 8d 4a 08 lea 0x8(%rdx),%ecx
800652: 48 8b 55 e8 mov -0x18(%rbp),%rdx
800656: 89 0a mov %ecx,(%rdx)
800658: eb 17 jmp 800671 <getint+0xb3>
80065a: 48 8b 45 e8 mov -0x18(%rbp),%rax
80065e: 48 8b 50 08 mov 0x8(%rax),%rdx
800662: 48 89 d0 mov %rdx,%rax
800665: 48 8d 4a 08 lea 0x8(%rdx),%rcx
800669: 48 8b 55 e8 mov -0x18(%rbp),%rdx
80066d: 48 89 4a 08 mov %rcx,0x8(%rdx)
800671: 48 8b 00 mov (%rax),%rax
800674: 48 89 45 f8 mov %rax,-0x8(%rbp)
800678: eb 4e jmp 8006c8 <getint+0x10a>
else
x=va_arg(*ap, int);
80067a: 48 8b 45 e8 mov -0x18(%rbp),%rax
80067e: 8b 00 mov (%rax),%eax
800680: 83 f8 30 cmp $0x30,%eax
800683: 73 24 jae 8006a9 <getint+0xeb>
800685: 48 8b 45 e8 mov -0x18(%rbp),%rax
800689: 48 8b 50 10 mov 0x10(%rax),%rdx
80068d: 48 8b 45 e8 mov -0x18(%rbp),%rax
800691: 8b 00 mov (%rax),%eax
800693: 89 c0 mov %eax,%eax
800695: 48 01 d0 add %rdx,%rax
800698: 48 8b 55 e8 mov -0x18(%rbp),%rdx
80069c: 8b 12 mov (%rdx),%edx
80069e: 8d 4a 08 lea 0x8(%rdx),%ecx
8006a1: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8006a5: 89 0a mov %ecx,(%rdx)
8006a7: eb 17 jmp 8006c0 <getint+0x102>
8006a9: 48 8b 45 e8 mov -0x18(%rbp),%rax
8006ad: 48 8b 50 08 mov 0x8(%rax),%rdx
8006b1: 48 89 d0 mov %rdx,%rax
8006b4: 48 8d 4a 08 lea 0x8(%rdx),%rcx
8006b8: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8006bc: 48 89 4a 08 mov %rcx,0x8(%rdx)
8006c0: 8b 00 mov (%rax),%eax
8006c2: 48 98 cltq
8006c4: 48 89 45 f8 mov %rax,-0x8(%rbp)
return x;
8006c8: 48 8b 45 f8 mov -0x8(%rbp),%rax
}
8006cc: c9 leaveq
8006cd: c3 retq
00000000008006ce <vprintfmt>:
// Main function to format and print a string.
void printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...);
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap)
{
8006ce: 55 push %rbp
8006cf: 48 89 e5 mov %rsp,%rbp
8006d2: 41 54 push %r12
8006d4: 53 push %rbx
8006d5: 48 83 ec 60 sub $0x60,%rsp
8006d9: 48 89 7d a8 mov %rdi,-0x58(%rbp)
8006dd: 48 89 75 a0 mov %rsi,-0x60(%rbp)
8006e1: 48 89 55 98 mov %rdx,-0x68(%rbp)
8006e5: 48 89 4d 90 mov %rcx,-0x70(%rbp)
register int ch, err;
unsigned long long num;
int base, lflag, width, precision, altflag;
char padc;
va_list aq;
va_copy(aq,ap);
8006e9: 48 8d 45 b8 lea -0x48(%rbp),%rax
8006ed: 48 8b 55 90 mov -0x70(%rbp),%rdx
8006f1: 48 8b 0a mov (%rdx),%rcx
8006f4: 48 89 08 mov %rcx,(%rax)
8006f7: 48 8b 4a 08 mov 0x8(%rdx),%rcx
8006fb: 48 89 48 08 mov %rcx,0x8(%rax)
8006ff: 48 8b 52 10 mov 0x10(%rdx),%rdx
800703: 48 89 50 10 mov %rdx,0x10(%rax)
while (1) {
while ((ch = *(unsigned char *) fmt++) != '%') {
800707: eb 17 jmp 800720 <vprintfmt+0x52>
if (ch == '\0')
800709: 85 db test %ebx,%ebx
80070b: 0f 84 cc 04 00 00 je 800bdd <vprintfmt+0x50f>
return;
putch(ch, putdat);
800711: 48 8b 55 a0 mov -0x60(%rbp),%rdx
800715: 48 8b 45 a8 mov -0x58(%rbp),%rax
800719: 48 89 d6 mov %rdx,%rsi
80071c: 89 df mov %ebx,%edi
80071e: ff d0 callq *%rax
int base, lflag, width, precision, altflag;
char padc;
va_list aq;
va_copy(aq,ap);
while (1) {
while ((ch = *(unsigned char *) fmt++) != '%') {
800720: 48 8b 45 98 mov -0x68(%rbp),%rax
800724: 48 8d 50 01 lea 0x1(%rax),%rdx
800728: 48 89 55 98 mov %rdx,-0x68(%rbp)
80072c: 0f b6 00 movzbl (%rax),%eax
80072f: 0f b6 d8 movzbl %al,%ebx
800732: 83 fb 25 cmp $0x25,%ebx
800735: 75 d2 jne 800709 <vprintfmt+0x3b>
return;
putch(ch, putdat);
}
// Process a %-escape sequence
padc = ' ';
800737: c6 45 d3 20 movb $0x20,-0x2d(%rbp)
width = -1;
80073b: c7 45 dc ff ff ff ff movl $0xffffffff,-0x24(%rbp)
precision = -1;
800742: c7 45 d8 ff ff ff ff movl $0xffffffff,-0x28(%rbp)
lflag = 0;
800749: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%rbp)
altflag = 0;
800750: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%rbp)
reswitch:
switch (ch = *(unsigned char *) fmt++) {
800757: 48 8b 45 98 mov -0x68(%rbp),%rax
80075b: 48 8d 50 01 lea 0x1(%rax),%rdx
80075f: 48 89 55 98 mov %rdx,-0x68(%rbp)
800763: 0f b6 00 movzbl (%rax),%eax
800766: 0f b6 d8 movzbl %al,%ebx
800769: 8d 43 dd lea -0x23(%rbx),%eax
80076c: 83 f8 55 cmp $0x55,%eax
80076f: 0f 87 34 04 00 00 ja 800ba9 <vprintfmt+0x4db>
800775: 89 c0 mov %eax,%eax
800777: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx
80077e: 00
80077f: 48 b8 30 3f 80 00 00 movabs $0x803f30,%rax
800786: 00 00 00
800789: 48 01 d0 add %rdx,%rax
80078c: 48 8b 00 mov (%rax),%rax
80078f: ff e0 jmpq *%rax
// flag to pad on the right
case '-':
padc = '-';
800791: c6 45 d3 2d movb $0x2d,-0x2d(%rbp)
goto reswitch;
800795: eb c0 jmp 800757 <vprintfmt+0x89>
// flag to pad with 0's instead of spaces
case '0':
padc = '0';
800797: c6 45 d3 30 movb $0x30,-0x2d(%rbp)
goto reswitch;
80079b: eb ba jmp 800757 <vprintfmt+0x89>
case '5':
case '6':
case '7':
case '8':
case '9':
for (precision = 0; ; ++fmt) {
80079d: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%rbp)
precision = precision * 10 + ch - '0';
8007a4: 8b 55 d8 mov -0x28(%rbp),%edx
8007a7: 89 d0 mov %edx,%eax
8007a9: c1 e0 02 shl $0x2,%eax
8007ac: 01 d0 add %edx,%eax
8007ae: 01 c0 add %eax,%eax
8007b0: 01 d8 add %ebx,%eax
8007b2: 83 e8 30 sub $0x30,%eax
8007b5: 89 45 d8 mov %eax,-0x28(%rbp)
ch = *fmt;
8007b8: 48 8b 45 98 mov -0x68(%rbp),%rax
8007bc: 0f b6 00 movzbl (%rax),%eax
8007bf: 0f be d8 movsbl %al,%ebx
if (ch < '0' || ch > '9')
8007c2: 83 fb 2f cmp $0x2f,%ebx
8007c5: 7e 0c jle 8007d3 <vprintfmt+0x105>
8007c7: 83 fb 39 cmp $0x39,%ebx
8007ca: 7f 07 jg 8007d3 <vprintfmt+0x105>
case '5':
case '6':
case '7':
case '8':
case '9':
for (precision = 0; ; ++fmt) {
8007cc: 48 83 45 98 01 addq $0x1,-0x68(%rbp)
precision = precision * 10 + ch - '0';
ch = *fmt;
if (ch < '0' || ch > '9')
break;
}
8007d1: eb d1 jmp 8007a4 <vprintfmt+0xd6>
goto process_precision;
8007d3: eb 58 jmp 80082d <vprintfmt+0x15f>
case '*':
precision = va_arg(aq, int);
8007d5: 8b 45 b8 mov -0x48(%rbp),%eax
8007d8: 83 f8 30 cmp $0x30,%eax
8007db: 73 17 jae 8007f4 <vprintfmt+0x126>
8007dd: 48 8b 55 c8 mov -0x38(%rbp),%rdx
8007e1: 8b 45 b8 mov -0x48(%rbp),%eax
8007e4: 89 c0 mov %eax,%eax
8007e6: 48 01 d0 add %rdx,%rax
8007e9: 8b 55 b8 mov -0x48(%rbp),%edx
8007ec: 83 c2 08 add $0x8,%edx
8007ef: 89 55 b8 mov %edx,-0x48(%rbp)
8007f2: eb 0f jmp 800803 <vprintfmt+0x135>
8007f4: 48 8b 55 c0 mov -0x40(%rbp),%rdx
8007f8: 48 89 d0 mov %rdx,%rax
8007fb: 48 83 c2 08 add $0x8,%rdx
8007ff: 48 89 55 c0 mov %rdx,-0x40(%rbp)
800803: 8b 00 mov (%rax),%eax
800805: 89 45 d8 mov %eax,-0x28(%rbp)
goto process_precision;
800808: eb 23 jmp 80082d <vprintfmt+0x15f>
case '.':
if (width < 0)
80080a: 83 7d dc 00 cmpl $0x0,-0x24(%rbp)
80080e: 79 0c jns 80081c <vprintfmt+0x14e>
width = 0;
800810: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%rbp)
goto reswitch;
800817: e9 3b ff ff ff jmpq 800757 <vprintfmt+0x89>
80081c: e9 36 ff ff ff jmpq 800757 <vprintfmt+0x89>
case '#':
altflag = 1;
800821: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%rbp)
goto reswitch;
800828: e9 2a ff ff ff jmpq 800757 <vprintfmt+0x89>
process_precision:
if (width < 0)
80082d: 83 7d dc 00 cmpl $0x0,-0x24(%rbp)
800831: 79 12 jns 800845 <vprintfmt+0x177>
width = precision, precision = -1;
800833: 8b 45 d8 mov -0x28(%rbp),%eax
800836: 89 45 dc mov %eax,-0x24(%rbp)
800839: c7 45 d8 ff ff ff ff movl $0xffffffff,-0x28(%rbp)
goto reswitch;
800840: e9 12 ff ff ff jmpq 800757 <vprintfmt+0x89>
800845: e9 0d ff ff ff jmpq 800757 <vprintfmt+0x89>
// long flag (doubled for long long)
case 'l':
lflag++;
80084a: 83 45 e0 01 addl $0x1,-0x20(%rbp)
goto reswitch;
80084e: e9 04 ff ff ff jmpq 800757 <vprintfmt+0x89>
// character
case 'c':
putch(va_arg(aq, int), putdat);
800853: 8b 45 b8 mov -0x48(%rbp),%eax
800856: 83 f8 30 cmp $0x30,%eax
800859: 73 17 jae 800872 <vprintfmt+0x1a4>
80085b: 48 8b 55 c8 mov -0x38(%rbp),%rdx
80085f: 8b 45 b8 mov -0x48(%rbp),%eax
800862: 89 c0 mov %eax,%eax
800864: 48 01 d0 add %rdx,%rax
800867: 8b 55 b8 mov -0x48(%rbp),%edx
80086a: 83 c2 08 add $0x8,%edx
80086d: 89 55 b8 mov %edx,-0x48(%rbp)
800870: eb 0f jmp 800881 <vprintfmt+0x1b3>
800872: 48 8b 55 c0 mov -0x40(%rbp),%rdx
800876: 48 89 d0 mov %rdx,%rax
800879: 48 83 c2 08 add $0x8,%rdx
80087d: 48 89 55 c0 mov %rdx,-0x40(%rbp)
800881: 8b 10 mov (%rax),%edx
800883: 48 8b 4d a0 mov -0x60(%rbp),%rcx
800887: 48 8b 45 a8 mov -0x58(%rbp),%rax
80088b: 48 89 ce mov %rcx,%rsi
80088e: 89 d7 mov %edx,%edi
800890: ff d0 callq *%rax
break;
800892: e9 40 03 00 00 jmpq 800bd7 <vprintfmt+0x509>
// error message
case 'e':
err = va_arg(aq, int);
800897: 8b 45 b8 mov -0x48(%rbp),%eax
80089a: 83 f8 30 cmp $0x30,%eax
80089d: 73 17 jae 8008b6 <vprintfmt+0x1e8>
80089f: 48 8b 55 c8 mov -0x38(%rbp),%rdx
8008a3: 8b 45 b8 mov -0x48(%rbp),%eax
8008a6: 89 c0 mov %eax,%eax
8008a8: 48 01 d0 add %rdx,%rax
8008ab: 8b 55 b8 mov -0x48(%rbp),%edx
8008ae: 83 c2 08 add $0x8,%edx
8008b1: 89 55 b8 mov %edx,-0x48(%rbp)
8008b4: eb 0f jmp 8008c5 <vprintfmt+0x1f7>
8008b6: 48 8b 55 c0 mov -0x40(%rbp),%rdx
8008ba: 48 89 d0 mov %rdx,%rax
8008bd: 48 83 c2 08 add $0x8,%rdx
8008c1: 48 89 55 c0 mov %rdx,-0x40(%rbp)
8008c5: 8b 18 mov (%rax),%ebx
if (err < 0)
8008c7: 85 db test %ebx,%ebx
8008c9: 79 02 jns 8008cd <vprintfmt+0x1ff>
err = -err;
8008cb: f7 db neg %ebx
if (err >= MAXERROR || (p = error_string[err]) == NULL)
8008cd: 83 fb 10 cmp $0x10,%ebx
8008d0: 7f 16 jg 8008e8 <vprintfmt+0x21a>
8008d2: 48 b8 80 3e 80 00 00 movabs $0x803e80,%rax
8008d9: 00 00 00
8008dc: 48 63 d3 movslq %ebx,%rdx
8008df: 4c 8b 24 d0 mov (%rax,%rdx,8),%r12
8008e3: 4d 85 e4 test %r12,%r12
8008e6: 75 2e jne 800916 <vprintfmt+0x248>
printfmt(putch, putdat, "error %d", err);
8008e8: 48 8b 75 a0 mov -0x60(%rbp),%rsi
8008ec: 48 8b 45 a8 mov -0x58(%rbp),%rax
8008f0: 89 d9 mov %ebx,%ecx
8008f2: 48 ba 19 3f 80 00 00 movabs $0x803f19,%rdx
8008f9: 00 00 00
8008fc: 48 89 c7 mov %rax,%rdi
8008ff: b8 00 00 00 00 mov $0x0,%eax
800904: 49 b8 e6 0b 80 00 00 movabs $0x800be6,%r8
80090b: 00 00 00
80090e: 41 ff d0 callq *%r8
else
printfmt(putch, putdat, "%s", p);
break;
800911: e9 c1 02 00 00 jmpq 800bd7 <vprintfmt+0x509>
if (err < 0)
err = -err;
if (err >= MAXERROR || (p = error_string[err]) == NULL)
printfmt(putch, putdat, "error %d", err);
else
printfmt(putch, putdat, "%s", p);
800916: 48 8b 75 a0 mov -0x60(%rbp),%rsi
80091a: 48 8b 45 a8 mov -0x58(%rbp),%rax
80091e: 4c 89 e1 mov %r12,%rcx
800921: 48 ba 22 3f 80 00 00 movabs $0x803f22,%rdx
800928: 00 00 00
80092b: 48 89 c7 mov %rax,%rdi
80092e: b8 00 00 00 00 mov $0x0,%eax
800933: 49 b8 e6 0b 80 00 00 movabs $0x800be6,%r8
80093a: 00 00 00
80093d: 41 ff d0 callq *%r8
break;
800940: e9 92 02 00 00 jmpq 800bd7 <vprintfmt+0x509>
// string
case 's':
if ((p = va_arg(aq, char *)) == NULL)
800945: 8b 45 b8 mov -0x48(%rbp),%eax
800948: 83 f8 30 cmp $0x30,%eax
80094b: 73 17 jae 800964 <vprintfmt+0x296>
80094d: 48 8b 55 c8 mov -0x38(%rbp),%rdx
800951: 8b 45 b8 mov -0x48(%rbp),%eax
800954: 89 c0 mov %eax,%eax
800956: 48 01 d0 add %rdx,%rax
800959: 8b 55 b8 mov -0x48(%rbp),%edx
80095c: 83 c2 08 add $0x8,%edx
80095f: 89 55 b8 mov %edx,-0x48(%rbp)
800962: eb 0f jmp 800973 <vprintfmt+0x2a5>
800964: 48 8b 55 c0 mov -0x40(%rbp),%rdx
800968: 48 89 d0 mov %rdx,%rax
80096b: 48 83 c2 08 add $0x8,%rdx
80096f: 48 89 55 c0 mov %rdx,-0x40(%rbp)
800973: 4c 8b 20 mov (%rax),%r12
800976: 4d 85 e4 test %r12,%r12
800979: 75 0a jne 800985 <vprintfmt+0x2b7>
p = "(null)";
80097b: 49 bc 25 3f 80 00 00 movabs $0x803f25,%r12
800982: 00 00 00
if (width > 0 && padc != '-')
800985: 83 7d dc 00 cmpl $0x0,-0x24(%rbp)
800989: 7e 3f jle 8009ca <vprintfmt+0x2fc>
80098b: 80 7d d3 2d cmpb $0x2d,-0x2d(%rbp)
80098f: 74 39 je 8009ca <vprintfmt+0x2fc>
for (width -= strnlen(p, precision); width > 0; width--)
800991: 8b 45 d8 mov -0x28(%rbp),%eax
800994: 48 98 cltq
800996: 48 89 c6 mov %rax,%rsi
800999: 4c 89 e7 mov %r12,%rdi
80099c: 48 b8 92 0e 80 00 00 movabs $0x800e92,%rax
8009a3: 00 00 00
8009a6: ff d0 callq *%rax
8009a8: 29 45 dc sub %eax,-0x24(%rbp)
8009ab: eb 17 jmp 8009c4 <vprintfmt+0x2f6>
putch(padc, putdat);
8009ad: 0f be 55 d3 movsbl -0x2d(%rbp),%edx
8009b1: 48 8b 4d a0 mov -0x60(%rbp),%rcx
8009b5: 48 8b 45 a8 mov -0x58(%rbp),%rax
8009b9: 48 89 ce mov %rcx,%rsi
8009bc: 89 d7 mov %edx,%edi
8009be: ff d0 callq *%rax
// string
case 's':
if ((p = va_arg(aq, char *)) == NULL)
p = "(null)";
if (width > 0 && padc != '-')
for (width -= strnlen(p, precision); width > 0; width--)
8009c0: 83 6d dc 01 subl $0x1,-0x24(%rbp)
8009c4: 83 7d dc 00 cmpl $0x0,-0x24(%rbp)
8009c8: 7f e3 jg 8009ad <vprintfmt+0x2df>
putch(padc, putdat);
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
8009ca: eb 37 jmp 800a03 <vprintfmt+0x335>
if (altflag && (ch < ' ' || ch > '~'))
8009cc: 83 7d d4 00 cmpl $0x0,-0x2c(%rbp)
8009d0: 74 1e je 8009f0 <vprintfmt+0x322>
8009d2: 83 fb 1f cmp $0x1f,%ebx
8009d5: 7e 05 jle 8009dc <vprintfmt+0x30e>
8009d7: 83 fb 7e cmp $0x7e,%ebx
8009da: 7e 14 jle 8009f0 <vprintfmt+0x322>
putch('?', putdat);
8009dc: 48 8b 55 a0 mov -0x60(%rbp),%rdx
8009e0: 48 8b 45 a8 mov -0x58(%rbp),%rax
8009e4: 48 89 d6 mov %rdx,%rsi
8009e7: bf 3f 00 00 00 mov $0x3f,%edi
8009ec: ff d0 callq *%rax
8009ee: eb 0f jmp 8009ff <vprintfmt+0x331>
else
putch(ch, putdat);
8009f0: 48 8b 55 a0 mov -0x60(%rbp),%rdx
8009f4: 48 8b 45 a8 mov -0x58(%rbp),%rax
8009f8: 48 89 d6 mov %rdx,%rsi
8009fb: 89 df mov %ebx,%edi
8009fd: ff d0 callq *%rax
if ((p = va_arg(aq, char *)) == NULL)
p = "(null)";
if (width > 0 && padc != '-')
for (width -= strnlen(p, precision); width > 0; width--)
putch(padc, putdat);
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
8009ff: 83 6d dc 01 subl $0x1,-0x24(%rbp)
800a03: 4c 89 e0 mov %r12,%rax
800a06: 4c 8d 60 01 lea 0x1(%rax),%r12
800a0a: 0f b6 00 movzbl (%rax),%eax
800a0d: 0f be d8 movsbl %al,%ebx
800a10: 85 db test %ebx,%ebx
800a12: 74 10 je 800a24 <vprintfmt+0x356>
800a14: 83 7d d8 00 cmpl $0x0,-0x28(%rbp)
800a18: 78 b2 js 8009cc <vprintfmt+0x2fe>
800a1a: 83 6d d8 01 subl $0x1,-0x28(%rbp)
800a1e: 83 7d d8 00 cmpl $0x0,-0x28(%rbp)
800a22: 79 a8 jns 8009cc <vprintfmt+0x2fe>
if (altflag && (ch < ' ' || ch > '~'))
putch('?', putdat);
else
putch(ch, putdat);
for (; width > 0; width--)
800a24: eb 16 jmp 800a3c <vprintfmt+0x36e>
putch(' ', putdat);
800a26: 48 8b 55 a0 mov -0x60(%rbp),%rdx
800a2a: 48 8b 45 a8 mov -0x58(%rbp),%rax
800a2e: 48 89 d6 mov %rdx,%rsi
800a31: bf 20 00 00 00 mov $0x20,%edi
800a36: ff d0 callq *%rax
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
if (altflag && (ch < ' ' || ch > '~'))
putch('?', putdat);
else
putch(ch, putdat);
for (; width > 0; width--)
800a38: 83 6d dc 01 subl $0x1,-0x24(%rbp)
800a3c: 83 7d dc 00 cmpl $0x0,-0x24(%rbp)
800a40: 7f e4 jg 800a26 <vprintfmt+0x358>
putch(' ', putdat);
break;
800a42: e9 90 01 00 00 jmpq 800bd7 <vprintfmt+0x509>
// (signed) decimal
case 'd':
num = getint(&aq, 3);
800a47: 48 8d 45 b8 lea -0x48(%rbp),%rax
800a4b: be 03 00 00 00 mov $0x3,%esi
800a50: 48 89 c7 mov %rax,%rdi
800a53: 48 b8 be 05 80 00 00 movabs $0x8005be,%rax
800a5a: 00 00 00
800a5d: ff d0 callq *%rax
800a5f: 48 89 45 e8 mov %rax,-0x18(%rbp)
if ((long long) num < 0) {
800a63: 48 8b 45 e8 mov -0x18(%rbp),%rax
800a67: 48 85 c0 test %rax,%rax
800a6a: 79 1d jns 800a89 <vprintfmt+0x3bb>
putch('-', putdat);
800a6c: 48 8b 55 a0 mov -0x60(%rbp),%rdx
800a70: 48 8b 45 a8 mov -0x58(%rbp),%rax
800a74: 48 89 d6 mov %rdx,%rsi
800a77: bf 2d 00 00 00 mov $0x2d,%edi
800a7c: ff d0 callq *%rax
num = -(long long) num;
800a7e: 48 8b 45 e8 mov -0x18(%rbp),%rax
800a82: 48 f7 d8 neg %rax
800a85: 48 89 45 e8 mov %rax,-0x18(%rbp)
}
base = 10;
800a89: c7 45 e4 0a 00 00 00 movl $0xa,-0x1c(%rbp)
goto number;
800a90: e9 d5 00 00 00 jmpq 800b6a <vprintfmt+0x49c>
// unsigned decimal
case 'u':
num = getuint(&aq, 3);
800a95: 48 8d 45 b8 lea -0x48(%rbp),%rax
800a99: be 03 00 00 00 mov $0x3,%esi
800a9e: 48 89 c7 mov %rax,%rdi
800aa1: 48 b8 ae 04 80 00 00 movabs $0x8004ae,%rax
800aa8: 00 00 00
800aab: ff d0 callq *%rax
800aad: 48 89 45 e8 mov %rax,-0x18(%rbp)
base = 10;
800ab1: c7 45 e4 0a 00 00 00 movl $0xa,-0x1c(%rbp)
goto number;
800ab8: e9 ad 00 00 00 jmpq 800b6a <vprintfmt+0x49c>
// (unsigned) octal
case 'o':
// Replace this with your code.
num = getint(&aq, lflag);
800abd: 8b 55 e0 mov -0x20(%rbp),%edx
800ac0: 48 8d 45 b8 lea -0x48(%rbp),%rax
800ac4: 89 d6 mov %edx,%esi
800ac6: 48 89 c7 mov %rax,%rdi
800ac9: 48 b8 be 05 80 00 00 movabs $0x8005be,%rax
800ad0: 00 00 00
800ad3: ff d0 callq *%rax
800ad5: 48 89 45 e8 mov %rax,-0x18(%rbp)
base = 8;
800ad9: c7 45 e4 08 00 00 00 movl $0x8,-0x1c(%rbp)
goto number;
800ae0: e9 85 00 00 00 jmpq 800b6a <vprintfmt+0x49c>
// pointer
case 'p':
putch('0', putdat);
800ae5: 48 8b 55 a0 mov -0x60(%rbp),%rdx
800ae9: 48 8b 45 a8 mov -0x58(%rbp),%rax
800aed: 48 89 d6 mov %rdx,%rsi
800af0: bf 30 00 00 00 mov $0x30,%edi
800af5: ff d0 callq *%rax
putch('x', putdat);
800af7: 48 8b 55 a0 mov -0x60(%rbp),%rdx
800afb: 48 8b 45 a8 mov -0x58(%rbp),%rax
800aff: 48 89 d6 mov %rdx,%rsi
800b02: bf 78 00 00 00 mov $0x78,%edi
800b07: ff d0 callq *%rax
num = (unsigned long long)
(uintptr_t) va_arg(aq, void *);
800b09: 8b 45 b8 mov -0x48(%rbp),%eax
800b0c: 83 f8 30 cmp $0x30,%eax
800b0f: 73 17 jae 800b28 <vprintfmt+0x45a>
800b11: 48 8b 55 c8 mov -0x38(%rbp),%rdx
800b15: 8b 45 b8 mov -0x48(%rbp),%eax
800b18: 89 c0 mov %eax,%eax
800b1a: 48 01 d0 add %rdx,%rax
800b1d: 8b 55 b8 mov -0x48(%rbp),%edx
800b20: 83 c2 08 add $0x8,%edx
800b23: 89 55 b8 mov %edx,-0x48(%rbp)
// pointer
case 'p':
putch('0', putdat);
putch('x', putdat);
num = (unsigned long long)
800b26: eb 0f jmp 800b37 <vprintfmt+0x469>
(uintptr_t) va_arg(aq, void *);
800b28: 48 8b 55 c0 mov -0x40(%rbp),%rdx
800b2c: 48 89 d0 mov %rdx,%rax
800b2f: 48 83 c2 08 add $0x8,%rdx
800b33: 48 89 55 c0 mov %rdx,-0x40(%rbp)
800b37: 48 8b 00 mov (%rax),%rax
// pointer
case 'p':
putch('0', putdat);
putch('x', putdat);
num = (unsigned long long)
800b3a: 48 89 45 e8 mov %rax,-0x18(%rbp)
(uintptr_t) va_arg(aq, void *);
base = 16;
800b3e: c7 45 e4 10 00 00 00 movl $0x10,-0x1c(%rbp)
goto number;
800b45: eb 23 jmp 800b6a <vprintfmt+0x49c>
// (unsigned) hexadecimal
case 'x':
num = getuint(&aq, 3);
800b47: 48 8d 45 b8 lea -0x48(%rbp),%rax
800b4b: be 03 00 00 00 mov $0x3,%esi
800b50: 48 89 c7 mov %rax,%rdi
800b53: 48 b8 ae 04 80 00 00 movabs $0x8004ae,%rax
800b5a: 00 00 00
800b5d: ff d0 callq *%rax
800b5f: 48 89 45 e8 mov %rax,-0x18(%rbp)
base = 16;
800b63: c7 45 e4 10 00 00 00 movl $0x10,-0x1c(%rbp)
number:
printnum(putch, putdat, num, base, width, padc);
800b6a: 44 0f be 45 d3 movsbl -0x2d(%rbp),%r8d
800b6f: 8b 4d e4 mov -0x1c(%rbp),%ecx
800b72: 8b 7d dc mov -0x24(%rbp),%edi
800b75: 48 8b 55 e8 mov -0x18(%rbp),%rdx
800b79: 48 8b 75 a0 mov -0x60(%rbp),%rsi
800b7d: 48 8b 45 a8 mov -0x58(%rbp),%rax
800b81: 45 89 c1 mov %r8d,%r9d
800b84: 41 89 f8 mov %edi,%r8d
800b87: 48 89 c7 mov %rax,%rdi
800b8a: 48 b8 f3 03 80 00 00 movabs $0x8003f3,%rax
800b91: 00 00 00
800b94: ff d0 callq *%rax
break;
800b96: eb 3f jmp 800bd7 <vprintfmt+0x509>
// escaped '%' character
case '%':
putch(ch, putdat);
800b98: 48 8b 55 a0 mov -0x60(%rbp),%rdx
800b9c: 48 8b 45 a8 mov -0x58(%rbp),%rax
800ba0: 48 89 d6 mov %rdx,%rsi
800ba3: 89 df mov %ebx,%edi
800ba5: ff d0 callq *%rax
break;
800ba7: eb 2e jmp 800bd7 <vprintfmt+0x509>
// unrecognized escape sequence - just print it literally
default:
putch('%', putdat);
800ba9: 48 8b 55 a0 mov -0x60(%rbp),%rdx
800bad: 48 8b 45 a8 mov -0x58(%rbp),%rax
800bb1: 48 89 d6 mov %rdx,%rsi
800bb4: bf 25 00 00 00 mov $0x25,%edi
800bb9: ff d0 callq *%rax
for (fmt--; fmt[-1] != '%'; fmt--)
800bbb: 48 83 6d 98 01 subq $0x1,-0x68(%rbp)
800bc0: eb 05 jmp 800bc7 <vprintfmt+0x4f9>
800bc2: 48 83 6d 98 01 subq $0x1,-0x68(%rbp)
800bc7: 48 8b 45 98 mov -0x68(%rbp),%rax
800bcb: 48 83 e8 01 sub $0x1,%rax
800bcf: 0f b6 00 movzbl (%rax),%eax
800bd2: 3c 25 cmp $0x25,%al
800bd4: 75 ec jne 800bc2 <vprintfmt+0x4f4>
/* do nothing */;
break;
800bd6: 90 nop
}
}
800bd7: 90 nop
int base, lflag, width, precision, altflag;
char padc;
va_list aq;
va_copy(aq,ap);
while (1) {
while ((ch = *(unsigned char *) fmt++) != '%') {
800bd8: e9 43 fb ff ff jmpq 800720 <vprintfmt+0x52>
/* do nothing */;
break;
}
}
va_end(aq);
}
800bdd: 48 83 c4 60 add $0x60,%rsp
800be1: 5b pop %rbx
800be2: 41 5c pop %r12
800be4: 5d pop %rbp
800be5: c3 retq
0000000000800be6 <printfmt>:
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...)
{
800be6: 55 push %rbp
800be7: 48 89 e5 mov %rsp,%rbp
800bea: 48 81 ec f0 00 00 00 sub $0xf0,%rsp
800bf1: 48 89 bd 28 ff ff ff mov %rdi,-0xd8(%rbp)
800bf8: 48 89 b5 20 ff ff ff mov %rsi,-0xe0(%rbp)
800bff: 48 89 8d 68 ff ff ff mov %rcx,-0x98(%rbp)
800c06: 4c 89 85 70 ff ff ff mov %r8,-0x90(%rbp)
800c0d: 4c 89 8d 78 ff ff ff mov %r9,-0x88(%rbp)
800c14: 84 c0 test %al,%al
800c16: 74 20 je 800c38 <printfmt+0x52>
800c18: 0f 29 45 80 movaps %xmm0,-0x80(%rbp)
800c1c: 0f 29 4d 90 movaps %xmm1,-0x70(%rbp)
800c20: 0f 29 55 a0 movaps %xmm2,-0x60(%rbp)
800c24: 0f 29 5d b0 movaps %xmm3,-0x50(%rbp)
800c28: 0f 29 65 c0 movaps %xmm4,-0x40(%rbp)
800c2c: 0f 29 6d d0 movaps %xmm5,-0x30(%rbp)
800c30: 0f 29 75 e0 movaps %xmm6,-0x20(%rbp)
800c34: 0f 29 7d f0 movaps %xmm7,-0x10(%rbp)
800c38: 48 89 95 18 ff ff ff mov %rdx,-0xe8(%rbp)
va_list ap;
va_start(ap, fmt);
800c3f: c7 85 38 ff ff ff 18 movl $0x18,-0xc8(%rbp)
800c46: 00 00 00
800c49: c7 85 3c ff ff ff 30 movl $0x30,-0xc4(%rbp)
800c50: 00 00 00
800c53: 48 8d 45 10 lea 0x10(%rbp),%rax
800c57: 48 89 85 40 ff ff ff mov %rax,-0xc0(%rbp)
800c5e: 48 8d 85 50 ff ff ff lea -0xb0(%rbp),%rax
800c65: 48 89 85 48 ff ff ff mov %rax,-0xb8(%rbp)
vprintfmt(putch, putdat, fmt, ap);
800c6c: 48 8d 8d 38 ff ff ff lea -0xc8(%rbp),%rcx
800c73: 48 8b 95 18 ff ff ff mov -0xe8(%rbp),%rdx
800c7a: 48 8b b5 20 ff ff ff mov -0xe0(%rbp),%rsi
800c81: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax
800c88: 48 89 c7 mov %rax,%rdi
800c8b: 48 b8 ce 06 80 00 00 movabs $0x8006ce,%rax
800c92: 00 00 00
800c95: ff d0 callq *%rax
va_end(ap);
}
800c97: c9 leaveq
800c98: c3 retq
0000000000800c99 <sprintputch>:
int cnt;
};
static void
sprintputch(int ch, struct sprintbuf *b)
{
800c99: 55 push %rbp
800c9a: 48 89 e5 mov %rsp,%rbp
800c9d: 48 83 ec 10 sub $0x10,%rsp
800ca1: 89 7d fc mov %edi,-0x4(%rbp)
800ca4: 48 89 75 f0 mov %rsi,-0x10(%rbp)
b->cnt++;
800ca8: 48 8b 45 f0 mov -0x10(%rbp),%rax
800cac: 8b 40 10 mov 0x10(%rax),%eax
800caf: 8d 50 01 lea 0x1(%rax),%edx
800cb2: 48 8b 45 f0 mov -0x10(%rbp),%rax
800cb6: 89 50 10 mov %edx,0x10(%rax)
if (b->buf < b->ebuf)
800cb9: 48 8b 45 f0 mov -0x10(%rbp),%rax
800cbd: 48 8b 10 mov (%rax),%rdx
800cc0: 48 8b 45 f0 mov -0x10(%rbp),%rax
800cc4: 48 8b 40 08 mov 0x8(%rax),%rax
800cc8: 48 39 c2 cmp %rax,%rdx
800ccb: 73 17 jae 800ce4 <sprintputch+0x4b>
*b->buf++ = ch;
800ccd: 48 8b 45 f0 mov -0x10(%rbp),%rax
800cd1: 48 8b 00 mov (%rax),%rax
800cd4: 48 8d 48 01 lea 0x1(%rax),%rcx
800cd8: 48 8b 55 f0 mov -0x10(%rbp),%rdx
800cdc: 48 89 0a mov %rcx,(%rdx)
800cdf: 8b 55 fc mov -0x4(%rbp),%edx
800ce2: 88 10 mov %dl,(%rax)
}
800ce4: c9 leaveq
800ce5: c3 retq
0000000000800ce6 <vsnprintf>:
int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
800ce6: 55 push %rbp
800ce7: 48 89 e5 mov %rsp,%rbp
800cea: 48 83 ec 50 sub $0x50,%rsp
800cee: 48 89 7d c8 mov %rdi,-0x38(%rbp)
800cf2: 89 75 c4 mov %esi,-0x3c(%rbp)
800cf5: 48 89 55 b8 mov %rdx,-0x48(%rbp)
800cf9: 48 89 4d b0 mov %rcx,-0x50(%rbp)
va_list aq;
va_copy(aq,ap);
800cfd: 48 8d 45 e8 lea -0x18(%rbp),%rax
800d01: 48 8b 55 b0 mov -0x50(%rbp),%rdx
800d05: 48 8b 0a mov (%rdx),%rcx
800d08: 48 89 08 mov %rcx,(%rax)
800d0b: 48 8b 4a 08 mov 0x8(%rdx),%rcx
800d0f: 48 89 48 08 mov %rcx,0x8(%rax)
800d13: 48 8b 52 10 mov 0x10(%rdx),%rdx
800d17: 48 89 50 10 mov %rdx,0x10(%rax)
struct sprintbuf b = {buf, buf+n-1, 0};
800d1b: 48 8b 45 c8 mov -0x38(%rbp),%rax
800d1f: 48 89 45 d0 mov %rax,-0x30(%rbp)
800d23: 8b 45 c4 mov -0x3c(%rbp),%eax
800d26: 48 98 cltq
800d28: 48 8d 50 ff lea -0x1(%rax),%rdx
800d2c: 48 8b 45 c8 mov -0x38(%rbp),%rax
800d30: 48 01 d0 add %rdx,%rax
800d33: 48 89 45 d8 mov %rax,-0x28(%rbp)
800d37: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%rbp)
if (buf == NULL || n < 1)
800d3e: 48 83 7d c8 00 cmpq $0x0,-0x38(%rbp)
800d43: 74 06 je 800d4b <vsnprintf+0x65>
800d45: 83 7d c4 00 cmpl $0x0,-0x3c(%rbp)
800d49: 7f 07 jg 800d52 <vsnprintf+0x6c>
return -E_INVAL;
800d4b: b8 fd ff ff ff mov $0xfffffffd,%eax
800d50: eb 2f jmp 800d81 <vsnprintf+0x9b>
// print the string to the buffer
vprintfmt((void*)sprintputch, &b, fmt, aq);
800d52: 48 8d 4d e8 lea -0x18(%rbp),%rcx
800d56: 48 8b 55 b8 mov -0x48(%rbp),%rdx
800d5a: 48 8d 45 d0 lea -0x30(%rbp),%rax
800d5e: 48 89 c6 mov %rax,%rsi
800d61: 48 bf 99 0c 80 00 00 movabs $0x800c99,%rdi
800d68: 00 00 00
800d6b: 48 b8 ce 06 80 00 00 movabs $0x8006ce,%rax
800d72: 00 00 00
800d75: ff d0 callq *%rax
va_end(aq);
// null terminate the buffer
*b.buf = '\0';
800d77: 48 8b 45 d0 mov -0x30(%rbp),%rax
800d7b: c6 00 00 movb $0x0,(%rax)
return b.cnt;
800d7e: 8b 45 e0 mov -0x20(%rbp),%eax
}
800d81: c9 leaveq
800d82: c3 retq
0000000000800d83 <snprintf>:
int
snprintf(char *buf, int n, const char *fmt, ...)
{
800d83: 55 push %rbp
800d84: 48 89 e5 mov %rsp,%rbp
800d87: 48 81 ec 10 01 00 00 sub $0x110,%rsp
800d8e: 48 89 bd 08 ff ff ff mov %rdi,-0xf8(%rbp)
800d95: 89 b5 04 ff ff ff mov %esi,-0xfc(%rbp)
800d9b: 48 89 8d 68 ff ff ff mov %rcx,-0x98(%rbp)
800da2: 4c 89 85 70 ff ff ff mov %r8,-0x90(%rbp)
800da9: 4c 89 8d 78 ff ff ff mov %r9,-0x88(%rbp)
800db0: 84 c0 test %al,%al
800db2: 74 20 je 800dd4 <snprintf+0x51>
800db4: 0f 29 45 80 movaps %xmm0,-0x80(%rbp)
800db8: 0f 29 4d 90 movaps %xmm1,-0x70(%rbp)
800dbc: 0f 29 55 a0 movaps %xmm2,-0x60(%rbp)
800dc0: 0f 29 5d b0 movaps %xmm3,-0x50(%rbp)
800dc4: 0f 29 65 c0 movaps %xmm4,-0x40(%rbp)
800dc8: 0f 29 6d d0 movaps %xmm5,-0x30(%rbp)
800dcc: 0f 29 75 e0 movaps %xmm6,-0x20(%rbp)
800dd0: 0f 29 7d f0 movaps %xmm7,-0x10(%rbp)
800dd4: 48 89 95 f8 fe ff ff mov %rdx,-0x108(%rbp)
va_list ap;
int rc;
va_list aq;
va_start(ap, fmt);
800ddb: c7 85 30 ff ff ff 18 movl $0x18,-0xd0(%rbp)
800de2: 00 00 00
800de5: c7 85 34 ff ff ff 30 movl $0x30,-0xcc(%rbp)
800dec: 00 00 00
800def: 48 8d 45 10 lea 0x10(%rbp),%rax
800df3: 48 89 85 38 ff ff ff mov %rax,-0xc8(%rbp)
800dfa: 48 8d 85 50 ff ff ff lea -0xb0(%rbp),%rax
800e01: 48 89 85 40 ff ff ff mov %rax,-0xc0(%rbp)
va_copy(aq,ap);
800e08: 48 8d 85 18 ff ff ff lea -0xe8(%rbp),%rax
800e0f: 48 8d 95 30 ff ff ff lea -0xd0(%rbp),%rdx
800e16: 48 8b 0a mov (%rdx),%rcx
800e19: 48 89 08 mov %rcx,(%rax)
800e1c: 48 8b 4a 08 mov 0x8(%rdx),%rcx
800e20: 48 89 48 08 mov %rcx,0x8(%rax)
800e24: 48 8b 52 10 mov 0x10(%rdx),%rdx
800e28: 48 89 50 10 mov %rdx,0x10(%rax)
rc = vsnprintf(buf, n, fmt, aq);
800e2c: 48 8d 8d 18 ff ff ff lea -0xe8(%rbp),%rcx
800e33: 48 8b 95 f8 fe ff ff mov -0x108(%rbp),%rdx
800e3a: 8b b5 04 ff ff ff mov -0xfc(%rbp),%esi
800e40: 48 8b 85 08 ff ff ff mov -0xf8(%rbp),%rax
800e47: 48 89 c7 mov %rax,%rdi
800e4a: 48 b8 e6 0c 80 00 00 movabs $0x800ce6,%rax
800e51: 00 00 00
800e54: ff d0 callq *%rax
800e56: 89 85 4c ff ff ff mov %eax,-0xb4(%rbp)
va_end(aq);
return rc;
800e5c: 8b 85 4c ff ff ff mov -0xb4(%rbp),%eax
}
800e62: c9 leaveq
800e63: c3 retq
0000000000800e64 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1
int
strlen(const char *s)
{
800e64: 55 push %rbp
800e65: 48 89 e5 mov %rsp,%rbp
800e68: 48 83 ec 18 sub $0x18,%rsp
800e6c: 48 89 7d e8 mov %rdi,-0x18(%rbp)
int n;
for (n = 0; *s != '\0'; s++)
800e70: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
800e77: eb 09 jmp 800e82 <strlen+0x1e>
n++;
800e79: 83 45 fc 01 addl $0x1,-0x4(%rbp)
int
strlen(const char *s)
{
int n;
for (n = 0; *s != '\0'; s++)
800e7d: 48 83 45 e8 01 addq $0x1,-0x18(%rbp)
800e82: 48 8b 45 e8 mov -0x18(%rbp),%rax
800e86: 0f b6 00 movzbl (%rax),%eax
800e89: 84 c0 test %al,%al
800e8b: 75 ec jne 800e79 <strlen+0x15>
n++;
return n;
800e8d: 8b 45 fc mov -0x4(%rbp),%eax
}
800e90: c9 leaveq
800e91: c3 retq
0000000000800e92 <strnlen>:
int
strnlen(const char *s, size_t size)
{
800e92: 55 push %rbp
800e93: 48 89 e5 mov %rsp,%rbp
800e96: 48 83 ec 20 sub $0x20,%rsp
800e9a: 48 89 7d e8 mov %rdi,-0x18(%rbp)
800e9e: 48 89 75 e0 mov %rsi,-0x20(%rbp)
int n;
for (n = 0; size > 0 && *s != '\0'; s++, size--)
800ea2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
800ea9: eb 0e jmp 800eb9 <strnlen+0x27>
n++;
800eab: 83 45 fc 01 addl $0x1,-0x4(%rbp)
int
strnlen(const char *s, size_t size)
{
int n;
for (n = 0; size > 0 && *s != '\0'; s++, size--)
800eaf: 48 83 45 e8 01 addq $0x1,-0x18(%rbp)
800eb4: 48 83 6d e0 01 subq $0x1,-0x20(%rbp)
800eb9: 48 83 7d e0 00 cmpq $0x0,-0x20(%rbp)
800ebe: 74 0b je 800ecb <strnlen+0x39>
800ec0: 48 8b 45 e8 mov -0x18(%rbp),%rax
800ec4: 0f b6 00 movzbl (%rax),%eax
800ec7: 84 c0 test %al,%al
800ec9: 75 e0 jne 800eab <strnlen+0x19>
n++;
return n;
800ecb: 8b 45 fc mov -0x4(%rbp),%eax
}
800ece: c9 leaveq
800ecf: c3 retq
0000000000800ed0 <strcpy>:
char *
strcpy(char *dst, const char *src)
{
800ed0: 55 push %rbp
800ed1: 48 89 e5 mov %rsp,%rbp
800ed4: 48 83 ec 20 sub $0x20,%rsp
800ed8: 48 89 7d e8 mov %rdi,-0x18(%rbp)
800edc: 48 89 75 e0 mov %rsi,-0x20(%rbp)
char *ret;
ret = dst;
800ee0: 48 8b 45 e8 mov -0x18(%rbp),%rax
800ee4: 48 89 45 f8 mov %rax,-0x8(%rbp)
while ((*dst++ = *src++) != '\0')
800ee8: 90 nop
800ee9: 48 8b 45 e8 mov -0x18(%rbp),%rax
800eed: 48 8d 50 01 lea 0x1(%rax),%rdx
800ef1: 48 89 55 e8 mov %rdx,-0x18(%rbp)
800ef5: 48 8b 55 e0 mov -0x20(%rbp),%rdx
800ef9: 48 8d 4a 01 lea 0x1(%rdx),%rcx
800efd: 48 89 4d e0 mov %rcx,-0x20(%rbp)
800f01: 0f b6 12 movzbl (%rdx),%edx
800f04: 88 10 mov %dl,(%rax)
800f06: 0f b6 00 movzbl (%rax),%eax
800f09: 84 c0 test %al,%al
800f0b: 75 dc jne 800ee9 <strcpy+0x19>
/* do nothing */;
return ret;
800f0d: 48 8b 45 f8 mov -0x8(%rbp),%rax
}
800f11: c9 leaveq
800f12: c3 retq
0000000000800f13 <strcat>:
char *
strcat(char *dst, const char *src)
{
800f13: 55 push %rbp
800f14: 48 89 e5 mov %rsp,%rbp
800f17: 48 83 ec 20 sub $0x20,%rsp
800f1b: 48 89 7d e8 mov %rdi,-0x18(%rbp)
800f1f: 48 89 75 e0 mov %rsi,-0x20(%rbp)
int len = strlen(dst);
800f23: 48 8b 45 e8 mov -0x18(%rbp),%rax
800f27: 48 89 c7 mov %rax,%rdi
800f2a: 48 b8 64 0e 80 00 00 movabs $0x800e64,%rax
800f31: 00 00 00
800f34: ff d0 callq *%rax
800f36: 89 45 fc mov %eax,-0x4(%rbp)
strcpy(dst + len, src);
800f39: 8b 45 fc mov -0x4(%rbp),%eax
800f3c: 48 63 d0 movslq %eax,%rdx
800f3f: 48 8b 45 e8 mov -0x18(%rbp),%rax
800f43: 48 01 c2 add %rax,%rdx
800f46: 48 8b 45 e0 mov -0x20(%rbp),%rax
800f4a: 48 89 c6 mov %rax,%rsi
800f4d: 48 89 d7 mov %rdx,%rdi
800f50: 48 b8 d0 0e 80 00 00 movabs $0x800ed0,%rax
800f57: 00 00 00
800f5a: ff d0 callq *%rax
return dst;
800f5c: 48 8b 45 e8 mov -0x18(%rbp),%rax
}
800f60: c9 leaveq
800f61: c3 retq
0000000000800f62 <strncpy>:
char *
strncpy(char *dst, const char *src, size_t size) {
800f62: 55 push %rbp
800f63: 48 89 e5 mov %rsp,%rbp
800f66: 48 83 ec 28 sub $0x28,%rsp
800f6a: 48 89 7d e8 mov %rdi,-0x18(%rbp)
800f6e: 48 89 75 e0 mov %rsi,-0x20(%rbp)
800f72: 48 89 55 d8 mov %rdx,-0x28(%rbp)
size_t i;
char *ret;
ret = dst;
800f76: 48 8b 45 e8 mov -0x18(%rbp),%rax
800f7a: 48 89 45 f0 mov %rax,-0x10(%rbp)
for (i = 0; i < size; i++) {
800f7e: 48 c7 45 f8 00 00 00 movq $0x0,-0x8(%rbp)
800f85: 00
800f86: eb 2a jmp 800fb2 <strncpy+0x50>
*dst++ = *src;
800f88: 48 8b 45 e8 mov -0x18(%rbp),%rax
800f8c: 48 8d 50 01 lea 0x1(%rax),%rdx
800f90: 48 89 55 e8 mov %rdx,-0x18(%rbp)
800f94: 48 8b 55 e0 mov -0x20(%rbp),%rdx
800f98: 0f b6 12 movzbl (%rdx),%edx
800f9b: 88 10 mov %dl,(%rax)
// If strlen(src) < size, null-pad 'dst' out to 'size' chars
if (*src != '\0')
800f9d: 48 8b 45 e0 mov -0x20(%rbp),%rax
800fa1: 0f b6 00 movzbl (%rax),%eax
800fa4: 84 c0 test %al,%al
800fa6: 74 05 je 800fad <strncpy+0x4b>
src++;
800fa8: 48 83 45 e0 01 addq $0x1,-0x20(%rbp)
strncpy(char *dst, const char *src, size_t size) {
size_t i;
char *ret;
ret = dst;
for (i = 0; i < size; i++) {
800fad: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
800fb2: 48 8b 45 f8 mov -0x8(%rbp),%rax
800fb6: 48 3b 45 d8 cmp -0x28(%rbp),%rax
800fba: 72 cc jb 800f88 <strncpy+0x26>
*dst++ = *src;
// If strlen(src) < size, null-pad 'dst' out to 'size' chars
if (*src != '\0')
src++;
}
return ret;
800fbc: 48 8b 45 f0 mov -0x10(%rbp),%rax
}
800fc0: c9 leaveq
800fc1: c3 retq
0000000000800fc2 <strlcpy>:
size_t
strlcpy(char *dst, const char *src, size_t size)
{
800fc2: 55 push %rbp
800fc3: 48 89 e5 mov %rsp,%rbp
800fc6: 48 83 ec 28 sub $0x28,%rsp
800fca: 48 89 7d e8 mov %rdi,-0x18(%rbp)
800fce: 48 89 75 e0 mov %rsi,-0x20(%rbp)
800fd2: 48 89 55 d8 mov %rdx,-0x28(%rbp)
char *dst_in;
dst_in = dst;
800fd6: 48 8b 45 e8 mov -0x18(%rbp),%rax
800fda: 48 89 45 f8 mov %rax,-0x8(%rbp)
if (size > 0) {
800fde: 48 83 7d d8 00 cmpq $0x0,-0x28(%rbp)
800fe3: 74 3d je 801022 <strlcpy+0x60>
while (--size > 0 && *src != '\0')
800fe5: eb 1d jmp 801004 <strlcpy+0x42>
*dst++ = *src++;
800fe7: 48 8b 45 e8 mov -0x18(%rbp),%rax
800feb: 48 8d 50 01 lea 0x1(%rax),%rdx
800fef: 48 89 55 e8 mov %rdx,-0x18(%rbp)
800ff3: 48 8b 55 e0 mov -0x20(%rbp),%rdx
800ff7: 48 8d 4a 01 lea 0x1(%rdx),%rcx
800ffb: 48 89 4d e0 mov %rcx,-0x20(%rbp)
800fff: 0f b6 12 movzbl (%rdx),%edx
801002: 88 10 mov %dl,(%rax)
{
char *dst_in;
dst_in = dst;
if (size > 0) {
while (--size > 0 && *src != '\0')
801004: 48 83 6d d8 01 subq $0x1,-0x28(%rbp)
801009: 48 83 7d d8 00 cmpq $0x0,-0x28(%rbp)
80100e: 74 0b je 80101b <strlcpy+0x59>
801010: 48 8b 45 e0 mov -0x20(%rbp),%rax
801014: 0f b6 00 movzbl (%rax),%eax
801017: 84 c0 test %al,%al
801019: 75 cc jne 800fe7 <strlcpy+0x25>
*dst++ = *src++;
*dst = '\0';
80101b: 48 8b 45 e8 mov -0x18(%rbp),%rax
80101f: c6 00 00 movb $0x0,(%rax)
}
return dst - dst_in;
801022: 48 8b 55 e8 mov -0x18(%rbp),%rdx
801026: 48 8b 45 f8 mov -0x8(%rbp),%rax
80102a: 48 29 c2 sub %rax,%rdx
80102d: 48 89 d0 mov %rdx,%rax
}
801030: c9 leaveq
801031: c3 retq
0000000000801032 <strcmp>:
int
strcmp(const char *p, const char *q)
{
801032: 55 push %rbp
801033: 48 89 e5 mov %rsp,%rbp
801036: 48 83 ec 10 sub $0x10,%rsp
80103a: 48 89 7d f8 mov %rdi,-0x8(%rbp)
80103e: 48 89 75 f0 mov %rsi,-0x10(%rbp)
while (*p && *p == *q)
801042: eb 0a jmp 80104e <strcmp+0x1c>
p++, q++;
801044: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
801049: 48 83 45 f0 01 addq $0x1,-0x10(%rbp)
}
int
strcmp(const char *p, const char *q)
{
while (*p && *p == *q)
80104e: 48 8b 45 f8 mov -0x8(%rbp),%rax
801052: 0f b6 00 movzbl (%rax),%eax
801055: 84 c0 test %al,%al
801057: 74 12 je 80106b <strcmp+0x39>
801059: 48 8b 45 f8 mov -0x8(%rbp),%rax
80105d: 0f b6 10 movzbl (%rax),%edx
801060: 48 8b 45 f0 mov -0x10(%rbp),%rax
801064: 0f b6 00 movzbl (%rax),%eax
801067: 38 c2 cmp %al,%dl
801069: 74 d9 je 801044 <strcmp+0x12>
p++, q++;
return (int) ((unsigned char) *p - (unsigned char) *q);
80106b: 48 8b 45 f8 mov -0x8(%rbp),%rax
80106f: 0f b6 00 movzbl (%rax),%eax
801072: 0f b6 d0 movzbl %al,%edx
801075: 48 8b 45 f0 mov -0x10(%rbp),%rax
801079: 0f b6 00 movzbl (%rax),%eax
80107c: 0f b6 c0 movzbl %al,%eax
80107f: 29 c2 sub %eax,%edx
801081: 89 d0 mov %edx,%eax
}
801083: c9 leaveq
801084: c3 retq
0000000000801085 <strncmp>:
int
strncmp(const char *p, const char *q, size_t n)
{
801085: 55 push %rbp
801086: 48 89 e5 mov %rsp,%rbp
801089: 48 83 ec 18 sub $0x18,%rsp
80108d: 48 89 7d f8 mov %rdi,-0x8(%rbp)
801091: 48 89 75 f0 mov %rsi,-0x10(%rbp)
801095: 48 89 55 e8 mov %rdx,-0x18(%rbp)
while (n > 0 && *p && *p == *q)
801099: eb 0f jmp 8010aa <strncmp+0x25>
n--, p++, q++;
80109b: 48 83 6d e8 01 subq $0x1,-0x18(%rbp)
8010a0: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
8010a5: 48 83 45 f0 01 addq $0x1,-0x10(%rbp)
}
int
strncmp(const char *p, const char *q, size_t n)
{
while (n > 0 && *p && *p == *q)
8010aa: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
8010af: 74 1d je 8010ce <strncmp+0x49>
8010b1: 48 8b 45 f8 mov -0x8(%rbp),%rax
8010b5: 0f b6 00 movzbl (%rax),%eax
8010b8: 84 c0 test %al,%al
8010ba: 74 12 je 8010ce <strncmp+0x49>
8010bc: 48 8b 45 f8 mov -0x8(%rbp),%rax
8010c0: 0f b6 10 movzbl (%rax),%edx
8010c3: 48 8b 45 f0 mov -0x10(%rbp),%rax
8010c7: 0f b6 00 movzbl (%rax),%eax
8010ca: 38 c2 cmp %al,%dl
8010cc: 74 cd je 80109b <strncmp+0x16>
n--, p++, q++;
if (n == 0)
8010ce: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
8010d3: 75 07 jne 8010dc <strncmp+0x57>
return 0;
8010d5: b8 00 00 00 00 mov $0x0,%eax
8010da: eb 18 jmp 8010f4 <strncmp+0x6f>
else
return (int) ((unsigned char) *p - (unsigned char) *q);
8010dc: 48 8b 45 f8 mov -0x8(%rbp),%rax
8010e0: 0f b6 00 movzbl (%rax),%eax
8010e3: 0f b6 d0 movzbl %al,%edx
8010e6: 48 8b 45 f0 mov -0x10(%rbp),%rax
8010ea: 0f b6 00 movzbl (%rax),%eax
8010ed: 0f b6 c0 movzbl %al,%eax
8010f0: 29 c2 sub %eax,%edx
8010f2: 89 d0 mov %edx,%eax
}
8010f4: c9 leaveq
8010f5: c3 retq
00000000008010f6 <strchr>:
// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
8010f6: 55 push %rbp
8010f7: 48 89 e5 mov %rsp,%rbp
8010fa: 48 83 ec 0c sub $0xc,%rsp
8010fe: 48 89 7d f8 mov %rdi,-0x8(%rbp)
801102: 89 f0 mov %esi,%eax
801104: 88 45 f4 mov %al,-0xc(%rbp)
for (; *s; s++)
801107: eb 17 jmp 801120 <strchr+0x2a>
if (*s == c)
801109: 48 8b 45 f8 mov -0x8(%rbp),%rax
80110d: 0f b6 00 movzbl (%rax),%eax
801110: 3a 45 f4 cmp -0xc(%rbp),%al
801113: 75 06 jne 80111b <strchr+0x25>
return (char *) s;
801115: 48 8b 45 f8 mov -0x8(%rbp),%rax
801119: eb 15 jmp 801130 <strchr+0x3a>
// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
for (; *s; s++)
80111b: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
801120: 48 8b 45 f8 mov -0x8(%rbp),%rax
801124: 0f b6 00 movzbl (%rax),%eax
801127: 84 c0 test %al,%al
801129: 75 de jne 801109 <strchr+0x13>
if (*s == c)
return (char *) s;
return 0;
80112b: b8 00 00 00 00 mov $0x0,%eax
}
801130: c9 leaveq
801131: c3 retq
0000000000801132 <strfind>:
// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
801132: 55 push %rbp
801133: 48 89 e5 mov %rsp,%rbp
801136: 48 83 ec 0c sub $0xc,%rsp
80113a: 48 89 7d f8 mov %rdi,-0x8(%rbp)
80113e: 89 f0 mov %esi,%eax
801140: 88 45 f4 mov %al,-0xc(%rbp)
for (; *s; s++)
801143: eb 13 jmp 801158 <strfind+0x26>
if (*s == c)
801145: 48 8b 45 f8 mov -0x8(%rbp),%rax
801149: 0f b6 00 movzbl (%rax),%eax
80114c: 3a 45 f4 cmp -0xc(%rbp),%al
80114f: 75 02 jne 801153 <strfind+0x21>
break;
801151: eb 10 jmp 801163 <strfind+0x31>
// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
for (; *s; s++)
801153: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
801158: 48 8b 45 f8 mov -0x8(%rbp),%rax
80115c: 0f b6 00 movzbl (%rax),%eax
80115f: 84 c0 test %al,%al
801161: 75 e2 jne 801145 <strfind+0x13>
if (*s == c)
break;
return (char *) s;
801163: 48 8b 45 f8 mov -0x8(%rbp),%rax
}
801167: c9 leaveq
801168: c3 retq
0000000000801169 <memset>:
#if ASM
void *
memset(void *v, int c, size_t n)
{
801169: 55 push %rbp
80116a: 48 89 e5 mov %rsp,%rbp
80116d: 48 83 ec 18 sub $0x18,%rsp
801171: 48 89 7d f8 mov %rdi,-0x8(%rbp)
801175: 89 75 f4 mov %esi,-0xc(%rbp)
801178: 48 89 55 e8 mov %rdx,-0x18(%rbp)
char *p;
if (n == 0)
80117c: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
801181: 75 06 jne 801189 <memset+0x20>
return v;
801183: 48 8b 45 f8 mov -0x8(%rbp),%rax
801187: eb 69 jmp 8011f2 <memset+0x89>
if ((int64_t)v%4 == 0 && n%4 == 0) {
801189: 48 8b 45 f8 mov -0x8(%rbp),%rax
80118d: 83 e0 03 and $0x3,%eax
801190: 48 85 c0 test %rax,%rax
801193: 75 48 jne 8011dd <memset+0x74>
801195: 48 8b 45 e8 mov -0x18(%rbp),%rax
801199: 83 e0 03 and $0x3,%eax
80119c: 48 85 c0 test %rax,%rax
80119f: 75 3c jne 8011dd <memset+0x74>
c &= 0xFF;
8011a1: 81 65 f4 ff 00 00 00 andl $0xff,-0xc(%rbp)
c = (c<<24)|(c<<16)|(c<<8)|c;
8011a8: 8b 45 f4 mov -0xc(%rbp),%eax
8011ab: c1 e0 18 shl $0x18,%eax
8011ae: 89 c2 mov %eax,%edx
8011b0: 8b 45 f4 mov -0xc(%rbp),%eax
8011b3: c1 e0 10 shl $0x10,%eax
8011b6: 09 c2 or %eax,%edx
8011b8: 8b 45 f4 mov -0xc(%rbp),%eax
8011bb: c1 e0 08 shl $0x8,%eax
8011be: 09 d0 or %edx,%eax
8011c0: 09 45 f4 or %eax,-0xc(%rbp)
asm volatile("cld; rep stosl\n"
:: "D" (v), "a" (c), "c" (n/4)
8011c3: 48 8b 45 e8 mov -0x18(%rbp),%rax
8011c7: 48 c1 e8 02 shr $0x2,%rax
8011cb: 48 89 c1 mov %rax,%rcx
if (n == 0)
return v;
if ((int64_t)v%4 == 0 && n%4 == 0) {
c &= 0xFF;
c = (c<<24)|(c<<16)|(c<<8)|c;
asm volatile("cld; rep stosl\n"
8011ce: 48 8b 55 f8 mov -0x8(%rbp),%rdx
8011d2: 8b 45 f4 mov -0xc(%rbp),%eax
8011d5: 48 89 d7 mov %rdx,%rdi
8011d8: fc cld
8011d9: f3 ab rep stos %eax,%es:(%rdi)
8011db: eb 11 jmp 8011ee <memset+0x85>
:: "D" (v), "a" (c), "c" (n/4)
: "cc", "memory");
} else
asm volatile("cld; rep stosb\n"
8011dd: 48 8b 55 f8 mov -0x8(%rbp),%rdx
8011e1: 8b 45 f4 mov -0xc(%rbp),%eax
8011e4: 48 8b 4d e8 mov -0x18(%rbp),%rcx
8011e8: 48 89 d7 mov %rdx,%rdi
8011eb: fc cld
8011ec: f3 aa rep stos %al,%es:(%rdi)
:: "D" (v), "a" (c), "c" (n)
: "cc", "memory");
return v;
8011ee: 48 8b 45 f8 mov -0x8(%rbp),%rax
}
8011f2: c9 leaveq
8011f3: c3 retq
00000000008011f4 <memmove>:
void *
memmove(void *dst, const void *src, size_t n)
{
8011f4: 55 push %rbp
8011f5: 48 89 e5 mov %rsp,%rbp
8011f8: 48 83 ec 28 sub $0x28,%rsp
8011fc: 48 89 7d e8 mov %rdi,-0x18(%rbp)
801200: 48 89 75 e0 mov %rsi,-0x20(%rbp)
801204: 48 89 55 d8 mov %rdx,-0x28(%rbp)
const char *s;
char *d;
s = src;
801208: 48 8b 45 e0 mov -0x20(%rbp),%rax
80120c: 48 89 45 f8 mov %rax,-0x8(%rbp)
d = dst;
801210: 48 8b 45 e8 mov -0x18(%rbp),%rax
801214: 48 89 45 f0 mov %rax,-0x10(%rbp)
if (s < d && s + n > d) {
801218: 48 8b 45 f8 mov -0x8(%rbp),%rax
80121c: 48 3b 45 f0 cmp -0x10(%rbp),%rax
801220: 0f 83 88 00 00 00 jae 8012ae <memmove+0xba>
801226: 48 8b 45 d8 mov -0x28(%rbp),%rax
80122a: 48 8b 55 f8 mov -0x8(%rbp),%rdx
80122e: 48 01 d0 add %rdx,%rax
801231: 48 3b 45 f0 cmp -0x10(%rbp),%rax
801235: 76 77 jbe 8012ae <memmove+0xba>
s += n;
801237: 48 8b 45 d8 mov -0x28(%rbp),%rax
80123b: 48 01 45 f8 add %rax,-0x8(%rbp)
d += n;
80123f: 48 8b 45 d8 mov -0x28(%rbp),%rax
801243: 48 01 45 f0 add %rax,-0x10(%rbp)
if ((int64_t)s%4 == 0 && (int64_t)d%4 == 0 && n%4 == 0)
801247: 48 8b 45 f8 mov -0x8(%rbp),%rax
80124b: 83 e0 03 and $0x3,%eax
80124e: 48 85 c0 test %rax,%rax
801251: 75 3b jne 80128e <memmove+0x9a>
801253: 48 8b 45 f0 mov -0x10(%rbp),%rax
801257: 83 e0 03 and $0x3,%eax
80125a: 48 85 c0 test %rax,%rax
80125d: 75 2f jne 80128e <memmove+0x9a>
80125f: 48 8b 45 d8 mov -0x28(%rbp),%rax
801263: 83 e0 03 and $0x3,%eax
801266: 48 85 c0 test %rax,%rax
801269: 75 23 jne 80128e <memmove+0x9a>
asm volatile("std; rep movsl\n"
:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
80126b: 48 8b 45 f0 mov -0x10(%rbp),%rax
80126f: 48 83 e8 04 sub $0x4,%rax
801273: 48 8b 55 f8 mov -0x8(%rbp),%rdx
801277: 48 83 ea 04 sub $0x4,%rdx
80127b: 48 8b 4d d8 mov -0x28(%rbp),%rcx
80127f: 48 c1 e9 02 shr $0x2,%rcx
d = dst;
if (s < d && s + n > d) {
s += n;
d += n;
if ((int64_t)s%4 == 0 && (int64_t)d%4 == 0 && n%4 == 0)
asm volatile("std; rep movsl\n"
801283: 48 89 c7 mov %rax,%rdi
801286: 48 89 d6 mov %rdx,%rsi
801289: fd std
80128a: f3 a5 rep movsl %ds:(%rsi),%es:(%rdi)
80128c: eb 1d jmp 8012ab <memmove+0xb7>
:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
else
asm volatile("std; rep movsb\n"
:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
80128e: 48 8b 45 f0 mov -0x10(%rbp),%rax
801292: 48 8d 50 ff lea -0x1(%rax),%rdx
801296: 48 8b 45 f8 mov -0x8(%rbp),%rax
80129a: 48 8d 70 ff lea -0x1(%rax),%rsi
d += n;
if ((int64_t)s%4 == 0 && (int64_t)d%4 == 0 && n%4 == 0)
asm volatile("std; rep movsl\n"
:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
else
asm volatile("std; rep movsb\n"
80129e: 48 8b 45 d8 mov -0x28(%rbp),%rax
8012a2: 48 89 d7 mov %rdx,%rdi
8012a5: 48 89 c1 mov %rax,%rcx
8012a8: fd std
8012a9: f3 a4 rep movsb %ds:(%rsi),%es:(%rdi)
:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
// Some versions of GCC rely on DF being clear
asm volatile("cld" ::: "cc");
8012ab: fc cld
8012ac: eb 57 jmp 801305 <memmove+0x111>
} else {
if ((int64_t)s%4 == 0 && (int64_t)d%4 == 0 && n%4 == 0)
8012ae: 48 8b 45 f8 mov -0x8(%rbp),%rax
8012b2: 83 e0 03 and $0x3,%eax
8012b5: 48 85 c0 test %rax,%rax
8012b8: 75 36 jne 8012f0 <memmove+0xfc>
8012ba: 48 8b 45 f0 mov -0x10(%rbp),%rax
8012be: 83 e0 03 and $0x3,%eax
8012c1: 48 85 c0 test %rax,%rax
8012c4: 75 2a jne 8012f0 <memmove+0xfc>
8012c6: 48 8b 45 d8 mov -0x28(%rbp),%rax
8012ca: 83 e0 03 and $0x3,%eax
8012cd: 48 85 c0 test %rax,%rax
8012d0: 75 1e jne 8012f0 <memmove+0xfc>
asm volatile("cld; rep movsl\n"
:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
8012d2: 48 8b 45 d8 mov -0x28(%rbp),%rax
8012d6: 48 c1 e8 02 shr $0x2,%rax
8012da: 48 89 c1 mov %rax,%rcx
:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
// Some versions of GCC rely on DF being clear
asm volatile("cld" ::: "cc");
} else {
if ((int64_t)s%4 == 0 && (int64_t)d%4 == 0 && n%4 == 0)
asm volatile("cld; rep movsl\n"
8012dd: 48 8b 45 f0 mov -0x10(%rbp),%rax
8012e1: 48 8b 55 f8 mov -0x8(%rbp),%rdx
8012e5: 48 89 c7 mov %rax,%rdi
8012e8: 48 89 d6 mov %rdx,%rsi
8012eb: fc cld
8012ec: f3 a5 rep movsl %ds:(%rsi),%es:(%rdi)
8012ee: eb 15 jmp 801305 <memmove+0x111>
:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
else
asm volatile("cld; rep movsb\n"
8012f0: 48 8b 45 f0 mov -0x10(%rbp),%rax
8012f4: 48 8b 55 f8 mov -0x8(%rbp),%rdx
8012f8: 48 8b 4d d8 mov -0x28(%rbp),%rcx
8012fc: 48 89 c7 mov %rax,%rdi
8012ff: 48 89 d6 mov %rdx,%rsi
801302: fc cld
801303: f3 a4 rep movsb %ds:(%rsi),%es:(%rdi)
:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
}
return dst;
801305: 48 8b 45 e8 mov -0x18(%rbp),%rax
}
801309: c9 leaveq
80130a: c3 retq
000000000080130b <memcpy>:
}
#endif
void *
memcpy(void *dst, const void *src, size_t n)
{
80130b: 55 push %rbp
80130c: 48 89 e5 mov %rsp,%rbp
80130f: 48 83 ec 18 sub $0x18,%rsp
801313: 48 89 7d f8 mov %rdi,-0x8(%rbp)
801317: 48 89 75 f0 mov %rsi,-0x10(%rbp)
80131b: 48 89 55 e8 mov %rdx,-0x18(%rbp)
return memmove(dst, src, n);
80131f: 48 8b 55 e8 mov -0x18(%rbp),%rdx
801323: 48 8b 4d f0 mov -0x10(%rbp),%rcx
801327: 48 8b 45 f8 mov -0x8(%rbp),%rax
80132b: 48 89 ce mov %rcx,%rsi
80132e: 48 89 c7 mov %rax,%rdi
801331: 48 b8 f4 11 80 00 00 movabs $0x8011f4,%rax
801338: 00 00 00
80133b: ff d0 callq *%rax
}
80133d: c9 leaveq
80133e: c3 retq
000000000080133f <memcmp>:
int
memcmp(const void *v1, const void *v2, size_t n)
{
80133f: 55 push %rbp
801340: 48 89 e5 mov %rsp,%rbp
801343: 48 83 ec 28 sub $0x28,%rsp
801347: 48 89 7d e8 mov %rdi,-0x18(%rbp)
80134b: 48 89 75 e0 mov %rsi,-0x20(%rbp)
80134f: 48 89 55 d8 mov %rdx,-0x28(%rbp)
const uint8_t *s1 = (const uint8_t *) v1;
801353: 48 8b 45 e8 mov -0x18(%rbp),%rax
801357: 48 89 45 f8 mov %rax,-0x8(%rbp)
const uint8_t *s2 = (const uint8_t *) v2;
80135b: 48 8b 45 e0 mov -0x20(%rbp),%rax
80135f: 48 89 45 f0 mov %rax,-0x10(%rbp)
while (n-- > 0) {
801363: eb 36 jmp 80139b <memcmp+0x5c>
if (*s1 != *s2)
801365: 48 8b 45 f8 mov -0x8(%rbp),%rax
801369: 0f b6 10 movzbl (%rax),%edx
80136c: 48 8b 45 f0 mov -0x10(%rbp),%rax
801370: 0f b6 00 movzbl (%rax),%eax
801373: 38 c2 cmp %al,%dl
801375: 74 1a je 801391 <memcmp+0x52>
return (int) *s1 - (int) *s2;
801377: 48 8b 45 f8 mov -0x8(%rbp),%rax
80137b: 0f b6 00 movzbl (%rax),%eax
80137e: 0f b6 d0 movzbl %al,%edx
801381: 48 8b 45 f0 mov -0x10(%rbp),%rax
801385: 0f b6 00 movzbl (%rax),%eax
801388: 0f b6 c0 movzbl %al,%eax
80138b: 29 c2 sub %eax,%edx
80138d: 89 d0 mov %edx,%eax
80138f: eb 20 jmp 8013b1 <memcmp+0x72>
s1++, s2++;
801391: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
801396: 48 83 45 f0 01 addq $0x1,-0x10(%rbp)
memcmp(const void *v1, const void *v2, size_t n)
{
const uint8_t *s1 = (const uint8_t *) v1;
const uint8_t *s2 = (const uint8_t *) v2;
while (n-- > 0) {
80139b: 48 8b 45 d8 mov -0x28(%rbp),%rax
80139f: 48 8d 50 ff lea -0x1(%rax),%rdx
8013a3: 48 89 55 d8 mov %rdx,-0x28(%rbp)
8013a7: 48 85 c0 test %rax,%rax
8013aa: 75 b9 jne 801365 <memcmp+0x26>
if (*s1 != *s2)
return (int) *s1 - (int) *s2;
s1++, s2++;
}
return 0;
8013ac: b8 00 00 00 00 mov $0x0,%eax
}
8013b1: c9 leaveq
8013b2: c3 retq
00000000008013b3 <memfind>:
void *
memfind(const void *s, int c, size_t n)
{
8013b3: 55 push %rbp
8013b4: 48 89 e5 mov %rsp,%rbp
8013b7: 48 83 ec 28 sub $0x28,%rsp
8013bb: 48 89 7d e8 mov %rdi,-0x18(%rbp)
8013bf: 89 75 e4 mov %esi,-0x1c(%rbp)
8013c2: 48 89 55 d8 mov %rdx,-0x28(%rbp)
const void *ends = (const char *) s + n;
8013c6: 48 8b 45 d8 mov -0x28(%rbp),%rax
8013ca: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8013ce: 48 01 d0 add %rdx,%rax
8013d1: 48 89 45 f8 mov %rax,-0x8(%rbp)
for (; s < ends; s++)
8013d5: eb 15 jmp 8013ec <memfind+0x39>
if (*(const unsigned char *) s == (unsigned char) c)
8013d7: 48 8b 45 e8 mov -0x18(%rbp),%rax
8013db: 0f b6 10 movzbl (%rax),%edx
8013de: 8b 45 e4 mov -0x1c(%rbp),%eax
8013e1: 38 c2 cmp %al,%dl
8013e3: 75 02 jne 8013e7 <memfind+0x34>
break;
8013e5: eb 0f jmp 8013f6 <memfind+0x43>
void *
memfind(const void *s, int c, size_t n)
{
const void *ends = (const char *) s + n;
for (; s < ends; s++)
8013e7: 48 83 45 e8 01 addq $0x1,-0x18(%rbp)
8013ec: 48 8b 45 e8 mov -0x18(%rbp),%rax
8013f0: 48 3b 45 f8 cmp -0x8(%rbp),%rax
8013f4: 72 e1 jb 8013d7 <memfind+0x24>
if (*(const unsigned char *) s == (unsigned char) c)
break;
return (void *) s;
8013f6: 48 8b 45 e8 mov -0x18(%rbp),%rax
}
8013fa: c9 leaveq
8013fb: c3 retq
00000000008013fc <strtol>:
long
strtol(const char *s, char **endptr, int base)
{
8013fc: 55 push %rbp
8013fd: 48 89 e5 mov %rsp,%rbp
801400: 48 83 ec 34 sub $0x34,%rsp
801404: 48 89 7d d8 mov %rdi,-0x28(%rbp)
801408: 48 89 75 d0 mov %rsi,-0x30(%rbp)
80140c: 89 55 cc mov %edx,-0x34(%rbp)
int neg = 0;
80140f: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
long val = 0;
801416: 48 c7 45 f0 00 00 00 movq $0x0,-0x10(%rbp)
80141d: 00
// gobble initial whitespace
while (*s == ' ' || *s == '\t')
80141e: eb 05 jmp 801425 <strtol+0x29>
s++;
801420: 48 83 45 d8 01 addq $0x1,-0x28(%rbp)
{
int neg = 0;
long val = 0;
// gobble initial whitespace
while (*s == ' ' || *s == '\t')
801425: 48 8b 45 d8 mov -0x28(%rbp),%rax
801429: 0f b6 00 movzbl (%rax),%eax
80142c: 3c 20 cmp $0x20,%al
80142e: 74 f0 je 801420 <strtol+0x24>
801430: 48 8b 45 d8 mov -0x28(%rbp),%rax
801434: 0f b6 00 movzbl (%rax),%eax
801437: 3c 09 cmp $0x9,%al
801439: 74 e5 je 801420 <strtol+0x24>
s++;
// plus/minus sign
if (*s == '+')
80143b: 48 8b 45 d8 mov -0x28(%rbp),%rax
80143f: 0f b6 00 movzbl (%rax),%eax
801442: 3c 2b cmp $0x2b,%al
801444: 75 07 jne 80144d <strtol+0x51>
s++;
801446: 48 83 45 d8 01 addq $0x1,-0x28(%rbp)
80144b: eb 17 jmp 801464 <strtol+0x68>
else if (*s == '-')
80144d: 48 8b 45 d8 mov -0x28(%rbp),%rax
801451: 0f b6 00 movzbl (%rax),%eax
801454: 3c 2d cmp $0x2d,%al
801456: 75 0c jne 801464 <strtol+0x68>
s++, neg = 1;
801458: 48 83 45 d8 01 addq $0x1,-0x28(%rbp)
80145d: c7 45 fc 01 00 00 00 movl $0x1,-0x4(%rbp)
// hex or octal base prefix
if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
801464: 83 7d cc 00 cmpl $0x0,-0x34(%rbp)
801468: 74 06 je 801470 <strtol+0x74>
80146a: 83 7d cc 10 cmpl $0x10,-0x34(%rbp)
80146e: 75 28 jne 801498 <strtol+0x9c>
801470: 48 8b 45 d8 mov -0x28(%rbp),%rax
801474: 0f b6 00 movzbl (%rax),%eax
801477: 3c 30 cmp $0x30,%al
801479: 75 1d jne 801498 <strtol+0x9c>
80147b: 48 8b 45 d8 mov -0x28(%rbp),%rax
80147f: 48 83 c0 01 add $0x1,%rax
801483: 0f b6 00 movzbl (%rax),%eax
801486: 3c 78 cmp $0x78,%al
801488: 75 0e jne 801498 <strtol+0x9c>
s += 2, base = 16;
80148a: 48 83 45 d8 02 addq $0x2,-0x28(%rbp)
80148f: c7 45 cc 10 00 00 00 movl $0x10,-0x34(%rbp)
801496: eb 2c jmp 8014c4 <strtol+0xc8>
else if (base == 0 && s[0] == '0')
801498: 83 7d cc 00 cmpl $0x0,-0x34(%rbp)
80149c: 75 19 jne 8014b7 <strtol+0xbb>
80149e: 48 8b 45 d8 mov -0x28(%rbp),%rax
8014a2: 0f b6 00 movzbl (%rax),%eax
8014a5: 3c 30 cmp $0x30,%al
8014a7: 75 0e jne 8014b7 <strtol+0xbb>
s++, base = 8;
8014a9: 48 83 45 d8 01 addq $0x1,-0x28(%rbp)
8014ae: c7 45 cc 08 00 00 00 movl $0x8,-0x34(%rbp)
8014b5: eb 0d jmp 8014c4 <strtol+0xc8>
else if (base == 0)
8014b7: 83 7d cc 00 cmpl $0x0,-0x34(%rbp)
8014bb: 75 07 jne 8014c4 <strtol+0xc8>
base = 10;
8014bd: c7 45 cc 0a 00 00 00 movl $0xa,-0x34(%rbp)
// digits
while (1) {
int dig;
if (*s >= '0' && *s <= '9')
8014c4: 48 8b 45 d8 mov -0x28(%rbp),%rax
8014c8: 0f b6 00 movzbl (%rax),%eax
8014cb: 3c 2f cmp $0x2f,%al
8014cd: 7e 1d jle 8014ec <strtol+0xf0>
8014cf: 48 8b 45 d8 mov -0x28(%rbp),%rax
8014d3: 0f b6 00 movzbl (%rax),%eax
8014d6: 3c 39 cmp $0x39,%al
8014d8: 7f 12 jg 8014ec <strtol+0xf0>
dig = *s - '0';
8014da: 48 8b 45 d8 mov -0x28(%rbp),%rax
8014de: 0f b6 00 movzbl (%rax),%eax
8014e1: 0f be c0 movsbl %al,%eax
8014e4: 83 e8 30 sub $0x30,%eax
8014e7: 89 45 ec mov %eax,-0x14(%rbp)
8014ea: eb 4e jmp 80153a <strtol+0x13e>
else if (*s >= 'a' && *s <= 'z')
8014ec: 48 8b 45 d8 mov -0x28(%rbp),%rax
8014f0: 0f b6 00 movzbl (%rax),%eax
8014f3: 3c 60 cmp $0x60,%al
8014f5: 7e 1d jle 801514 <strtol+0x118>
8014f7: 48 8b 45 d8 mov -0x28(%rbp),%rax
8014fb: 0f b6 00 movzbl (%rax),%eax
8014fe: 3c 7a cmp $0x7a,%al
801500: 7f 12 jg 801514 <strtol+0x118>
dig = *s - 'a' + 10;
801502: 48 8b 45 d8 mov -0x28(%rbp),%rax
801506: 0f b6 00 movzbl (%rax),%eax
801509: 0f be c0 movsbl %al,%eax
80150c: 83 e8 57 sub $0x57,%eax
80150f: 89 45 ec mov %eax,-0x14(%rbp)
801512: eb 26 jmp 80153a <strtol+0x13e>
else if (*s >= 'A' && *s <= 'Z')
801514: 48 8b 45 d8 mov -0x28(%rbp),%rax
801518: 0f b6 00 movzbl (%rax),%eax
80151b: 3c 40 cmp $0x40,%al
80151d: 7e 48 jle 801567 <strtol+0x16b>
80151f: 48 8b 45 d8 mov -0x28(%rbp),%rax
801523: 0f b6 00 movzbl (%rax),%eax
801526: 3c 5a cmp $0x5a,%al
801528: 7f 3d jg 801567 <strtol+0x16b>
dig = *s - 'A' + 10;
80152a: 48 8b 45 d8 mov -0x28(%rbp),%rax
80152e: 0f b6 00 movzbl (%rax),%eax
801531: 0f be c0 movsbl %al,%eax
801534: 83 e8 37 sub $0x37,%eax
801537: 89 45 ec mov %eax,-0x14(%rbp)
else
break;
if (dig >= base)
80153a: 8b 45 ec mov -0x14(%rbp),%eax
80153d: 3b 45 cc cmp -0x34(%rbp),%eax
801540: 7c 02 jl 801544 <strtol+0x148>
break;
801542: eb 23 jmp 801567 <strtol+0x16b>
s++, val = (val * base) + dig;
801544: 48 83 45 d8 01 addq $0x1,-0x28(%rbp)
801549: 8b 45 cc mov -0x34(%rbp),%eax
80154c: 48 98 cltq
80154e: 48 0f af 45 f0 imul -0x10(%rbp),%rax
801553: 48 89 c2 mov %rax,%rdx
801556: 8b 45 ec mov -0x14(%rbp),%eax
801559: 48 98 cltq
80155b: 48 01 d0 add %rdx,%rax
80155e: 48 89 45 f0 mov %rax,-0x10(%rbp)
// we don't properly detect overflow!
}
801562: e9 5d ff ff ff jmpq 8014c4 <strtol+0xc8>
if (endptr)
801567: 48 83 7d d0 00 cmpq $0x0,-0x30(%rbp)
80156c: 74 0b je 801579 <strtol+0x17d>
*endptr = (char *) s;
80156e: 48 8b 45 d0 mov -0x30(%rbp),%rax
801572: 48 8b 55 d8 mov -0x28(%rbp),%rdx
801576: 48 89 10 mov %rdx,(%rax)
return (neg ? -val : val);
801579: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
80157d: 74 09 je 801588 <strtol+0x18c>
80157f: 48 8b 45 f0 mov -0x10(%rbp),%rax
801583: 48 f7 d8 neg %rax
801586: eb 04 jmp 80158c <strtol+0x190>
801588: 48 8b 45 f0 mov -0x10(%rbp),%rax
}
80158c: c9 leaveq
80158d: c3 retq
000000000080158e <strstr>:
char * strstr(const char *in, const char *str)
{
80158e: 55 push %rbp
80158f: 48 89 e5 mov %rsp,%rbp
801592: 48 83 ec 30 sub $0x30,%rsp
801596: 48 89 7d d8 mov %rdi,-0x28(%rbp)
80159a: 48 89 75 d0 mov %rsi,-0x30(%rbp)
char c;
size_t len;
c = *str++;
80159e: 48 8b 45 d0 mov -0x30(%rbp),%rax
8015a2: 48 8d 50 01 lea 0x1(%rax),%rdx
8015a6: 48 89 55 d0 mov %rdx,-0x30(%rbp)
8015aa: 0f b6 00 movzbl (%rax),%eax
8015ad: 88 45 ff mov %al,-0x1(%rbp)
if (!c)
8015b0: 80 7d ff 00 cmpb $0x0,-0x1(%rbp)
8015b4: 75 06 jne 8015bc <strstr+0x2e>
return (char *) in; // Trivial empty string case
8015b6: 48 8b 45 d8 mov -0x28(%rbp),%rax
8015ba: eb 6b jmp 801627 <strstr+0x99>
len = strlen(str);
8015bc: 48 8b 45 d0 mov -0x30(%rbp),%rax
8015c0: 48 89 c7 mov %rax,%rdi
8015c3: 48 b8 64 0e 80 00 00 movabs $0x800e64,%rax
8015ca: 00 00 00
8015cd: ff d0 callq *%rax
8015cf: 48 98 cltq
8015d1: 48 89 45 f0 mov %rax,-0x10(%rbp)
do {
char sc;
do {
sc = *in++;
8015d5: 48 8b 45 d8 mov -0x28(%rbp),%rax
8015d9: 48 8d 50 01 lea 0x1(%rax),%rdx
8015dd: 48 89 55 d8 mov %rdx,-0x28(%rbp)
8015e1: 0f b6 00 movzbl (%rax),%eax
8015e4: 88 45 ef mov %al,-0x11(%rbp)
if (!sc)
8015e7: 80 7d ef 00 cmpb $0x0,-0x11(%rbp)
8015eb: 75 07 jne 8015f4 <strstr+0x66>
return (char *) 0;
8015ed: b8 00 00 00 00 mov $0x0,%eax
8015f2: eb 33 jmp 801627 <strstr+0x99>
} while (sc != c);
8015f4: 0f b6 45 ef movzbl -0x11(%rbp),%eax
8015f8: 3a 45 ff cmp -0x1(%rbp),%al
8015fb: 75 d8 jne 8015d5 <strstr+0x47>
} while (strncmp(in, str, len) != 0);
8015fd: 48 8b 55 f0 mov -0x10(%rbp),%rdx
801601: 48 8b 4d d0 mov -0x30(%rbp),%rcx
801605: 48 8b 45 d8 mov -0x28(%rbp),%rax
801609: 48 89 ce mov %rcx,%rsi
80160c: 48 89 c7 mov %rax,%rdi
80160f: 48 b8 85 10 80 00 00 movabs $0x801085,%rax
801616: 00 00 00
801619: ff d0 callq *%rax
80161b: 85 c0 test %eax,%eax
80161d: 75 b6 jne 8015d5 <strstr+0x47>
return (char *) (in - 1);
80161f: 48 8b 45 d8 mov -0x28(%rbp),%rax
801623: 48 83 e8 01 sub $0x1,%rax
}
801627: c9 leaveq
801628: c3 retq
0000000000801629 <syscall>:
#include <inc/syscall.h>
#include <inc/lib.h>
static inline int64_t
syscall(int num, int check, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5)
{
801629: 55 push %rbp
80162a: 48 89 e5 mov %rsp,%rbp
80162d: 53 push %rbx
80162e: 48 83 ec 48 sub $0x48,%rsp
801632: 89 7d dc mov %edi,-0x24(%rbp)
801635: 89 75 d8 mov %esi,-0x28(%rbp)
801638: 48 89 55 d0 mov %rdx,-0x30(%rbp)
80163c: 48 89 4d c8 mov %rcx,-0x38(%rbp)
801640: 4c 89 45 c0 mov %r8,-0x40(%rbp)
801644: 4c 89 4d b8 mov %r9,-0x48(%rbp)
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
801648: 8b 45 dc mov -0x24(%rbp),%eax
80164b: 48 8b 55 d0 mov -0x30(%rbp),%rdx
80164f: 48 8b 4d c8 mov -0x38(%rbp),%rcx
801653: 4c 8b 45 c0 mov -0x40(%rbp),%r8
801657: 48 8b 7d b8 mov -0x48(%rbp),%rdi
80165b: 48 8b 75 10 mov 0x10(%rbp),%rsi
80165f: 4c 89 c3 mov %r8,%rbx
801662: cd 30 int $0x30
801664: 48 89 45 e8 mov %rax,-0x18(%rbp)
"b" (a3),
"D" (a4),
"S" (a5)
: "cc", "memory");
if(check && ret > 0)
801668: 83 7d d8 00 cmpl $0x0,-0x28(%rbp)
80166c: 74 3e je 8016ac <syscall+0x83>
80166e: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
801673: 7e 37 jle 8016ac <syscall+0x83>
panic("syscall %d returned %d (> 0)", num, ret);
801675: 48 8b 55 e8 mov -0x18(%rbp),%rdx
801679: 8b 45 dc mov -0x24(%rbp),%eax
80167c: 49 89 d0 mov %rdx,%r8
80167f: 89 c1 mov %eax,%ecx
801681: 48 ba e0 41 80 00 00 movabs $0x8041e0,%rdx
801688: 00 00 00
80168b: be 23 00 00 00 mov $0x23,%esi
801690: 48 bf fd 41 80 00 00 movabs $0x8041fd,%rdi
801697: 00 00 00
80169a: b8 00 00 00 00 mov $0x0,%eax
80169f: 49 b9 ab 37 80 00 00 movabs $0x8037ab,%r9
8016a6: 00 00 00
8016a9: 41 ff d1 callq *%r9
return ret;
8016ac: 48 8b 45 e8 mov -0x18(%rbp),%rax
}
8016b0: 48 83 c4 48 add $0x48,%rsp
8016b4: 5b pop %rbx
8016b5: 5d pop %rbp
8016b6: c3 retq
00000000008016b7 <sys_cputs>:
void
sys_cputs(const char *s, size_t len)
{
8016b7: 55 push %rbp
8016b8: 48 89 e5 mov %rsp,%rbp
8016bb: 48 83 ec 20 sub $0x20,%rsp
8016bf: 48 89 7d f8 mov %rdi,-0x8(%rbp)
8016c3: 48 89 75 f0 mov %rsi,-0x10(%rbp)
syscall(SYS_cputs, 0, (uint64_t)s, len, 0, 0, 0);
8016c7: 48 8b 45 f8 mov -0x8(%rbp),%rax
8016cb: 48 8b 55 f0 mov -0x10(%rbp),%rdx
8016cf: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
8016d6: 00
8016d7: 41 b9 00 00 00 00 mov $0x0,%r9d
8016dd: 41 b8 00 00 00 00 mov $0x0,%r8d
8016e3: 48 89 d1 mov %rdx,%rcx
8016e6: 48 89 c2 mov %rax,%rdx
8016e9: be 00 00 00 00 mov $0x0,%esi
8016ee: bf 00 00 00 00 mov $0x0,%edi
8016f3: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
8016fa: 00 00 00
8016fd: ff d0 callq *%rax
}
8016ff: c9 leaveq
801700: c3 retq
0000000000801701 <sys_cgetc>:
int
sys_cgetc(void)
{
801701: 55 push %rbp
801702: 48 89 e5 mov %rsp,%rbp
801705: 48 83 ec 10 sub $0x10,%rsp
return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
801709: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
801710: 00
801711: 41 b9 00 00 00 00 mov $0x0,%r9d
801717: 41 b8 00 00 00 00 mov $0x0,%r8d
80171d: b9 00 00 00 00 mov $0x0,%ecx
801722: ba 00 00 00 00 mov $0x0,%edx
801727: be 00 00 00 00 mov $0x0,%esi
80172c: bf 01 00 00 00 mov $0x1,%edi
801731: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
801738: 00 00 00
80173b: ff d0 callq *%rax
}
80173d: c9 leaveq
80173e: c3 retq
000000000080173f <sys_env_destroy>:
int
sys_env_destroy(envid_t envid)
{
80173f: 55 push %rbp
801740: 48 89 e5 mov %rsp,%rbp
801743: 48 83 ec 10 sub $0x10,%rsp
801747: 89 7d fc mov %edi,-0x4(%rbp)
return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
80174a: 8b 45 fc mov -0x4(%rbp),%eax
80174d: 48 98 cltq
80174f: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
801756: 00
801757: 41 b9 00 00 00 00 mov $0x0,%r9d
80175d: 41 b8 00 00 00 00 mov $0x0,%r8d
801763: b9 00 00 00 00 mov $0x0,%ecx
801768: 48 89 c2 mov %rax,%rdx
80176b: be 01 00 00 00 mov $0x1,%esi
801770: bf 03 00 00 00 mov $0x3,%edi
801775: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
80177c: 00 00 00
80177f: ff d0 callq *%rax
}
801781: c9 leaveq
801782: c3 retq
0000000000801783 <sys_getenvid>:
envid_t
sys_getenvid(void)
{
801783: 55 push %rbp
801784: 48 89 e5 mov %rsp,%rbp
801787: 48 83 ec 10 sub $0x10,%rsp
return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
80178b: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
801792: 00
801793: 41 b9 00 00 00 00 mov $0x0,%r9d
801799: 41 b8 00 00 00 00 mov $0x0,%r8d
80179f: b9 00 00 00 00 mov $0x0,%ecx
8017a4: ba 00 00 00 00 mov $0x0,%edx
8017a9: be 00 00 00 00 mov $0x0,%esi
8017ae: bf 02 00 00 00 mov $0x2,%edi
8017b3: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
8017ba: 00 00 00
8017bd: ff d0 callq *%rax
}
8017bf: c9 leaveq
8017c0: c3 retq
00000000008017c1 <sys_yield>:
void
sys_yield(void)
{
8017c1: 55 push %rbp
8017c2: 48 89 e5 mov %rsp,%rbp
8017c5: 48 83 ec 10 sub $0x10,%rsp
syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
8017c9: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
8017d0: 00
8017d1: 41 b9 00 00 00 00 mov $0x0,%r9d
8017d7: 41 b8 00 00 00 00 mov $0x0,%r8d
8017dd: b9 00 00 00 00 mov $0x0,%ecx
8017e2: ba 00 00 00 00 mov $0x0,%edx
8017e7: be 00 00 00 00 mov $0x0,%esi
8017ec: bf 0b 00 00 00 mov $0xb,%edi
8017f1: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
8017f8: 00 00 00
8017fb: ff d0 callq *%rax
}
8017fd: c9 leaveq
8017fe: c3 retq
00000000008017ff <sys_page_alloc>:
int
sys_page_alloc(envid_t envid, void *va, int perm)
{
8017ff: 55 push %rbp
801800: 48 89 e5 mov %rsp,%rbp
801803: 48 83 ec 20 sub $0x20,%rsp
801807: 89 7d fc mov %edi,-0x4(%rbp)
80180a: 48 89 75 f0 mov %rsi,-0x10(%rbp)
80180e: 89 55 f8 mov %edx,-0x8(%rbp)
return syscall(SYS_page_alloc, 1, envid, (uint64_t) va, perm, 0, 0);
801811: 8b 45 f8 mov -0x8(%rbp),%eax
801814: 48 63 c8 movslq %eax,%rcx
801817: 48 8b 55 f0 mov -0x10(%rbp),%rdx
80181b: 8b 45 fc mov -0x4(%rbp),%eax
80181e: 48 98 cltq
801820: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
801827: 00
801828: 41 b9 00 00 00 00 mov $0x0,%r9d
80182e: 49 89 c8 mov %rcx,%r8
801831: 48 89 d1 mov %rdx,%rcx
801834: 48 89 c2 mov %rax,%rdx
801837: be 01 00 00 00 mov $0x1,%esi
80183c: bf 04 00 00 00 mov $0x4,%edi
801841: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
801848: 00 00 00
80184b: ff d0 callq *%rax
}
80184d: c9 leaveq
80184e: c3 retq
000000000080184f <sys_page_map>:
int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
80184f: 55 push %rbp
801850: 48 89 e5 mov %rsp,%rbp
801853: 48 83 ec 30 sub $0x30,%rsp
801857: 89 7d fc mov %edi,-0x4(%rbp)
80185a: 48 89 75 f0 mov %rsi,-0x10(%rbp)
80185e: 89 55 f8 mov %edx,-0x8(%rbp)
801861: 48 89 4d e8 mov %rcx,-0x18(%rbp)
801865: 44 89 45 e4 mov %r8d,-0x1c(%rbp)
return syscall(SYS_page_map, 1, srcenv, (uint64_t) srcva, dstenv, (uint64_t) dstva, perm);
801869: 8b 45 e4 mov -0x1c(%rbp),%eax
80186c: 48 63 c8 movslq %eax,%rcx
80186f: 48 8b 7d e8 mov -0x18(%rbp),%rdi
801873: 8b 45 f8 mov -0x8(%rbp),%eax
801876: 48 63 f0 movslq %eax,%rsi
801879: 48 8b 55 f0 mov -0x10(%rbp),%rdx
80187d: 8b 45 fc mov -0x4(%rbp),%eax
801880: 48 98 cltq
801882: 48 89 0c 24 mov %rcx,(%rsp)
801886: 49 89 f9 mov %rdi,%r9
801889: 49 89 f0 mov %rsi,%r8
80188c: 48 89 d1 mov %rdx,%rcx
80188f: 48 89 c2 mov %rax,%rdx
801892: be 01 00 00 00 mov $0x1,%esi
801897: bf 05 00 00 00 mov $0x5,%edi
80189c: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
8018a3: 00 00 00
8018a6: ff d0 callq *%rax
}
8018a8: c9 leaveq
8018a9: c3 retq
00000000008018aa <sys_page_unmap>:
int
sys_page_unmap(envid_t envid, void *va)
{
8018aa: 55 push %rbp
8018ab: 48 89 e5 mov %rsp,%rbp
8018ae: 48 83 ec 20 sub $0x20,%rsp
8018b2: 89 7d fc mov %edi,-0x4(%rbp)
8018b5: 48 89 75 f0 mov %rsi,-0x10(%rbp)
return syscall(SYS_page_unmap, 1, envid, (uint64_t) va, 0, 0, 0);
8018b9: 48 8b 55 f0 mov -0x10(%rbp),%rdx
8018bd: 8b 45 fc mov -0x4(%rbp),%eax
8018c0: 48 98 cltq
8018c2: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
8018c9: 00
8018ca: 41 b9 00 00 00 00 mov $0x0,%r9d
8018d0: 41 b8 00 00 00 00 mov $0x0,%r8d
8018d6: 48 89 d1 mov %rdx,%rcx
8018d9: 48 89 c2 mov %rax,%rdx
8018dc: be 01 00 00 00 mov $0x1,%esi
8018e1: bf 06 00 00 00 mov $0x6,%edi
8018e6: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
8018ed: 00 00 00
8018f0: ff d0 callq *%rax
}
8018f2: c9 leaveq
8018f3: c3 retq
00000000008018f4 <sys_env_set_status>:
// sys_exofork is inlined in lib.h
int
sys_env_set_status(envid_t envid, int status)
{
8018f4: 55 push %rbp
8018f5: 48 89 e5 mov %rsp,%rbp
8018f8: 48 83 ec 10 sub $0x10,%rsp
8018fc: 89 7d fc mov %edi,-0x4(%rbp)
8018ff: 89 75 f8 mov %esi,-0x8(%rbp)
return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
801902: 8b 45 f8 mov -0x8(%rbp),%eax
801905: 48 63 d0 movslq %eax,%rdx
801908: 8b 45 fc mov -0x4(%rbp),%eax
80190b: 48 98 cltq
80190d: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
801914: 00
801915: 41 b9 00 00 00 00 mov $0x0,%r9d
80191b: 41 b8 00 00 00 00 mov $0x0,%r8d
801921: 48 89 d1 mov %rdx,%rcx
801924: 48 89 c2 mov %rax,%rdx
801927: be 01 00 00 00 mov $0x1,%esi
80192c: bf 08 00 00 00 mov $0x8,%edi
801931: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
801938: 00 00 00
80193b: ff d0 callq *%rax
}
80193d: c9 leaveq
80193e: c3 retq
000000000080193f <sys_env_set_trapframe>:
int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
80193f: 55 push %rbp
801940: 48 89 e5 mov %rsp,%rbp
801943: 48 83 ec 20 sub $0x20,%rsp
801947: 89 7d fc mov %edi,-0x4(%rbp)
80194a: 48 89 75 f0 mov %rsi,-0x10(%rbp)
return syscall(SYS_env_set_trapframe, 1, envid, (uint64_t) tf, 0, 0, 0);
80194e: 48 8b 55 f0 mov -0x10(%rbp),%rdx
801952: 8b 45 fc mov -0x4(%rbp),%eax
801955: 48 98 cltq
801957: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
80195e: 00
80195f: 41 b9 00 00 00 00 mov $0x0,%r9d
801965: 41 b8 00 00 00 00 mov $0x0,%r8d
80196b: 48 89 d1 mov %rdx,%rcx
80196e: 48 89 c2 mov %rax,%rdx
801971: be 01 00 00 00 mov $0x1,%esi
801976: bf 09 00 00 00 mov $0x9,%edi
80197b: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
801982: 00 00 00
801985: ff d0 callq *%rax
}
801987: c9 leaveq
801988: c3 retq
0000000000801989 <sys_env_set_pgfault_upcall>:
int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
801989: 55 push %rbp
80198a: 48 89 e5 mov %rsp,%rbp
80198d: 48 83 ec 20 sub $0x20,%rsp
801991: 89 7d fc mov %edi,-0x4(%rbp)
801994: 48 89 75 f0 mov %rsi,-0x10(%rbp)
return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint64_t) upcall, 0, 0, 0);
801998: 48 8b 55 f0 mov -0x10(%rbp),%rdx
80199c: 8b 45 fc mov -0x4(%rbp),%eax
80199f: 48 98 cltq
8019a1: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
8019a8: 00
8019a9: 41 b9 00 00 00 00 mov $0x0,%r9d
8019af: 41 b8 00 00 00 00 mov $0x0,%r8d
8019b5: 48 89 d1 mov %rdx,%rcx
8019b8: 48 89 c2 mov %rax,%rdx
8019bb: be 01 00 00 00 mov $0x1,%esi
8019c0: bf 0a 00 00 00 mov $0xa,%edi
8019c5: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
8019cc: 00 00 00
8019cf: ff d0 callq *%rax
}
8019d1: c9 leaveq
8019d2: c3 retq
00000000008019d3 <sys_ipc_try_send>:
int
sys_ipc_try_send(envid_t envid, uint64_t value, void *srcva, int perm)
{
8019d3: 55 push %rbp
8019d4: 48 89 e5 mov %rsp,%rbp
8019d7: 48 83 ec 20 sub $0x20,%rsp
8019db: 89 7d fc mov %edi,-0x4(%rbp)
8019de: 48 89 75 f0 mov %rsi,-0x10(%rbp)
8019e2: 48 89 55 e8 mov %rdx,-0x18(%rbp)
8019e6: 89 4d f8 mov %ecx,-0x8(%rbp)
return syscall(SYS_ipc_try_send, 0, envid, value, (uint64_t) srcva, perm, 0);
8019e9: 8b 45 f8 mov -0x8(%rbp),%eax
8019ec: 48 63 f0 movslq %eax,%rsi
8019ef: 48 8b 4d e8 mov -0x18(%rbp),%rcx
8019f3: 8b 45 fc mov -0x4(%rbp),%eax
8019f6: 48 98 cltq
8019f8: 48 8b 55 f0 mov -0x10(%rbp),%rdx
8019fc: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
801a03: 00
801a04: 49 89 f1 mov %rsi,%r9
801a07: 49 89 c8 mov %rcx,%r8
801a0a: 48 89 d1 mov %rdx,%rcx
801a0d: 48 89 c2 mov %rax,%rdx
801a10: be 00 00 00 00 mov $0x0,%esi
801a15: bf 0c 00 00 00 mov $0xc,%edi
801a1a: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
801a21: 00 00 00
801a24: ff d0 callq *%rax
}
801a26: c9 leaveq
801a27: c3 retq
0000000000801a28 <sys_ipc_recv>:
int
sys_ipc_recv(void *dstva)
{
801a28: 55 push %rbp
801a29: 48 89 e5 mov %rsp,%rbp
801a2c: 48 83 ec 10 sub $0x10,%rsp
801a30: 48 89 7d f8 mov %rdi,-0x8(%rbp)
return syscall(SYS_ipc_recv, 1, (uint64_t)dstva, 0, 0, 0, 0);
801a34: 48 8b 45 f8 mov -0x8(%rbp),%rax
801a38: 48 c7 04 24 00 00 00 movq $0x0,(%rsp)
801a3f: 00
801a40: 41 b9 00 00 00 00 mov $0x0,%r9d
801a46: 41 b8 00 00 00 00 mov $0x0,%r8d
801a4c: b9 00 00 00 00 mov $0x0,%ecx
801a51: 48 89 c2 mov %rax,%rdx
801a54: be 01 00 00 00 mov $0x1,%esi
801a59: bf 0d 00 00 00 mov $0xd,%edi
801a5e: 48 b8 29 16 80 00 00 movabs $0x801629,%rax
801a65: 00 00 00
801a68: ff d0 callq *%rax
}
801a6a: c9 leaveq
801a6b: c3 retq
0000000000801a6c <pgfault>:
return esp;
}
static void
pgfault(struct UTrapframe *utf)
{
801a6c: 55 push %rbp
801a6d: 48 89 e5 mov %rsp,%rbp
801a70: 48 83 ec 30 sub $0x30,%rsp
801a74: 48 89 7d d8 mov %rdi,-0x28(%rbp)
void *addr = (void *) utf->utf_fault_va;
801a78: 48 8b 45 d8 mov -0x28(%rbp),%rax
801a7c: 48 8b 00 mov (%rax),%rax
801a7f: 48 89 45 f8 mov %rax,-0x8(%rbp)
uint32_t err = utf->utf_err;
801a83: 48 8b 45 d8 mov -0x28(%rbp),%rax
801a87: 48 8b 40 08 mov 0x8(%rax),%rax
801a8b: 89 45 f4 mov %eax,-0xc(%rbp)
// Use the read-only page table mappings at uvpt
// (see <inc/memlayout.h>).
// LAB 4: Your code here.
//cprintf("I am in user's page fault handler\n");
if(!(err &FEC_WR)&&(uvpt[PPN(addr)]& PTE_COW))
801a8e: 8b 45 f4 mov -0xc(%rbp),%eax
801a91: 83 e0 02 and $0x2,%eax
801a94: 85 c0 test %eax,%eax
801a96: 75 4d jne 801ae5 <pgfault+0x79>
801a98: 48 8b 45 f8 mov -0x8(%rbp),%rax
801a9c: 48 c1 e8 0c shr $0xc,%rax
801aa0: 48 89 c2 mov %rax,%rdx
801aa3: 48 b8 00 00 00 00 00 movabs $0x10000000000,%rax
801aaa: 01 00 00
801aad: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
801ab1: 25 00 08 00 00 and $0x800,%eax
801ab6: 48 85 c0 test %rax,%rax
801ab9: 74 2a je 801ae5 <pgfault+0x79>
panic("Page isnt writable/ COW, why did I get a pagefault \n");
801abb: 48 ba 10 42 80 00 00 movabs $0x804210,%rdx
801ac2: 00 00 00
801ac5: be 23 00 00 00 mov $0x23,%esi
801aca: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
801ad1: 00 00 00
801ad4: b8 00 00 00 00 mov $0x0,%eax
801ad9: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
801ae0: 00 00 00
801ae3: ff d1 callq *%rcx
// copy the data from the old page to the new page, then move the new
// page to the old page's address.
// Hint:
// You should make three system calls.
// No need to explicitly delete the old page's mapping.
if(0 == sys_page_alloc(0,(void*)PFTEMP,PTE_U|PTE_P|PTE_W)){
801ae5: ba 07 00 00 00 mov $0x7,%edx
801aea: be 00 f0 5f 00 mov $0x5ff000,%esi
801aef: bf 00 00 00 00 mov $0x0,%edi
801af4: 48 b8 ff 17 80 00 00 movabs $0x8017ff,%rax
801afb: 00 00 00
801afe: ff d0 callq *%rax
801b00: 85 c0 test %eax,%eax
801b02: 0f 85 cd 00 00 00 jne 801bd5 <pgfault+0x169>
Pageaddr = ROUNDDOWN(addr,PGSIZE);
801b08: 48 8b 45 f8 mov -0x8(%rbp),%rax
801b0c: 48 89 45 e8 mov %rax,-0x18(%rbp)
801b10: 48 8b 45 e8 mov -0x18(%rbp),%rax
801b14: 48 25 00 f0 ff ff and $0xfffffffffffff000,%rax
801b1a: 48 89 45 e0 mov %rax,-0x20(%rbp)
memmove(PFTEMP, Pageaddr, PGSIZE);
801b1e: 48 8b 45 e0 mov -0x20(%rbp),%rax
801b22: ba 00 10 00 00 mov $0x1000,%edx
801b27: 48 89 c6 mov %rax,%rsi
801b2a: bf 00 f0 5f 00 mov $0x5ff000,%edi
801b2f: 48 b8 f4 11 80 00 00 movabs $0x8011f4,%rax
801b36: 00 00 00
801b39: ff d0 callq *%rax
if(0> sys_page_map(0,PFTEMP,0,Pageaddr,PTE_U|PTE_P|PTE_W))
801b3b: 48 8b 45 e0 mov -0x20(%rbp),%rax
801b3f: 41 b8 07 00 00 00 mov $0x7,%r8d
801b45: 48 89 c1 mov %rax,%rcx
801b48: ba 00 00 00 00 mov $0x0,%edx
801b4d: be 00 f0 5f 00 mov $0x5ff000,%esi
801b52: bf 00 00 00 00 mov $0x0,%edi
801b57: 48 b8 4f 18 80 00 00 movabs $0x80184f,%rax
801b5e: 00 00 00
801b61: ff d0 callq *%rax
801b63: 85 c0 test %eax,%eax
801b65: 79 2a jns 801b91 <pgfault+0x125>
panic("Page map at temp address failed");
801b67: 48 ba 50 42 80 00 00 movabs $0x804250,%rdx
801b6e: 00 00 00
801b71: be 30 00 00 00 mov $0x30,%esi
801b76: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
801b7d: 00 00 00
801b80: b8 00 00 00 00 mov $0x0,%eax
801b85: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
801b8c: 00 00 00
801b8f: ff d1 callq *%rcx
if(0> sys_page_unmap(0,PFTEMP))
801b91: be 00 f0 5f 00 mov $0x5ff000,%esi
801b96: bf 00 00 00 00 mov $0x0,%edi
801b9b: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
801ba2: 00 00 00
801ba5: ff d0 callq *%rax
801ba7: 85 c0 test %eax,%eax
801ba9: 79 54 jns 801bff <pgfault+0x193>
panic("Page unmap from temp location failed");
801bab: 48 ba 70 42 80 00 00 movabs $0x804270,%rdx
801bb2: 00 00 00
801bb5: be 32 00 00 00 mov $0x32,%esi
801bba: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
801bc1: 00 00 00
801bc4: b8 00 00 00 00 mov $0x0,%eax
801bc9: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
801bd0: 00 00 00
801bd3: ff d1 callq *%rcx
}else{
panic("Page Allocation Failed during handling page fault");
801bd5: 48 ba 98 42 80 00 00 movabs $0x804298,%rdx
801bdc: 00 00 00
801bdf: be 34 00 00 00 mov $0x34,%esi
801be4: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
801beb: 00 00 00
801bee: b8 00 00 00 00 mov $0x0,%eax
801bf3: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
801bfa: 00 00 00
801bfd: ff d1 callq *%rcx
}
//panic("pgfault not implemented");
}
801bff: c9 leaveq
801c00: c3 retq
0000000000801c01 <duppage>:
// Returns: 0 on success, < 0 on error.
// It is also OK to panic on error.
//
static int
duppage(envid_t envid, unsigned pn)
{
801c01: 55 push %rbp
801c02: 48 89 e5 mov %rsp,%rbp
801c05: 48 83 ec 20 sub $0x20,%rsp
801c09: 89 7d ec mov %edi,-0x14(%rbp)
801c0c: 89 75 e8 mov %esi,-0x18(%rbp)
int r;
int perm = (uvpt[pn]) & PTE_SYSCALL; // Doubtful..
801c0f: 48 b8 00 00 00 00 00 movabs $0x10000000000,%rax
801c16: 01 00 00
801c19: 8b 55 e8 mov -0x18(%rbp),%edx
801c1c: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
801c20: 25 07 0e 00 00 and $0xe07,%eax
801c25: 89 45 fc mov %eax,-0x4(%rbp)
void* addr = (void*)((uint64_t)pn *PGSIZE);
801c28: 8b 45 e8 mov -0x18(%rbp),%eax
801c2b: 48 c1 e0 0c shl $0xc,%rax
801c2f: 48 89 45 f0 mov %rax,-0x10(%rbp)
//cprintf("DuPpage: Incoming addr = [%x], permission = [%d]\n", addr,perm);
// LAB 4: Your code here.
if(perm & PTE_SHARE){
801c33: 8b 45 fc mov -0x4(%rbp),%eax
801c36: 25 00 04 00 00 and $0x400,%eax
801c3b: 85 c0 test %eax,%eax
801c3d: 74 57 je 801c96 <duppage+0x95>
if(0 < sys_page_map(0,addr,envid,addr,perm))
801c3f: 8b 75 fc mov -0x4(%rbp),%esi
801c42: 48 8b 4d f0 mov -0x10(%rbp),%rcx
801c46: 8b 55 ec mov -0x14(%rbp),%edx
801c49: 48 8b 45 f0 mov -0x10(%rbp),%rax
801c4d: 41 89 f0 mov %esi,%r8d
801c50: 48 89 c6 mov %rax,%rsi
801c53: bf 00 00 00 00 mov $0x0,%edi
801c58: 48 b8 4f 18 80 00 00 movabs $0x80184f,%rax
801c5f: 00 00 00
801c62: ff d0 callq *%rax
801c64: 85 c0 test %eax,%eax
801c66: 0f 8e 52 01 00 00 jle 801dbe <duppage+0x1bd>
panic("Page alloc with COW failed.\n");
801c6c: 48 ba ca 42 80 00 00 movabs $0x8042ca,%rdx
801c73: 00 00 00
801c76: be 4e 00 00 00 mov $0x4e,%esi
801c7b: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
801c82: 00 00 00
801c85: b8 00 00 00 00 mov $0x0,%eax
801c8a: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
801c91: 00 00 00
801c94: ff d1 callq *%rcx
}else{
if((perm & PTE_W || perm & PTE_COW)){
801c96: 8b 45 fc mov -0x4(%rbp),%eax
801c99: 83 e0 02 and $0x2,%eax
801c9c: 85 c0 test %eax,%eax
801c9e: 75 10 jne 801cb0 <duppage+0xaf>
801ca0: 8b 45 fc mov -0x4(%rbp),%eax
801ca3: 25 00 08 00 00 and $0x800,%eax
801ca8: 85 c0 test %eax,%eax
801caa: 0f 84 bb 00 00 00 je 801d6b <duppage+0x16a>
perm = (perm|PTE_COW)&(~PTE_W);
801cb0: 8b 45 fc mov -0x4(%rbp),%eax
801cb3: 25 fd f7 ff ff and $0xfffff7fd,%eax
801cb8: 80 cc 08 or $0x8,%ah
801cbb: 89 45 fc mov %eax,-0x4(%rbp)
if(0 < sys_page_map(0,addr,envid,addr,perm))
801cbe: 8b 75 fc mov -0x4(%rbp),%esi
801cc1: 48 8b 4d f0 mov -0x10(%rbp),%rcx
801cc5: 8b 55 ec mov -0x14(%rbp),%edx
801cc8: 48 8b 45 f0 mov -0x10(%rbp),%rax
801ccc: 41 89 f0 mov %esi,%r8d
801ccf: 48 89 c6 mov %rax,%rsi
801cd2: bf 00 00 00 00 mov $0x0,%edi
801cd7: 48 b8 4f 18 80 00 00 movabs $0x80184f,%rax
801cde: 00 00 00
801ce1: ff d0 callq *%rax
801ce3: 85 c0 test %eax,%eax
801ce5: 7e 2a jle 801d11 <duppage+0x110>
panic("Page alloc with COW failed.\n");
801ce7: 48 ba ca 42 80 00 00 movabs $0x8042ca,%rdx
801cee: 00 00 00
801cf1: be 55 00 00 00 mov $0x55,%esi
801cf6: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
801cfd: 00 00 00
801d00: b8 00 00 00 00 mov $0x0,%eax
801d05: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
801d0c: 00 00 00
801d0f: ff d1 callq *%rcx
if(0 < sys_page_map(0,addr,0,addr,perm))
801d11: 8b 4d fc mov -0x4(%rbp),%ecx
801d14: 48 8b 55 f0 mov -0x10(%rbp),%rdx
801d18: 48 8b 45 f0 mov -0x10(%rbp),%rax
801d1c: 41 89 c8 mov %ecx,%r8d
801d1f: 48 89 d1 mov %rdx,%rcx
801d22: ba 00 00 00 00 mov $0x0,%edx
801d27: 48 89 c6 mov %rax,%rsi
801d2a: bf 00 00 00 00 mov $0x0,%edi
801d2f: 48 b8 4f 18 80 00 00 movabs $0x80184f,%rax
801d36: 00 00 00
801d39: ff d0 callq *%rax
801d3b: 85 c0 test %eax,%eax
801d3d: 7e 2a jle 801d69 <duppage+0x168>
panic("Page alloc with COW failed.\n");
801d3f: 48 ba ca 42 80 00 00 movabs $0x8042ca,%rdx
801d46: 00 00 00
801d49: be 57 00 00 00 mov $0x57,%esi
801d4e: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
801d55: 00 00 00
801d58: b8 00 00 00 00 mov $0x0,%eax
801d5d: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
801d64: 00 00 00
801d67: ff d1 callq *%rcx
if((perm & PTE_W || perm & PTE_COW)){
perm = (perm|PTE_COW)&(~PTE_W);
if(0 < sys_page_map(0,addr,envid,addr,perm))
panic("Page alloc with COW failed.\n");
if(0 < sys_page_map(0,addr,0,addr,perm))
801d69: eb 53 jmp 801dbe <duppage+0x1bd>
panic("Page alloc with COW failed.\n");
}else{
if(0 < sys_page_map(0,addr,envid,addr,perm))
801d6b: 8b 75 fc mov -0x4(%rbp),%esi
801d6e: 48 8b 4d f0 mov -0x10(%rbp),%rcx
801d72: 8b 55 ec mov -0x14(%rbp),%edx
801d75: 48 8b 45 f0 mov -0x10(%rbp),%rax
801d79: 41 89 f0 mov %esi,%r8d
801d7c: 48 89 c6 mov %rax,%rsi
801d7f: bf 00 00 00 00 mov $0x0,%edi
801d84: 48 b8 4f 18 80 00 00 movabs $0x80184f,%rax
801d8b: 00 00 00
801d8e: ff d0 callq *%rax
801d90: 85 c0 test %eax,%eax
801d92: 7e 2a jle 801dbe <duppage+0x1bd>
panic("Page alloc with COW failed.\n");
801d94: 48 ba ca 42 80 00 00 movabs $0x8042ca,%rdx
801d9b: 00 00 00
801d9e: be 5b 00 00 00 mov $0x5b,%esi
801da3: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
801daa: 00 00 00
801dad: b8 00 00 00 00 mov $0x0,%eax
801db2: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
801db9: 00 00 00
801dbc: ff d1 callq *%rcx
}
}
//panic("duppage not implemented");
return 0;
801dbe: b8 00 00 00 00 mov $0x0,%eax
}
801dc3: c9 leaveq
801dc4: c3 retq
0000000000801dc5 <pt_is_mapped>:
// Neither user exception stack should ever be marked copy-on-write,
// so you must allocate a new page for the child's user exception stack.
//
bool
pt_is_mapped(void *va)
{
801dc5: 55 push %rbp
801dc6: 48 89 e5 mov %rsp,%rbp
801dc9: 48 83 ec 18 sub $0x18,%rsp
801dcd: 48 89 7d e8 mov %rdi,-0x18(%rbp)
uint64_t addr = (uint64_t)va;
801dd1: 48 8b 45 e8 mov -0x18(%rbp),%rax
801dd5: 48 89 45 f8 mov %rax,-0x8(%rbp)
return (uvpml4e[VPML4E(addr)] & PTE_P) && (uvpde[VPDPE(addr<<12)] & PTE_P) && (uvpd[VPD(addr<<12)] & PTE_P);
801dd9: 48 8b 45 f8 mov -0x8(%rbp),%rax
801ddd: 48 c1 e8 27 shr $0x27,%rax
801de1: 48 89 c2 mov %rax,%rdx
801de4: 48 b8 00 20 40 80 00 movabs $0x10080402000,%rax
801deb: 01 00 00
801dee: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
801df2: 83 e0 01 and $0x1,%eax
801df5: 48 85 c0 test %rax,%rax
801df8: 74 51 je 801e4b <pt_is_mapped+0x86>
801dfa: 48 8b 45 f8 mov -0x8(%rbp),%rax
801dfe: 48 c1 e0 0c shl $0xc,%rax
801e02: 48 c1 e8 1e shr $0x1e,%rax
801e06: 48 89 c2 mov %rax,%rdx
801e09: 48 b8 00 00 40 80 00 movabs $0x10080400000,%rax
801e10: 01 00 00
801e13: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
801e17: 83 e0 01 and $0x1,%eax
801e1a: 48 85 c0 test %rax,%rax
801e1d: 74 2c je 801e4b <pt_is_mapped+0x86>
801e1f: 48 8b 45 f8 mov -0x8(%rbp),%rax
801e23: 48 c1 e0 0c shl $0xc,%rax
801e27: 48 c1 e8 15 shr $0x15,%rax
801e2b: 48 89 c2 mov %rax,%rdx
801e2e: 48 b8 00 00 00 80 00 movabs $0x10080000000,%rax
801e35: 01 00 00
801e38: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
801e3c: 83 e0 01 and $0x1,%eax
801e3f: 48 85 c0 test %rax,%rax
801e42: 74 07 je 801e4b <pt_is_mapped+0x86>
801e44: b8 01 00 00 00 mov $0x1,%eax
801e49: eb 05 jmp 801e50 <pt_is_mapped+0x8b>
801e4b: b8 00 00 00 00 mov $0x0,%eax
801e50: 83 e0 01 and $0x1,%eax
}
801e53: c9 leaveq
801e54: c3 retq
0000000000801e55 <fork>:
envid_t
fork(void)
{
801e55: 55 push %rbp
801e56: 48 89 e5 mov %rsp,%rbp
801e59: 48 83 ec 20 sub $0x20,%rsp
// LAB 4: Your code here.
envid_t envid;
int r;
uint64_t i;
uint64_t addr, last;
set_pgfault_handler(pgfault);
801e5d: 48 bf 6c 1a 80 00 00 movabs $0x801a6c,%rdi
801e64: 00 00 00
801e67: 48 b8 bf 38 80 00 00 movabs $0x8038bf,%rax
801e6e: 00 00 00
801e71: ff d0 callq *%rax
// This must be inlined. Exercise for reader: why?
static __inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
envid_t ret;
__asm __volatile("int %2"
801e73: b8 07 00 00 00 mov $0x7,%eax
801e78: cd 30 int $0x30
801e7a: 89 45 e4 mov %eax,-0x1c(%rbp)
: "=a" (ret)
: "a" (SYS_exofork),
"i" (T_SYSCALL)
);
return ret;
801e7d: 8b 45 e4 mov -0x1c(%rbp),%eax
envid = sys_exofork();
801e80: 89 45 f4 mov %eax,-0xc(%rbp)
if(envid < 0)
801e83: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
801e87: 79 30 jns 801eb9 <fork+0x64>
panic("\nsys_exofork error: %e\n", envid);
801e89: 8b 45 f4 mov -0xc(%rbp),%eax
801e8c: 89 c1 mov %eax,%ecx
801e8e: 48 ba e8 42 80 00 00 movabs $0x8042e8,%rdx
801e95: 00 00 00
801e98: be 86 00 00 00 mov $0x86,%esi
801e9d: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
801ea4: 00 00 00
801ea7: b8 00 00 00 00 mov $0x0,%eax
801eac: 49 b8 ab 37 80 00 00 movabs $0x8037ab,%r8
801eb3: 00 00 00
801eb6: 41 ff d0 callq *%r8
else if(envid == 0)
801eb9: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
801ebd: 75 46 jne 801f05 <fork+0xb0>
{
thisenv = &envs[ENVX(sys_getenvid())];
801ebf: 48 b8 83 17 80 00 00 movabs $0x801783,%rax
801ec6: 00 00 00
801ec9: ff d0 callq *%rax
801ecb: 25 ff 03 00 00 and $0x3ff,%eax
801ed0: 48 63 d0 movslq %eax,%rdx
801ed3: 48 89 d0 mov %rdx,%rax
801ed6: 48 c1 e0 03 shl $0x3,%rax
801eda: 48 01 d0 add %rdx,%rax
801edd: 48 c1 e0 05 shl $0x5,%rax
801ee1: 48 ba 00 00 80 00 80 movabs $0x8000800000,%rdx
801ee8: 00 00 00
801eeb: 48 01 c2 add %rax,%rdx
801eee: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
801ef5: 00 00 00
801ef8: 48 89 10 mov %rdx,(%rax)
return 0;
801efb: b8 00 00 00 00 mov $0x0,%eax
801f00: e9 d1 01 00 00 jmpq 8020d6 <fork+0x281>
}
uint64_t ad = 0;
801f05: 48 c7 45 e8 00 00 00 movq $0x0,-0x18(%rbp)
801f0c: 00
for (addr = (uint64_t)USTACKTOP-PGSIZE; addr >=(uint64_t)UTEXT; addr -= PGSIZE){ // Is this enough, am I leaving a bug for future here???
801f0d: b8 00 d0 7f ef mov $0xef7fd000,%eax
801f12: 48 89 45 f8 mov %rax,-0x8(%rbp)
801f16: e9 df 00 00 00 jmpq 801ffa <fork+0x1a5>
/*Do we really need to scan all the pages????*/
if(uvpml4e[VPML4E(addr)]& PTE_P){
801f1b: 48 8b 45 f8 mov -0x8(%rbp),%rax
801f1f: 48 c1 e8 27 shr $0x27,%rax
801f23: 48 89 c2 mov %rax,%rdx
801f26: 48 b8 00 20 40 80 00 movabs $0x10080402000,%rax
801f2d: 01 00 00
801f30: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
801f34: 83 e0 01 and $0x1,%eax
801f37: 48 85 c0 test %rax,%rax
801f3a: 0f 84 9e 00 00 00 je 801fde <fork+0x189>
if( uvpde[VPDPE(addr)] & PTE_P){
801f40: 48 8b 45 f8 mov -0x8(%rbp),%rax
801f44: 48 c1 e8 1e shr $0x1e,%rax
801f48: 48 89 c2 mov %rax,%rdx
801f4b: 48 b8 00 00 40 80 00 movabs $0x10080400000,%rax
801f52: 01 00 00
801f55: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
801f59: 83 e0 01 and $0x1,%eax
801f5c: 48 85 c0 test %rax,%rax
801f5f: 74 73 je 801fd4 <fork+0x17f>
if( uvpd[VPD(addr)] & PTE_P){
801f61: 48 8b 45 f8 mov -0x8(%rbp),%rax
801f65: 48 c1 e8 15 shr $0x15,%rax
801f69: 48 89 c2 mov %rax,%rdx
801f6c: 48 b8 00 00 00 80 00 movabs $0x10080000000,%rax
801f73: 01 00 00
801f76: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
801f7a: 83 e0 01 and $0x1,%eax
801f7d: 48 85 c0 test %rax,%rax
801f80: 74 48 je 801fca <fork+0x175>
if((ad =uvpt[VPN(addr)])& PTE_P){
801f82: 48 8b 45 f8 mov -0x8(%rbp),%rax
801f86: 48 c1 e8 0c shr $0xc,%rax
801f8a: 48 89 c2 mov %rax,%rdx
801f8d: 48 b8 00 00 00 00 00 movabs $0x10000000000,%rax
801f94: 01 00 00
801f97: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
801f9b: 48 89 45 e8 mov %rax,-0x18(%rbp)
801f9f: 48 8b 45 e8 mov -0x18(%rbp),%rax
801fa3: 83 e0 01 and $0x1,%eax
801fa6: 48 85 c0 test %rax,%rax
801fa9: 74 47 je 801ff2 <fork+0x19d>
//cprintf("hi\n");
//cprintf("addr = [%x]\n",ad);
duppage(envid, VPN(addr));
801fab: 48 8b 45 f8 mov -0x8(%rbp),%rax
801faf: 48 c1 e8 0c shr $0xc,%rax
801fb3: 89 c2 mov %eax,%edx
801fb5: 8b 45 f4 mov -0xc(%rbp),%eax
801fb8: 89 d6 mov %edx,%esi
801fba: 89 c7 mov %eax,%edi
801fbc: 48 b8 01 1c 80 00 00 movabs $0x801c01,%rax
801fc3: 00 00 00
801fc6: ff d0 callq *%rax
801fc8: eb 28 jmp 801ff2 <fork+0x19d>
}
}else{
addr -= NPDENTRIES*PGSIZE;
801fca: 48 81 6d f8 00 00 20 subq $0x200000,-0x8(%rbp)
801fd1: 00
801fd2: eb 1e jmp 801ff2 <fork+0x19d>
//addr -= ((VPD(addr)+1)<<PDXSHIFT);
}
}else{
addr -= NPDENTRIES*NPDENTRIES*PGSIZE;
801fd4: 48 81 6d f8 00 00 00 subq $0x40000000,-0x8(%rbp)
801fdb: 40
801fdc: eb 14 jmp 801ff2 <fork+0x19d>
//addr -= ((VPDPE(addr)+1)<<PDPESHIFT);
}
}else{
/*uvpml4e.. move by */
addr -= ((VPML4E(addr)+1)<<PML4SHIFT)
801fde: 48 8b 45 f8 mov -0x8(%rbp),%rax
801fe2: 48 c1 e8 27 shr $0x27,%rax
801fe6: 48 83 c0 01 add $0x1,%rax
801fea: 48 c1 e0 27 shl $0x27,%rax
801fee: 48 29 45 f8 sub %rax,-0x8(%rbp)
{
thisenv = &envs[ENVX(sys_getenvid())];
return 0;
}
uint64_t ad = 0;
for (addr = (uint64_t)USTACKTOP-PGSIZE; addr >=(uint64_t)UTEXT; addr -= PGSIZE){ // Is this enough, am I leaving a bug for future here???
801ff2: 48 81 6d f8 00 10 00 subq $0x1000,-0x8(%rbp)
801ff9: 00
801ffa: 48 81 7d f8 ff ff 7f cmpq $0x7fffff,-0x8(%rbp)
802001: 00
802002: 0f 87 13 ff ff ff ja 801f1b <fork+0xc6>
}
}
sys_page_alloc(envid, (void *)(UXSTACKTOP - PGSIZE),PTE_P|PTE_U|PTE_W);
802008: 8b 45 f4 mov -0xc(%rbp),%eax
80200b: ba 07 00 00 00 mov $0x7,%edx
802010: be 00 f0 7f ef mov $0xef7ff000,%esi
802015: 89 c7 mov %eax,%edi
802017: 48 b8 ff 17 80 00 00 movabs $0x8017ff,%rax
80201e: 00 00 00
802021: ff d0 callq *%rax
sys_page_alloc(envid, (void*)(USTACKTOP - PGSIZE),PTE_P|PTE_U|PTE_W);
802023: 8b 45 f4 mov -0xc(%rbp),%eax
802026: ba 07 00 00 00 mov $0x7,%edx
80202b: be 00 d0 7f ef mov $0xef7fd000,%esi
802030: 89 c7 mov %eax,%edi
802032: 48 b8 ff 17 80 00 00 movabs $0x8017ff,%rax
802039: 00 00 00
80203c: ff d0 callq *%rax
sys_page_map(envid, (void*)(USTACKTOP - PGSIZE), 0, PFTEMP,PTE_P|PTE_U|PTE_W);
80203e: 8b 45 f4 mov -0xc(%rbp),%eax
802041: 41 b8 07 00 00 00 mov $0x7,%r8d
802047: b9 00 f0 5f 00 mov $0x5ff000,%ecx
80204c: ba 00 00 00 00 mov $0x0,%edx
802051: be 00 d0 7f ef mov $0xef7fd000,%esi
802056: 89 c7 mov %eax,%edi
802058: 48 b8 4f 18 80 00 00 movabs $0x80184f,%rax
80205f: 00 00 00
802062: ff d0 callq *%rax
memmove(PFTEMP, (void*)(USTACKTOP-PGSIZE), PGSIZE);
802064: ba 00 10 00 00 mov $0x1000,%edx
802069: be 00 d0 7f ef mov $0xef7fd000,%esi
80206e: bf 00 f0 5f 00 mov $0x5ff000,%edi
802073: 48 b8 f4 11 80 00 00 movabs $0x8011f4,%rax
80207a: 00 00 00
80207d: ff d0 callq *%rax
sys_page_unmap(0, PFTEMP);
80207f: be 00 f0 5f 00 mov $0x5ff000,%esi
802084: bf 00 00 00 00 mov $0x0,%edi
802089: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
802090: 00 00 00
802093: ff d0 callq *%rax
sys_env_set_pgfault_upcall(envid, thisenv->env_pgfault_upcall);
802095: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
80209c: 00 00 00
80209f: 48 8b 00 mov (%rax),%rax
8020a2: 48 8b 90 f0 00 00 00 mov 0xf0(%rax),%rdx
8020a9: 8b 45 f4 mov -0xc(%rbp),%eax
8020ac: 48 89 d6 mov %rdx,%rsi
8020af: 89 c7 mov %eax,%edi
8020b1: 48 b8 89 19 80 00 00 movabs $0x801989,%rax
8020b8: 00 00 00
8020bb: ff d0 callq *%rax
sys_env_set_status(envid, ENV_RUNNABLE);
8020bd: 8b 45 f4 mov -0xc(%rbp),%eax
8020c0: be 02 00 00 00 mov $0x2,%esi
8020c5: 89 c7 mov %eax,%edi
8020c7: 48 b8 f4 18 80 00 00 movabs $0x8018f4,%rax
8020ce: 00 00 00
8020d1: ff d0 callq *%rax
return envid;
8020d3: 8b 45 f4 mov -0xc(%rbp),%eax
}
8020d6: c9 leaveq
8020d7: c3 retq
00000000008020d8 <sfork>:
// Challenge!
int
sfork(void)
{
8020d8: 55 push %rbp
8020d9: 48 89 e5 mov %rsp,%rbp
panic("sfork not implemented");
8020dc: 48 ba 00 43 80 00 00 movabs $0x804300,%rdx
8020e3: 00 00 00
8020e6: be bf 00 00 00 mov $0xbf,%esi
8020eb: 48 bf 45 42 80 00 00 movabs $0x804245,%rdi
8020f2: 00 00 00
8020f5: b8 00 00 00 00 mov $0x0,%eax
8020fa: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
802101: 00 00 00
802104: ff d1 callq *%rcx
0000000000802106 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------
uint64_t
fd2num(struct Fd *fd)
{
802106: 55 push %rbp
802107: 48 89 e5 mov %rsp,%rbp
80210a: 48 83 ec 08 sub $0x8,%rsp
80210e: 48 89 7d f8 mov %rdi,-0x8(%rbp)
return ((uintptr_t) fd - FDTABLE) / PGSIZE;
802112: 48 8b 55 f8 mov -0x8(%rbp),%rdx
802116: 48 b8 00 00 00 30 ff movabs $0xffffffff30000000,%rax
80211d: ff ff ff
802120: 48 01 d0 add %rdx,%rax
802123: 48 c1 e8 0c shr $0xc,%rax
}
802127: c9 leaveq
802128: c3 retq
0000000000802129 <fd2data>:
char*
fd2data(struct Fd *fd)
{
802129: 55 push %rbp
80212a: 48 89 e5 mov %rsp,%rbp
80212d: 48 83 ec 08 sub $0x8,%rsp
802131: 48 89 7d f8 mov %rdi,-0x8(%rbp)
return INDEX2DATA(fd2num(fd));
802135: 48 8b 45 f8 mov -0x8(%rbp),%rax
802139: 48 89 c7 mov %rax,%rdi
80213c: 48 b8 06 21 80 00 00 movabs $0x802106,%rax
802143: 00 00 00
802146: ff d0 callq *%rax
802148: 48 05 20 00 0d 00 add $0xd0020,%rax
80214e: 48 c1 e0 0c shl $0xc,%rax
}
802152: c9 leaveq
802153: c3 retq
0000000000802154 <fd_alloc>:
// Returns 0 on success, < 0 on error. Errors are:
// -E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
802154: 55 push %rbp
802155: 48 89 e5 mov %rsp,%rbp
802158: 48 83 ec 18 sub $0x18,%rsp
80215c: 48 89 7d e8 mov %rdi,-0x18(%rbp)
int i;
struct Fd *fd;
for (i = 0; i < MAXFD; i++) {
802160: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
802167: eb 6b jmp 8021d4 <fd_alloc+0x80>
fd = INDEX2FD(i);
802169: 8b 45 fc mov -0x4(%rbp),%eax
80216c: 48 98 cltq
80216e: 48 05 00 00 0d 00 add $0xd0000,%rax
802174: 48 c1 e0 0c shl $0xc,%rax
802178: 48 89 45 f0 mov %rax,-0x10(%rbp)
if ((uvpd[VPD(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
80217c: 48 8b 45 f0 mov -0x10(%rbp),%rax
802180: 48 c1 e8 15 shr $0x15,%rax
802184: 48 89 c2 mov %rax,%rdx
802187: 48 b8 00 00 00 80 00 movabs $0x10080000000,%rax
80218e: 01 00 00
802191: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
802195: 83 e0 01 and $0x1,%eax
802198: 48 85 c0 test %rax,%rax
80219b: 74 21 je 8021be <fd_alloc+0x6a>
80219d: 48 8b 45 f0 mov -0x10(%rbp),%rax
8021a1: 48 c1 e8 0c shr $0xc,%rax
8021a5: 48 89 c2 mov %rax,%rdx
8021a8: 48 b8 00 00 00 00 00 movabs $0x10000000000,%rax
8021af: 01 00 00
8021b2: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
8021b6: 83 e0 01 and $0x1,%eax
8021b9: 48 85 c0 test %rax,%rax
8021bc: 75 12 jne 8021d0 <fd_alloc+0x7c>
*fd_store = fd;
8021be: 48 8b 45 e8 mov -0x18(%rbp),%rax
8021c2: 48 8b 55 f0 mov -0x10(%rbp),%rdx
8021c6: 48 89 10 mov %rdx,(%rax)
return 0;
8021c9: b8 00 00 00 00 mov $0x0,%eax
8021ce: eb 1a jmp 8021ea <fd_alloc+0x96>
fd_alloc(struct Fd **fd_store)
{
int i;
struct Fd *fd;
for (i = 0; i < MAXFD; i++) {
8021d0: 83 45 fc 01 addl $0x1,-0x4(%rbp)
8021d4: 83 7d fc 1f cmpl $0x1f,-0x4(%rbp)
8021d8: 7e 8f jle 802169 <fd_alloc+0x15>
if ((uvpd[VPD(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
*fd_store = fd;
return 0;
}
}
*fd_store = 0;
8021da: 48 8b 45 e8 mov -0x18(%rbp),%rax
8021de: 48 c7 00 00 00 00 00 movq $0x0,(%rax)
return -E_MAX_OPEN;
8021e5: b8 f5 ff ff ff mov $0xfffffff5,%eax
}
8021ea: c9 leaveq
8021eb: c3 retq
00000000008021ec <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
// -E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
8021ec: 55 push %rbp
8021ed: 48 89 e5 mov %rsp,%rbp
8021f0: 48 83 ec 20 sub $0x20,%rsp
8021f4: 89 7d ec mov %edi,-0x14(%rbp)
8021f7: 48 89 75 e0 mov %rsi,-0x20(%rbp)
struct Fd *fd;
if (fdnum < 0 || fdnum >= MAXFD) {
8021fb: 83 7d ec 00 cmpl $0x0,-0x14(%rbp)
8021ff: 78 06 js 802207 <fd_lookup+0x1b>
802201: 83 7d ec 1f cmpl $0x1f,-0x14(%rbp)
802205: 7e 07 jle 80220e <fd_lookup+0x22>
if (debug)
cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
return -E_INVAL;
802207: b8 fd ff ff ff mov $0xfffffffd,%eax
80220c: eb 6c jmp 80227a <fd_lookup+0x8e>
}
fd = INDEX2FD(fdnum);
80220e: 8b 45 ec mov -0x14(%rbp),%eax
802211: 48 98 cltq
802213: 48 05 00 00 0d 00 add $0xd0000,%rax
802219: 48 c1 e0 0c shl $0xc,%rax
80221d: 48 89 45 f8 mov %rax,-0x8(%rbp)
if (!(uvpd[VPD(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
802221: 48 8b 45 f8 mov -0x8(%rbp),%rax
802225: 48 c1 e8 15 shr $0x15,%rax
802229: 48 89 c2 mov %rax,%rdx
80222c: 48 b8 00 00 00 80 00 movabs $0x10080000000,%rax
802233: 01 00 00
802236: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
80223a: 83 e0 01 and $0x1,%eax
80223d: 48 85 c0 test %rax,%rax
802240: 74 21 je 802263 <fd_lookup+0x77>
802242: 48 8b 45 f8 mov -0x8(%rbp),%rax
802246: 48 c1 e8 0c shr $0xc,%rax
80224a: 48 89 c2 mov %rax,%rdx
80224d: 48 b8 00 00 00 00 00 movabs $0x10000000000,%rax
802254: 01 00 00
802257: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
80225b: 83 e0 01 and $0x1,%eax
80225e: 48 85 c0 test %rax,%rax
802261: 75 07 jne 80226a <fd_lookup+0x7e>
if (debug)
cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
return -E_INVAL;
802263: b8 fd ff ff ff mov $0xfffffffd,%eax
802268: eb 10 jmp 80227a <fd_lookup+0x8e>
}
*fd_store = fd;
80226a: 48 8b 45 e0 mov -0x20(%rbp),%rax
80226e: 48 8b 55 f8 mov -0x8(%rbp),%rdx
802272: 48 89 10 mov %rdx,(%rax)
return 0;
802275: b8 00 00 00 00 mov $0x0,%eax
}
80227a: c9 leaveq
80227b: c3 retq
000000000080227c <fd_close>:
// If 'must_exist' is 1, then fd_close returns -E_INVAL when passed a
// closed or nonexistent file descriptor.
// Returns 0 on success, < 0 on error.
int
fd_close(struct Fd *fd, bool must_exist)
{
80227c: 55 push %rbp
80227d: 48 89 e5 mov %rsp,%rbp
802280: 48 83 ec 30 sub $0x30,%rsp
802284: 48 89 7d d8 mov %rdi,-0x28(%rbp)
802288: 89 f0 mov %esi,%eax
80228a: 88 45 d4 mov %al,-0x2c(%rbp)
struct Fd *fd2;
struct Dev *dev;
int r;
if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
80228d: 48 8b 45 d8 mov -0x28(%rbp),%rax
802291: 48 89 c7 mov %rax,%rdi
802294: 48 b8 06 21 80 00 00 movabs $0x802106,%rax
80229b: 00 00 00
80229e: ff d0 callq *%rax
8022a0: 48 8d 55 f0 lea -0x10(%rbp),%rdx
8022a4: 48 89 d6 mov %rdx,%rsi
8022a7: 89 c7 mov %eax,%edi
8022a9: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
8022b0: 00 00 00
8022b3: ff d0 callq *%rax
8022b5: 89 45 fc mov %eax,-0x4(%rbp)
8022b8: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
8022bc: 78 0a js 8022c8 <fd_close+0x4c>
|| fd != fd2)
8022be: 48 8b 45 f0 mov -0x10(%rbp),%rax
8022c2: 48 39 45 d8 cmp %rax,-0x28(%rbp)
8022c6: 74 12 je 8022da <fd_close+0x5e>
return (must_exist ? r : 0);
8022c8: 80 7d d4 00 cmpb $0x0,-0x2c(%rbp)
8022cc: 74 05 je 8022d3 <fd_close+0x57>
8022ce: 8b 45 fc mov -0x4(%rbp),%eax
8022d1: eb 05 jmp 8022d8 <fd_close+0x5c>
8022d3: b8 00 00 00 00 mov $0x0,%eax
8022d8: eb 69 jmp 802343 <fd_close+0xc7>
if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
8022da: 48 8b 45 d8 mov -0x28(%rbp),%rax
8022de: 8b 00 mov (%rax),%eax
8022e0: 48 8d 55 e8 lea -0x18(%rbp),%rdx
8022e4: 48 89 d6 mov %rdx,%rsi
8022e7: 89 c7 mov %eax,%edi
8022e9: 48 b8 45 23 80 00 00 movabs $0x802345,%rax
8022f0: 00 00 00
8022f3: ff d0 callq *%rax
8022f5: 89 45 fc mov %eax,-0x4(%rbp)
8022f8: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
8022fc: 78 2a js 802328 <fd_close+0xac>
if (dev->dev_close)
8022fe: 48 8b 45 e8 mov -0x18(%rbp),%rax
802302: 48 8b 40 20 mov 0x20(%rax),%rax
802306: 48 85 c0 test %rax,%rax
802309: 74 16 je 802321 <fd_close+0xa5>
r = (*dev->dev_close)(fd);
80230b: 48 8b 45 e8 mov -0x18(%rbp),%rax
80230f: 48 8b 40 20 mov 0x20(%rax),%rax
802313: 48 8b 55 d8 mov -0x28(%rbp),%rdx
802317: 48 89 d7 mov %rdx,%rdi
80231a: ff d0 callq *%rax
80231c: 89 45 fc mov %eax,-0x4(%rbp)
80231f: eb 07 jmp 802328 <fd_close+0xac>
else
r = 0;
802321: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
}
// Make sure fd is unmapped. Might be a no-op if
// (*dev->dev_close)(fd) already unmapped it.
(void) sys_page_unmap(0, fd);
802328: 48 8b 45 d8 mov -0x28(%rbp),%rax
80232c: 48 89 c6 mov %rax,%rsi
80232f: bf 00 00 00 00 mov $0x0,%edi
802334: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
80233b: 00 00 00
80233e: ff d0 callq *%rax
return r;
802340: 8b 45 fc mov -0x4(%rbp),%eax
}
802343: c9 leaveq
802344: c3 retq
0000000000802345 <dev_lookup>:
0
};
int
dev_lookup(int dev_id, struct Dev **dev)
{
802345: 55 push %rbp
802346: 48 89 e5 mov %rsp,%rbp
802349: 48 83 ec 20 sub $0x20,%rsp
80234d: 89 7d ec mov %edi,-0x14(%rbp)
802350: 48 89 75 e0 mov %rsi,-0x20(%rbp)
int i;
for (i = 0; devtab[i]; i++)
802354: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
80235b: eb 41 jmp 80239e <dev_lookup+0x59>
if (devtab[i]->dev_id == dev_id) {
80235d: 48 b8 20 60 80 00 00 movabs $0x806020,%rax
802364: 00 00 00
802367: 8b 55 fc mov -0x4(%rbp),%edx
80236a: 48 63 d2 movslq %edx,%rdx
80236d: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
802371: 8b 00 mov (%rax),%eax
802373: 3b 45 ec cmp -0x14(%rbp),%eax
802376: 75 22 jne 80239a <dev_lookup+0x55>
*dev = devtab[i];
802378: 48 b8 20 60 80 00 00 movabs $0x806020,%rax
80237f: 00 00 00
802382: 8b 55 fc mov -0x4(%rbp),%edx
802385: 48 63 d2 movslq %edx,%rdx
802388: 48 8b 14 d0 mov (%rax,%rdx,8),%rdx
80238c: 48 8b 45 e0 mov -0x20(%rbp),%rax
802390: 48 89 10 mov %rdx,(%rax)
return 0;
802393: b8 00 00 00 00 mov $0x0,%eax
802398: eb 60 jmp 8023fa <dev_lookup+0xb5>
int
dev_lookup(int dev_id, struct Dev **dev)
{
int i;
for (i = 0; devtab[i]; i++)
80239a: 83 45 fc 01 addl $0x1,-0x4(%rbp)
80239e: 48 b8 20 60 80 00 00 movabs $0x806020,%rax
8023a5: 00 00 00
8023a8: 8b 55 fc mov -0x4(%rbp),%edx
8023ab: 48 63 d2 movslq %edx,%rdx
8023ae: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
8023b2: 48 85 c0 test %rax,%rax
8023b5: 75 a6 jne 80235d <dev_lookup+0x18>
if (devtab[i]->dev_id == dev_id) {
*dev = devtab[i];
return 0;
}
cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
8023b7: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
8023be: 00 00 00
8023c1: 48 8b 00 mov (%rax),%rax
8023c4: 8b 80 c8 00 00 00 mov 0xc8(%rax),%eax
8023ca: 8b 55 ec mov -0x14(%rbp),%edx
8023cd: 89 c6 mov %eax,%esi
8023cf: 48 bf 18 43 80 00 00 movabs $0x804318,%rdi
8023d6: 00 00 00
8023d9: b8 00 00 00 00 mov $0x0,%eax
8023de: 48 b9 1b 03 80 00 00 movabs $0x80031b,%rcx
8023e5: 00 00 00
8023e8: ff d1 callq *%rcx
*dev = 0;
8023ea: 48 8b 45 e0 mov -0x20(%rbp),%rax
8023ee: 48 c7 00 00 00 00 00 movq $0x0,(%rax)
return -E_INVAL;
8023f5: b8 fd ff ff ff mov $0xfffffffd,%eax
}
8023fa: c9 leaveq
8023fb: c3 retq
00000000008023fc <close>:
int
close(int fdnum)
{
8023fc: 55 push %rbp
8023fd: 48 89 e5 mov %rsp,%rbp
802400: 48 83 ec 20 sub $0x20,%rsp
802404: 89 7d ec mov %edi,-0x14(%rbp)
struct Fd *fd;
int r;
if ((r = fd_lookup(fdnum, &fd)) < 0)
802407: 48 8d 55 f0 lea -0x10(%rbp),%rdx
80240b: 8b 45 ec mov -0x14(%rbp),%eax
80240e: 48 89 d6 mov %rdx,%rsi
802411: 89 c7 mov %eax,%edi
802413: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
80241a: 00 00 00
80241d: ff d0 callq *%rax
80241f: 89 45 fc mov %eax,-0x4(%rbp)
802422: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802426: 79 05 jns 80242d <close+0x31>
return r;
802428: 8b 45 fc mov -0x4(%rbp),%eax
80242b: eb 18 jmp 802445 <close+0x49>
else
return fd_close(fd, 1);
80242d: 48 8b 45 f0 mov -0x10(%rbp),%rax
802431: be 01 00 00 00 mov $0x1,%esi
802436: 48 89 c7 mov %rax,%rdi
802439: 48 b8 7c 22 80 00 00 movabs $0x80227c,%rax
802440: 00 00 00
802443: ff d0 callq *%rax
}
802445: c9 leaveq
802446: c3 retq
0000000000802447 <close_all>:
void
close_all(void)
{
802447: 55 push %rbp
802448: 48 89 e5 mov %rsp,%rbp
80244b: 48 83 ec 10 sub $0x10,%rsp
int i;
for (i = 0; i < MAXFD; i++)
80244f: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
802456: eb 15 jmp 80246d <close_all+0x26>
close(i);
802458: 8b 45 fc mov -0x4(%rbp),%eax
80245b: 89 c7 mov %eax,%edi
80245d: 48 b8 fc 23 80 00 00 movabs $0x8023fc,%rax
802464: 00 00 00
802467: ff d0 callq *%rax
void
close_all(void)
{
int i;
for (i = 0; i < MAXFD; i++)
802469: 83 45 fc 01 addl $0x1,-0x4(%rbp)
80246d: 83 7d fc 1f cmpl $0x1f,-0x4(%rbp)
802471: 7e e5 jle 802458 <close_all+0x11>
close(i);
}
802473: c9 leaveq
802474: c3 retq
0000000000802475 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
802475: 55 push %rbp
802476: 48 89 e5 mov %rsp,%rbp
802479: 48 83 ec 40 sub $0x40,%rsp
80247d: 89 7d cc mov %edi,-0x34(%rbp)
802480: 89 75 c8 mov %esi,-0x38(%rbp)
int r;
char *ova, *nva;
pte_t pte;
struct Fd *oldfd, *newfd;
if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
802483: 48 8d 55 d8 lea -0x28(%rbp),%rdx
802487: 8b 45 cc mov -0x34(%rbp),%eax
80248a: 48 89 d6 mov %rdx,%rsi
80248d: 89 c7 mov %eax,%edi
80248f: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
802496: 00 00 00
802499: ff d0 callq *%rax
80249b: 89 45 fc mov %eax,-0x4(%rbp)
80249e: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
8024a2: 79 08 jns 8024ac <dup+0x37>
return r;
8024a4: 8b 45 fc mov -0x4(%rbp),%eax
8024a7: e9 70 01 00 00 jmpq 80261c <dup+0x1a7>
close(newfdnum);
8024ac: 8b 45 c8 mov -0x38(%rbp),%eax
8024af: 89 c7 mov %eax,%edi
8024b1: 48 b8 fc 23 80 00 00 movabs $0x8023fc,%rax
8024b8: 00 00 00
8024bb: ff d0 callq *%rax
newfd = INDEX2FD(newfdnum);
8024bd: 8b 45 c8 mov -0x38(%rbp),%eax
8024c0: 48 98 cltq
8024c2: 48 05 00 00 0d 00 add $0xd0000,%rax
8024c8: 48 c1 e0 0c shl $0xc,%rax
8024cc: 48 89 45 f0 mov %rax,-0x10(%rbp)
ova = fd2data(oldfd);
8024d0: 48 8b 45 d8 mov -0x28(%rbp),%rax
8024d4: 48 89 c7 mov %rax,%rdi
8024d7: 48 b8 29 21 80 00 00 movabs $0x802129,%rax
8024de: 00 00 00
8024e1: ff d0 callq *%rax
8024e3: 48 89 45 e8 mov %rax,-0x18(%rbp)
nva = fd2data(newfd);
8024e7: 48 8b 45 f0 mov -0x10(%rbp),%rax
8024eb: 48 89 c7 mov %rax,%rdi
8024ee: 48 b8 29 21 80 00 00 movabs $0x802129,%rax
8024f5: 00 00 00
8024f8: ff d0 callq *%rax
8024fa: 48 89 45 e0 mov %rax,-0x20(%rbp)
if ((uvpd[VPD(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
8024fe: 48 8b 45 e8 mov -0x18(%rbp),%rax
802502: 48 c1 e8 15 shr $0x15,%rax
802506: 48 89 c2 mov %rax,%rdx
802509: 48 b8 00 00 00 80 00 movabs $0x10080000000,%rax
802510: 01 00 00
802513: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
802517: 83 e0 01 and $0x1,%eax
80251a: 48 85 c0 test %rax,%rax
80251d: 74 73 je 802592 <dup+0x11d>
80251f: 48 8b 45 e8 mov -0x18(%rbp),%rax
802523: 48 c1 e8 0c shr $0xc,%rax
802527: 48 89 c2 mov %rax,%rdx
80252a: 48 b8 00 00 00 00 00 movabs $0x10000000000,%rax
802531: 01 00 00
802534: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
802538: 83 e0 01 and $0x1,%eax
80253b: 48 85 c0 test %rax,%rax
80253e: 74 52 je 802592 <dup+0x11d>
if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
802540: 48 8b 45 e8 mov -0x18(%rbp),%rax
802544: 48 c1 e8 0c shr $0xc,%rax
802548: 48 89 c2 mov %rax,%rdx
80254b: 48 b8 00 00 00 00 00 movabs $0x10000000000,%rax
802552: 01 00 00
802555: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
802559: 25 07 0e 00 00 and $0xe07,%eax
80255e: 89 c1 mov %eax,%ecx
802560: 48 8b 55 e0 mov -0x20(%rbp),%rdx
802564: 48 8b 45 e8 mov -0x18(%rbp),%rax
802568: 41 89 c8 mov %ecx,%r8d
80256b: 48 89 d1 mov %rdx,%rcx
80256e: ba 00 00 00 00 mov $0x0,%edx
802573: 48 89 c6 mov %rax,%rsi
802576: bf 00 00 00 00 mov $0x0,%edi
80257b: 48 b8 4f 18 80 00 00 movabs $0x80184f,%rax
802582: 00 00 00
802585: ff d0 callq *%rax
802587: 89 45 fc mov %eax,-0x4(%rbp)
80258a: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
80258e: 79 02 jns 802592 <dup+0x11d>
goto err;
802590: eb 57 jmp 8025e9 <dup+0x174>
if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
802592: 48 8b 45 d8 mov -0x28(%rbp),%rax
802596: 48 c1 e8 0c shr $0xc,%rax
80259a: 48 89 c2 mov %rax,%rdx
80259d: 48 b8 00 00 00 00 00 movabs $0x10000000000,%rax
8025a4: 01 00 00
8025a7: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
8025ab: 25 07 0e 00 00 and $0xe07,%eax
8025b0: 89 c1 mov %eax,%ecx
8025b2: 48 8b 45 d8 mov -0x28(%rbp),%rax
8025b6: 48 8b 55 f0 mov -0x10(%rbp),%rdx
8025ba: 41 89 c8 mov %ecx,%r8d
8025bd: 48 89 d1 mov %rdx,%rcx
8025c0: ba 00 00 00 00 mov $0x0,%edx
8025c5: 48 89 c6 mov %rax,%rsi
8025c8: bf 00 00 00 00 mov $0x0,%edi
8025cd: 48 b8 4f 18 80 00 00 movabs $0x80184f,%rax
8025d4: 00 00 00
8025d7: ff d0 callq *%rax
8025d9: 89 45 fc mov %eax,-0x4(%rbp)
8025dc: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
8025e0: 79 02 jns 8025e4 <dup+0x16f>
goto err;
8025e2: eb 05 jmp 8025e9 <dup+0x174>
return newfdnum;
8025e4: 8b 45 c8 mov -0x38(%rbp),%eax
8025e7: eb 33 jmp 80261c <dup+0x1a7>
err:
sys_page_unmap(0, newfd);
8025e9: 48 8b 45 f0 mov -0x10(%rbp),%rax
8025ed: 48 89 c6 mov %rax,%rsi
8025f0: bf 00 00 00 00 mov $0x0,%edi
8025f5: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
8025fc: 00 00 00
8025ff: ff d0 callq *%rax
sys_page_unmap(0, nva);
802601: 48 8b 45 e0 mov -0x20(%rbp),%rax
802605: 48 89 c6 mov %rax,%rsi
802608: bf 00 00 00 00 mov $0x0,%edi
80260d: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
802614: 00 00 00
802617: ff d0 callq *%rax
return r;
802619: 8b 45 fc mov -0x4(%rbp),%eax
}
80261c: c9 leaveq
80261d: c3 retq
000000000080261e <read>:
ssize_t
read(int fdnum, void *buf, size_t n)
{
80261e: 55 push %rbp
80261f: 48 89 e5 mov %rsp,%rbp
802622: 48 83 ec 40 sub $0x40,%rsp
802626: 89 7d dc mov %edi,-0x24(%rbp)
802629: 48 89 75 d0 mov %rsi,-0x30(%rbp)
80262d: 48 89 55 c8 mov %rdx,-0x38(%rbp)
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
802631: 48 8d 55 e8 lea -0x18(%rbp),%rdx
802635: 8b 45 dc mov -0x24(%rbp),%eax
802638: 48 89 d6 mov %rdx,%rsi
80263b: 89 c7 mov %eax,%edi
80263d: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
802644: 00 00 00
802647: ff d0 callq *%rax
802649: 89 45 fc mov %eax,-0x4(%rbp)
80264c: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802650: 78 24 js 802676 <read+0x58>
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
802652: 48 8b 45 e8 mov -0x18(%rbp),%rax
802656: 8b 00 mov (%rax),%eax
802658: 48 8d 55 f0 lea -0x10(%rbp),%rdx
80265c: 48 89 d6 mov %rdx,%rsi
80265f: 89 c7 mov %eax,%edi
802661: 48 b8 45 23 80 00 00 movabs $0x802345,%rax
802668: 00 00 00
80266b: ff d0 callq *%rax
80266d: 89 45 fc mov %eax,-0x4(%rbp)
802670: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802674: 79 05 jns 80267b <read+0x5d>
return r;
802676: 8b 45 fc mov -0x4(%rbp),%eax
802679: eb 76 jmp 8026f1 <read+0xd3>
if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
80267b: 48 8b 45 e8 mov -0x18(%rbp),%rax
80267f: 8b 40 08 mov 0x8(%rax),%eax
802682: 83 e0 03 and $0x3,%eax
802685: 83 f8 01 cmp $0x1,%eax
802688: 75 3a jne 8026c4 <read+0xa6>
cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
80268a: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
802691: 00 00 00
802694: 48 8b 00 mov (%rax),%rax
802697: 8b 80 c8 00 00 00 mov 0xc8(%rax),%eax
80269d: 8b 55 dc mov -0x24(%rbp),%edx
8026a0: 89 c6 mov %eax,%esi
8026a2: 48 bf 37 43 80 00 00 movabs $0x804337,%rdi
8026a9: 00 00 00
8026ac: b8 00 00 00 00 mov $0x0,%eax
8026b1: 48 b9 1b 03 80 00 00 movabs $0x80031b,%rcx
8026b8: 00 00 00
8026bb: ff d1 callq *%rcx
return -E_INVAL;
8026bd: b8 fd ff ff ff mov $0xfffffffd,%eax
8026c2: eb 2d jmp 8026f1 <read+0xd3>
}
if (!dev->dev_read)
8026c4: 48 8b 45 f0 mov -0x10(%rbp),%rax
8026c8: 48 8b 40 10 mov 0x10(%rax),%rax
8026cc: 48 85 c0 test %rax,%rax
8026cf: 75 07 jne 8026d8 <read+0xba>
return -E_NOT_SUPP;
8026d1: b8 f0 ff ff ff mov $0xfffffff0,%eax
8026d6: eb 19 jmp 8026f1 <read+0xd3>
return (*dev->dev_read)(fd, buf, n);
8026d8: 48 8b 45 f0 mov -0x10(%rbp),%rax
8026dc: 48 8b 40 10 mov 0x10(%rax),%rax
8026e0: 48 8b 4d e8 mov -0x18(%rbp),%rcx
8026e4: 48 8b 55 c8 mov -0x38(%rbp),%rdx
8026e8: 48 8b 75 d0 mov -0x30(%rbp),%rsi
8026ec: 48 89 cf mov %rcx,%rdi
8026ef: ff d0 callq *%rax
}
8026f1: c9 leaveq
8026f2: c3 retq
00000000008026f3 <readn>:
ssize_t
readn(int fdnum, void *buf, size_t n)
{
8026f3: 55 push %rbp
8026f4: 48 89 e5 mov %rsp,%rbp
8026f7: 48 83 ec 30 sub $0x30,%rsp
8026fb: 89 7d ec mov %edi,-0x14(%rbp)
8026fe: 48 89 75 e0 mov %rsi,-0x20(%rbp)
802702: 48 89 55 d8 mov %rdx,-0x28(%rbp)
int m, tot;
for (tot = 0; tot < n; tot += m) {
802706: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
80270d: eb 49 jmp 802758 <readn+0x65>
m = read(fdnum, (char*)buf + tot, n - tot);
80270f: 8b 45 fc mov -0x4(%rbp),%eax
802712: 48 98 cltq
802714: 48 8b 55 d8 mov -0x28(%rbp),%rdx
802718: 48 29 c2 sub %rax,%rdx
80271b: 8b 45 fc mov -0x4(%rbp),%eax
80271e: 48 63 c8 movslq %eax,%rcx
802721: 48 8b 45 e0 mov -0x20(%rbp),%rax
802725: 48 01 c1 add %rax,%rcx
802728: 8b 45 ec mov -0x14(%rbp),%eax
80272b: 48 89 ce mov %rcx,%rsi
80272e: 89 c7 mov %eax,%edi
802730: 48 b8 1e 26 80 00 00 movabs $0x80261e,%rax
802737: 00 00 00
80273a: ff d0 callq *%rax
80273c: 89 45 f8 mov %eax,-0x8(%rbp)
if (m < 0)
80273f: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
802743: 79 05 jns 80274a <readn+0x57>
return m;
802745: 8b 45 f8 mov -0x8(%rbp),%eax
802748: eb 1c jmp 802766 <readn+0x73>
if (m == 0)
80274a: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
80274e: 75 02 jne 802752 <readn+0x5f>
break;
802750: eb 11 jmp 802763 <readn+0x70>
ssize_t
readn(int fdnum, void *buf, size_t n)
{
int m, tot;
for (tot = 0; tot < n; tot += m) {
802752: 8b 45 f8 mov -0x8(%rbp),%eax
802755: 01 45 fc add %eax,-0x4(%rbp)
802758: 8b 45 fc mov -0x4(%rbp),%eax
80275b: 48 98 cltq
80275d: 48 3b 45 d8 cmp -0x28(%rbp),%rax
802761: 72 ac jb 80270f <readn+0x1c>
if (m < 0)
return m;
if (m == 0)
break;
}
return tot;
802763: 8b 45 fc mov -0x4(%rbp),%eax
}
802766: c9 leaveq
802767: c3 retq
0000000000802768 <write>:
ssize_t
write(int fdnum, const void *buf, size_t n)
{
802768: 55 push %rbp
802769: 48 89 e5 mov %rsp,%rbp
80276c: 48 83 ec 40 sub $0x40,%rsp
802770: 89 7d dc mov %edi,-0x24(%rbp)
802773: 48 89 75 d0 mov %rsi,-0x30(%rbp)
802777: 48 89 55 c8 mov %rdx,-0x38(%rbp)
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
80277b: 48 8d 55 e8 lea -0x18(%rbp),%rdx
80277f: 8b 45 dc mov -0x24(%rbp),%eax
802782: 48 89 d6 mov %rdx,%rsi
802785: 89 c7 mov %eax,%edi
802787: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
80278e: 00 00 00
802791: ff d0 callq *%rax
802793: 89 45 fc mov %eax,-0x4(%rbp)
802796: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
80279a: 78 24 js 8027c0 <write+0x58>
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
80279c: 48 8b 45 e8 mov -0x18(%rbp),%rax
8027a0: 8b 00 mov (%rax),%eax
8027a2: 48 8d 55 f0 lea -0x10(%rbp),%rdx
8027a6: 48 89 d6 mov %rdx,%rsi
8027a9: 89 c7 mov %eax,%edi
8027ab: 48 b8 45 23 80 00 00 movabs $0x802345,%rax
8027b2: 00 00 00
8027b5: ff d0 callq *%rax
8027b7: 89 45 fc mov %eax,-0x4(%rbp)
8027ba: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
8027be: 79 05 jns 8027c5 <write+0x5d>
return r;
8027c0: 8b 45 fc mov -0x4(%rbp),%eax
8027c3: eb 75 jmp 80283a <write+0xd2>
if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
8027c5: 48 8b 45 e8 mov -0x18(%rbp),%rax
8027c9: 8b 40 08 mov 0x8(%rax),%eax
8027cc: 83 e0 03 and $0x3,%eax
8027cf: 85 c0 test %eax,%eax
8027d1: 75 3a jne 80280d <write+0xa5>
cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
8027d3: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
8027da: 00 00 00
8027dd: 48 8b 00 mov (%rax),%rax
8027e0: 8b 80 c8 00 00 00 mov 0xc8(%rax),%eax
8027e6: 8b 55 dc mov -0x24(%rbp),%edx
8027e9: 89 c6 mov %eax,%esi
8027eb: 48 bf 53 43 80 00 00 movabs $0x804353,%rdi
8027f2: 00 00 00
8027f5: b8 00 00 00 00 mov $0x0,%eax
8027fa: 48 b9 1b 03 80 00 00 movabs $0x80031b,%rcx
802801: 00 00 00
802804: ff d1 callq *%rcx
return -E_INVAL;
802806: b8 fd ff ff ff mov $0xfffffffd,%eax
80280b: eb 2d jmp 80283a <write+0xd2>
}
if (debug)
cprintf("write %d %p %d via dev %s\n",
fdnum, buf, n, dev->dev_name);
if (!dev->dev_write)
80280d: 48 8b 45 f0 mov -0x10(%rbp),%rax
802811: 48 8b 40 18 mov 0x18(%rax),%rax
802815: 48 85 c0 test %rax,%rax
802818: 75 07 jne 802821 <write+0xb9>
return -E_NOT_SUPP;
80281a: b8 f0 ff ff ff mov $0xfffffff0,%eax
80281f: eb 19 jmp 80283a <write+0xd2>
return (*dev->dev_write)(fd, buf, n);
802821: 48 8b 45 f0 mov -0x10(%rbp),%rax
802825: 48 8b 40 18 mov 0x18(%rax),%rax
802829: 48 8b 4d e8 mov -0x18(%rbp),%rcx
80282d: 48 8b 55 c8 mov -0x38(%rbp),%rdx
802831: 48 8b 75 d0 mov -0x30(%rbp),%rsi
802835: 48 89 cf mov %rcx,%rdi
802838: ff d0 callq *%rax
}
80283a: c9 leaveq
80283b: c3 retq
000000000080283c <seek>:
int
seek(int fdnum, off_t offset)
{
80283c: 55 push %rbp
80283d: 48 89 e5 mov %rsp,%rbp
802840: 48 83 ec 18 sub $0x18,%rsp
802844: 89 7d ec mov %edi,-0x14(%rbp)
802847: 89 75 e8 mov %esi,-0x18(%rbp)
int r;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0)
80284a: 48 8d 55 f0 lea -0x10(%rbp),%rdx
80284e: 8b 45 ec mov -0x14(%rbp),%eax
802851: 48 89 d6 mov %rdx,%rsi
802854: 89 c7 mov %eax,%edi
802856: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
80285d: 00 00 00
802860: ff d0 callq *%rax
802862: 89 45 fc mov %eax,-0x4(%rbp)
802865: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802869: 79 05 jns 802870 <seek+0x34>
return r;
80286b: 8b 45 fc mov -0x4(%rbp),%eax
80286e: eb 0f jmp 80287f <seek+0x43>
fd->fd_offset = offset;
802870: 48 8b 45 f0 mov -0x10(%rbp),%rax
802874: 8b 55 e8 mov -0x18(%rbp),%edx
802877: 89 50 04 mov %edx,0x4(%rax)
return 0;
80287a: b8 00 00 00 00 mov $0x0,%eax
}
80287f: c9 leaveq
802880: c3 retq
0000000000802881 <ftruncate>:
int
ftruncate(int fdnum, off_t newsize)
{
802881: 55 push %rbp
802882: 48 89 e5 mov %rsp,%rbp
802885: 48 83 ec 30 sub $0x30,%rsp
802889: 89 7d dc mov %edi,-0x24(%rbp)
80288c: 89 75 d8 mov %esi,-0x28(%rbp)
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
80288f: 48 8d 55 e8 lea -0x18(%rbp),%rdx
802893: 8b 45 dc mov -0x24(%rbp),%eax
802896: 48 89 d6 mov %rdx,%rsi
802899: 89 c7 mov %eax,%edi
80289b: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
8028a2: 00 00 00
8028a5: ff d0 callq *%rax
8028a7: 89 45 fc mov %eax,-0x4(%rbp)
8028aa: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
8028ae: 78 24 js 8028d4 <ftruncate+0x53>
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
8028b0: 48 8b 45 e8 mov -0x18(%rbp),%rax
8028b4: 8b 00 mov (%rax),%eax
8028b6: 48 8d 55 f0 lea -0x10(%rbp),%rdx
8028ba: 48 89 d6 mov %rdx,%rsi
8028bd: 89 c7 mov %eax,%edi
8028bf: 48 b8 45 23 80 00 00 movabs $0x802345,%rax
8028c6: 00 00 00
8028c9: ff d0 callq *%rax
8028cb: 89 45 fc mov %eax,-0x4(%rbp)
8028ce: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
8028d2: 79 05 jns 8028d9 <ftruncate+0x58>
return r;
8028d4: 8b 45 fc mov -0x4(%rbp),%eax
8028d7: eb 72 jmp 80294b <ftruncate+0xca>
if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
8028d9: 48 8b 45 e8 mov -0x18(%rbp),%rax
8028dd: 8b 40 08 mov 0x8(%rax),%eax
8028e0: 83 e0 03 and $0x3,%eax
8028e3: 85 c0 test %eax,%eax
8028e5: 75 3a jne 802921 <ftruncate+0xa0>
cprintf("[%08x] ftruncate %d -- bad mode\n",
thisenv->env_id, fdnum);
8028e7: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
8028ee: 00 00 00
8028f1: 48 8b 00 mov (%rax),%rax
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
return r;
if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
cprintf("[%08x] ftruncate %d -- bad mode\n",
8028f4: 8b 80 c8 00 00 00 mov 0xc8(%rax),%eax
8028fa: 8b 55 dc mov -0x24(%rbp),%edx
8028fd: 89 c6 mov %eax,%esi
8028ff: 48 bf 70 43 80 00 00 movabs $0x804370,%rdi
802906: 00 00 00
802909: b8 00 00 00 00 mov $0x0,%eax
80290e: 48 b9 1b 03 80 00 00 movabs $0x80031b,%rcx
802915: 00 00 00
802918: ff d1 callq *%rcx
thisenv->env_id, fdnum);
return -E_INVAL;
80291a: b8 fd ff ff ff mov $0xfffffffd,%eax
80291f: eb 2a jmp 80294b <ftruncate+0xca>
}
if (!dev->dev_trunc)
802921: 48 8b 45 f0 mov -0x10(%rbp),%rax
802925: 48 8b 40 30 mov 0x30(%rax),%rax
802929: 48 85 c0 test %rax,%rax
80292c: 75 07 jne 802935 <ftruncate+0xb4>
return -E_NOT_SUPP;
80292e: b8 f0 ff ff ff mov $0xfffffff0,%eax
802933: eb 16 jmp 80294b <ftruncate+0xca>
return (*dev->dev_trunc)(fd, newsize);
802935: 48 8b 45 f0 mov -0x10(%rbp),%rax
802939: 48 8b 40 30 mov 0x30(%rax),%rax
80293d: 48 8b 55 e8 mov -0x18(%rbp),%rdx
802941: 8b 4d d8 mov -0x28(%rbp),%ecx
802944: 89 ce mov %ecx,%esi
802946: 48 89 d7 mov %rdx,%rdi
802949: ff d0 callq *%rax
}
80294b: c9 leaveq
80294c: c3 retq
000000000080294d <fstat>:
int
fstat(int fdnum, struct Stat *stat)
{
80294d: 55 push %rbp
80294e: 48 89 e5 mov %rsp,%rbp
802951: 48 83 ec 30 sub $0x30,%rsp
802955: 89 7d dc mov %edi,-0x24(%rbp)
802958: 48 89 75 d0 mov %rsi,-0x30(%rbp)
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
80295c: 48 8d 55 e8 lea -0x18(%rbp),%rdx
802960: 8b 45 dc mov -0x24(%rbp),%eax
802963: 48 89 d6 mov %rdx,%rsi
802966: 89 c7 mov %eax,%edi
802968: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
80296f: 00 00 00
802972: ff d0 callq *%rax
802974: 89 45 fc mov %eax,-0x4(%rbp)
802977: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
80297b: 78 24 js 8029a1 <fstat+0x54>
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
80297d: 48 8b 45 e8 mov -0x18(%rbp),%rax
802981: 8b 00 mov (%rax),%eax
802983: 48 8d 55 f0 lea -0x10(%rbp),%rdx
802987: 48 89 d6 mov %rdx,%rsi
80298a: 89 c7 mov %eax,%edi
80298c: 48 b8 45 23 80 00 00 movabs $0x802345,%rax
802993: 00 00 00
802996: ff d0 callq *%rax
802998: 89 45 fc mov %eax,-0x4(%rbp)
80299b: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
80299f: 79 05 jns 8029a6 <fstat+0x59>
return r;
8029a1: 8b 45 fc mov -0x4(%rbp),%eax
8029a4: eb 5e jmp 802a04 <fstat+0xb7>
if (!dev->dev_stat)
8029a6: 48 8b 45 f0 mov -0x10(%rbp),%rax
8029aa: 48 8b 40 28 mov 0x28(%rax),%rax
8029ae: 48 85 c0 test %rax,%rax
8029b1: 75 07 jne 8029ba <fstat+0x6d>
return -E_NOT_SUPP;
8029b3: b8 f0 ff ff ff mov $0xfffffff0,%eax
8029b8: eb 4a jmp 802a04 <fstat+0xb7>
stat->st_name[0] = 0;
8029ba: 48 8b 45 d0 mov -0x30(%rbp),%rax
8029be: c6 00 00 movb $0x0,(%rax)
stat->st_size = 0;
8029c1: 48 8b 45 d0 mov -0x30(%rbp),%rax
8029c5: c7 80 80 00 00 00 00 movl $0x0,0x80(%rax)
8029cc: 00 00 00
stat->st_isdir = 0;
8029cf: 48 8b 45 d0 mov -0x30(%rbp),%rax
8029d3: c7 80 84 00 00 00 00 movl $0x0,0x84(%rax)
8029da: 00 00 00
stat->st_dev = dev;
8029dd: 48 8b 55 f0 mov -0x10(%rbp),%rdx
8029e1: 48 8b 45 d0 mov -0x30(%rbp),%rax
8029e5: 48 89 90 88 00 00 00 mov %rdx,0x88(%rax)
return (*dev->dev_stat)(fd, stat);
8029ec: 48 8b 45 f0 mov -0x10(%rbp),%rax
8029f0: 48 8b 40 28 mov 0x28(%rax),%rax
8029f4: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8029f8: 48 8b 4d d0 mov -0x30(%rbp),%rcx
8029fc: 48 89 ce mov %rcx,%rsi
8029ff: 48 89 d7 mov %rdx,%rdi
802a02: ff d0 callq *%rax
}
802a04: c9 leaveq
802a05: c3 retq
0000000000802a06 <stat>:
int
stat(const char *path, struct Stat *stat)
{
802a06: 55 push %rbp
802a07: 48 89 e5 mov %rsp,%rbp
802a0a: 48 83 ec 20 sub $0x20,%rsp
802a0e: 48 89 7d e8 mov %rdi,-0x18(%rbp)
802a12: 48 89 75 e0 mov %rsi,-0x20(%rbp)
int fd, r;
if ((fd = open(path, O_RDONLY)) < 0)
802a16: 48 8b 45 e8 mov -0x18(%rbp),%rax
802a1a: be 00 00 00 00 mov $0x0,%esi
802a1f: 48 89 c7 mov %rax,%rdi
802a22: 48 b8 f4 2a 80 00 00 movabs $0x802af4,%rax
802a29: 00 00 00
802a2c: ff d0 callq *%rax
802a2e: 89 45 fc mov %eax,-0x4(%rbp)
802a31: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802a35: 79 05 jns 802a3c <stat+0x36>
return fd;
802a37: 8b 45 fc mov -0x4(%rbp),%eax
802a3a: eb 2f jmp 802a6b <stat+0x65>
r = fstat(fd, stat);
802a3c: 48 8b 55 e0 mov -0x20(%rbp),%rdx
802a40: 8b 45 fc mov -0x4(%rbp),%eax
802a43: 48 89 d6 mov %rdx,%rsi
802a46: 89 c7 mov %eax,%edi
802a48: 48 b8 4d 29 80 00 00 movabs $0x80294d,%rax
802a4f: 00 00 00
802a52: ff d0 callq *%rax
802a54: 89 45 f8 mov %eax,-0x8(%rbp)
close(fd);
802a57: 8b 45 fc mov -0x4(%rbp),%eax
802a5a: 89 c7 mov %eax,%edi
802a5c: 48 b8 fc 23 80 00 00 movabs $0x8023fc,%rax
802a63: 00 00 00
802a66: ff d0 callq *%rax
return r;
802a68: 8b 45 f8 mov -0x8(%rbp),%eax
}
802a6b: c9 leaveq
802a6c: c3 retq
0000000000802a6d <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
802a6d: 55 push %rbp
802a6e: 48 89 e5 mov %rsp,%rbp
802a71: 48 83 ec 10 sub $0x10,%rsp
802a75: 89 7d fc mov %edi,-0x4(%rbp)
802a78: 48 89 75 f0 mov %rsi,-0x10(%rbp)
static envid_t fsenv;
if (fsenv == 0)
802a7c: 48 b8 00 70 80 00 00 movabs $0x807000,%rax
802a83: 00 00 00
802a86: 8b 00 mov (%rax),%eax
802a88: 85 c0 test %eax,%eax
802a8a: 75 1d jne 802aa9 <fsipc+0x3c>
fsenv = ipc_find_env(ENV_TYPE_FS);
802a8c: bf 01 00 00 00 mov $0x1,%edi
802a91: 48 b8 67 3b 80 00 00 movabs $0x803b67,%rax
802a98: 00 00 00
802a9b: ff d0 callq *%rax
802a9d: 48 ba 00 70 80 00 00 movabs $0x807000,%rdx
802aa4: 00 00 00
802aa7: 89 02 mov %eax,(%rdx)
//static_assert(sizeof(fsipcbuf) == PGSIZE);
if (debug)
cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);
ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
802aa9: 48 b8 00 70 80 00 00 movabs $0x807000,%rax
802ab0: 00 00 00
802ab3: 8b 00 mov (%rax),%eax
802ab5: 8b 75 fc mov -0x4(%rbp),%esi
802ab8: b9 07 00 00 00 mov $0x7,%ecx
802abd: 48 ba 00 80 80 00 00 movabs $0x808000,%rdx
802ac4: 00 00 00
802ac7: 89 c7 mov %eax,%edi
802ac9: 48 b8 05 3b 80 00 00 movabs $0x803b05,%rax
802ad0: 00 00 00
802ad3: ff d0 callq *%rax
return ipc_recv(NULL, dstva, NULL);
802ad5: 48 8b 45 f0 mov -0x10(%rbp),%rax
802ad9: ba 00 00 00 00 mov $0x0,%edx
802ade: 48 89 c6 mov %rax,%rsi
802ae1: bf 00 00 00 00 mov $0x0,%edi
802ae6: 48 b8 ff 39 80 00 00 movabs $0x8039ff,%rax
802aed: 00 00 00
802af0: ff d0 callq *%rax
}
802af2: c9 leaveq
802af3: c3 retq
0000000000802af4 <open>:
// The file descriptor index on success
// -E_BAD_PATH if the path is too long (>= MAXPATHLEN)
// < 0 for other errors.
int
open(const char *path, int mode)
{
802af4: 55 push %rbp
802af5: 48 89 e5 mov %rsp,%rbp
802af8: 48 83 ec 30 sub $0x30,%rsp
802afc: 48 89 7d d8 mov %rdi,-0x28(%rbp)
802b00: 89 75 d4 mov %esi,-0x2c(%rbp)
// Return the file descriptor index.
// If any step after fd_alloc fails, use fd_close to free the
// file descriptor.
// LAB 5: Your code here
int r = -1;
802b03: c7 45 fc ff ff ff ff movl $0xffffffff,-0x4(%rbp)
int d = -1;
802b0a: c7 45 f8 ff ff ff ff movl $0xffffffff,-0x8(%rbp)
int len = 0;
802b11: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp)
void *va;
if(!path)
802b18: 48 83 7d d8 00 cmpq $0x0,-0x28(%rbp)
802b1d: 75 08 jne 802b27 <open+0x33>
{
return r;
802b1f: 8b 45 fc mov -0x4(%rbp),%eax
802b22: e9 f2 00 00 00 jmpq 802c19 <open+0x125>
}
else if((len = strlen(path)) >= MAXPATHLEN)
802b27: 48 8b 45 d8 mov -0x28(%rbp),%rax
802b2b: 48 89 c7 mov %rax,%rdi
802b2e: 48 b8 64 0e 80 00 00 movabs $0x800e64,%rax
802b35: 00 00 00
802b38: ff d0 callq *%rax
802b3a: 89 45 f4 mov %eax,-0xc(%rbp)
802b3d: 81 7d f4 ff 03 00 00 cmpl $0x3ff,-0xc(%rbp)
802b44: 7e 0a jle 802b50 <open+0x5c>
{
return -E_BAD_PATH;
802b46: b8 f3 ff ff ff mov $0xfffffff3,%eax
802b4b: e9 c9 00 00 00 jmpq 802c19 <open+0x125>
}
else
{
struct Fd *fd_store = NULL;
802b50: 48 c7 45 e8 00 00 00 movq $0x0,-0x18(%rbp)
802b57: 00
if((r = fd_alloc(&fd_store)) < 0 || fd_store == NULL)
802b58: 48 8d 45 e8 lea -0x18(%rbp),%rax
802b5c: 48 89 c7 mov %rax,%rdi
802b5f: 48 b8 54 21 80 00 00 movabs $0x802154,%rax
802b66: 00 00 00
802b69: ff d0 callq *%rax
802b6b: 89 45 fc mov %eax,-0x4(%rbp)
802b6e: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802b72: 78 09 js 802b7d <open+0x89>
802b74: 48 8b 45 e8 mov -0x18(%rbp),%rax
802b78: 48 85 c0 test %rax,%rax
802b7b: 75 08 jne 802b85 <open+0x91>
{
return r;
802b7d: 8b 45 fc mov -0x4(%rbp),%eax
802b80: e9 94 00 00 00 jmpq 802c19 <open+0x125>
}
strncpy(fsipcbuf.open.req_path, path, MAXPATHLEN);
802b85: 48 8b 45 d8 mov -0x28(%rbp),%rax
802b89: ba 00 04 00 00 mov $0x400,%edx
802b8e: 48 89 c6 mov %rax,%rsi
802b91: 48 bf 00 80 80 00 00 movabs $0x808000,%rdi
802b98: 00 00 00
802b9b: 48 b8 62 0f 80 00 00 movabs $0x800f62,%rax
802ba2: 00 00 00
802ba5: ff d0 callq *%rax
fsipcbuf.open.req_omode = mode;
802ba7: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802bae: 00 00 00
802bb1: 8b 55 d4 mov -0x2c(%rbp),%edx
802bb4: 89 90 00 04 00 00 mov %edx,0x400(%rax)
if ((r = fsipc(FSREQ_OPEN, fd_store)) < 0)
802bba: 48 8b 45 e8 mov -0x18(%rbp),%rax
802bbe: 48 89 c6 mov %rax,%rsi
802bc1: bf 01 00 00 00 mov $0x1,%edi
802bc6: 48 b8 6d 2a 80 00 00 movabs $0x802a6d,%rax
802bcd: 00 00 00
802bd0: ff d0 callq *%rax
802bd2: 89 45 fc mov %eax,-0x4(%rbp)
802bd5: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802bd9: 79 2b jns 802c06 <open+0x112>
{
if((d = fd_close(fd_store, 0)) < 0)
802bdb: 48 8b 45 e8 mov -0x18(%rbp),%rax
802bdf: be 00 00 00 00 mov $0x0,%esi
802be4: 48 89 c7 mov %rax,%rdi
802be7: 48 b8 7c 22 80 00 00 movabs $0x80227c,%rax
802bee: 00 00 00
802bf1: ff d0 callq *%rax
802bf3: 89 45 f8 mov %eax,-0x8(%rbp)
802bf6: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
802bfa: 79 05 jns 802c01 <open+0x10d>
{
return d;
802bfc: 8b 45 f8 mov -0x8(%rbp),%eax
802bff: eb 18 jmp 802c19 <open+0x125>
}
return r;
802c01: 8b 45 fc mov -0x4(%rbp),%eax
802c04: eb 13 jmp 802c19 <open+0x125>
}
return fd2num(fd_store);
802c06: 48 8b 45 e8 mov -0x18(%rbp),%rax
802c0a: 48 89 c7 mov %rax,%rdi
802c0d: 48 b8 06 21 80 00 00 movabs $0x802106,%rax
802c14: 00 00 00
802c17: ff d0 callq *%rax
}
//panic ("open not implemented");
}
802c19: c9 leaveq
802c1a: c3 retq
0000000000802c1b <devfile_flush>:
// open, unmapping it is enough to free up server-side resources.
// Other than that, we just have to make sure our changes are flushed
// to disk.
static int
devfile_flush(struct Fd *fd)
{
802c1b: 55 push %rbp
802c1c: 48 89 e5 mov %rsp,%rbp
802c1f: 48 83 ec 10 sub $0x10,%rsp
802c23: 48 89 7d f8 mov %rdi,-0x8(%rbp)
fsipcbuf.flush.req_fileid = fd->fd_file.id;
802c27: 48 8b 45 f8 mov -0x8(%rbp),%rax
802c2b: 8b 50 0c mov 0xc(%rax),%edx
802c2e: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802c35: 00 00 00
802c38: 89 10 mov %edx,(%rax)
return fsipc(FSREQ_FLUSH, NULL);
802c3a: be 00 00 00 00 mov $0x0,%esi
802c3f: bf 06 00 00 00 mov $0x6,%edi
802c44: 48 b8 6d 2a 80 00 00 movabs $0x802a6d,%rax
802c4b: 00 00 00
802c4e: ff d0 callq *%rax
}
802c50: c9 leaveq
802c51: c3 retq
0000000000802c52 <devfile_read>:
// Returns:
// The number of bytes successfully read.
// < 0 on error.
static ssize_t
devfile_read(struct Fd *fd, void *buf, size_t n)
{
802c52: 55 push %rbp
802c53: 48 89 e5 mov %rsp,%rbp
802c56: 48 83 ec 30 sub $0x30,%rsp
802c5a: 48 89 7d e8 mov %rdi,-0x18(%rbp)
802c5e: 48 89 75 e0 mov %rsi,-0x20(%rbp)
802c62: 48 89 55 d8 mov %rdx,-0x28(%rbp)
// Make an FSREQ_READ request to the file system server after
// filling fsipcbuf.read with the request arguments. The
// bytes read will be written back to fsipcbuf by the file
// system server.
// LAB 5: Your code here
int r = 0;
802c66: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
if(!fd || !buf)
802c6d: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
802c72: 74 07 je 802c7b <devfile_read+0x29>
802c74: 48 83 7d e0 00 cmpq $0x0,-0x20(%rbp)
802c79: 75 07 jne 802c82 <devfile_read+0x30>
return -E_INVAL;
802c7b: b8 fd ff ff ff mov $0xfffffffd,%eax
802c80: eb 77 jmp 802cf9 <devfile_read+0xa7>
fsipcbuf.read.req_fileid = fd->fd_file.id;
802c82: 48 8b 45 e8 mov -0x18(%rbp),%rax
802c86: 8b 50 0c mov 0xc(%rax),%edx
802c89: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802c90: 00 00 00
802c93: 89 10 mov %edx,(%rax)
fsipcbuf.read.req_n = n;
802c95: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802c9c: 00 00 00
802c9f: 48 8b 55 d8 mov -0x28(%rbp),%rdx
802ca3: 48 89 50 08 mov %rdx,0x8(%rax)
if ((r = fsipc(FSREQ_READ, NULL)) <= 0){
802ca7: be 00 00 00 00 mov $0x0,%esi
802cac: bf 03 00 00 00 mov $0x3,%edi
802cb1: 48 b8 6d 2a 80 00 00 movabs $0x802a6d,%rax
802cb8: 00 00 00
802cbb: ff d0 callq *%rax
802cbd: 89 45 fc mov %eax,-0x4(%rbp)
802cc0: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802cc4: 7f 05 jg 802ccb <devfile_read+0x79>
//cprintf("devfile_read r is [%d]\n",r);
return r;
802cc6: 8b 45 fc mov -0x4(%rbp),%eax
802cc9: eb 2e jmp 802cf9 <devfile_read+0xa7>
}
//cprintf("devfile_read %x %x %x %x\n",fsipcbuf.readRet.ret_buf[0], fsipcbuf.readRet.ret_buf[1], fsipcbuf.readRet.ret_buf[2], fsipcbuf.readRet.ret_buf[3]);
memmove(buf, (char*)fsipcbuf.readRet.ret_buf, r);
802ccb: 8b 45 fc mov -0x4(%rbp),%eax
802cce: 48 63 d0 movslq %eax,%rdx
802cd1: 48 8b 45 e0 mov -0x20(%rbp),%rax
802cd5: 48 be 00 80 80 00 00 movabs $0x808000,%rsi
802cdc: 00 00 00
802cdf: 48 89 c7 mov %rax,%rdi
802ce2: 48 b8 f4 11 80 00 00 movabs $0x8011f4,%rax
802ce9: 00 00 00
802cec: ff d0 callq *%rax
char* buf1 = (char*)buf;
802cee: 48 8b 45 e0 mov -0x20(%rbp),%rax
802cf2: 48 89 45 f0 mov %rax,-0x10(%rbp)
//cprintf("devfile_read ri is [%d] %x %x %x %x\n",r,buf1[0],buf1[1],buf1[2],buf1[3]);
return r;
802cf6: 8b 45 fc mov -0x4(%rbp),%eax
//panic("devfile_read not implemented");
}
802cf9: c9 leaveq
802cfa: c3 retq
0000000000802cfb <devfile_write>:
// Returns:
// The number of bytes successfully written.
// < 0 on error.
static ssize_t
devfile_write(struct Fd *fd, const void *buf, size_t n)
{
802cfb: 55 push %rbp
802cfc: 48 89 e5 mov %rsp,%rbp
802cff: 48 83 ec 30 sub $0x30,%rsp
802d03: 48 89 7d e8 mov %rdi,-0x18(%rbp)
802d07: 48 89 75 e0 mov %rsi,-0x20(%rbp)
802d0b: 48 89 55 d8 mov %rdx,-0x28(%rbp)
// Make an FSREQ_WRITE request to the file system server. Be
// careful: fsipcbuf.write.req_buf is only so large, but
// remember that write is always allowed to write *fewer*
// bytes than requested.
// LAB 5: Your code here
int r = -1;
802d0f: c7 45 fc ff ff ff ff movl $0xffffffff,-0x4(%rbp)
if(!fd || !buf)
802d16: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
802d1b: 74 07 je 802d24 <devfile_write+0x29>
802d1d: 48 83 7d e0 00 cmpq $0x0,-0x20(%rbp)
802d22: 75 08 jne 802d2c <devfile_write+0x31>
return r;
802d24: 8b 45 fc mov -0x4(%rbp),%eax
802d27: e9 9a 00 00 00 jmpq 802dc6 <devfile_write+0xcb>
fsipcbuf.write.req_fileid = fd->fd_file.id;
802d2c: 48 8b 45 e8 mov -0x18(%rbp),%rax
802d30: 8b 50 0c mov 0xc(%rax),%edx
802d33: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802d3a: 00 00 00
802d3d: 89 10 mov %edx,(%rax)
if(n > PGSIZE - (sizeof(int) + sizeof(size_t)))
802d3f: 48 81 7d d8 f4 0f 00 cmpq $0xff4,-0x28(%rbp)
802d46: 00
802d47: 76 08 jbe 802d51 <devfile_write+0x56>
{
n = PGSIZE - (sizeof(int) + sizeof(size_t));
802d49: 48 c7 45 d8 f4 0f 00 movq $0xff4,-0x28(%rbp)
802d50: 00
}
fsipcbuf.write.req_n = n;
802d51: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802d58: 00 00 00
802d5b: 48 8b 55 d8 mov -0x28(%rbp),%rdx
802d5f: 48 89 50 08 mov %rdx,0x8(%rax)
memmove((void*)fsipcbuf.write.req_buf, (void*)buf, n);
802d63: 48 8b 55 d8 mov -0x28(%rbp),%rdx
802d67: 48 8b 45 e0 mov -0x20(%rbp),%rax
802d6b: 48 89 c6 mov %rax,%rsi
802d6e: 48 bf 10 80 80 00 00 movabs $0x808010,%rdi
802d75: 00 00 00
802d78: 48 b8 f4 11 80 00 00 movabs $0x8011f4,%rax
802d7f: 00 00 00
802d82: ff d0 callq *%rax
if ((r = fsipc(FSREQ_WRITE, NULL)) <= 0){
802d84: be 00 00 00 00 mov $0x0,%esi
802d89: bf 04 00 00 00 mov $0x4,%edi
802d8e: 48 b8 6d 2a 80 00 00 movabs $0x802a6d,%rax
802d95: 00 00 00
802d98: ff d0 callq *%rax
802d9a: 89 45 fc mov %eax,-0x4(%rbp)
802d9d: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802da1: 7f 20 jg 802dc3 <devfile_write+0xc8>
cprintf("fsipc-FSREQ_WRITE returns 0");
802da3: 48 bf 96 43 80 00 00 movabs $0x804396,%rdi
802daa: 00 00 00
802dad: b8 00 00 00 00 mov $0x0,%eax
802db2: 48 ba 1b 03 80 00 00 movabs $0x80031b,%rdx
802db9: 00 00 00
802dbc: ff d2 callq *%rdx
return r;
802dbe: 8b 45 fc mov -0x4(%rbp),%eax
802dc1: eb 03 jmp 802dc6 <devfile_write+0xcb>
}
return r;
802dc3: 8b 45 fc mov -0x4(%rbp),%eax
//panic("devfile_write not implemented");
}
802dc6: c9 leaveq
802dc7: c3 retq
0000000000802dc8 <devfile_stat>:
static int
devfile_stat(struct Fd *fd, struct Stat *st)
{
802dc8: 55 push %rbp
802dc9: 48 89 e5 mov %rsp,%rbp
802dcc: 48 83 ec 20 sub $0x20,%rsp
802dd0: 48 89 7d e8 mov %rdi,-0x18(%rbp)
802dd4: 48 89 75 e0 mov %rsi,-0x20(%rbp)
int r;
fsipcbuf.stat.req_fileid = fd->fd_file.id;
802dd8: 48 8b 45 e8 mov -0x18(%rbp),%rax
802ddc: 8b 50 0c mov 0xc(%rax),%edx
802ddf: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802de6: 00 00 00
802de9: 89 10 mov %edx,(%rax)
if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
802deb: be 00 00 00 00 mov $0x0,%esi
802df0: bf 05 00 00 00 mov $0x5,%edi
802df5: 48 b8 6d 2a 80 00 00 movabs $0x802a6d,%rax
802dfc: 00 00 00
802dff: ff d0 callq *%rax
802e01: 89 45 fc mov %eax,-0x4(%rbp)
802e04: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
802e08: 79 05 jns 802e0f <devfile_stat+0x47>
return r;
802e0a: 8b 45 fc mov -0x4(%rbp),%eax
802e0d: eb 56 jmp 802e65 <devfile_stat+0x9d>
strcpy(st->st_name, fsipcbuf.statRet.ret_name);
802e0f: 48 8b 45 e0 mov -0x20(%rbp),%rax
802e13: 48 be 00 80 80 00 00 movabs $0x808000,%rsi
802e1a: 00 00 00
802e1d: 48 89 c7 mov %rax,%rdi
802e20: 48 b8 d0 0e 80 00 00 movabs $0x800ed0,%rax
802e27: 00 00 00
802e2a: ff d0 callq *%rax
st->st_size = fsipcbuf.statRet.ret_size;
802e2c: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802e33: 00 00 00
802e36: 8b 90 80 00 00 00 mov 0x80(%rax),%edx
802e3c: 48 8b 45 e0 mov -0x20(%rbp),%rax
802e40: 89 90 80 00 00 00 mov %edx,0x80(%rax)
st->st_isdir = fsipcbuf.statRet.ret_isdir;
802e46: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802e4d: 00 00 00
802e50: 8b 90 84 00 00 00 mov 0x84(%rax),%edx
802e56: 48 8b 45 e0 mov -0x20(%rbp),%rax
802e5a: 89 90 84 00 00 00 mov %edx,0x84(%rax)
return 0;
802e60: b8 00 00 00 00 mov $0x0,%eax
}
802e65: c9 leaveq
802e66: c3 retq
0000000000802e67 <devfile_trunc>:
// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
802e67: 55 push %rbp
802e68: 48 89 e5 mov %rsp,%rbp
802e6b: 48 83 ec 10 sub $0x10,%rsp
802e6f: 48 89 7d f8 mov %rdi,-0x8(%rbp)
802e73: 89 75 f4 mov %esi,-0xc(%rbp)
fsipcbuf.set_size.req_fileid = fd->fd_file.id;
802e76: 48 8b 45 f8 mov -0x8(%rbp),%rax
802e7a: 8b 50 0c mov 0xc(%rax),%edx
802e7d: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802e84: 00 00 00
802e87: 89 10 mov %edx,(%rax)
fsipcbuf.set_size.req_size = newsize;
802e89: 48 b8 00 80 80 00 00 movabs $0x808000,%rax
802e90: 00 00 00
802e93: 8b 55 f4 mov -0xc(%rbp),%edx
802e96: 89 50 04 mov %edx,0x4(%rax)
return fsipc(FSREQ_SET_SIZE, NULL);
802e99: be 00 00 00 00 mov $0x0,%esi
802e9e: bf 02 00 00 00 mov $0x2,%edi
802ea3: 48 b8 6d 2a 80 00 00 movabs $0x802a6d,%rax
802eaa: 00 00 00
802ead: ff d0 callq *%rax
}
802eaf: c9 leaveq
802eb0: c3 retq
0000000000802eb1 <remove>:
// Delete a file
int
remove(const char *path)
{
802eb1: 55 push %rbp
802eb2: 48 89 e5 mov %rsp,%rbp
802eb5: 48 83 ec 10 sub $0x10,%rsp
802eb9: 48 89 7d f8 mov %rdi,-0x8(%rbp)
if (strlen(path) >= MAXPATHLEN)
802ebd: 48 8b 45 f8 mov -0x8(%rbp),%rax
802ec1: 48 89 c7 mov %rax,%rdi
802ec4: 48 b8 64 0e 80 00 00 movabs $0x800e64,%rax
802ecb: 00 00 00
802ece: ff d0 callq *%rax
802ed0: 3d ff 03 00 00 cmp $0x3ff,%eax
802ed5: 7e 07 jle 802ede <remove+0x2d>
return -E_BAD_PATH;
802ed7: b8 f3 ff ff ff mov $0xfffffff3,%eax
802edc: eb 33 jmp 802f11 <remove+0x60>
strcpy(fsipcbuf.remove.req_path, path);
802ede: 48 8b 45 f8 mov -0x8(%rbp),%rax
802ee2: 48 89 c6 mov %rax,%rsi
802ee5: 48 bf 00 80 80 00 00 movabs $0x808000,%rdi
802eec: 00 00 00
802eef: 48 b8 d0 0e 80 00 00 movabs $0x800ed0,%rax
802ef6: 00 00 00
802ef9: ff d0 callq *%rax
return fsipc(FSREQ_REMOVE, NULL);
802efb: be 00 00 00 00 mov $0x0,%esi
802f00: bf 07 00 00 00 mov $0x7,%edi
802f05: 48 b8 6d 2a 80 00 00 movabs $0x802a6d,%rax
802f0c: 00 00 00
802f0f: ff d0 callq *%rax
}
802f11: c9 leaveq
802f12: c3 retq
0000000000802f13 <sync>:
// Synchronize disk with buffer cache
int
sync(void)
{
802f13: 55 push %rbp
802f14: 48 89 e5 mov %rsp,%rbp
// Ask the file server to update the disk
// by writing any dirty blocks in the buffer cache.
return fsipc(FSREQ_SYNC, NULL);
802f17: be 00 00 00 00 mov $0x0,%esi
802f1c: bf 08 00 00 00 mov $0x8,%edi
802f21: 48 b8 6d 2a 80 00 00 movabs $0x802a6d,%rax
802f28: 00 00 00
802f2b: ff d0 callq *%rax
}
802f2d: 5d pop %rbp
802f2e: c3 retq
0000000000802f2f <pipe>:
uint8_t p_buf[PIPEBUFSIZ]; // data buffer
};
int
pipe(int pfd[2])
{
802f2f: 55 push %rbp
802f30: 48 89 e5 mov %rsp,%rbp
802f33: 53 push %rbx
802f34: 48 83 ec 38 sub $0x38,%rsp
802f38: 48 89 7d c8 mov %rdi,-0x38(%rbp)
int r;
struct Fd *fd0, *fd1;
void *va;
// allocate the file descriptor table entries
if ((r = fd_alloc(&fd0)) < 0
802f3c: 48 8d 45 d8 lea -0x28(%rbp),%rax
802f40: 48 89 c7 mov %rax,%rdi
802f43: 48 b8 54 21 80 00 00 movabs $0x802154,%rax
802f4a: 00 00 00
802f4d: ff d0 callq *%rax
802f4f: 89 45 ec mov %eax,-0x14(%rbp)
802f52: 83 7d ec 00 cmpl $0x0,-0x14(%rbp)
802f56: 0f 88 bf 01 00 00 js 80311b <pipe+0x1ec>
|| (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
802f5c: 48 8b 45 d8 mov -0x28(%rbp),%rax
802f60: ba 07 04 00 00 mov $0x407,%edx
802f65: 48 89 c6 mov %rax,%rsi
802f68: bf 00 00 00 00 mov $0x0,%edi
802f6d: 48 b8 ff 17 80 00 00 movabs $0x8017ff,%rax
802f74: 00 00 00
802f77: ff d0 callq *%rax
802f79: 89 45 ec mov %eax,-0x14(%rbp)
802f7c: 83 7d ec 00 cmpl $0x0,-0x14(%rbp)
802f80: 0f 88 95 01 00 00 js 80311b <pipe+0x1ec>
goto err;
if ((r = fd_alloc(&fd1)) < 0
802f86: 48 8d 45 d0 lea -0x30(%rbp),%rax
802f8a: 48 89 c7 mov %rax,%rdi
802f8d: 48 b8 54 21 80 00 00 movabs $0x802154,%rax
802f94: 00 00 00
802f97: ff d0 callq *%rax
802f99: 89 45 ec mov %eax,-0x14(%rbp)
802f9c: 83 7d ec 00 cmpl $0x0,-0x14(%rbp)
802fa0: 0f 88 5d 01 00 00 js 803103 <pipe+0x1d4>
|| (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
802fa6: 48 8b 45 d0 mov -0x30(%rbp),%rax
802faa: ba 07 04 00 00 mov $0x407,%edx
802faf: 48 89 c6 mov %rax,%rsi
802fb2: bf 00 00 00 00 mov $0x0,%edi
802fb7: 48 b8 ff 17 80 00 00 movabs $0x8017ff,%rax
802fbe: 00 00 00
802fc1: ff d0 callq *%rax
802fc3: 89 45 ec mov %eax,-0x14(%rbp)
802fc6: 83 7d ec 00 cmpl $0x0,-0x14(%rbp)
802fca: 0f 88 33 01 00 00 js 803103 <pipe+0x1d4>
goto err1;
// allocate the pipe structure as first data page in both
va = fd2data(fd0);
802fd0: 48 8b 45 d8 mov -0x28(%rbp),%rax
802fd4: 48 89 c7 mov %rax,%rdi
802fd7: 48 b8 29 21 80 00 00 movabs $0x802129,%rax
802fde: 00 00 00
802fe1: ff d0 callq *%rax
802fe3: 48 89 45 e0 mov %rax,-0x20(%rbp)
if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
802fe7: 48 8b 45 e0 mov -0x20(%rbp),%rax
802feb: ba 07 04 00 00 mov $0x407,%edx
802ff0: 48 89 c6 mov %rax,%rsi
802ff3: bf 00 00 00 00 mov $0x0,%edi
802ff8: 48 b8 ff 17 80 00 00 movabs $0x8017ff,%rax
802fff: 00 00 00
803002: ff d0 callq *%rax
803004: 89 45 ec mov %eax,-0x14(%rbp)
803007: 83 7d ec 00 cmpl $0x0,-0x14(%rbp)
80300b: 79 05 jns 803012 <pipe+0xe3>
goto err2;
80300d: e9 d9 00 00 00 jmpq 8030eb <pipe+0x1bc>
if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
803012: 48 8b 45 d0 mov -0x30(%rbp),%rax
803016: 48 89 c7 mov %rax,%rdi
803019: 48 b8 29 21 80 00 00 movabs $0x802129,%rax
803020: 00 00 00
803023: ff d0 callq *%rax
803025: 48 89 c2 mov %rax,%rdx
803028: 48 8b 45 e0 mov -0x20(%rbp),%rax
80302c: 41 b8 07 04 00 00 mov $0x407,%r8d
803032: 48 89 d1 mov %rdx,%rcx
803035: ba 00 00 00 00 mov $0x0,%edx
80303a: 48 89 c6 mov %rax,%rsi
80303d: bf 00 00 00 00 mov $0x0,%edi
803042: 48 b8 4f 18 80 00 00 movabs $0x80184f,%rax
803049: 00 00 00
80304c: ff d0 callq *%rax
80304e: 89 45 ec mov %eax,-0x14(%rbp)
803051: 83 7d ec 00 cmpl $0x0,-0x14(%rbp)
803055: 79 1b jns 803072 <pipe+0x143>
goto err3;
803057: 90 nop
pfd[0] = fd2num(fd0);
pfd[1] = fd2num(fd1);
return 0;
err3:
sys_page_unmap(0, va);
803058: 48 8b 45 e0 mov -0x20(%rbp),%rax
80305c: 48 89 c6 mov %rax,%rsi
80305f: bf 00 00 00 00 mov $0x0,%edi
803064: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
80306b: 00 00 00
80306e: ff d0 callq *%rax
803070: eb 79 jmp 8030eb <pipe+0x1bc>
goto err2;
if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
goto err3;
// set up fd structures
fd0->fd_dev_id = devpipe.dev_id;
803072: 48 8b 45 d8 mov -0x28(%rbp),%rax
803076: 48 ba 80 60 80 00 00 movabs $0x806080,%rdx
80307d: 00 00 00
803080: 8b 12 mov (%rdx),%edx
803082: 89 10 mov %edx,(%rax)
fd0->fd_omode = O_RDONLY;
803084: 48 8b 45 d8 mov -0x28(%rbp),%rax
803088: c7 40 08 00 00 00 00 movl $0x0,0x8(%rax)
fd1->fd_dev_id = devpipe.dev_id;
80308f: 48 8b 45 d0 mov -0x30(%rbp),%rax
803093: 48 ba 80 60 80 00 00 movabs $0x806080,%rdx
80309a: 00 00 00
80309d: 8b 12 mov (%rdx),%edx
80309f: 89 10 mov %edx,(%rax)
fd1->fd_omode = O_WRONLY;
8030a1: 48 8b 45 d0 mov -0x30(%rbp),%rax
8030a5: c7 40 08 01 00 00 00 movl $0x1,0x8(%rax)
if (debug)
cprintf("[%08x] pipecreate %08x\n", thisenv->env_id, uvpt[PGNUM(va)]);
pfd[0] = fd2num(fd0);
8030ac: 48 8b 45 d8 mov -0x28(%rbp),%rax
8030b0: 48 89 c7 mov %rax,%rdi
8030b3: 48 b8 06 21 80 00 00 movabs $0x802106,%rax
8030ba: 00 00 00
8030bd: ff d0 callq *%rax
8030bf: 89 c2 mov %eax,%edx
8030c1: 48 8b 45 c8 mov -0x38(%rbp),%rax
8030c5: 89 10 mov %edx,(%rax)
pfd[1] = fd2num(fd1);
8030c7: 48 8b 45 c8 mov -0x38(%rbp),%rax
8030cb: 48 8d 58 04 lea 0x4(%rax),%rbx
8030cf: 48 8b 45 d0 mov -0x30(%rbp),%rax
8030d3: 48 89 c7 mov %rax,%rdi
8030d6: 48 b8 06 21 80 00 00 movabs $0x802106,%rax
8030dd: 00 00 00
8030e0: ff d0 callq *%rax
8030e2: 89 03 mov %eax,(%rbx)
return 0;
8030e4: b8 00 00 00 00 mov $0x0,%eax
8030e9: eb 33 jmp 80311e <pipe+0x1ef>
err3:
sys_page_unmap(0, va);
err2:
sys_page_unmap(0, fd1);
8030eb: 48 8b 45 d0 mov -0x30(%rbp),%rax
8030ef: 48 89 c6 mov %rax,%rsi
8030f2: bf 00 00 00 00 mov $0x0,%edi
8030f7: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
8030fe: 00 00 00
803101: ff d0 callq *%rax
err1:
sys_page_unmap(0, fd0);
803103: 48 8b 45 d8 mov -0x28(%rbp),%rax
803107: 48 89 c6 mov %rax,%rsi
80310a: bf 00 00 00 00 mov $0x0,%edi
80310f: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
803116: 00 00 00
803119: ff d0 callq *%rax
err:
return r;
80311b: 8b 45 ec mov -0x14(%rbp),%eax
}
80311e: 48 83 c4 38 add $0x38,%rsp
803122: 5b pop %rbx
803123: 5d pop %rbp
803124: c3 retq
0000000000803125 <_pipeisclosed>:
static int
_pipeisclosed(struct Fd *fd, struct Pipe *p)
{
803125: 55 push %rbp
803126: 48 89 e5 mov %rsp,%rbp
803129: 53 push %rbx
80312a: 48 83 ec 28 sub $0x28,%rsp
80312e: 48 89 7d d8 mov %rdi,-0x28(%rbp)
803132: 48 89 75 d0 mov %rsi,-0x30(%rbp)
int n, nn, ret;
while (1) {
n = thisenv->env_runs;
803136: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
80313d: 00 00 00
803140: 48 8b 00 mov (%rax),%rax
803143: 8b 80 d8 00 00 00 mov 0xd8(%rax),%eax
803149: 89 45 ec mov %eax,-0x14(%rbp)
ret = pageref(fd) == pageref(p);
80314c: 48 8b 45 d8 mov -0x28(%rbp),%rax
803150: 48 89 c7 mov %rax,%rdi
803153: 48 b8 e9 3b 80 00 00 movabs $0x803be9,%rax
80315a: 00 00 00
80315d: ff d0 callq *%rax
80315f: 89 c3 mov %eax,%ebx
803161: 48 8b 45 d0 mov -0x30(%rbp),%rax
803165: 48 89 c7 mov %rax,%rdi
803168: 48 b8 e9 3b 80 00 00 movabs $0x803be9,%rax
80316f: 00 00 00
803172: ff d0 callq *%rax
803174: 39 c3 cmp %eax,%ebx
803176: 0f 94 c0 sete %al
803179: 0f b6 c0 movzbl %al,%eax
80317c: 89 45 e8 mov %eax,-0x18(%rbp)
nn = thisenv->env_runs;
80317f: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
803186: 00 00 00
803189: 48 8b 00 mov (%rax),%rax
80318c: 8b 80 d8 00 00 00 mov 0xd8(%rax),%eax
803192: 89 45 e4 mov %eax,-0x1c(%rbp)
if (n == nn)
803195: 8b 45 ec mov -0x14(%rbp),%eax
803198: 3b 45 e4 cmp -0x1c(%rbp),%eax
80319b: 75 05 jne 8031a2 <_pipeisclosed+0x7d>
return ret;
80319d: 8b 45 e8 mov -0x18(%rbp),%eax
8031a0: eb 4f jmp 8031f1 <_pipeisclosed+0xcc>
if (n != nn && ret == 1)
8031a2: 8b 45 ec mov -0x14(%rbp),%eax
8031a5: 3b 45 e4 cmp -0x1c(%rbp),%eax
8031a8: 74 42 je 8031ec <_pipeisclosed+0xc7>
8031aa: 83 7d e8 01 cmpl $0x1,-0x18(%rbp)
8031ae: 75 3c jne 8031ec <_pipeisclosed+0xc7>
cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
8031b0: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
8031b7: 00 00 00
8031ba: 48 8b 00 mov (%rax),%rax
8031bd: 8b 90 d8 00 00 00 mov 0xd8(%rax),%edx
8031c3: 8b 4d e8 mov -0x18(%rbp),%ecx
8031c6: 8b 45 ec mov -0x14(%rbp),%eax
8031c9: 89 c6 mov %eax,%esi
8031cb: 48 bf b7 43 80 00 00 movabs $0x8043b7,%rdi
8031d2: 00 00 00
8031d5: b8 00 00 00 00 mov $0x0,%eax
8031da: 49 b8 1b 03 80 00 00 movabs $0x80031b,%r8
8031e1: 00 00 00
8031e4: 41 ff d0 callq *%r8
}
8031e7: e9 4a ff ff ff jmpq 803136 <_pipeisclosed+0x11>
8031ec: e9 45 ff ff ff jmpq 803136 <_pipeisclosed+0x11>
}
8031f1: 48 83 c4 28 add $0x28,%rsp
8031f5: 5b pop %rbx
8031f6: 5d pop %rbp
8031f7: c3 retq
00000000008031f8 <pipeisclosed>:
int
pipeisclosed(int fdnum)
{
8031f8: 55 push %rbp
8031f9: 48 89 e5 mov %rsp,%rbp
8031fc: 48 83 ec 30 sub $0x30,%rsp
803200: 89 7d dc mov %edi,-0x24(%rbp)
struct Fd *fd;
struct Pipe *p;
int r;
if ((r = fd_lookup(fdnum, &fd)) < 0)
803203: 48 8d 55 e8 lea -0x18(%rbp),%rdx
803207: 8b 45 dc mov -0x24(%rbp),%eax
80320a: 48 89 d6 mov %rdx,%rsi
80320d: 89 c7 mov %eax,%edi
80320f: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
803216: 00 00 00
803219: ff d0 callq *%rax
80321b: 89 45 fc mov %eax,-0x4(%rbp)
80321e: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
803222: 79 05 jns 803229 <pipeisclosed+0x31>
return r;
803224: 8b 45 fc mov -0x4(%rbp),%eax
803227: eb 31 jmp 80325a <pipeisclosed+0x62>
p = (struct Pipe*) fd2data(fd);
803229: 48 8b 45 e8 mov -0x18(%rbp),%rax
80322d: 48 89 c7 mov %rax,%rdi
803230: 48 b8 29 21 80 00 00 movabs $0x802129,%rax
803237: 00 00 00
80323a: ff d0 callq *%rax
80323c: 48 89 45 f0 mov %rax,-0x10(%rbp)
return _pipeisclosed(fd, p);
803240: 48 8b 45 e8 mov -0x18(%rbp),%rax
803244: 48 8b 55 f0 mov -0x10(%rbp),%rdx
803248: 48 89 d6 mov %rdx,%rsi
80324b: 48 89 c7 mov %rax,%rdi
80324e: 48 b8 25 31 80 00 00 movabs $0x803125,%rax
803255: 00 00 00
803258: ff d0 callq *%rax
}
80325a: c9 leaveq
80325b: c3 retq
000000000080325c <devpipe_read>:
static ssize_t
devpipe_read(struct Fd *fd, void *vbuf, size_t n)
{
80325c: 55 push %rbp
80325d: 48 89 e5 mov %rsp,%rbp
803260: 48 83 ec 40 sub $0x40,%rsp
803264: 48 89 7d d8 mov %rdi,-0x28(%rbp)
803268: 48 89 75 d0 mov %rsi,-0x30(%rbp)
80326c: 48 89 55 c8 mov %rdx,-0x38(%rbp)
uint8_t *buf;
size_t i;
struct Pipe *p;
p = (struct Pipe*)fd2data(fd);
803270: 48 8b 45 d8 mov -0x28(%rbp),%rax
803274: 48 89 c7 mov %rax,%rdi
803277: 48 b8 29 21 80 00 00 movabs $0x802129,%rax
80327e: 00 00 00
803281: ff d0 callq *%rax
803283: 48 89 45 f0 mov %rax,-0x10(%rbp)
if (debug)
cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
803287: 48 8b 45 d0 mov -0x30(%rbp),%rax
80328b: 48 89 45 e8 mov %rax,-0x18(%rbp)
for (i = 0; i < n; i++) {
80328f: 48 c7 45 f8 00 00 00 movq $0x0,-0x8(%rbp)
803296: 00
803297: e9 92 00 00 00 jmpq 80332e <devpipe_read+0xd2>
while (p->p_rpos == p->p_wpos) {
80329c: eb 41 jmp 8032df <devpipe_read+0x83>
// pipe is empty
// if we got any data, return it
if (i > 0)
80329e: 48 83 7d f8 00 cmpq $0x0,-0x8(%rbp)
8032a3: 74 09 je 8032ae <devpipe_read+0x52>
return i;
8032a5: 48 8b 45 f8 mov -0x8(%rbp),%rax
8032a9: e9 92 00 00 00 jmpq 803340 <devpipe_read+0xe4>
// if all the writers are gone, note eof
if (_pipeisclosed(fd, p))
8032ae: 48 8b 55 f0 mov -0x10(%rbp),%rdx
8032b2: 48 8b 45 d8 mov -0x28(%rbp),%rax
8032b6: 48 89 d6 mov %rdx,%rsi
8032b9: 48 89 c7 mov %rax,%rdi
8032bc: 48 b8 25 31 80 00 00 movabs $0x803125,%rax
8032c3: 00 00 00
8032c6: ff d0 callq *%rax
8032c8: 85 c0 test %eax,%eax
8032ca: 74 07 je 8032d3 <devpipe_read+0x77>
return 0;
8032cc: b8 00 00 00 00 mov $0x0,%eax
8032d1: eb 6d jmp 803340 <devpipe_read+0xe4>
// yield and see what happens
if (debug)
cprintf("devpipe_read yield\n");
sys_yield();
8032d3: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
8032da: 00 00 00
8032dd: ff d0 callq *%rax
cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
while (p->p_rpos == p->p_wpos) {
8032df: 48 8b 45 f0 mov -0x10(%rbp),%rax
8032e3: 8b 10 mov (%rax),%edx
8032e5: 48 8b 45 f0 mov -0x10(%rbp),%rax
8032e9: 8b 40 04 mov 0x4(%rax),%eax
8032ec: 39 c2 cmp %eax,%edx
8032ee: 74 ae je 80329e <devpipe_read+0x42>
cprintf("devpipe_read yield\n");
sys_yield();
}
// there's a byte. take it.
// wait to increment rpos until the byte is taken!
buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
8032f0: 48 8b 45 f8 mov -0x8(%rbp),%rax
8032f4: 48 8b 55 e8 mov -0x18(%rbp),%rdx
8032f8: 48 8d 0c 02 lea (%rdx,%rax,1),%rcx
8032fc: 48 8b 45 f0 mov -0x10(%rbp),%rax
803300: 8b 00 mov (%rax),%eax
803302: 99 cltd
803303: c1 ea 1b shr $0x1b,%edx
803306: 01 d0 add %edx,%eax
803308: 83 e0 1f and $0x1f,%eax
80330b: 29 d0 sub %edx,%eax
80330d: 48 8b 55 f0 mov -0x10(%rbp),%rdx
803311: 48 98 cltq
803313: 0f b6 44 02 08 movzbl 0x8(%rdx,%rax,1),%eax
803318: 88 01 mov %al,(%rcx)
p->p_rpos++;
80331a: 48 8b 45 f0 mov -0x10(%rbp),%rax
80331e: 8b 00 mov (%rax),%eax
803320: 8d 50 01 lea 0x1(%rax),%edx
803323: 48 8b 45 f0 mov -0x10(%rbp),%rax
803327: 89 10 mov %edx,(%rax)
if (debug)
cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
803329: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
80332e: 48 8b 45 f8 mov -0x8(%rbp),%rax
803332: 48 3b 45 c8 cmp -0x38(%rbp),%rax
803336: 0f 82 60 ff ff ff jb 80329c <devpipe_read+0x40>
// there's a byte. take it.
// wait to increment rpos until the byte is taken!
buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
p->p_rpos++;
}
return i;
80333c: 48 8b 45 f8 mov -0x8(%rbp),%rax
}
803340: c9 leaveq
803341: c3 retq
0000000000803342 <devpipe_write>:
static ssize_t
devpipe_write(struct Fd *fd, const void *vbuf, size_t n)
{
803342: 55 push %rbp
803343: 48 89 e5 mov %rsp,%rbp
803346: 48 83 ec 40 sub $0x40,%rsp
80334a: 48 89 7d d8 mov %rdi,-0x28(%rbp)
80334e: 48 89 75 d0 mov %rsi,-0x30(%rbp)
803352: 48 89 55 c8 mov %rdx,-0x38(%rbp)
const uint8_t *buf;
size_t i;
struct Pipe *p;
p = (struct Pipe*) fd2data(fd);
803356: 48 8b 45 d8 mov -0x28(%rbp),%rax
80335a: 48 89 c7 mov %rax,%rdi
80335d: 48 b8 29 21 80 00 00 movabs $0x802129,%rax
803364: 00 00 00
803367: ff d0 callq *%rax
803369: 48 89 45 f0 mov %rax,-0x10(%rbp)
if (debug)
cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
80336d: 48 8b 45 d0 mov -0x30(%rbp),%rax
803371: 48 89 45 e8 mov %rax,-0x18(%rbp)
for (i = 0; i < n; i++) {
803375: 48 c7 45 f8 00 00 00 movq $0x0,-0x8(%rbp)
80337c: 00
80337d: e9 8e 00 00 00 jmpq 803410 <devpipe_write+0xce>
while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
803382: eb 31 jmp 8033b5 <devpipe_write+0x73>
// pipe is full
// if all the readers are gone
// (it's only writers like us now),
// note eof
if (_pipeisclosed(fd, p))
803384: 48 8b 55 f0 mov -0x10(%rbp),%rdx
803388: 48 8b 45 d8 mov -0x28(%rbp),%rax
80338c: 48 89 d6 mov %rdx,%rsi
80338f: 48 89 c7 mov %rax,%rdi
803392: 48 b8 25 31 80 00 00 movabs $0x803125,%rax
803399: 00 00 00
80339c: ff d0 callq *%rax
80339e: 85 c0 test %eax,%eax
8033a0: 74 07 je 8033a9 <devpipe_write+0x67>
return 0;
8033a2: b8 00 00 00 00 mov $0x0,%eax
8033a7: eb 79 jmp 803422 <devpipe_write+0xe0>
// yield and see what happens
if (debug)
cprintf("devpipe_write yield\n");
sys_yield();
8033a9: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
8033b0: 00 00 00
8033b3: ff d0 callq *%rax
cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
8033b5: 48 8b 45 f0 mov -0x10(%rbp),%rax
8033b9: 8b 40 04 mov 0x4(%rax),%eax
8033bc: 48 63 d0 movslq %eax,%rdx
8033bf: 48 8b 45 f0 mov -0x10(%rbp),%rax
8033c3: 8b 00 mov (%rax),%eax
8033c5: 48 98 cltq
8033c7: 48 83 c0 20 add $0x20,%rax
8033cb: 48 39 c2 cmp %rax,%rdx
8033ce: 73 b4 jae 803384 <devpipe_write+0x42>
cprintf("devpipe_write yield\n");
sys_yield();
}
// there's room for a byte. store it.
// wait to increment wpos until the byte is stored!
p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
8033d0: 48 8b 45 f0 mov -0x10(%rbp),%rax
8033d4: 8b 40 04 mov 0x4(%rax),%eax
8033d7: 99 cltd
8033d8: c1 ea 1b shr $0x1b,%edx
8033db: 01 d0 add %edx,%eax
8033dd: 83 e0 1f and $0x1f,%eax
8033e0: 29 d0 sub %edx,%eax
8033e2: 48 8b 55 f8 mov -0x8(%rbp),%rdx
8033e6: 48 8b 4d e8 mov -0x18(%rbp),%rcx
8033ea: 48 01 ca add %rcx,%rdx
8033ed: 0f b6 0a movzbl (%rdx),%ecx
8033f0: 48 8b 55 f0 mov -0x10(%rbp),%rdx
8033f4: 48 98 cltq
8033f6: 88 4c 02 08 mov %cl,0x8(%rdx,%rax,1)
p->p_wpos++;
8033fa: 48 8b 45 f0 mov -0x10(%rbp),%rax
8033fe: 8b 40 04 mov 0x4(%rax),%eax
803401: 8d 50 01 lea 0x1(%rax),%edx
803404: 48 8b 45 f0 mov -0x10(%rbp),%rax
803408: 89 50 04 mov %edx,0x4(%rax)
if (debug)
cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
80340b: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
803410: 48 8b 45 f8 mov -0x8(%rbp),%rax
803414: 48 3b 45 c8 cmp -0x38(%rbp),%rax
803418: 0f 82 64 ff ff ff jb 803382 <devpipe_write+0x40>
// wait to increment wpos until the byte is stored!
p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
p->p_wpos++;
}
return i;
80341e: 48 8b 45 f8 mov -0x8(%rbp),%rax
}
803422: c9 leaveq
803423: c3 retq
0000000000803424 <devpipe_stat>:
static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
803424: 55 push %rbp
803425: 48 89 e5 mov %rsp,%rbp
803428: 48 83 ec 20 sub $0x20,%rsp
80342c: 48 89 7d e8 mov %rdi,-0x18(%rbp)
803430: 48 89 75 e0 mov %rsi,-0x20(%rbp)
struct Pipe *p = (struct Pipe*) fd2data(fd);
803434: 48 8b 45 e8 mov -0x18(%rbp),%rax
803438: 48 89 c7 mov %rax,%rdi
80343b: 48 b8 29 21 80 00 00 movabs $0x802129,%rax
803442: 00 00 00
803445: ff d0 callq *%rax
803447: 48 89 45 f8 mov %rax,-0x8(%rbp)
strcpy(stat->st_name, "<pipe>");
80344b: 48 8b 45 e0 mov -0x20(%rbp),%rax
80344f: 48 be ca 43 80 00 00 movabs $0x8043ca,%rsi
803456: 00 00 00
803459: 48 89 c7 mov %rax,%rdi
80345c: 48 b8 d0 0e 80 00 00 movabs $0x800ed0,%rax
803463: 00 00 00
803466: ff d0 callq *%rax
stat->st_size = p->p_wpos - p->p_rpos;
803468: 48 8b 45 f8 mov -0x8(%rbp),%rax
80346c: 8b 50 04 mov 0x4(%rax),%edx
80346f: 48 8b 45 f8 mov -0x8(%rbp),%rax
803473: 8b 00 mov (%rax),%eax
803475: 29 c2 sub %eax,%edx
803477: 48 8b 45 e0 mov -0x20(%rbp),%rax
80347b: 89 90 80 00 00 00 mov %edx,0x80(%rax)
stat->st_isdir = 0;
803481: 48 8b 45 e0 mov -0x20(%rbp),%rax
803485: c7 80 84 00 00 00 00 movl $0x0,0x84(%rax)
80348c: 00 00 00
stat->st_dev = &devpipe;
80348f: 48 8b 45 e0 mov -0x20(%rbp),%rax
803493: 48 b9 80 60 80 00 00 movabs $0x806080,%rcx
80349a: 00 00 00
80349d: 48 89 88 88 00 00 00 mov %rcx,0x88(%rax)
return 0;
8034a4: b8 00 00 00 00 mov $0x0,%eax
}
8034a9: c9 leaveq
8034aa: c3 retq
00000000008034ab <devpipe_close>:
static int
devpipe_close(struct Fd *fd)
{
8034ab: 55 push %rbp
8034ac: 48 89 e5 mov %rsp,%rbp
8034af: 48 83 ec 10 sub $0x10,%rsp
8034b3: 48 89 7d f8 mov %rdi,-0x8(%rbp)
(void) sys_page_unmap(0, fd);
8034b7: 48 8b 45 f8 mov -0x8(%rbp),%rax
8034bb: 48 89 c6 mov %rax,%rsi
8034be: bf 00 00 00 00 mov $0x0,%edi
8034c3: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
8034ca: 00 00 00
8034cd: ff d0 callq *%rax
return sys_page_unmap(0, fd2data(fd));
8034cf: 48 8b 45 f8 mov -0x8(%rbp),%rax
8034d3: 48 89 c7 mov %rax,%rdi
8034d6: 48 b8 29 21 80 00 00 movabs $0x802129,%rax
8034dd: 00 00 00
8034e0: ff d0 callq *%rax
8034e2: 48 89 c6 mov %rax,%rsi
8034e5: bf 00 00 00 00 mov $0x0,%edi
8034ea: 48 b8 aa 18 80 00 00 movabs $0x8018aa,%rax
8034f1: 00 00 00
8034f4: ff d0 callq *%rax
}
8034f6: c9 leaveq
8034f7: c3 retq
00000000008034f8 <cputchar>:
#include <inc/string.h>
#include <inc/lib.h>
void
cputchar(int ch)
{
8034f8: 55 push %rbp
8034f9: 48 89 e5 mov %rsp,%rbp
8034fc: 48 83 ec 20 sub $0x20,%rsp
803500: 89 7d ec mov %edi,-0x14(%rbp)
char c = ch;
803503: 8b 45 ec mov -0x14(%rbp),%eax
803506: 88 45 ff mov %al,-0x1(%rbp)
// Unlike standard Unix's putchar,
// the cputchar function _always_ outputs to the system console.
sys_cputs(&c, 1);
803509: 48 8d 45 ff lea -0x1(%rbp),%rax
80350d: be 01 00 00 00 mov $0x1,%esi
803512: 48 89 c7 mov %rax,%rdi
803515: 48 b8 b7 16 80 00 00 movabs $0x8016b7,%rax
80351c: 00 00 00
80351f: ff d0 callq *%rax
}
803521: c9 leaveq
803522: c3 retq
0000000000803523 <getchar>:
int
getchar(void)
{
803523: 55 push %rbp
803524: 48 89 e5 mov %rsp,%rbp
803527: 48 83 ec 10 sub $0x10,%rsp
int r;
// JOS does, however, support standard _input_ redirection,
// allowing the user to redirect script files to the shell and such.
// getchar() reads a character from file descriptor 0.
r = read(0, &c, 1);
80352b: 48 8d 45 fb lea -0x5(%rbp),%rax
80352f: ba 01 00 00 00 mov $0x1,%edx
803534: 48 89 c6 mov %rax,%rsi
803537: bf 00 00 00 00 mov $0x0,%edi
80353c: 48 b8 1e 26 80 00 00 movabs $0x80261e,%rax
803543: 00 00 00
803546: ff d0 callq *%rax
803548: 89 45 fc mov %eax,-0x4(%rbp)
if (r < 0)
80354b: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
80354f: 79 05 jns 803556 <getchar+0x33>
return r;
803551: 8b 45 fc mov -0x4(%rbp),%eax
803554: eb 14 jmp 80356a <getchar+0x47>
if (r < 1)
803556: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
80355a: 7f 07 jg 803563 <getchar+0x40>
return -E_EOF;
80355c: b8 f7 ff ff ff mov $0xfffffff7,%eax
803561: eb 07 jmp 80356a <getchar+0x47>
return c;
803563: 0f b6 45 fb movzbl -0x5(%rbp),%eax
803567: 0f b6 c0 movzbl %al,%eax
}
80356a: c9 leaveq
80356b: c3 retq
000000000080356c <iscons>:
.dev_stat = devcons_stat
};
int
iscons(int fdnum)
{
80356c: 55 push %rbp
80356d: 48 89 e5 mov %rsp,%rbp
803570: 48 83 ec 20 sub $0x20,%rsp
803574: 89 7d ec mov %edi,-0x14(%rbp)
int r;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0)
803577: 48 8d 55 f0 lea -0x10(%rbp),%rdx
80357b: 8b 45 ec mov -0x14(%rbp),%eax
80357e: 48 89 d6 mov %rdx,%rsi
803581: 89 c7 mov %eax,%edi
803583: 48 b8 ec 21 80 00 00 movabs $0x8021ec,%rax
80358a: 00 00 00
80358d: ff d0 callq *%rax
80358f: 89 45 fc mov %eax,-0x4(%rbp)
803592: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
803596: 79 05 jns 80359d <iscons+0x31>
return r;
803598: 8b 45 fc mov -0x4(%rbp),%eax
80359b: eb 1a jmp 8035b7 <iscons+0x4b>
return fd->fd_dev_id == devcons.dev_id;
80359d: 48 8b 45 f0 mov -0x10(%rbp),%rax
8035a1: 8b 10 mov (%rax),%edx
8035a3: 48 b8 c0 60 80 00 00 movabs $0x8060c0,%rax
8035aa: 00 00 00
8035ad: 8b 00 mov (%rax),%eax
8035af: 39 c2 cmp %eax,%edx
8035b1: 0f 94 c0 sete %al
8035b4: 0f b6 c0 movzbl %al,%eax
}
8035b7: c9 leaveq
8035b8: c3 retq
00000000008035b9 <opencons>:
int
opencons(void)
{
8035b9: 55 push %rbp
8035ba: 48 89 e5 mov %rsp,%rbp
8035bd: 48 83 ec 10 sub $0x10,%rsp
int r;
struct Fd* fd;
if ((r = fd_alloc(&fd)) < 0)
8035c1: 48 8d 45 f0 lea -0x10(%rbp),%rax
8035c5: 48 89 c7 mov %rax,%rdi
8035c8: 48 b8 54 21 80 00 00 movabs $0x802154,%rax
8035cf: 00 00 00
8035d2: ff d0 callq *%rax
8035d4: 89 45 fc mov %eax,-0x4(%rbp)
8035d7: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
8035db: 79 05 jns 8035e2 <opencons+0x29>
return r;
8035dd: 8b 45 fc mov -0x4(%rbp),%eax
8035e0: eb 5b jmp 80363d <opencons+0x84>
if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
8035e2: 48 8b 45 f0 mov -0x10(%rbp),%rax
8035e6: ba 07 04 00 00 mov $0x407,%edx
8035eb: 48 89 c6 mov %rax,%rsi
8035ee: bf 00 00 00 00 mov $0x0,%edi
8035f3: 48 b8 ff 17 80 00 00 movabs $0x8017ff,%rax
8035fa: 00 00 00
8035fd: ff d0 callq *%rax
8035ff: 89 45 fc mov %eax,-0x4(%rbp)
803602: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
803606: 79 05 jns 80360d <opencons+0x54>
return r;
803608: 8b 45 fc mov -0x4(%rbp),%eax
80360b: eb 30 jmp 80363d <opencons+0x84>
fd->fd_dev_id = devcons.dev_id;
80360d: 48 8b 45 f0 mov -0x10(%rbp),%rax
803611: 48 ba c0 60 80 00 00 movabs $0x8060c0,%rdx
803618: 00 00 00
80361b: 8b 12 mov (%rdx),%edx
80361d: 89 10 mov %edx,(%rax)
fd->fd_omode = O_RDWR;
80361f: 48 8b 45 f0 mov -0x10(%rbp),%rax
803623: c7 40 08 02 00 00 00 movl $0x2,0x8(%rax)
return fd2num(fd);
80362a: 48 8b 45 f0 mov -0x10(%rbp),%rax
80362e: 48 89 c7 mov %rax,%rdi
803631: 48 b8 06 21 80 00 00 movabs $0x802106,%rax
803638: 00 00 00
80363b: ff d0 callq *%rax
}
80363d: c9 leaveq
80363e: c3 retq
000000000080363f <devcons_read>:
static ssize_t
devcons_read(struct Fd *fd, void *vbuf, size_t n)
{
80363f: 55 push %rbp
803640: 48 89 e5 mov %rsp,%rbp
803643: 48 83 ec 30 sub $0x30,%rsp
803647: 48 89 7d e8 mov %rdi,-0x18(%rbp)
80364b: 48 89 75 e0 mov %rsi,-0x20(%rbp)
80364f: 48 89 55 d8 mov %rdx,-0x28(%rbp)
int c;
if (n == 0)
803653: 48 83 7d d8 00 cmpq $0x0,-0x28(%rbp)
803658: 75 07 jne 803661 <devcons_read+0x22>
return 0;
80365a: b8 00 00 00 00 mov $0x0,%eax
80365f: eb 4b jmp 8036ac <devcons_read+0x6d>
while ((c = sys_cgetc()) == 0)
803661: eb 0c jmp 80366f <devcons_read+0x30>
sys_yield();
803663: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
80366a: 00 00 00
80366d: ff d0 callq *%rax
int c;
if (n == 0)
return 0;
while ((c = sys_cgetc()) == 0)
80366f: 48 b8 01 17 80 00 00 movabs $0x801701,%rax
803676: 00 00 00
803679: ff d0 callq *%rax
80367b: 89 45 fc mov %eax,-0x4(%rbp)
80367e: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
803682: 74 df je 803663 <devcons_read+0x24>
sys_yield();
if (c < 0)
803684: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
803688: 79 05 jns 80368f <devcons_read+0x50>
return c;
80368a: 8b 45 fc mov -0x4(%rbp),%eax
80368d: eb 1d jmp 8036ac <devcons_read+0x6d>
if (c == 0x04) // ctl-d is eof
80368f: 83 7d fc 04 cmpl $0x4,-0x4(%rbp)
803693: 75 07 jne 80369c <devcons_read+0x5d>
return 0;
803695: b8 00 00 00 00 mov $0x0,%eax
80369a: eb 10 jmp 8036ac <devcons_read+0x6d>
*(char*)vbuf = c;
80369c: 8b 45 fc mov -0x4(%rbp),%eax
80369f: 89 c2 mov %eax,%edx
8036a1: 48 8b 45 e0 mov -0x20(%rbp),%rax
8036a5: 88 10 mov %dl,(%rax)
return 1;
8036a7: b8 01 00 00 00 mov $0x1,%eax
}
8036ac: c9 leaveq
8036ad: c3 retq
00000000008036ae <devcons_write>:
static ssize_t
devcons_write(struct Fd *fd, const void *vbuf, size_t n)
{
8036ae: 55 push %rbp
8036af: 48 89 e5 mov %rsp,%rbp
8036b2: 48 81 ec b0 00 00 00 sub $0xb0,%rsp
8036b9: 48 89 bd 68 ff ff ff mov %rdi,-0x98(%rbp)
8036c0: 48 89 b5 60 ff ff ff mov %rsi,-0xa0(%rbp)
8036c7: 48 89 95 58 ff ff ff mov %rdx,-0xa8(%rbp)
int tot, m;
char buf[128];
// mistake: have to nul-terminate arg to sys_cputs,
// so we have to copy vbuf into buf in chunks and nul-terminate.
for (tot = 0; tot < n; tot += m) {
8036ce: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
8036d5: eb 76 jmp 80374d <devcons_write+0x9f>
m = n - tot;
8036d7: 48 8b 85 58 ff ff ff mov -0xa8(%rbp),%rax
8036de: 89 c2 mov %eax,%edx
8036e0: 8b 45 fc mov -0x4(%rbp),%eax
8036e3: 29 c2 sub %eax,%edx
8036e5: 89 d0 mov %edx,%eax
8036e7: 89 45 f8 mov %eax,-0x8(%rbp)
if (m > sizeof(buf) - 1)
8036ea: 8b 45 f8 mov -0x8(%rbp),%eax
8036ed: 83 f8 7f cmp $0x7f,%eax
8036f0: 76 07 jbe 8036f9 <devcons_write+0x4b>
m = sizeof(buf) - 1;
8036f2: c7 45 f8 7f 00 00 00 movl $0x7f,-0x8(%rbp)
memmove(buf, (char*)vbuf + tot, m);
8036f9: 8b 45 f8 mov -0x8(%rbp),%eax
8036fc: 48 63 d0 movslq %eax,%rdx
8036ff: 8b 45 fc mov -0x4(%rbp),%eax
803702: 48 63 c8 movslq %eax,%rcx
803705: 48 8b 85 60 ff ff ff mov -0xa0(%rbp),%rax
80370c: 48 01 c1 add %rax,%rcx
80370f: 48 8d 85 70 ff ff ff lea -0x90(%rbp),%rax
803716: 48 89 ce mov %rcx,%rsi
803719: 48 89 c7 mov %rax,%rdi
80371c: 48 b8 f4 11 80 00 00 movabs $0x8011f4,%rax
803723: 00 00 00
803726: ff d0 callq *%rax
sys_cputs(buf, m);
803728: 8b 45 f8 mov -0x8(%rbp),%eax
80372b: 48 63 d0 movslq %eax,%rdx
80372e: 48 8d 85 70 ff ff ff lea -0x90(%rbp),%rax
803735: 48 89 d6 mov %rdx,%rsi
803738: 48 89 c7 mov %rax,%rdi
80373b: 48 b8 b7 16 80 00 00 movabs $0x8016b7,%rax
803742: 00 00 00
803745: ff d0 callq *%rax
int tot, m;
char buf[128];
// mistake: have to nul-terminate arg to sys_cputs,
// so we have to copy vbuf into buf in chunks and nul-terminate.
for (tot = 0; tot < n; tot += m) {
803747: 8b 45 f8 mov -0x8(%rbp),%eax
80374a: 01 45 fc add %eax,-0x4(%rbp)
80374d: 8b 45 fc mov -0x4(%rbp),%eax
803750: 48 98 cltq
803752: 48 3b 85 58 ff ff ff cmp -0xa8(%rbp),%rax
803759: 0f 82 78 ff ff ff jb 8036d7 <devcons_write+0x29>
if (m > sizeof(buf) - 1)
m = sizeof(buf) - 1;
memmove(buf, (char*)vbuf + tot, m);
sys_cputs(buf, m);
}
return tot;
80375f: 8b 45 fc mov -0x4(%rbp),%eax
}
803762: c9 leaveq
803763: c3 retq
0000000000803764 <devcons_close>:
static int
devcons_close(struct Fd *fd)
{
803764: 55 push %rbp
803765: 48 89 e5 mov %rsp,%rbp
803768: 48 83 ec 08 sub $0x8,%rsp
80376c: 48 89 7d f8 mov %rdi,-0x8(%rbp)
USED(fd);
return 0;
803770: b8 00 00 00 00 mov $0x0,%eax
}
803775: c9 leaveq
803776: c3 retq
0000000000803777 <devcons_stat>:
static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
803777: 55 push %rbp
803778: 48 89 e5 mov %rsp,%rbp
80377b: 48 83 ec 10 sub $0x10,%rsp
80377f: 48 89 7d f8 mov %rdi,-0x8(%rbp)
803783: 48 89 75 f0 mov %rsi,-0x10(%rbp)
strcpy(stat->st_name, "<cons>");
803787: 48 8b 45 f0 mov -0x10(%rbp),%rax
80378b: 48 be d6 43 80 00 00 movabs $0x8043d6,%rsi
803792: 00 00 00
803795: 48 89 c7 mov %rax,%rdi
803798: 48 b8 d0 0e 80 00 00 movabs $0x800ed0,%rax
80379f: 00 00 00
8037a2: ff d0 callq *%rax
return 0;
8037a4: b8 00 00 00 00 mov $0x0,%eax
}
8037a9: c9 leaveq
8037aa: c3 retq
00000000008037ab <_panic>:
* It prints "panic: <message>", then causes a breakpoint exception,
* which causes JOS to enter the JOS kernel monitor.
*/
void
_panic(const char *file, int line, const char *fmt, ...)
{
8037ab: 55 push %rbp
8037ac: 48 89 e5 mov %rsp,%rbp
8037af: 53 push %rbx
8037b0: 48 81 ec f8 00 00 00 sub $0xf8,%rsp
8037b7: 48 89 bd 18 ff ff ff mov %rdi,-0xe8(%rbp)
8037be: 89 b5 14 ff ff ff mov %esi,-0xec(%rbp)
8037c4: 48 89 8d 58 ff ff ff mov %rcx,-0xa8(%rbp)
8037cb: 4c 89 85 60 ff ff ff mov %r8,-0xa0(%rbp)
8037d2: 4c 89 8d 68 ff ff ff mov %r9,-0x98(%rbp)
8037d9: 84 c0 test %al,%al
8037db: 74 23 je 803800 <_panic+0x55>
8037dd: 0f 29 85 70 ff ff ff movaps %xmm0,-0x90(%rbp)
8037e4: 0f 29 4d 80 movaps %xmm1,-0x80(%rbp)
8037e8: 0f 29 55 90 movaps %xmm2,-0x70(%rbp)
8037ec: 0f 29 5d a0 movaps %xmm3,-0x60(%rbp)
8037f0: 0f 29 65 b0 movaps %xmm4,-0x50(%rbp)
8037f4: 0f 29 6d c0 movaps %xmm5,-0x40(%rbp)
8037f8: 0f 29 75 d0 movaps %xmm6,-0x30(%rbp)
8037fc: 0f 29 7d e0 movaps %xmm7,-0x20(%rbp)
803800: 48 89 95 08 ff ff ff mov %rdx,-0xf8(%rbp)
va_list ap;
va_start(ap, fmt);
803807: c7 85 28 ff ff ff 18 movl $0x18,-0xd8(%rbp)
80380e: 00 00 00
803811: c7 85 2c ff ff ff 30 movl $0x30,-0xd4(%rbp)
803818: 00 00 00
80381b: 48 8d 45 10 lea 0x10(%rbp),%rax
80381f: 48 89 85 30 ff ff ff mov %rax,-0xd0(%rbp)
803826: 48 8d 85 40 ff ff ff lea -0xc0(%rbp),%rax
80382d: 48 89 85 38 ff ff ff mov %rax,-0xc8(%rbp)
// Print the panic message
cprintf("[%08x] user panic in %s at %s:%d: ",
803834: 48 b8 00 60 80 00 00 movabs $0x806000,%rax
80383b: 00 00 00
80383e: 48 8b 18 mov (%rax),%rbx
803841: 48 b8 83 17 80 00 00 movabs $0x801783,%rax
803848: 00 00 00
80384b: ff d0 callq *%rax
80384d: 8b 8d 14 ff ff ff mov -0xec(%rbp),%ecx
803853: 48 8b 95 18 ff ff ff mov -0xe8(%rbp),%rdx
80385a: 41 89 c8 mov %ecx,%r8d
80385d: 48 89 d1 mov %rdx,%rcx
803860: 48 89 da mov %rbx,%rdx
803863: 89 c6 mov %eax,%esi
803865: 48 bf e0 43 80 00 00 movabs $0x8043e0,%rdi
80386c: 00 00 00
80386f: b8 00 00 00 00 mov $0x0,%eax
803874: 49 b9 1b 03 80 00 00 movabs $0x80031b,%r9
80387b: 00 00 00
80387e: 41 ff d1 callq *%r9
sys_getenvid(), binaryname, file, line);
vcprintf(fmt, ap);
803881: 48 8d 95 28 ff ff ff lea -0xd8(%rbp),%rdx
803888: 48 8b 85 08 ff ff ff mov -0xf8(%rbp),%rax
80388f: 48 89 d6 mov %rdx,%rsi
803892: 48 89 c7 mov %rax,%rdi
803895: 48 b8 6f 02 80 00 00 movabs $0x80026f,%rax
80389c: 00 00 00
80389f: ff d0 callq *%rax
cprintf("\n");
8038a1: 48 bf 03 44 80 00 00 movabs $0x804403,%rdi
8038a8: 00 00 00
8038ab: b8 00 00 00 00 mov $0x0,%eax
8038b0: 48 ba 1b 03 80 00 00 movabs $0x80031b,%rdx
8038b7: 00 00 00
8038ba: ff d2 callq *%rdx
// Cause a breakpoint exception
while (1)
asm volatile("int3");
8038bc: cc int3
8038bd: eb fd jmp 8038bc <_panic+0x111>
00000000008038bf <set_pgfault_handler>:
// _pgfault_upcall routine when a page fault occurs.
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
8038bf: 55 push %rbp
8038c0: 48 89 e5 mov %rsp,%rbp
8038c3: 48 83 ec 10 sub $0x10,%rsp
8038c7: 48 89 7d f8 mov %rdi,-0x8(%rbp)
int r;
//struct Env *thisenv = NULL;
if (_pgfault_handler == 0) {
8038cb: 48 b8 08 90 80 00 00 movabs $0x809008,%rax
8038d2: 00 00 00
8038d5: 48 8b 00 mov (%rax),%rax
8038d8: 48 85 c0 test %rax,%rax
8038db: 0f 85 84 00 00 00 jne 803965 <set_pgfault_handler+0xa6>
// First time through!
// LAB 4: Your code here.
//cprintf("Inside set_pgfault_handler");
if(0> sys_page_alloc(thisenv->env_id, (void*)UXSTACKTOP - PGSIZE,PTE_U|PTE_P|PTE_W)){
8038e1: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
8038e8: 00 00 00
8038eb: 48 8b 00 mov (%rax),%rax
8038ee: 8b 80 c8 00 00 00 mov 0xc8(%rax),%eax
8038f4: ba 07 00 00 00 mov $0x7,%edx
8038f9: be 00 f0 7f ef mov $0xef7ff000,%esi
8038fe: 89 c7 mov %eax,%edi
803900: 48 b8 ff 17 80 00 00 movabs $0x8017ff,%rax
803907: 00 00 00
80390a: ff d0 callq *%rax
80390c: 85 c0 test %eax,%eax
80390e: 79 2a jns 80393a <set_pgfault_handler+0x7b>
panic("Page not available for exception stack");
803910: 48 ba 08 44 80 00 00 movabs $0x804408,%rdx
803917: 00 00 00
80391a: be 23 00 00 00 mov $0x23,%esi
80391f: 48 bf 2f 44 80 00 00 movabs $0x80442f,%rdi
803926: 00 00 00
803929: b8 00 00 00 00 mov $0x0,%eax
80392e: 48 b9 ab 37 80 00 00 movabs $0x8037ab,%rcx
803935: 00 00 00
803938: ff d1 callq *%rcx
}
sys_env_set_pgfault_upcall(thisenv->env_id, (void*)_pgfault_upcall);
80393a: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
803941: 00 00 00
803944: 48 8b 00 mov (%rax),%rax
803947: 8b 80 c8 00 00 00 mov 0xc8(%rax),%eax
80394d: 48 be 78 39 80 00 00 movabs $0x803978,%rsi
803954: 00 00 00
803957: 89 c7 mov %eax,%edi
803959: 48 b8 89 19 80 00 00 movabs $0x801989,%rax
803960: 00 00 00
803963: ff d0 callq *%rax
// sys_env_set_pgfault_upcall(thisenv->env_id,handler);
}
// Save handler pointer for assembly to call.
_pgfault_handler = handler;
803965: 48 b8 08 90 80 00 00 movabs $0x809008,%rax
80396c: 00 00 00
80396f: 48 8b 55 f8 mov -0x8(%rbp),%rdx
803973: 48 89 10 mov %rdx,(%rax)
}
803976: c9 leaveq
803977: c3 retq
0000000000803978 <_pgfault_upcall>:
.globl _pgfault_upcall
_pgfault_upcall:
// Call the C page fault handler.
// function argument: pointer to UTF
movq %rsp,%rdi // passing the function argument in rdi
803978: 48 89 e7 mov %rsp,%rdi
movabs _pgfault_handler, %rax
80397b: 48 a1 08 90 80 00 00 movabs 0x809008,%rax
803982: 00 00 00
call *%rax
803985: ff d0 callq *%rax
/*This code is to be removed*/
// LAB 4: Your code here.
movq 136(%rsp), %rbx //Load RIP
803987: 48 8b 9c 24 88 00 00 mov 0x88(%rsp),%rbx
80398e: 00
movq 152(%rsp), %rcx //Load RSP
80398f: 48 8b 8c 24 98 00 00 mov 0x98(%rsp),%rcx
803996: 00
//Move pointer on the stack and save the RIP on trap time stack
subq $8, %rcx
803997: 48 83 e9 08 sub $0x8,%rcx
movq %rbx, (%rcx)
80399b: 48 89 19 mov %rbx,(%rcx)
//Now update value of trap time stack rsp after pushing rip in UXSTACKTOP
movq %rcx, 152(%rsp)
80399e: 48 89 8c 24 98 00 00 mov %rcx,0x98(%rsp)
8039a5: 00
// Restore the trap-time registers. After you do this, you
// can no longer modify any general-purpose registers.
// LAB 4: Your code here.
addq $16,%rsp
8039a6: 48 83 c4 10 add $0x10,%rsp
POPA_
8039aa: 4c 8b 3c 24 mov (%rsp),%r15
8039ae: 4c 8b 74 24 08 mov 0x8(%rsp),%r14
8039b3: 4c 8b 6c 24 10 mov 0x10(%rsp),%r13
8039b8: 4c 8b 64 24 18 mov 0x18(%rsp),%r12
8039bd: 4c 8b 5c 24 20 mov 0x20(%rsp),%r11
8039c2: 4c 8b 54 24 28 mov 0x28(%rsp),%r10
8039c7: 4c 8b 4c 24 30 mov 0x30(%rsp),%r9
8039cc: 4c 8b 44 24 38 mov 0x38(%rsp),%r8
8039d1: 48 8b 74 24 40 mov 0x40(%rsp),%rsi
8039d6: 48 8b 7c 24 48 mov 0x48(%rsp),%rdi
8039db: 48 8b 6c 24 50 mov 0x50(%rsp),%rbp
8039e0: 48 8b 54 24 58 mov 0x58(%rsp),%rdx
8039e5: 48 8b 4c 24 60 mov 0x60(%rsp),%rcx
8039ea: 48 8b 5c 24 68 mov 0x68(%rsp),%rbx
8039ef: 48 8b 44 24 70 mov 0x70(%rsp),%rax
8039f4: 48 83 c4 78 add $0x78,%rsp
// Restore eflags from the stack. After you do this, you can
// no longer use arithmetic operations or anything else that
// modifies eflags.
// LAB 4: Your code here.
addq $8, %rsp
8039f8: 48 83 c4 08 add $0x8,%rsp
popfq
8039fc: 9d popfq
// Switch back to the adjusted trap-time stack.
// LAB 4: Your code here.
popq %rsp
8039fd: 5c pop %rsp
// Return to re-execute the instruction that faulted.
// LAB 4: Your code here.
ret
8039fe: c3 retq
00000000008039ff <ipc_recv>:
// If 'pg' is null, pass sys_ipc_recv a value that it will understand
// as meaning "no page". (Zero is not the right value, since that's
// a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
8039ff: 55 push %rbp
803a00: 48 89 e5 mov %rsp,%rbp
803a03: 48 83 ec 30 sub $0x30,%rsp
803a07: 48 89 7d e8 mov %rdi,-0x18(%rbp)
803a0b: 48 89 75 e0 mov %rsi,-0x20(%rbp)
803a0f: 48 89 55 d8 mov %rdx,-0x28(%rbp)
// LAB 4: Your code here.
int result;
if(thisenv->env_status== 0){
803a13: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
803a1a: 00 00 00
803a1d: 48 8b 00 mov (%rax),%rax
803a20: 8b 80 d4 00 00 00 mov 0xd4(%rax),%eax
803a26: 85 c0 test %eax,%eax
803a28: 75 3c jne 803a66 <ipc_recv+0x67>
thisenv = &envs[ENVX(sys_getenvid())];
803a2a: 48 b8 83 17 80 00 00 movabs $0x801783,%rax
803a31: 00 00 00
803a34: ff d0 callq *%rax
803a36: 25 ff 03 00 00 and $0x3ff,%eax
803a3b: 48 63 d0 movslq %eax,%rdx
803a3e: 48 89 d0 mov %rdx,%rax
803a41: 48 c1 e0 03 shl $0x3,%rax
803a45: 48 01 d0 add %rdx,%rax
803a48: 48 c1 e0 05 shl $0x5,%rax
803a4c: 48 ba 00 00 80 00 80 movabs $0x8000800000,%rdx
803a53: 00 00 00
803a56: 48 01 c2 add %rax,%rdx
803a59: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
803a60: 00 00 00
803a63: 48 89 10 mov %rdx,(%rax)
}
if(!pg)
803a66: 48 83 7d e0 00 cmpq $0x0,-0x20(%rbp)
803a6b: 75 0e jne 803a7b <ipc_recv+0x7c>
pg = (void*) UTOP;
803a6d: 48 b8 00 00 80 00 80 movabs $0x8000800000,%rax
803a74: 00 00 00
803a77: 48 89 45 e0 mov %rax,-0x20(%rbp)
result = sys_ipc_recv(pg);
803a7b: 48 8b 45 e0 mov -0x20(%rbp),%rax
803a7f: 48 89 c7 mov %rax,%rdi
803a82: 48 b8 28 1a 80 00 00 movabs $0x801a28,%rax
803a89: 00 00 00
803a8c: ff d0 callq *%rax
803a8e: 89 45 fc mov %eax,-0x4(%rbp)
if(result< 0){
803a91: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
803a95: 79 19 jns 803ab0 <ipc_recv+0xb1>
*from_env_store = 0;
803a97: 48 8b 45 e8 mov -0x18(%rbp),%rax
803a9b: c7 00 00 00 00 00 movl $0x0,(%rax)
*perm_store =0;
803aa1: 48 8b 45 d8 mov -0x28(%rbp),%rax
803aa5: c7 00 00 00 00 00 movl $0x0,(%rax)
return result;
803aab: 8b 45 fc mov -0x4(%rbp),%eax
803aae: eb 53 jmp 803b03 <ipc_recv+0x104>
}
if(from_env_store)
803ab0: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
803ab5: 74 19 je 803ad0 <ipc_recv+0xd1>
*from_env_store = thisenv->env_ipc_from;
803ab7: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
803abe: 00 00 00
803ac1: 48 8b 00 mov (%rax),%rax
803ac4: 8b 90 0c 01 00 00 mov 0x10c(%rax),%edx
803aca: 48 8b 45 e8 mov -0x18(%rbp),%rax
803ace: 89 10 mov %edx,(%rax)
if(perm_store)
803ad0: 48 83 7d d8 00 cmpq $0x0,-0x28(%rbp)
803ad5: 74 19 je 803af0 <ipc_recv+0xf1>
*perm_store = thisenv->env_ipc_perm;
803ad7: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
803ade: 00 00 00
803ae1: 48 8b 00 mov (%rax),%rax
803ae4: 8b 90 10 01 00 00 mov 0x110(%rax),%edx
803aea: 48 8b 45 d8 mov -0x28(%rbp),%rax
803aee: 89 10 mov %edx,(%rax)
//cprintf("I am IPC Recv, sending value[%d] my env id is [%d]and status is [%d] and I am sending to [%d]",thisenv->env_ipc_value,thisenv->env_id,thisenv->env_status,thisenv->env_ipc_from);
return thisenv->env_ipc_value;
803af0: 48 b8 08 70 80 00 00 movabs $0x807008,%rax
803af7: 00 00 00
803afa: 48 8b 00 mov (%rax),%rax
803afd: 8b 80 08 01 00 00 mov 0x108(%rax),%eax
//panic("ipc_recv not implemented");
}
803b03: c9 leaveq
803b04: c3 retq
0000000000803b05 <ipc_send>:
// Use sys_yield() to be CPU-friendly.
// If 'pg' is null, pass sys_ipc_recv a value that it will understand
// as meaning "no page". (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
803b05: 55 push %rbp
803b06: 48 89 e5 mov %rsp,%rbp
803b09: 48 83 ec 30 sub $0x30,%rsp
803b0d: 89 7d ec mov %edi,-0x14(%rbp)
803b10: 89 75 e8 mov %esi,-0x18(%rbp)
803b13: 48 89 55 e0 mov %rdx,-0x20(%rbp)
803b17: 89 4d dc mov %ecx,-0x24(%rbp)
// LAB 4: Your code here.
int result;
if(!pg)
803b1a: 48 83 7d e0 00 cmpq $0x0,-0x20(%rbp)
803b1f: 75 0e jne 803b2f <ipc_send+0x2a>
pg = (void*)UTOP;
803b21: 48 b8 00 00 80 00 80 movabs $0x8000800000,%rax
803b28: 00 00 00
803b2b: 48 89 45 e0 mov %rax,-0x20(%rbp)
do{
result = sys_ipc_try_send(to_env,val,pg,perm);
803b2f: 8b 75 e8 mov -0x18(%rbp),%esi
803b32: 8b 4d dc mov -0x24(%rbp),%ecx
803b35: 48 8b 55 e0 mov -0x20(%rbp),%rdx
803b39: 8b 45 ec mov -0x14(%rbp),%eax
803b3c: 89 c7 mov %eax,%edi
803b3e: 48 b8 d3 19 80 00 00 movabs $0x8019d3,%rax
803b45: 00 00 00
803b48: ff d0 callq *%rax
803b4a: 89 45 fc mov %eax,-0x4(%rbp)
if(-E_IPC_NOT_RECV == result)
803b4d: 83 7d fc f8 cmpl $0xfffffff8,-0x4(%rbp)
803b51: 75 0c jne 803b5f <ipc_send+0x5a>
sys_yield();
803b53: 48 b8 c1 17 80 00 00 movabs $0x8017c1,%rax
803b5a: 00 00 00
803b5d: ff d0 callq *%rax
}while(-E_IPC_NOT_RECV == result);
803b5f: 83 7d fc f8 cmpl $0xfffffff8,-0x4(%rbp)
803b63: 74 ca je 803b2f <ipc_send+0x2a>
//panic("ipc_send not implemented");
}
803b65: c9 leaveq
803b66: c3 retq
0000000000803b67 <ipc_find_env>:
// Find the first environment of the given type. We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
803b67: 55 push %rbp
803b68: 48 89 e5 mov %rsp,%rbp
803b6b: 48 83 ec 14 sub $0x14,%rsp
803b6f: 89 7d ec mov %edi,-0x14(%rbp)
int i;
for (i = 0; i < NENV; i++)
803b72: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
803b79: eb 5e jmp 803bd9 <ipc_find_env+0x72>
if (envs[i].env_type == type)
803b7b: 48 b9 00 00 80 00 80 movabs $0x8000800000,%rcx
803b82: 00 00 00
803b85: 8b 45 fc mov -0x4(%rbp),%eax
803b88: 48 63 d0 movslq %eax,%rdx
803b8b: 48 89 d0 mov %rdx,%rax
803b8e: 48 c1 e0 03 shl $0x3,%rax
803b92: 48 01 d0 add %rdx,%rax
803b95: 48 c1 e0 05 shl $0x5,%rax
803b99: 48 01 c8 add %rcx,%rax
803b9c: 48 05 d0 00 00 00 add $0xd0,%rax
803ba2: 8b 00 mov (%rax),%eax
803ba4: 3b 45 ec cmp -0x14(%rbp),%eax
803ba7: 75 2c jne 803bd5 <ipc_find_env+0x6e>
return envs[i].env_id;
803ba9: 48 b9 00 00 80 00 80 movabs $0x8000800000,%rcx
803bb0: 00 00 00
803bb3: 8b 45 fc mov -0x4(%rbp),%eax
803bb6: 48 63 d0 movslq %eax,%rdx
803bb9: 48 89 d0 mov %rdx,%rax
803bbc: 48 c1 e0 03 shl $0x3,%rax
803bc0: 48 01 d0 add %rdx,%rax
803bc3: 48 c1 e0 05 shl $0x5,%rax
803bc7: 48 01 c8 add %rcx,%rax
803bca: 48 05 c0 00 00 00 add $0xc0,%rax
803bd0: 8b 40 08 mov 0x8(%rax),%eax
803bd3: eb 12 jmp 803be7 <ipc_find_env+0x80>
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
int i;
for (i = 0; i < NENV; i++)
803bd5: 83 45 fc 01 addl $0x1,-0x4(%rbp)
803bd9: 81 7d fc ff 03 00 00 cmpl $0x3ff,-0x4(%rbp)
803be0: 7e 99 jle 803b7b <ipc_find_env+0x14>
if (envs[i].env_type == type)
return envs[i].env_id;
return 0;
803be2: b8 00 00 00 00 mov $0x0,%eax
}
803be7: c9 leaveq
803be8: c3 retq
0000000000803be9 <pageref>:
#include <inc/lib.h>
int
pageref(void *v)
{
803be9: 55 push %rbp
803bea: 48 89 e5 mov %rsp,%rbp
803bed: 48 83 ec 18 sub $0x18,%rsp
803bf1: 48 89 7d e8 mov %rdi,-0x18(%rbp)
pte_t pte;
if (!(uvpd[VPD(v)] & PTE_P))
803bf5: 48 8b 45 e8 mov -0x18(%rbp),%rax
803bf9: 48 c1 e8 15 shr $0x15,%rax
803bfd: 48 89 c2 mov %rax,%rdx
803c00: 48 b8 00 00 00 80 00 movabs $0x10080000000,%rax
803c07: 01 00 00
803c0a: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
803c0e: 83 e0 01 and $0x1,%eax
803c11: 48 85 c0 test %rax,%rax
803c14: 75 07 jne 803c1d <pageref+0x34>
return 0;
803c16: b8 00 00 00 00 mov $0x0,%eax
803c1b: eb 53 jmp 803c70 <pageref+0x87>
pte = uvpt[PGNUM(v)];
803c1d: 48 8b 45 e8 mov -0x18(%rbp),%rax
803c21: 48 c1 e8 0c shr $0xc,%rax
803c25: 48 89 c2 mov %rax,%rdx
803c28: 48 b8 00 00 00 00 00 movabs $0x10000000000,%rax
803c2f: 01 00 00
803c32: 48 8b 04 d0 mov (%rax,%rdx,8),%rax
803c36: 48 89 45 f8 mov %rax,-0x8(%rbp)
if (!(pte & PTE_P))
803c3a: 48 8b 45 f8 mov -0x8(%rbp),%rax
803c3e: 83 e0 01 and $0x1,%eax
803c41: 48 85 c0 test %rax,%rax
803c44: 75 07 jne 803c4d <pageref+0x64>
return 0;
803c46: b8 00 00 00 00 mov $0x0,%eax
803c4b: eb 23 jmp 803c70 <pageref+0x87>
return pages[PPN(pte)].pp_ref;
803c4d: 48 8b 45 f8 mov -0x8(%rbp),%rax
803c51: 48 c1 e8 0c shr $0xc,%rax
803c55: 48 89 c2 mov %rax,%rdx
803c58: 48 b8 00 00 a0 00 80 movabs $0x8000a00000,%rax
803c5f: 00 00 00
803c62: 48 c1 e2 04 shl $0x4,%rdx
803c66: 48 01 d0 add %rdx,%rax
803c69: 0f b7 40 08 movzwl 0x8(%rax),%eax
803c6d: 0f b7 c0 movzwl %ax,%eax
}
803c70: c9 leaveq
803c71: c3 retq
|
code
|
\begin{document}
\def{\langle}{{{\langle}ngle}}
\def{\rangle}{{{\rangle}ngle}}
\def{\varepsilon}{{\varepsilon}}
\\ \nonumberewcommand{\begin{equation}}{\begin{equation}}
\\ \nonumberewcommand{\epsilonnd{equation}}{\epsilonnd{equation}}
\\ \nonumberewcommand{\begin{equation}a}{\begin{eqnarray}}
\\ \nonumberewcommand{\epsilonnd{equation}a}{\epsilonnd{eqnarray}}
\\ \nonumberewcommand{\quad}{\quaduad}
\\ \nonumberewcommand{\text{tunn}}{\text{tunn}}
\\ \nonumberewcommand{\text{refl}}{\text{refl}}
\\ \nonumberewcommand{\text{all}}{\text{all}}
\\ \nonumberewcommand{\text{ion}}{\text{ion}}
\\ \nonumberewcommand{\text{bound}}{\text{bound}}
\\ \nonumberewcommand{\text{free}}{\text{free}}
\\ \nonumberewcommand{\curly{l}}{\curly{l}}
\\ \nonumberewcommand{\hat{H}at{A}}{\hat{H}at{A}}
\\ \nonumberewcommand{\hat{H}at{B}}{\hat{H}at{B}}
\\ \nonumberewcommand{\hat{H}at{S}}{\hat{H}at{S}}
\\ \nonumberewcommand{x_{cl}}{x_{cl}}
\\ \nonumberewcommand{\hat{H}at{S}i}{\hat{H}at{\hat{H}at{S}igma}}
\\ \nonumberewcommand{\hat{H}at{\Pi}}{\hat{H}at{\Pi}}
\\ \nonumberewcommand{\hat{H}at{A}C}{{\it AC }}
\\ \nonumberewcommand{{{\langle}mbda }}{{{\langle}mbda }}
\\ \nonumberewcommand{|\psi_I{\rangle}}{|\psi_I{\rangle}}
\\ \nonumberewcommand{|\psi_F{\rangle}}{|\psi_F{\rangle}}
\\ \nonumberewcommand{\\ \nonumber}{\\ \\ \nonumberonumber}
\\ \nonumberewcommand{\\ \nonumbern}{\quad\quad\quad\quad\quad\quad\quad\quad\quad\\ \\ \nonumberonumber}
\quad\quad\quad\quad\quad\quad\quad\quad\quad
\\ \nonumberewcommand{\omega}{\omegaega}
\\ \nonumberewcommand{\hat{H}at{U}}{\hat{H}at{U}}
\\ \nonumberewcommand{\hat{H}at{U}_{part}}{\hat{H}at{U}_{part}}
\\ \nonumberewcommand{m_f^{\alpha}}{m_f^{\alpha}}
\\ \nonumberewcommand{\epsilon}{\epsilonpsilon}
\\ \nonumberewcommand{\Omega}{\Omegaega}
\\ \nonumberewcommand{\mathcal{T}_{SWP}}{\mathcal{T}_{SWP}}
\\ \nonumberewcommand{\tau_{in/out}}{\tau_{in/out}}
\\ \nonumberewcommand{\overline}{\overline}
\\ \nonumberewcommand{\cn}[1]{#1_{\hat{H}box{\hat{H}at{S}criptsize{con}}}}
\\ \nonumberewcommand{\hat{H}at{S}y}[1]{#1_{\hat{H}box{\hat{H}at{S}criptsize{sys}}}}
\\ \nonumberewcommand{Pad\'{e} }{Pad\'{e} }
\\ \nonumberewcommand{Pad\'{e}\q}{Pad\'{e}\quad}
\\ \nonumberewcommand{\hat{H}at{\Pi}}{\hat{H}at{\Pi}}
\\ \nonumberewcommand{\leftarrow}{\leftarrow}
\\ \nonumberewcommand{\ref }{\ref }
\\ \nonumberewcommand{\text{T}_\Om}{\text{T}_\Omega}
\\ \nonumberewcommand{\text{T}_\Omf}{\text{T}}
\\ \nonumberewcommand{{\ttau}}{\overline{\tau_\Omega} }
\\ \nonumberewcommand{{\tttu}}{\overline{\tau_{[0,d]}} }
\\ \nonumberewcommand{\hat{H}}{\hat{H}at{H}}
\\ \nonumberewcommand{\mathfrak{N} }{\mathfrak{N} }
\\ \nonumberewcommand{\text{Im } }{\text{Im } }
\title{ The Salecker-Wigner-Peres clock, Feynman paths, and a tunnelling time that should not exist}
\author {D. Sokolovski$^{a,b}$}
\affiliation{$^a$ Departmento de Qu\'imica-F\'isica, Universidad del Pa\' is Vasco, UPV/EHU, Leioa, Spain}
\affiliation{$^b$ IKERBASQUE, Basque Foundation for Science, Maria Diaz de Haro 3, 48013, Bilbao, Spain}
\begin{abstract}
\\ \nonumberoindent
The Salecker-Wigner-Peres (SWP) clock is often used to determine the duration a quantum particle is supposed to spend is a specified region of space $\Omega$. By construction, the result is a real positive number, and the method seems to avoid the difficulty of introducing complex time parameters, which arises in the Feynman paths approach. However, it tells little about about the particle's motion. We investigate this matter further, and show that the SWP clock, like any other Larmor clock, correlates the rotation of its angular momentum with the durations, $\tau$, which the Feynman paths spend in $\Omega$, thereby destroying interference between different durations. An inaccurate weakly coupled clock leaves the interference almost intact, and the need to resolve the resulting "which way?"
problem is one of the main difficulties at the centre of the "tunnelling time" controversy. In the absence of a probability distribution for the values of $\tau$, the SWP results are expressed in terms of moduli of the "complex times", given by the weighted sums of the corresponding probability amplitudes. It is shown that over-interpretation of these results, by treating the SWP times as physical time intervals, leads to paradoxes and should be avoided. We also analyse various settings of the SWP clock, different calibration procedures, and the relation between the SWP results and the quantum dwell time.
The cases of stationary tunnelling and tunnel ionisation are considered in some detail.
Although our detailed analysis addresses only one particular definition of the duration of a tunnelling process, it also points towards the
impossibility of uniting various time parameters, which may occur in quantum theory, within the concept of a single "tunnelling time".
\pacs{ 03.65.Xp,73.40.Gk}
\date{\today}
\epsilonnd{abstract}
\maketitle
\vskip0.5cm
\hat{H}at{S}ection{introduction}
Recent progress in attosecond science \cite{UFAST} has returned to prominence
the nearly hundred years old \cite{McColl} question "how long does it take for a particle to tunnel?". There are serious disagreements, e.g., between the authors of \cite{ZeroT}, who claimed that "optical tunnelling is instantaneous", and the conclusions of \cite{Teeny1} suggesting that "the electron spends a non-vanishing time under the potential barrier". An overview of the "tunnelling time problem", in its relation to attosecond physics, can be found, for example, in \cite{LansREV}.
\\ \nonumberewline
The tunnelling time problem was extensively investigated in the last decade of the previous century, mostly in the context of tunnelling across stationary potential barriers, closely related to the then-fashionable subject of carrier transport in heterostructures (for review see \cite{REV1}- \cite{REV2}). The problem also has a more fundamental aspect.
An often cited difficulty in defining a tunnelling time is the absence of the corresponding hermitian operator, an the impossibility of performing a standard von Neumann measurement \cite{vN} in order to determine it.
However, this is not a major obstacle, since the von Neumann procedure can be extended to measuring quantities represented by certain types of functionals on the Feynman paths of the measured system \cite{FUNC1}- \cite{FUNC2}, by making the meter monitor the system over an extended period of time.
\\ \nonumberewline
One time parameter, represented by such a functional, is the net time a quantum particle spends in the specified region of space.
It is intimately related to Larmor precession, and following Buettiker \cite{Buett2} we will refer to it as the {\it traversal time}.
With the functional specified, the problem becomes one in quantum measurement theory. It was studied in some depth in
\cite{DSB}-\cite{DSbook}. The main conclusion of these studies, which we maintain to date, is as follows.
Traversal time can be measured by an extended von Neumann procedure, and the relevant meter is a variant of a Larmor clock,
a spin, whose angle of rotation correlates with the duration spent in the magnetic field \cite{QUINT}.
However, a quantum measurement is significantly more complicated than its classical counterpart,
largely due to the trade-off between its accuracy, and the perturbation the measurement produces.
Larmor clocks with spins of different sizes, observed in different states and subjected to different magnetic fields, will all produce different results.
These results, although perfectly tractable, lack the universality of the classical traversal time.
To put it differently, analysis of the quantum traversal time problem is worthy from the general point of view, but its result is bound to disappoint a practitioner wishing to know only
"how many seconds does it take to tunnel, after all?".
\\ \nonumberewline
Among many possible versions of the Larmor clock \cite{Buett2}, \cite{Larm1}-\cite{Larm2}, one stands out, and has been the subject of many recent and not so recent studies
\cite{SWP1}-\cite{SWP2}. The Salecker-Wigner-Peres (SWP) clock was first considered as a quantum tool for measuring space-time distances in the general relativity \cite{SWP1}, and was later adopted by Peres \cite{SWP3} for timing events in non-relativistic quantum mechanics.
Specifications of the SWP clock include the choice of its initial and final states, the size of the spin, the strength of the field, and the particular way in which the result of the measurement is calculated. The resulting time can represented as the average value of
the "clock time" operator and is, by construction, a real positive number. The SWP result is often taken to be the {definition}
of the time a particle spends in the magnetic field contained in the region of interest.
One reason why the analysis must not stop there is because such a result tells little about the particle's motion.
Timing a classical particle by means of a classical stopwatch, and getting a result of one second, implies that the particle has actually spent one second in the region $\Omega$,
plus all practical consequences one can draw from this information. The implications of measuring one second with a quantum clock remain unclear, until one considers its precise relation to the particle's Feynman paths.
\\ \nonumberewline
Like every Larmor clock, the SWP clock modifies the contributions the Feynman paths make to a transition amplitude, depending on the final state in which the clock is found. As one would expect, a nearly classical clock, equipped with a very large spin or angular momentum,
destroys the interference between the paths spending different durations in $\Omega$ almost completely. In this case,
having found the initial state of the clock rotated by an angle $\phi$, one can be certain that the particle did spend in $\Omega$ $\phi/\omega_L$ seconds, where $\omega_L$ stands for the Larmor frequency \cite{QUINT}. Choosing a weaker field, or a smaller angular momentum, would
leave certain amount of the interference intact, and reduce the accuracy of the measurement. Even so,
by varying the accuracy, one can probe certain aspects of the particle's motion. For example, in the case of resonance tunnelling across a double barrier, a measurement of a medium accuracy allows one to identify the long delays associated with
the exponential decay of the barrier's metastable state [see Fig.8 of \cite{SBrouard}]. Improving the accuracy, one finds the evidence
of the particle "bouncing" between the potential walls [see Fig.9 of \cite{SBrouard}]. Both the decay and the "bounces" are often
associated with the particle being trapped in a metastable well. Both can be observed, but not at the same time \cite{SBrouard}.
One problem with quantum time measurements is that the restrictions on the Feynman paths, imposed by the clock,
tend to perturb the transition the particle is supposed to make. Thus, if an accurate clock is employed, the particle may either not reach
its final state at all, or be seen to spend no time in $\Omega$ \cite{SBrouard}. Similarly, resonance tunnelling, even in the presence
of a relatively inaccurate Larmor clock, will not be the same, as without it. Yet when one asks "how long it takes to tunnel?",
he/she usually means "unperturbed". This is a well known difficulty in quantum mechanics, where "to know" often implies "to disturb".
\\ \nonumberewline
A natural way to avoid the unwelcome perturbation is to reduce the coupling between the clock and the system, and try to interpret whatever information can be gained in this manner. The purpose of this paper is to analyse the results obtained by an SWP clock in the limit $\omega_L \to 0$, and relate them to the time parameters describing the motion of a quantum particle, involved in a transition between known initial and final states. This brings the discussion into the realm of the inaccurate, "indirect" \cite{QUINT}, or "weak" \cite{LANprl} measurements of the traversal time. In the "weak" regime, we can expect a weak SWP clock to make a rather poor job of destroying interference between different values of the traversal time. We will also need to heed D. Bohm's warning \cite{Bohm} that "if the interference were not destroyed", "the quantum theory could be shown to lead to absurd results", and see what it means for the quest to find "the tunnelling time".
\\ \nonumberewline
The rest of the paper is organised as follows.
\\ \nonumberewline
In Section II we discuss various time parameters describing the motion of a classical particle.
\\ \nonumberewline
Section III lists some of the quantum time parameters which are not discussed in this paper.
\\ \nonumberewline
In Sect. IV we define the quantum traversal time, and its amplitude distribution, for a particle pre- and post-selected in the known initial and final states.
\\ \nonumberewline
In Sect. V we introduce the "complex times", which are likely to arise in any weakly perturbing measurement scheme.
\\ \nonumberewline
In Sect. VI we cast the complex times into a more familiar operator form.
\\ \nonumberewline
In Sect. VII we describe the family of Larmor clocks, and their relation to the amplitude distribution of the quantum traversal time.
\\ \nonumberewline
In Sect. VIII we introduce the SWP clock as a particular member of the family.
\\ \nonumberewline
In Sect. IX we reduce the coupling, and show that the time measured by a weakly coupled SWP clock is naturally
expressed in terms the moduli of the complex time of Sect. V.
\\ \nonumberewline
In Sect. X we study the calibration procedure proposed in \cite{Leav1}, and demonstrate that it can lead to "absurd results" predicted by Bohm.
\\ \nonumberewline
In Sect. XI we try to make sense of these "absurd results", and establish a connection between the complex times and
the weak values of quantum measurement theory.
\\ \nonumberewline
In Sect. XII we revisit the dwell time and show it to be a particular case of the "complex times" of Sect. V.
\\ \nonumberewline
In Sect. XIII we ask whether the Peres' clock would measure the dwell time, and find that it would not.
\\ \nonumberewline
In Sect. XIV we apply our general analysis to tunnelling across a stationary potential barrier.
\\ \nonumberewline
In Sect. XV we apply the analysis to a simple model of tunnel ionisation.
\\ \nonumberewline
Section XVI contains our conclusions.
\hat{H}at{S}ection{Which classical time?}
We start by reiterating the three questions which, in our opinion, one might want to answer before performing a quantum measurement. These are:
(i) What is being measured?
(ii) By what means is it being measured?
(iii) To what accuracy is it being measured?
\\ \nonumberewline
The first question arises already in classical mechanics, when we discuss the time parameters describing the presence of a particle, moving along a trajectory $x_{cl}(t)$, in a specified region of space, $\Omega$. One obvious choice is the net duration the particle spends in $\Omega$. It is given by the integral \cite{DSB}
\begin{eqnarray}{\langle}bel{a1}
\tau_\Omega[x_{cl}(t)]=\int_{t_1}^{t_2}\text{T}_\Omheta_{\Omega}(x_{cl}(t))dt,
\epsilonnd{eqnarray}
where $\text{T}_\Omheta_{\Omega}(z)$ has the value of one for a $z$ inside $\Omegaega$, and zero otherwise.
Another choice would be, for example, the time interval between the moments $t_{in}$, when the particle enters $\Omega$ for the first time,
and $t_{out}$, when it leaves it for the last time,
\begin{eqnarray}{\langle}bel{a2}
\tau_{in/out}[x_{cl}(t)]=t_{out}[x_{cl}(t)]-t_{in}[x_{cl}(t)].
\epsilonnd{eqnarray}
The choice depends on the question we want to ask. If the particle has a tendency to change colour from white to black
proportionally to the net duration spent in $\Omega$, to predict the shade of grey acquired we need $\tau_\Omegaega [x_{cl}(t)]$.
If, on the other hand the temperature in $\Omega$ changes with a frequency $\omegaega$, and we need the particle
to experience no change, the required condition would be $\omegaega\tau_{in/out}[x_{cl}(t)]<<1$, and not $\omegaega\tau_\Omega[x_{cl}(t)]<<1$.
In general, these two parameters are different.
\begin{eqnarray}{\langle}bel{a3}
\tau_\Omega[x_{cl}(t)] \\ \nonumbere \tau_{in/out}[x_{cl}(t)].
\epsilonnd{eqnarray}
Even classically, different time parameters require different measurement procedures. To measure $\tau_\Omega[x_{cl}(t)]$, we can equip
the particle with a magnetic moment which precesses in the magnetic field introduced in $\Omega$. Dividing the final angle of precession by the Larmor frequency, $\omegaega_L$, we obtain the value of $\tau_\Omega[x_{cl}(t)]$. It appears that no similar procedure exists for $\tau_{in/out}[x_{cl}(t)]$, or even for $t_{in}[x(t)]$ in Eq.(\ref{a2}) \cite{FUNC4}. The difficulty is in stopping the clock after the {\it first} entry in $\Omega$, and preventing it from running again should the path leave the region and then re-enter. In classical mechanics we can simply plot the particle's trajectory, and determine $t_{in}[x_{cl}(t)]$ from the graph. In the quantum case, there is no trajectory to draw, and the absence of a meter is a serious problem \cite{FUNC4}.
\\ \nonumberewline
The accuracy of a measurement is of no great importance in the classical case, where a meter (a clock) can monitor a particle
with any precision, without altering its trajectory $x_{cl}(t)$. It plays a much more important role in the quantum case, where there is a tradeoff between the accuracy of the measurement, and the perturbation the meter exerts on the particle's motion.
\\ \nonumberewline
Throughout the rest of the paper we will try to answer the following question: {\it What is the total amount of time a quantum particle starting in a known state $|\psi_I{\rangle}$ at $t=t_1$, and then observed on a state $|\psi_F{\rangle}$ at $t=t_2$, had spent in a specified region $\Omega$
between $t_1$and $t_2$? }. To measure it we will employ a highly inaccurate Salecker-Wigner-Peres clock,
specifically designed to perturb the studied quantum transition as little as possible.
The experiment we have in mind is like this. A particle is prepared in $|\psi_I{\rangle}$, coupled to an SWP clock, and then detected in $|\psi_F{\rangle}$.
If the detection is successful, we "read" the clock in some manner, record the result, and draw conclusions about the duration spent in $\Omega$. Although we consider one-dimensional scattering, most of our results can be extended to two or three dimensions.
\hat{H}at{S}ection{Other quantum times beyond the scope of this paper}
In quantum mechanics there are many different ways to introduce quantities measured in units of time.
Before proceeding with our main task, we briefly discuss some of the time parameters, which describe a scattering (tunnelling) process and are {\it not } a subject of of this paper.
\\ \nonumberewline
The simplest way to probe the tunnelling delay is to prepare a particle in a wave packet state on one side of the barrier, choose a location $x$ on its other side, and evaluate the probability $P(x,t)=|\psi(x,t)|^2$.
Using $P(x,t)$ as a probability distribution, one can construct the
real non-negative mean time \cite{Japha}, also known as the "time of presence" \cite{Muga1}
\begin{eqnarray}{\langle}bel{p1}
{\langle} t(x){\rangle} = \int t P(t,x)dt/\int P(x,t)dt.
\epsilonnd{eqnarray}
This mean time can be measured by performing $N>>1$ trials, each time checking whether the particle is between $x$ and $x+dx$
at a time $t$. If in $N_1$ cases the particle is found there, the ratio $N_1/Ndx$ would yield an approximate value of $P(x,t)$.
Repeating the checks at various times, allows one to reconstruct $P(x,t)$ and, with it, ${\langle} t(x){\rangle}$.
This is, however, different from what we intend to do here, as explained in Sect. 18 of \cite{DSann}.
\\ \nonumberewline
A slightly different method was recently proposed by Pollack in Refs. \cite{Poll1}, \cite{Poll2}. There
the particle is prepared in a thermal mixed state
\begin{eqnarray}{\langle}bel{p1a}
\hat{H}at{\rho}_I= \epsilonxp(-\beta \hat{H}/2)|x_0{\rangle}{\langle} x_0|\epsilonxp(-\beta \hat{H}/2),
\epsilonnd{eqnarray}
where $x_0$ is some initial location, $\hat{H}$ is the Hamiltonian, and $\beta$ is the inverse temperature. The state is evolved until some $t$, $\hat{H}at{\rho}(t)=\epsilonxp(i\hat{H} t)\hat{H}at{\rho}_I\epsilonxp(-i\hat{H} t)$, and the probability to find the particle at a location $x$ on the other side of the barrier, $P(x,t)=tr\{|x{\rangle}{\langle} x| \hat{H}at{\rho}(t)\}$, is inserted into Eq.(\ref{p1}) for the mean transit time. The mean time can then be measured as discussed above.
This is also not what we wish to discuss below, if only because here we are not interested in systems in thermal equilibrium.
\\ \nonumberewline
Finally, the authors of \cite{Teeny1} proposed using the probability current evaluated at two locations on the opposite sides of the barrier, $x_1$ and $x_2$, and define the mean transit time as the difference between the moments the out- and in-going probability currents at $x_2$ and $x_1$ reach their maxima.
Measuring, albeit indirectly, this time would require a different experiment, e.g., the one in which the presence of the particle is
checked at all times to the right of $x_1$, and then at $x_2$, the evaluated probabilities are differentiated with respect to time to yield the currents, and the maxima of the two curves are identified. This procedure is not our subject either.
The list of possible quantum time parameters can be extended, and new times will, undoubtably, be proposed in future studies.
It is not our intention to compare relative merits or defects of the approaches discussed in this Section. (Except, perhaps,
citing some of well known problems with defining quantum arrival times \cite{Muga1}, or relying on the probability current in order to determine times, or time intervals \cite{Muga2}). Rather, we note that measurements of different quantum times require different experimental procedures, and should not be expected to give the same result. To some extent this is true already in classical mechanics,
as was pointed out in the previous Section. Thus, A may propose, and perform, an experiment in which a time parameter associated with a tunnelling transition vanishes, and claim tunnelling to be an "infinitely fast" process. B can do something different, obtain a non-zero answer, and state "that tunnelling does take time after all". The argument between A and B will never have a meaningful resolution, since both claims rely on the assumption that there is a single time tunnelling "takes", and there is overwhelming evidence that this assumption is false.
In this paper, to add to this evidence, we consider a particular classical time (\ref{a1}), and see what will happen if it is generalised to the full quantum case.
\hat{H}at{S}ection{Traversal time for quantum motion}
A classical particle of a mass $\mu$ in a potential $V(x,t)$ goes from some initial position $x_I$ at $t=t_1$ to a final position $x_F$ at $t=t_2$ along a smooth continuous trajectory $x_{cl}(t)$. There is a single value of the duration spent in $\Omega$, and it is given by the functional $\tau_\Omega[x(t)]$ in Eq.(\ref{a1}).
\\ \nonumberewline
The quantum case is more complex. A quantum particle can make a transition from an initial state $|\psi_I{\rangle}$ at $t=t_1$ to a final state $|\psi_F{\rangle}$ at $t=t_2$. To proceed, we need to choose a representation. Since we are interested in a spacial region $\Omega$,
the coordinate representation is the appropriate one. Now a point particle can be thought of as being at some location $x(t)$ at any time $t_1\le t\le t_2$,
and a possible scenario for reaching $\psi_F$ from $\psi_I$ is by following a Feynman path $x(t)$, which is continuous, but not smooth \cite{Feyn}. The path is virtual, and is equipped only with a probability amplitude (we use $\hat{H}bar=1$)
\begin{eqnarray}{\langle}bel{b1}
A([x(t)],\psi_I,\psi_F)={\langle} \psi_F|x_F{\rangle} \epsilonxp\{iS[x(t)]\}{\langle} x_I |\psi_I{\rangle},
\epsilonnd{eqnarray}
where
$S[x(t)]=\int_{t_1}^{t_2}[\dot{x}^2/2\mu-V(x,t)]dt$ is the classical action.
The full transition amplitude to reach $|\psi_F{\rangle}$ from $|\psi_I{\rangle}$ is given by the Feynman path integral \cite{Feyn}, which we symbolically write as
\begin{eqnarray}{\langle}bel{b2}
A(\psi_F, \psi_I, t_2,t_1)= \hat{H}at{S}um_{paths}A([x(t)],\psi_I,\psi_F).
\epsilonnd{eqnarray}
Note that the set of Feynman paths in Eq.(\ref{b2}) is always the same. What changes, with the change of the potential in which a particle moves, are the path amplitudes $A([x(t)],\psi_I,\psi_F)$. The classical dynamics emerges from Eq.(\ref{b2}) when the contribution to
the path integral comes from the vicinity of the path $x_{cl}(t)$ on which $S[x(t)]$ is stationary \cite{Feyn}.
\\ \nonumberewline
What can be said about the duration a particle spends in $\Omega$ is dictated by the basic rules of quantum mechanics.
The functional $\tau_\Omega[x(t)]$ can be evaluated for each of the Feynman paths. The paths can be combined and recombined into new pathways, just as the superposition principle allows us to recombine vectors in Hilbert space into a new vector \cite{FUNC2}. Combining together all the paths which share the same value $\tau$ of
$\tau_\Omega[x(t)]$, we create a new virtual pathway, {\it for reaching} $|\psi_F{\rangle}$ {\it from} $|\psi_I{\rangle}$, {\it and spending} $\tau$ {\it seconds in} $\Omega$ {\it along the way}, and sacrifice to interference all other information contained in the individual Feynman paths.
The amplitude for the new pathway is
\begin{eqnarray}{\langle}bel{b3}
A(\psi_F, \psi_I, t_2,t_1|\tau)= \\ \nonumber
\hat{H}at{S}um_{paths}A([x(t)],\psi_I,\psi_F)\delta(\tau_\Omega[x(t)]-\tau),
\epsilonnd{eqnarray}
where $\delta(z)$ is the Dirac delta. Integrating Eq.(\ref{b3}) over all possible $\tau$'s restores the full transition amplitude
$A(\psi_F, \psi_I, t_2,t_1)$ in Eq.(\ref{b2}).In addition, we have
\begin{eqnarray}{\langle}bel{b3a}
A(\psi_F, \psi_I, t_2,t_1|\tau)\epsilonquiv 0, \quad \text{for} \quad \tau<0 \quad \\ \nonumber
\text{and} \quad \tau > t_2-t_1,
\epsilonnd{eqnarray}
since non-relativistic Feynman paths may not spend in $\Omega$ a duration which is either negative, or exceeds
the total duration of motion.
\\ \nonumberewline
The situation is a standard one in quantum mechanics. For given initial and final states of the particle, we have not one, but infinitely many values of the traversal time $\tau$.
To each value we can ascribe a probability amplitude, but not the probability itself.
This is not different from what happens in Young's two-slit experiment \cite{QUINT}.
The expectation that there must, after all, be a single traversal time associated with a quantum transition, is as good, or as bad, as the assumption that each electron must have
actually gone through one slit or another. According to Feynman \cite{FeynLaw}, the latter assumption should be abandoned, and
the rule for adding amplitudes must be accepted as the basic axiom of quantum theory instead.
Throughout the rest of the paper, we will maintain this point of view, despite possible objections from the proponents of the Bohmian version of quantum theory \cite{Leav3}, \cite{Leav4}, \cite{Holl}.
\\ \nonumberewline
Thus, our virtual pathways, labelled by the value of $\tau$, interfere just like individual Feynman paths they comprise,
and should together be considered a single indivisible pathway connecting $|\psi_I{\rangle}$ and $|\psi_F{\rangle}$ \cite{FUNC2}.
Interference between them can be destroyed by an accurate meter \cite{QUINT}, registering the actual value of $\tau$ each time the transition is observed, but the probability $P_{acc}(\psi_F, \psi_I, t_2,t_1)$ to reach the final state, while being observed, will change,
\begin{eqnarray}{\langle}bel{b4}
P_{acc}(\psi_F, \psi_I, t_2,t_1) \epsilonquiv \int_{0}^{t_2-t_1} d\tau |A(\psi_F,\psi_I, t_2,t_1|\tau)|^2 \\ \nonumbere \quad\quad\\ \nonumber
|\int_{0}^{t_2-t_1} d\tau A(\psi_F,\psi_I, t_2,t_1|\tau)|^2=|\hat{H}at{S}um_{paths}A([x(t)],\psi_I,\psi_F)|^2.
\epsilonnd{eqnarray}
This simple discussion should help to establish the status of the time parameter represented by the functional (\ref{a1}) within the standard quantum theory. We note the similarity between the quantum traversal time problem and the Young's double-slit experiment.
If we were able to construct a unique traversal time, or even a probability distribution for such times, we could, in principle, also determine the slit through which the electron has passed, with the interference pattern on the screen intact.
According to Feynman \cite{FeynLaw}, the latter is an impossible task.
\hat{H}at{S}ection{The complex times}
Even before going into the details of a particular measurement,
we can guess what would happen if the meter's
interaction with the particle has been deliberately made small (weak), in order to preserve the interference, and minimise the perturbation produced on the particle's motion.
There is a fashionable view that the result would be a "weak value", a new type of quantum variable, capable of providing a new insight into physical reality. (For a recent review see \cite{WEAK11}, the term "weak measurement elements of reality" was coined in \cite{WEAK12}).
\\ \nonumberewline
Recently we argued against over-interpretation of the "weak values", and offered a more prosaic explanation \cite{FUNC2}, \cite{PLA2016}.
In the absence of probabilities, any weakly perturbing scheme is bound to give a result, expressed in terms of the probability amplitudes. A scheme set up to weakly measure a quantity would typically yield a {\it real} result expressed, in one way or another, in terms of the complex valued {\it sums of the
corresponding amplitudes, weighed by the values of the measured quantity}
and, occasionally, the amplitudes themselves \cite{FUNC2}, \cite{PLA2016}.
Far from representing a new type of "reality", these results only give us this limited information about the particular set of virtual pathways connecting the initial and final states.
They would, for example, shed no new light on the mechanism of the two-slit experiment, mentioned in the previous Section, beyond what is known from the textbooks.
\\ \nonumberewline
In the case of the traversal time (\ref{a1}) one such weighted sum is the "complex time" introduced in \cite{DSB},
\begin{eqnarray}{\langle}bel{b5}
\overline{\tau_{\Omega}}(\psi_I,\psi_F)=\quad\quad\quad\quad\quad\quad\quad\quad\quad\\ \nonumber
\hat{H}at{S}um_{paths}\tau_\Omega[x(t)]A([x(t)],\psi_I,\psi_F)/\hat{H}at{S}um_{paths}A([x(t)],\psi_I,\psi_F) \quad\quad \\ \nonumber
=\int_{0}^{t_2-t_1} d\tau \tau A(\psi_F,\psi_I, t_2,t_1|\tau)/A(\psi_F, \psi_I, t_2,t_1). \quad\quad
\epsilonnd{eqnarray}
The quantities of these type, first introduced by Feynman \cite{Feyn} as "transition elements of functionals",
reduce to the weak values of \cite{WEAK11}, if the functional in question is the instantaneous value of a variable
$A(t_0)$ at a time $t_1<t_0<t_2$.
\\ \nonumberewline
The quantity in Eq.(\ref{b5}) was often dismissed as a candidate for the duration quantum particle performing a transition (e.g., tunnelling transmission
across a potential barrier) spends in a specified region of space, on account of it being complex valued. For example, in Ref.\cite{REV1} we read: "...common sense dictates that to the question of the duration of a tunneling
process, the answer, if it exists at all, must be a real
time". The key words here are "if it exists", and in the previous Section we explained in what sense the answer should not exist.
As a consequence, only complex valued combinations of transition amplitudes similar to (\ref{b5}) will be found in the analysis of a non-perturbing weakly coupled meter. It is true that the result of a physical measurement must be real, but there is no contradiction. Different setups, employed to weakly measure the quantum traversal time (\ref{a1}), may yield $\text{Re} \ttau_{}$, $\text{Im} \ttau_{}$ or $|\ttau_{}|$, as demonstrated in the table
in \cite{DSwp}.
\\ \nonumberewline
Finally, we can define expressions similar to (\ref{b5}) for higher powers of the functional $\tau[x(t)]$,
\begin{eqnarray}{\langle}bel{xy5}
\overline{\tau^n_\Omega}(\psi_I,\psi_F,t_2,t_1)
\epsilonquiv \ref rac{\int_{0}^{t_2-t_1} d\tau \tau^n A(\psi_F,\psi_I, t_2,t_1|\tau)}{A(\psi_F, \psi_I, t_2,t_1)}, \quad
\epsilonnd{eqnarray}
where $n=2,3....$. We will require some of these quantities in what follows.
In the following Sections we illustrate what has been said so far, using the example of a weakly coupled SWP clock.
\hat{H}at{S}ection{Complex times in operator notations}
It may be convenient to formulate the problem in terms of partial evolution operators acting in the particle's Hilbert space.
Let $\hat{H}at{U}_{part}[x(t)] =|x_F{\rangle} \epsilonxp\{iS[x(t)]\} {\langle} x_I|$ be an operator which evolves the (part)icle along a single Feynman path $x(t)$, which starts in $x_I$ at $t_1$,and ends in $x_F$ at $t_2$. Summing over all paths which spend exactly $\tau$ seconds in $\Omega$, (summation over $x_I$ and $x_F$ included), we obtain an evolution operator {\it conditioned} by the requirement that the particle spend exactly $\tau$ seconds in the region of interest,
\begin{eqnarray}{\langle}bel{xy1}
\hat{H}at{U}_{part}(t_2,t_1|\tau)=\hat{H}at{S}um_{paths}\hat{H}at{U}_{part}[x(t)]\delta(\tau[x(t)]-\tau).
\epsilonnd{eqnarray}
Summing Eq.(\ref{xy1}) over all $\tau$'s restores the full evolution operator, $\hat{H}at{U}_{part}(t_2,t_1)$,
\begin{eqnarray}{\langle}bel{xy2}
\int_{0}^{t_2-t_1}\hat{H}at{U}_{part}(t_2,t_1|\tau)d\tau =\hat{H}at{S}um_{paths}\hat{H}at{U}_{part}[x(t)]\\ \nonumber
=\hat{H}at{U}_{part}(t_2,t_1).\quad\quad
\epsilonnd{eqnarray}
Next we introduce an operator $\hat{H}at{U}_{part}(t_2,t_1|{{\langle}mbda })$ as a Fourier transform of $\hat{H}at{U}_{part}(t_2,t_1|\tau)$,
\begin{eqnarray}{\langle}bel{xy3}
\hat{H}at{U}_{part}(t_2,t_1|\tau)=
(2\pi)^{-1/2}\int \epsilonxp(i{\langle}mbda \tau) \hat{H}at{U}_{part}(t_2,t_1|{{\langle}mbda })d{{\langle}mbda },\quad\quad
\epsilonnd{eqnarray}
and, with it, an operator family,
\begin{eqnarray}{\langle}bel{xy4}
\hat{H}at{U}_{part}^{(n)}(t_2,t_1)=\int_{0}^{t_2-t_1} \tau^n\hat{H}at{U}_{part}(t_2,t_1|\tau) d\tau \\ \nonumber
=(i)^n \partial^n_{{\langle}mbda } \hat{H}at{U}_{part}(t_2,t_1|{{\langle}mbda })|_{{{\langle}mbda }=0},\quad n=0,1,2...,
\epsilonnd{eqnarray}
where $\hat{H}at{U}_{part}^{(0)}(t_2,t_1)=\hat{H}at{U}_{part}^{}(t_2,t_1)$.
\\ \nonumberewline Now the complex "averages" in Eqs. (\ref{b5}) and (\ref{xy5}),
can also be written as
\begin{eqnarray}{\langle}bel{xy6}
\overline{\tau^n_\Omega}(\psi_F, \psi_I, t_2,t_1)=
\ref rac{{\langle} \psi_F|\psi^{(n)}{\rangle}}{{\langle} \psi_F|\psi^{(0)}{\rangle}},\quad
\epsilonnd{eqnarray}
where
\begin{eqnarray}{\langle}bel{xy7}
|\psi^{(n)}(t_2,t_1,\psi_I){\rangle} \epsilonquiv \hat{H}at{U}^{(n)}_{part}(t_2,t_1)|\psi_I{\rangle},
\epsilonnd{eqnarray}
and $\overline{\tau_{\Omega}}(\psi_I,\psi_F)=\overline{\tau^{(1)}_{\Omega}}(\psi_I,\psi_F)$.
\\ \nonumberewline
The usefulness of this approach becomes more evident as we realise that $\hat{H}at{U}_{part}(t_2,t_1|{{\langle}mbda })$ coincides with the evolution operator
for a particle moving in the original potential $V(x,t)$ plus an additional potential which equals ${{\langle}mbda }$ inside $\Omega$, and
vanishes outside it, $\hat{H}at{U}_{part}(t_2,t_1|{{\langle}mbda })=\epsilonxp[-i\int_{t_1}^{t_2}\hat{H}_{part}(t,{{\langle}mbda })dt]$, where the particle's Hamiltonian, $\hat{H}_{part}(t,{{\langle}mbda })$, is given by
\begin{eqnarray}{\langle}bel{xy8}
\hat{H}_{part}(t,{{\langle}mbda }) \epsilonquiv -\partial_x^2/2\mu + V(x,t)+{\langle}mbda \text{T}_\Omheta_\Omega(x).
\epsilonnd{eqnarray}
This result follows by noting that
if one writes $\delta(\tau[x(t)]-\tau)$ as $(2\pi)^{-1}\int \epsilonxp\{i{{\langle}mbda } (\tau-\tau[x(t)])\}d{\langle}mbda$ and inserts it in (\ref{b3}), the action
$S[x(t)]$ in Eq.(\ref{b1}) is modified by the term $-{{\langle}mbda } \int_{t_1}^{t_2}\text{T}_\Omheta_\Omega(x(t))dt$, which corresponds to adding an extra potential
${{\langle}mbda } \text{T}_\Omheta_\Omega(x)$. The operators $\hat{H}at{U}_{part}^{(n)}(t_2,t_1)$ can now be evaluated by expanding $\hat{H}at{U}_{part}(t_2,t_1|{{\langle}mbda })$ in powers
of ${{\langle}mbda }$ with the help of the perturbation theory \cite{Feyn}. For example, for $\hat{H}at{U}_{part}^{(1)}(t_2,t_1)$ we have
\begin{eqnarray}{\langle}bel{xy9}
\hat{H}at{U}_{part}^{(1)}(t_2,t_1) =\quad\quad\quad\quad\quad\quad\\ \nonumber
\int_{t_1}^{t_2}dt'\int_\Omega dx' \hat{H}at{U}_{part}(t_2,t')|x'{\rangle}{\langle} x'|\hat{H}at{U}_{part}(t',t_1),\quad\quad
\epsilonnd{eqnarray}
so that
\begin{eqnarray}{\langle}bel{xy10}
\overline{\tau_\Omega}(\psi_I,\psi_F)=
\ref rac{\int_{t_1}^{t_2}dt'\int_\Omega dx' \psi^*_F(t',x')\psi_I(t',x')}{{\langle} \psi_F|\hat{H}at{U}_{part}(t_2,t_1)|\psi_I{\rangle}},
\epsilonnd{eqnarray}
where $\psi_I(t',x')\epsilonquiv {\langle} x'|\hat{H}at{U}_{part}(t',t_1)|\psi_I{\rangle}$ and $\psi_F(t',x')\epsilonquiv {\langle} x'|\hat{H}at{U}_{part}^{\dagger}(t_2,t')|\psi_F{\rangle}$.
With the help of Eq.(\ref{xy6})
is easy to prove an identity
\begin{eqnarray}{\langle}bel{A10}
{\langle} \psi^{(m)}| \psi^{(n)}{\rangle} = \overline{\tau^n_\Omega}(\psi^{(m)},\psi_I) \overline{\tau^{m}_\Omega}^*(\psi^{(0)},\psi_I),
\epsilonnd{eqnarray}
which we will use in what follows.
\\ \nonumberewline
Finally, the Fourier transform (\ref{xy3}), relating $\hat{H}at{U}_{part}(t_2,t_1|\tau)$ to $\hat{H}at{U}_{part}(t_2,t_1|{{\langle}mbda })$, suggests that $\tau$ and ${{\langle}mbda }$ are,
in some sense, "conjugate variables". They must satisfy an uncertainty relation \cite{SBrouard}, so that a narrow amplitude distribution of $\tau$ would imply a broad range of ${{\langle}mbda }$'s, and vice versa.
Thus, in order to know the duration $\tau$ spent in $\Omega$, one must make the potential in $\Omega$ uncertain. Conversely, if the potential
is sharply defined, $\tau$ cannot, in general, be known exactly. For example, the choice $\hat{H}at{U}_{part}(t_2,t_1|\tau)=\hat{H}at{U}_{part}(t_2,t_1)\delta(\tau - \tau_0)$ makes in Eq.(\ref{xy3}) the effective range of integration over ${{\langle}mbda }$ infinite. Therefore an evolution for which $\tau$ is known exactly, must be represented as a sum of evolutions for all possible potentials ${{\langle}mbda }\text{T}_\Omheta_\Omega(x)$ added to $V(x,t)$. It also means that in order
to measure $\tau$, a meter would need to introduce at least some uncertainty in the potential in the region of interest.
This can be done by equipping the particle with a magnetic moment, proportional to its spin, or angular momentum,
so that each component of the spin would experience a different potential inside $\Omega$, where a constant magnetic field is introduced. There are various ways for preparing the spin degree of freedom, and we will discuss them next.
\hat{H}at{S}ection{The family of Larmor clocks}
Any spin-rotating (Larmor) quantum clock relies on the fact that a magnetic moment, proportional to a spin of a size $j$, undergoes in a magnetic field Larmor precession with an angular frequency $\omega_L$.
Let the field be directed along the $z$-axis, and $|m{\rangle}$ denote the state in which the projection of the spin on the axis is $m$, so that the spin's Hamiltonian is given by $\hat{H}_{spin}=\omega_L \hat{H}at{j}_z$, with $\hat{H}at{j}_z|m{\rangle}=m|m{\rangle}$.
Then, after a time $t$, an arbitrary $(2j+1)$-component initial spin state $|\gamma^I{\rangle} =\hat{H}at{S}um_{m=-j}^j\gamma_m^I |m{\rangle}$, will end up rotated around the $z$-axis by an angle $\omega_Lt$, $|\gamma^I{\rangle} \to |\gamma (t){\rangle}=\hat{H}at{S}um_{m=-j}^j\gamma_m^I \epsilonxp(-im\omega_Lt)|m{\rangle}$.
\\ \nonumberewline
If the magnetic field is introduced only in the region $\Omega$, and the spin is travelling with a classical particle which follows a trajectory $x_{cl}(t)$ for $t_1 \le t \le t_2$, the state rotates only while the particle remains inside $\Omega$. The final angle of rotation is
$\omega_L\tau_\Omega[x_{cl}(t)]$, and we have
\begin{eqnarray}{\langle}bel{c1}
|\gamma (t_2){\rangle}=\epsilonxp\{-i\omega_L\tau_\Omega[x_{cl}(t)]\hat{H}at{j}_z\}|\gamma^I{\rangle}.
\epsilonnd{eqnarray}
Generalisation to the case where the particle is quantum, rather than classical, is now straightforward. A transition between
$|\psi_I{\rangle}$ and $|\psi_F{\rangle}$ involves a range of durations, each occurring with the probability amplitude (\ref{b3}).
Hence, the final state of the spin is a superposition of all possible rotations weighted by the corresponding amplitudes,
\begin{eqnarray}{\langle}bel{c2}
|\gamma (t_2){\rangle}=\int_{0} ^{t_2-t_1} A(\psi_F, \psi_I, t_2,t_1|\tau) \\ \nonumber
\times \epsilonxp\{-i\omega_L\tau\hat{H}at{j}_z\}|\gamma^I{\rangle} d\tau.
\epsilonnd{eqnarray}
The amplitude to find the spin in some state $|\beta{\rangle} =\hat{H}at{S}um_{m=-j}^j\beta_m |m{\rangle}$ takes a particularly simple form \cite{QUINT},
\begin{eqnarray}{\langle}bel{c3}
{\langle} \beta |\gamma (t_2){\rangle}=\int_{0}^{t_2-t_1}G(\omega_L\tau|j,\beta,\gamma^I)
A(\psi_F, \psi_I, t_2,t_1|\tau)d\tau,\quad\quad
\epsilonnd{eqnarray}
where
\begin{eqnarray}{\langle}bel{c4}
G(\omega_L\tau|j,\beta,\gamma^I)\epsilonquiv {\langle} \beta|\epsilonxp(-i\omega_L\tau\hat{H}at{j}_z|\gamma^I{\rangle}\\ \nonumber
=\hat{H}at{S}um_{m=-j}^j \beta_m^*\gamma^I_m\epsilonxp(-im\omega_L\tau).
\epsilonnd{eqnarray}
Choosing orthonormal bases $|\beta^k{\rangle}$, $k=0,1,..2j$, and $|N{\rangle}$ to describe the spin and the particle \cite{FOOTbox}, respectively,
we easily reconstruct the state into which the system, initially described by the product $|\psi_I{\rangle}|\gamma^I{\rangle}$, evolves
by $t=t_2$,
\begin{eqnarray}{\langle}bel{c5}
|\Psi(t_2){\rangle}=\hat{H}at{S}um_N \hat{H}at{S}um_k \int_{0}^{t-t_1}
G(\omega_L\tau|j,\beta^k,\gamma^I)
\\ \nonumber\times
A(N, \psi_I, t_2,t_1|\tau)d\tau|\beta^k{\rangle}|N{\rangle}\quad\quad
\epsilonnd{eqnarray}
Expanding $G$ in a Taylor series around $\omega_L=0$, and using the operators of the previous Section, we can rewrite
this as
\begin{eqnarray}{\langle}bel{c5b}
{\langle} \beta^k|\Psi(t_2){\rangle}=
\hat{H}at{S}um_{n=0}^\infty\ref rac{(-i\omega_L)^n}{n!}{\langle} \beta^k|\hat{H}at{j}_z^n|\gamma^ I{\rangle}
\hat{H}at{U}_{part}^{(n)}(t_2,t_1)|\psi_I{\rangle}.\quad\quad
\epsilonnd{eqnarray}
We note that in the classical limit, where there is a single classical trajectory $x_{cl}(t)$, and a single classical duration
$\tau_{cl}=\tau_\Omega[x_{cl}]$, a Larmor clock ceases to affect the particle's motion, and is driven by it. Indeed, with $A(N, \psi_I, t_2,t_1|\tau)=A(N, \psi_I, t_2,t_1)\delta(\tau-\tau_{cl})$, from Eq.(\ref{c5}) we have
\begin{eqnarray}{\langle}bel{c5a}
|\Psi(t_2){\rangle}=
\epsilonxp(-i\omega_L \tau_{cl}\hat{H}at{j}_z)|\gamma^I{\rangle} \hat{H}at{U}_{part}(t_2,t_1)|\psi_I{\rangle}
\epsilonnd{eqnarray}
Transition to the classical limit is discussed, for example, in \cite{SBrouard}. In this limit $A(N, \psi_I, t_2,t_1|\tau)$ becomes highly oscillatory everywhere except in a small vicinity of $\tau=\tau_\Omega[x_{cl}(t)]\epsilonquiv \tau_{cl}$, making $A(N, \psi_I, t,t_1|\tau)$ tend to $A(N, \psi_I, t_2,t_1)\delta(\tau-\tau_{cl})$. This is the only case in which a uniquely defined traversal time can be ascribed to a quantum transition.
\\ \nonumberewline
Thus,we have a family of Larmor clocks, each defined by a particular choice of $\omega_L$, $j$, $|\beta^k{\rangle}$, and $|\gamma^I{\rangle}$.
\hat{H}at{S}ection{The Salecker-Wigner-Peres clock}
A particular choice due to Salecker and Wigner \cite{SWP1}, and also to Peres \cite{SWP3}, defines the Salecker-Wigner-Peres clock.
After the measurement, the spin is to be observed in one of the orthogonal states, obtained from its initial state,
\begin{eqnarray}{\langle}bel{d1}
|\gamma^I{\rangle} = |\beta^0{\rangle}= (2j+1)^{-1/2}\hat{H}at{S}um_{m=-j}^j|m{\rangle},
\epsilonnd{eqnarray}
by rotation through one of the angles $\phi_k=2\pi k/(2j+1)$, $k=0,1,...,2j$,
\begin{eqnarray}{\langle}bel{d2}
|\beta^k{\rangle} = \epsilonxp(-i\hat{H}at{j}_z\phi_k)|\beta^0{\rangle}=\hat{H}at{S}um_{m=-j}^j\ref rac{\epsilonxp(-im\phi_k)}{(2j+1)^{-1/2}}|m{\rangle}.\quad \\ \nonumber
\epsilonnd{eqnarray}
The function $G$ in Eq.(\ref{c4}) is, therefore, given by \cite{QUINT}, \cite{SBrouard}
\begin{eqnarray}{\langle}bel{d2a}
G_{SWP}(\omega_L\tau|j,\beta^k,\beta^0)=(2j+1)^{-1}\times\\ \nonumber
\ref rac{\hat{H}at{S}in[(2j+1)(\phi_k-\omega_L\tau)/2]}{\hat{H}at{S}in[(\phi_k-\omega_L\tau)/2]}.
\epsilonnd{eqnarray}
A particle may be observed (post-selected) in a particular sub-space $\mathfrak{N} $ of its Hilbert space,
specified by a projector
\begin{eqnarray}{\langle}bel{d3}
\PP(\mathfrak{N} ) = \hat{H}at{S}um_{N \in \mathfrak{N} }|N{\rangle}{\langle} N|.
\epsilonnd{eqnarray}
The options range from detecting the particle in a single final state $|N_0{\rangle}$ of the chosen basis, $\PP(\mathfrak{N} ) = |N_0{\rangle}{\langle} N_0|$,
to being completely ignorant of its final state, thus choosing $\PP(\mathfrak{N} ) =1$. In all cases, the measured time is {\it defined} as the average
of the times corresponding to rotations by the angles $\phi_k$, $\tau_k=\phi_k/\omega_L$, weighed by the probabilities, $P(k,\mathfrak{N} )$,
for finding the spin in the rotated state,
\begin{eqnarray}{\langle}bel{d4}
\text{T}_\Om(\mathfrak{N} ,\psi_I)\epsilonquiv \hat{H}at{S}um_{k=0}^{2j}\tau_k P(k,\mathfrak{N} )= \hat{H}at{S}um_{k=1}^{2j}\ref rac{2\pi k}{(2j+1)\omega_L} P(k,\mathfrak{N} ),\quad\quad\quad
\epsilonnd{eqnarray}
where
\begin{eqnarray}{\langle}bel{d5}
P(k,\mathfrak{N} )=\ref rac{{\langle} \Psi(t_2)|\beta^k{\rangle}{\langle} \beta^k|\PP(\mathfrak{N} )|\Psi(t_2){\rangle}}{{\langle} \Psi(t_2)|\PP(\mathfrak{N} )|\Psi(t_2){\rangle}},
\epsilonnd{eqnarray}
with $|\Psi(t_2){\rangle}$ given by Eq.(\ref{c5}).
\\ \nonumberewline
The rational behind Eqs.(\ref{d4}) and (\ref{d5}) is simple. After a time $t$, the hand of a classical clock rotates by
a well defined angle, and points at the hour. The final position of a quantum state, which replaces the classical hand, appears
to be distributed, pointing at different "hours" with different probabilities. Equation (\ref{d4}) represents the "mean time"
measured in this way, and associated with the passage of the particle from the state $|\psi_I{\rangle}$ to anywhere in the part of its Hilbert space denoted as $\mathfrak{N} $.
\\ \nonumberewline
There are at least three remarks to be made. Firstly, finding the clock in a state $|\beta^k{\rangle}$, rotated by $\phi_k$, by no means guarantees that the particle has indeed spent a duration $\phi_k/\omega_L$ in $\Omega$. Unless $G$ in Eq.(\ref{d2a}) is proportional to
$\delta(\tau-\phi_l/\omega_L)$, various durations $\tau$ continue to interfere,
and the precise time the particle spends in $\Omega$ remains, in general, indeterminate.
\\ \nonumberewline
Secondly, if we are not interested in the final state of the particle, $\PP(\mathfrak{N} )=1$, $\text{T}_\Om(all,\psi_I)$ can be written as an expectation value of an operator $\hat{H}at{T}_\Omega=\hat{H}at{S}um_{k=0}^{2j}|\beta^k{\rangle} \tau_k{\langle} \beta^k|$,
\begin{eqnarray}{\langle}bel{d4a}
\text{T}_\Om(\text{all},\psi_I)={\langle} \Psi(t_2)|\hat{H}at{T}_\Omega|\Psi(t_2){\rangle}.\quad
\epsilonnd{eqnarray}
It is tempting to conclude that $\hat{H}at{T}_\Omega$ represents the "traversal time operator", and that with it the "time problem" has been brought into the framework of standard quantum mechanics. This is not quite so, since in quantum measurements the measured operator
acts on the variables of the studied system, whereas $\hat{H}at{T}_\Omega$ acts on the variable of the clock.
\\ \nonumberewline
Finally, being coupled to the clock perturbs the particle's motion, and whatever information is obtained, no longer refers
to the particle "on its own". The obvious way out of this last difficulty is to try to reduce the coupling as much as it is possible.
In the next Section we will show that this would inevitably lead to "complex times", whose appearance we have already anticipated in Sect. V.
\hat{H}at{S}ection{A non-perturbing (weak) SWP clock}
We still need to specify the values of $\omegaega_L$ and $j$, which determine the accuracy of the measurement.
In \cite{QUINT} it was shown that if $j\to \infty$ while $\omega_L$ is kept finite, the function $G(\omega_L \tau|j,\beta^k,\beta^0)$ in Eq.(\ref{c4}) becomes proportional to $\delta(\tau-\tau_k)$, so that the spin can be found in $|\beta_k{\rangle}$ if, and only if, the particle has actually spent in $\Omega$ a duration $\tau$. This is a very accurate measurement, and $P(k,\mathfrak{N} )$ in Eq.(\ref{d4}) becomes also the {\it probability}
with which a duration $\tau$ would occur. But, as Eq.(\ref{b4}) demonstrates, by gaining in accuracy we destroyed the original transition, and will have learnt very little about the duration spent in $\Omega$ with the interference intact.
\\ \nonumberewline
To pin down this elusive duration we may try to keep $j$ finite, while making the magnetic field, and with it $\omega_L$, very small.
This will reduce the perturbation which affects the particle's motion. Indeed,
and as $\omega_L \to 0$, from Eq.(\ref{c5b})
we have
\begin{eqnarray}{\langle}bel{c3a}
{\langle} \beta^k |\Psi(t_2){\rangle}\approx{\langle} \beta^k|\beta^0{\rangle} \hat{H}at{U}_{part}(t_2,t_1)|\psi_I{\rangle}\\ \nonumber
=\delta_{k0}\hat{H}at{U}_{part}(t_2,t_1)|\psi_I{\rangle}. \quad
\epsilonnd{eqnarray}
The particle moves unimpeded, the spin does not rotate, and the clock provides no information at all.
\\ \nonumberewline
We need to find the first correction to this result.
Truncating the expansion (\ref{c5b}) after the terms linear in $\omega_L$, and inserting the result into Eq.(\ref{d4}) yields
\begin{eqnarray}{\langle}bel{d9}
\text{T}_\Om(\mathfrak{N} ,\psi_I) = \omega_L Q(j)\mathcal{T}_{SWP}^2 (\mathfrak{N} ,\Omega,\psi_I)+O(\omega_L^2),
\epsilonnd{eqnarray}
with
\begin{eqnarray}{\langle}bel{d99a}
Q(j)\epsilonquiv \hat{H}at{S}um_{k=0}^{2j}\phi_k|{\langle} \beta^k| \hat{H}at{j}_z|\beta_0{\rangle} |^2.\quad\quad
\epsilonnd{eqnarray}
In Eq.(\ref{d9}), the new time parameter $\mathcal{T}_{SWP}(\mathfrak{N} ,\Omega,\psi_I)$, called the { \it SWP time} until a better name is found,
is given by \cite{FOOTswp}
\begin{eqnarray}{\langle}bel{d10}
\mathcal{T}_{SWP}^2(\mathfrak{N} ,\Omega,\psi_I) =W(\mathfrak{N} ,\psi_I)^{-1}\times \\ \nonumber
\hat{H}at{S}um_{N \in \mathfrak{N} } W(N,\psi_I) |\ttau(N,\psi_I)|^2,\quad\quad
\epsilonnd{eqnarray}
where
\begin{eqnarray}{\langle}bel{d10a}
W(N,\psi_I)\epsilonquiv |{\langle} N|\hat{H}at{U}_{part}(t_2,t_1)|\psi_I{\rangle}|^2
\epsilonnd{eqnarray}
is the probability for the particle to be found in $|N{\rangle}$ in
the absence of the clock, and
\begin{eqnarray}{\langle}bel{d10aa}
W(\mathfrak{N} ,\psi_I)\epsilonquiv \hat{H}at{S}um_{N \in \mathfrak{N} }W(N,\psi_I)
\epsilonnd{eqnarray}
is this probability for the whole of the chosen subspace $\mathfrak{N} $.
\\ \nonumberewline
Equation (\ref{d10}) is the central result of our discussion so far. In its l.h.s., we have an average, obtained for an ensemble weakly coupled SWP clocks, which is the observed result of the measurement.
In the r.h.s., the only quantity describing the particle is $\mathcal{T}_{SWP}(\mathfrak{N} ,\psi_I)$. It is given by the weighted sum of the squared moduli of the complex times defined in (\ref{b5}), evaluated for the transitions into all orthogonal states spanning the chosen subspace $\mathfrak{N} $ of the particle's Hilbert space. This is an illustration of the general principle discussed in Sect. V: in a weakly perturbing inaccurate measurement the system is always represented by combinations of the relevant probability amplitudes,
given in this case by $\overline{\tau}_{\Omega}(N,\psi_F)$ of Eq.(\ref{b5}).
\\ \nonumberewline
We note also that the squares of the SWP times, rather than the SWP times themselves, are additive.
For two disjoint subspaces $\mathfrak{N} $ and $\mathfrak{N} '$, $\PP(\mathfrak{N} )\PP(\mathfrak{N} ')=0$, equation (\ref{d4}) gives
\begin{eqnarray}{\langle}bel{d11}
\mathcal{T}_{SWP}^2(\mathfrak{N} \cup \mathfrak{N} ',\Omega,\psi_I)=[W(\mathfrak{N} ,\psi_I)+W(\mathfrak{N} ',\psi_I)]^{-1}\times\quad\quad\\ \nonumber
[W(\mathfrak{N} ,\psi_I)\mathcal{T}_{SWP}^2(\mathfrak{N} ,\Omega,\psi_I)+W(\mathfrak{N} ',\psi_I)\mathcal{T}_{SWP}^2(\mathfrak{N} ',\Omega,\psi_I).
\epsilonnd{eqnarray}
Next we look at the SWP times from a slightly different prospective.
\hat{H}at{S}ection{Calibration and the Uncertainty Principle}
A perhaps less direct way to arrive at the SWP time $\mathcal{T}_{SWP}(\mathfrak{N} ,\Omega,\psi_I)$ is to calibrate SWP clock by using a procedure similar to the one proposed by Leavens in \cite{Leav1}. Consider first introducing a magnetic field everywhere in space, rather than just inside $\Omega$.
Now all Feynman paths spend in the field the same duration $\tau=t_2-t_1$,
we have $A(\psi_F, \psi_I, t_2,t_1|\tau)=A(\psi_F, \psi_I, t_2,t_1) \delta(\tau-t_2+t_1)$ for all $|\psi_I{\rangle}$ and $|\psi_F{\rangle}$,
and the clock decouples from the particle's motion. Thus, in the limit $\omega_L\to 0$ this "free running" clock would measure
[cf. Eq.(\ref{d9})]
\begin{eqnarray}{\langle}bel{dz1}
{\text{T}_\Omf}^{free}(t_2-t_1) = \omega_L Q(j)(t_2-t_1)^2.
\epsilonnd{eqnarray}
Next, let us measure $\text{T}_\Om(\mathfrak{N} ,\psi_I)$ in the case where the magnetic field exists only inside $\Omega$. Let us also assume that there is some hypothetical
duration $\tau_{"in \Omega"}$ which the particle spends in $\Omega$, and during which the spin rotates. If so, the resulting value
of $\text{T}_\Om(\mathfrak{N} ,\psi_I)$ should be the same as ${\text{T}_\Omf}^{free}(\tau_{"in \Omega"})$, obtained for a spin that has been in free rotation for $\tau_{"in \Omega"}$ seconds. Equating $\text{T}_\Om(\mathfrak{N} ,\psi_I)$ in Eq.(\ref{d9}) to ${\text{T}_\Omf}^{free}(\tau_{"in \Omega"})$ shows that we must identify
the sought $\tau_{"in \Omega"}$ with the SWP time,
\begin{eqnarray}{\langle}bel{dz2}
\tau_{"in \Omega"}=\mathcal{T}_{SWP}(\mathfrak{N} ,\Omega,\psi_I).
\epsilonnd{eqnarray}
This may seem reasonable, since $\mathcal{T}_{SWP}(\mathfrak{N} ,\Omega,\psi_I)$ is a real valued positive quantity, yet there is a serious concern.
Apparently, we {\it impose} a single duration while, according to Sect. V, there shouldn't be one. It ought to be prudent to make further checks.
\\ \nonumberewline
First we consider a classical case, where the magnetic field is confined to $\Omega$, and the single path which connects $|\psi_F{\rangle}$ with $|\psi_I{\rangle}$, spends $\tau_{cl}$ seconds in $\Omega$. Clearly,
$A(\psi_F, \psi_I, t_2,t_1|\tau)=A(\psi_F, \psi_I, t_2,t_1) \delta(\tau-\tau_{cl})$, and we obtain the correct result
\begin{eqnarray}{\langle}bel{dz3}
\tau_{"in \Omega"}=\tau_{cl}.
\epsilonnd{eqnarray}
The problems begin once quantum interference starts to play a role.
To see it, suppose that there are exactly two virtual paths, via which $|\psi_F{\rangle}$ can be reached from $|\psi_I{\rangle}$ (perhaps in a situation similar to the one shown in Fig.1, or in a setup where the particle's wave packet is split into two parts, which pass via different optical fibres, and are later recombined). The paths spend in $\Omega$ $\tau_1$ and $\tau_2$ seconds, and have the probability amplitudes $A_1$ and $A_2$, respectively. How much time does the particle spend in $\Omega$?
Before proceeding, we recall the Uncertainty Principle, already outlined in Sect. IV. Interference merges the two virtual paths into a single
route connecting the particle's initial and final states. The duration spent in $\Omega$ is, therefore, truly indeterminate \cite{FUNC2}. It is not $\tau_1$ or $\tau_2$, nor any other similar duration. It should not exist.
\\ \nonumberewline
Noting that now $A(\psi_F, \psi_I, t_2,t_1|\tau)=A_1 \delta(\tau-\tau_1)+A_2 \delta(\tau-\tau_2)$, [in the situation shown in Fig.1, the amplitude $A(x_F, x_I, t_2,t_1|\tau)$ has two stationary regions around $\tau_1$ and $\tau_2$, and is highly oscillatory elsewhere],
and using (\ref{dz2}) we find
\begin{eqnarray}{\langle}bel{dz4}
\tau_{"in \Omega"}=
\left | \ref rac{A_1\tau_1+A_2\tau_2}{A_1+A_2}\right |
\epsilonnd{eqnarray}
There are no {\it a priori} restrictions on the magnitude or the sigh of the ratio $A_2/A_1$. Suppose the transition takes three seconds, $t_2-t_1=3$, and the paths spend in $\Omega$ $1$ and $2$ seconds, respectively. Choosing $A_1=0.5$ and
$A_2= -A_1+0.001$ we find
\begin{eqnarray}{\langle}bel{i5}
\tau_{"in \Omega"}=4998\text{s} >> t_2-t_1=3\text{s},
\epsilonnd{eqnarray}
which is strange.
Further, choosing $A_1=0.5$ and $A_2=-0.25$, yields
\begin{eqnarray}{\langle}bel{dz6}
\tau_{"in \Omega"}=0,
\epsilonnd{eqnarray}
which is also strange, especially if $|\psi_I{\rangle}$ and $|\psi_F{\rangle}$ are, as in Fig.1, localised on the opposite sides
of the region $\Omega$, which the particle, therefore, has to cross.
\hat{H}at{S}ection{Complex times and the "weak measurements"}
Both experiments described at the end of the previous Section, can be performed, at least in principle. We must, therefore, decide on an interpretation of the results (\ref{i5}) and (\ref{dz6}).
There are two possibilities. Either, (A), the $\tau_{"in \Omega"}$ represents a physical duration, and has further implications
for our understanding of quantum motion.
Or, (B), it is something else, in which case we need to explain what it is precisely. Next we look at both options.
A. The first option may appear either absurd \cite{Bohm} or intriguing, depending on the reader's viewpoint.
Indeed, should the $4998\text{s}$ in Eq.(\ref{i5}) be "physical", we must conclude that
quantum mechanics allows a particle "to spend more than an hour in some place during a journey that last only three seconds".
By taking the $0\text{s}$ result in Eq.(\ref{i5}) literally, we defy Einstein's relativity by letting the particle "cross the region infinitely fast".
\\ \nonumberewline
Both conclusions are reminiscent of other "surprising" results obtained within the so-called "weak measurements"
approach \cite{WEAK11}.
Among these one encounters the notions of "negative kinetic energy" \cite{NKE}, "negative number of particles" \cite{AhHARDY}, "having one particle in several places simultaneously" \cite{AhBOOK}, a "photon disembodied from its polarisation" \cite{CAT},
an "electron with disembodied charge and mass" \cite{CAT}, "an atom with the internal energy disembodied from the mass" \cite{CAT}, and "photons found in places they neither enter or leave" \cite{v2013}, \cite{vPRL}.
Perhaps closest to the subject of this paper is the concept of "charged particles moving faster than light through the vacuum", introduced in \cite{Cher}. In all these examples, the analysis relies on obtaining the "weak value" ${\langle} \hat{H}at{B} {\rangle}_w$, of an operator $\hat{H}at{B}=\hat{H}at{S}um_i |b_i{\rangle} B_i{\langle} b_i|$,
defined for a system prepared (pre-selected) in a state $|\psi_I{\rangle}$ and then found (post-selected) in a state $|\psi_F{\rangle}$,
\begin{eqnarray}{\langle}bel{wm1}
{\langle} \hat{H}at{B} {\rangle}_w=\ref rac{{\langle} \psi_F|\hat{H}at{B}|\psi_I{\rangle}}{{\langle} \psi_F|\psi_I{\rangle}}.
\epsilonnd{eqnarray}
The conclusions of Refs. \cite{NKE}-\cite{Cher}, mentioned above, are then drawn from the properties of the complex valued quantity ${\langle} \hat{H}at{B} {\rangle}_w$.
B. Another explanation available to us is more down to earth (see also \cite{FUNC2}, \cite{PLA2016}, \cite{PLA2015}, \cite{PLAvaid}).
The results (\ref{i5}) and (\ref{dz6}) may simply illustrate the Uncertainty Principle (above) by showing that it is impossible to ascribe
a meaningful duration to a situation where two or more durations interfere to produce the result.
Response of a quantum system to an attempt to measure the traversal time without perturbing the system's motion results in evaluation
of the sum of the probability amplitudes (\ref{b3}), which can, in principle, take any value at all.
The weak value (\ref{wm1}) is another illustration of this general principle. Indeed, the final state $|\psi_F{\rangle}$ can be reached
via passing through the eigenstates $|b_i{\rangle}$, and the amplitude for the $i$-th virtual path is $A(i,\psi_f,\psi_i)={\langle} \psi_F|b_i{\rangle}{\langle} b_i|\psi_I{\rangle}$.
Thus, Eq.(\ref{wm1}) can be cast in the form similar to (\ref{b5})
\begin{eqnarray}{\langle}bel{wm1a}
{\langle} \hat{H}at{B} {\rangle}_w=\hat{H}at{S}um_{paths}B_iA(i,\psi_I,\psi_F)/\hat{H}at{S}um_{paths}A(i,\psi_I,\psi_F).
\epsilonnd{eqnarray}
where the eigenvalues of $\hat{H}at{B}$ on the routes $|\psi_F{\rangle} \gets |b_i{\rangle} \gets |\psi_I{\rangle}$, $B_i$, replace the values of $\tau_\Omega[x(t)]$ on the virtual Feynman paths.
We could call the complex time (\ref{b5}) "the weak value of the traversal time functional",
bearing in mind that it is {\it just} a particular combination of the probability amplitudes $A(\psi_F,\psi_I,t_2, t_1|\tau)$.
No other interpretation of the complex times should be possible, as the Uncertainty Principle does not allow to view probability amplitudes, or their combinations, as the actual values of a physical quantity \cite{FUNC2}.
\\ \nonumberewline
We strongly advocate the second explanation.
Indeed, there is nothing strange about the result (\ref{dz4}) itself, and the only thing at fault is our desire to impose, through the calibration procedure, a single physical duration $|\ttau|$ where there shouldn't be one.
Not surprisingly, the result is unsatisfactory.
Accordingly, with Eq.(\ref{i5}), the clock has not "aged" by more than an hour in a span of three seconds. Its final state $|\gamma(t){\rangle}$ is a superposition of the states $|\gamma(t|\tau_1){\rangle}$ and $|\gamma(t|\tau_2){\rangle}$, rotated by the angles $\omega_L \tau_1$ and
$\omega_L \tau_2$, respectively. It is certainly not equal to $|\gamma(t|\tau_{"in \Omega"}){\rangle}$, and cannot, in general, be obtained by a rotation through {\it any} angle $\omegaega_L \tau_{X}$,
\begin{eqnarray}{\langle}bel{i6}
A_1|\gamma(t|\tau_1){\rangle} + A_2|\gamma(t|\tau_2){\rangle} \\ \nonumbere const |\gamma(t|\tau_X){\rangle},
\epsilonnd{eqnarray}
since higher orders in $\omega_L$ would involve quantities $\overline{\tau^n_\Omega}$ in Eq.(\ref{xy5}),
and $\overline{\tau^n_\Omega}\\ \nonumbere (\ttau)^n$.
\\ \nonumberewline
We must conclude that the calibration of a weak SWP clock fails to define a meaningful traversal time for a quantum particle.
This is in agreement with the Uncertainty Principle.
\begin{figure}
\centering
\includegraphics[width=8.5cm,height=5.5cm]{{FIG1.pdf}}
\caption{(Color online) A semiclassical particle can reach the final state $|x_F{\rangle}$ from $|x_I{\rangle}$ directly, and by having been reflected off a wall at $x=0$. The particle is heavy, so there are two "classical" trajectories trajectories, which minimise the
action $S$ in Eq.(\ref{b1}). The trajectories interfere, and
are travelled with the amplitudes $A_2$ and $A_1$, spending in the region $\Omega$ $\tau_2$ $\tau_1$ and $\tau_2$ seconds, respectively. All in all, how much time does the particle spend in $\Omega$? This is the "which way?" question at the centre of the traversal time controversy. }
{\langle}bel{fig:1}
\epsilonnd{figure}
\hat{H}at{S}ection{The dwell time}
Despite the difficulties outlined in the previous Section, much of the discussion about tunnelling times continues to be built around a tacit assumption that a single classical-like duration, which characterises a classically forbidden transition, exists and simply has not yet been found \cite{LansREV}.
One candidate for the role of this parameter is the {\it dwell time}, a special case of the complex time (\ref{b5}), evaluated for the final state
$|\psi_F{\rangle}$ obtained by unperturbed evolution of the initial state $|\psi_I{\rangle}$,
\begin{eqnarray}{\langle}bel{ga1a}
\tau^{dwell}_\Omega(\psi_I) \epsilonquiv \ttau(\hat{H}at{U}_{part}(t_2,t_1)\psi_I,\psi_I).
\epsilonnd{eqnarray}
It can be written is several different ways. Expanding $|\hat{H}at{U}_{part}(t_2,t_1)\psi_I{\rangle}$ is some basis $|N{\rangle}$, we can express $\tau^{dwell}_\Omega$
in a form similar to Eq.(\ref{d10}),
\begin{eqnarray}{\langle}bel{ga2}
\tau^{dwell}_\Omega(\psi_I)=\hat{H}at{S}um_{N} W(N,\psi_I) \ttau(N,\psi_I).\quad\quad
\epsilonnd{eqnarray}
In the operator notations of Sect. VI, the dwell time becomes
\begin{eqnarray}{\langle}bel{ga2a}
\tau^{dwell}_\Omega(\psi_I)={\langle} \psi_I|\hat{H}at{U}_{part}^\dagger(t_2,t_1)\hat{H}at{U}_{part}^{(1)}(t_2,t_1)|\psi_I{\rangle},
\epsilonnd{eqnarray}
and using Eq.(\ref{xy9}) yields a derived result, often mistaken for the definition of $\tau^{dwell}_\Omega(\psi_I)$,
\cite{Buett2, DSB,Leav1, Leav2},
\begin{eqnarray}{\langle}bel{ga3}
\tau^{dwell}_\Omega = \int_{t_1}^{t_2} dt'\int_{\Omega}dx |\psi_I(x,t')|^2.
\epsilonnd{eqnarray}
\\ \nonumberewline
The dwell time possesses several attractive properties.
Firstly, like its classical counterpart, it is non-negative, and never exceeds the total duration of motion, $\tau^{dwell}_\Omega \le t_2-t_1$, thus avoiding the problems encountered in the previous Section.
Secondly, written as in Eq.(\ref{ga3}), it appears to have a simple probabilistic structure, with the contribution from the interval $dt'$ proportional
to the probability to find the particle in $\Omega$. Thirdly, the same expression arises in approaches as different as the Bohm trajectories method \cite{Leav3}, and the Feynman path approach considered here.
Before accepting $\tau^{dwell}_\Omega$ as the long sought classical-like duration, we note
that certain questions about it remain unanswered. The interference between different durations, which contribute to the transition, remains intact, and the conflict with Uncertainty Principle continues unresolved. Also, the said properties do not extend to the individual terms
$\ttau(N,\psi_I)$ in Eq.(\ref{ga2}), which remain complex-valued, and should not be confused with meaningful durations, as was shown in the previous Section. Finally, it may be that, for some unknown reason, a classical-like duration can only be defined for a quantum system, which
follows uninterrupted evolution along its "orbit" in the Hilbert space, $|\psi(t){\rangle}=\hat{H}at{U}_{part}(t,t_1)|\psi_i{\rangle}$.
But then, to be a true analogue of the classical traversal time, $\tau^{dwell}_\Omega(\psi_I)$ should arise whenever a time measurement perturbs the particle only slightly, and no post-selection is performed on the particle in the end. Should it not be so, the appealing form of Eq.(\ref{ga3}) would be fortuitous, and have no further physical consequences. We will test this last assumption next.
\hat{H}at{S}ection{Would the SWP clock measure the dwell time?}
An example at hand is the SWP clock in the $\omega_L \to 0$ regime. Suppose we run an ensemble of clocks between $t_1$ and $t_2$
without controlling the particle's final state, evaluate the average $\mathcal{T}_{SWP}(all,\psi_I)$ by choosing $\mathfrak{N} $ to coincide with all of the particle's Hilbert space, and use the calibration procedure of Sect. X.
Will the result coincide with the dwell time (\ref{ga3}) as was assumed in \cite{SWP2}?
The question was studied also in \cite{Leav1}.
\\ \nonumberewline
The answer is yes, provided the system evolves along single classical path. We have already shown
[see Eq.(\ref{dz3})] that
the SWP time coincides with the $\tau_{cl}$, evaluated for this path. With an (almost) classical particle represented by a
very narrow wave packet crossing the region $\Omega$, the equality $\tau^{dwell}_\Omega=\tau_{cl}$ follows directly from the "stopwatch expression" (\ref{ga3}). Thus, $\tau_{cl}$ is the unique duration which arises from both approaches in the classical limit.
\\ \nonumberewline
However, in the full quantum case, the answer is no. From Eq.(\ref{d10}) we have
\begin{eqnarray}{\langle}bel{gc1}
\mathcal{T}_{SWP}(all,\Omega,\psi_I) =
{\langle} \psi_I|\hat{H}at{U}_{part}^{(1)\dagger}(t_2,t_1)|\hat{H}at{U}_{part}^{(1)}(t_2,t_1)|\psi_I{\rangle}^{1/2},\quad\quad
\epsilonnd{eqnarray}
and the application of (\ref{A10}) yields
\begin{eqnarray}{\langle}bel{h3}
\mathcal{T}_{SWP}(all,\Omega,\psi_I)
=\hat{H}at{S}qrt{\tau^{dwell}_\Omega(\psi_I) \times \ttau(\psi^{(1)}(t_2),\psi_I)}\quad
\epsilonnd{eqnarray}
which, in general, is not the same as
$\tau^{dwell}_\Omega(\psi_I)$.
\\ \nonumberewline
It is easy to see the reason for this discrepancy. According to Eq.(\ref{ga2a}) the dwell time must involve the product $\hat{H}at{U}_{part}^\dagger(t_2,t_1)\hat{H}at{U}_{part}^{(1)}(t_2,t_1)$,
and could only appear
in the linear in $\omega_L$ corrections to $P(k,\text{all})$ in Eq.(\ref{d5}). But with the choice of the states $|\beta^k{\rangle}$ in Eq.(\ref{d2}), all such corrections vanish,
for $k\\ \nonumbere 0$ because ${\langle} \beta^k|\beta^0{\rangle}=0$, and for $k=0$ since ${\langle} \beta^0|\hat{H}at{j}_z|\beta^0{\rangle}=0$.
Neither would $\tau^{dwell}_\Omega(\psi_I)$ appear in the higher order corrections to $P(k,\text{all})$, since none of these corrections contain the required term $\hat{H}at{U}_{part}^\dagger(t_2,t_1)$.
In general, the dwell time plays no role in the analysis of the SWP clock, as defined in Sect. VIII. However, in some special cases, $\mathcal{T}_{SWP}(all,\Omega,\psi_I)$ may
accidentally reduce to $\tau^{dwell}_\Omega(\psi_I)$, as we will show in the next Section.
\hat{H}at{S}ection{Stationary tunnelling and the Leavens' analysis}
All that was said above applies to tunnelling of a particle prepared in a wave packet state, shown in the diagram in Fig.2.
The particle's initial state at $t=t_1$ is a superposition of the plane waves with positive momenta $p>0$,
\begin{eqnarray}{\langle}bel{e1}
\psi_I(x)={\langle} x | \psi_I{\rangle}=\int_0^\infty A(p)\epsilonxp(ipx) dp,
\epsilonnd{eqnarray}
located to the left of a barrier of a finite width, $V(x)$, occupying the region $[0,d]$. The wave packet moves towards the barrier, and the energies $E(p)=p^2/2\mu$ are chosen all to lie below the barrier height, so that in order to be transmitted the particle has to tunnel.
At a sufficiently large time $t_2$, the scattering is complete, and the wave packet is divided into the transmitted (T), $\psi^T(x,t_2)$,
and reflected (R), $\psi^R(x,t_2)$, parts,
\begin{eqnarray}{\langle}bel{e2a}\\ \nonumberonumber
{\langle} x |\psi(t_2){\rangle}\epsilonquiv{\langle} x|\hat{H}at{U}_{part}(t_2-t_1)|\psi_I{\rangle}=\quad\quad\quad\quad\quad\quad\\ \nonumber
\psi_T(x,t_2)+\psi_R(x,t_2)=\quad\quad\quad\quad\quad\quad\\ \nonumber
(2\pi)^{-1/2}\int_0^\infty dp T(p)A(p)\epsilonxp[px-iE(t_2-t_1)]+\quad\quad\\
(2\pi)^{-1/2}\int_0^\infty dp R(p)A(p)\epsilonxp[-ipx-iE(t_2-t_1)],\quad\quad
\epsilonnd{eqnarray}
where $T(p)$ and $R(p)$ are the transmission and reflection amplitudes, respectively.
\\ \nonumberewline
We are interested in the duration spent in the barrier region, and choose $\Omega\epsilonquiv [0,d]$.
In the limit $t_{1,2} \to \mp \infty$, matrix elements of the operators in Sect. VI between the plane waves $|p{\rangle}$,
${\langle} x|p{\rangle}=exp(ipx)$, are given by ($n=0,1,2,...$)
\begin{eqnarray}{\langle}bel{e3}
{\langle} p'|\hat{H}at{U}_{part}^{(n)}(t_2-t_1)|p{\rangle} =\quad\quad\quad\quad\quad\quad\quad\quad\quad\\ \nonumber
i^n\epsilonxp[-iE(p)(t_2-t_1)] \partial_{\langle}mbda^nT(p,{\langle}mbda=0) \delta(p-p'),\\ \nonumber
\quad\text{for}\quad p>0\quad \text{and}\quad p'>0,\\ \nonumber
\text{and}\\ \nonumbern
i^n\epsilonxp[-iE(p)(t_2-t_1)] \partial_{\langle}mbda^nR(p,{\langle}mbda=0) \delta(|p|-|p'|),\\ \nonumber
\quad\text{for}\quad p>0\quad \text{and}\quad p'<0,
\epsilonnd{eqnarray}
where $T(R)(p,{\langle}mbda)$ denote the transmission (reflection) amplitudes for a composite barrier $V(x)+{\langle}mbda\text{T}_\Omheta_{[0,d]}(x)$.
From Eq.(\ref{xy6}), for the complex tunnelling and reflection times of a particle with an initial momentum $p$ we have
\begin{eqnarray}{\langle}bel{e4}
\tttu(p,p) = i\partial_{\langle}mbda \ln T(p,{\langle}mbda=0),
\epsilonnd{eqnarray}
and
\begin{eqnarray}{\langle}bel{e5}
\tttu(-p,p) = i\partial_{\langle}mbda \ln R(p,{\langle}mbda=0).
\epsilonnd{eqnarray}
In the following we will be interested only in whether the particle is transmitted, or reflected, and employ the projectors $\PP(\text{tunn})=\int_{0}^\infty |p{\rangle}{\langle} p|$ and $\PP(\text{refl})=\int_{-\infty}^0 |p{\rangle}{\langle} p|$, on all positive and all negative momenta, to distinguish between the two outcomes.
\\ \nonumberewline
Suppose next that a weak SWP clock is used to measure the time the particle spends in $\Omega$.
To obtain the SWP time for transmission,
we replace in Eq.(\ref{d10}) summation over $N$ by integration over $p$, and $\PP(\mathfrak{N} )$ with $\PP(\text{tunn})$. We find
\begin{eqnarray}{\langle}bel{e2}
\mathcal{T}_{SWP}(\text{tunn},[0,d],\Psi_I)=\\ \nonumbern
W(\text{tunn})^{-1/2}\left [\int_{0}^\infty dp |T(p)|^2 |A(p)|^2 |\tttu (p,p)|^2\right ]^{1/2},
\epsilonnd{eqnarray}
and similarly for reflection,
\begin{eqnarray}{\langle}bel{e7}
\mathcal{T}_{SWP}(\text{refl},[0,d],\Psi_I)=\\ \nonumbern
W(\text{refl})^{-1/2}\left [ \int_{0}^\infty dp |R(p)|^2 |A(p)|^2 |\tttu(-p,p)|^2\right ]^{1/2},
\epsilonnd{eqnarray}
where $W(\text{tunn})\epsilonquiv\int_{0}^\infty|T(p)|^2 |A(p)|^2 dp $ and $W(\text{refl})\epsilonquiv\int_{0}^\infty |R(p)|^2 |A(p)|^2 dp $,
are the tunnelling and reflection probabilities, respectively. Finally, if we do not care whether the particle is transmitted or reflected,
from Eqs.(\ref{d10}) and (\ref{e3}) we find the calibrated SWP result, without post-selection, to be
\begin{eqnarray}{\langle}bel{e8}
\mathcal{T}_{SWP}(\text{all},[0,d],\Psi_I)=\\ \nonumbern
\left \{\int_{0}^\infty dp |A(p)|^2[|\partial_{\langle}mbda T(p,{\langle}mbda=0)|^2
+ |\partial_{\langle}mbda R(p,{\langle}mbda=0)|^2]\right \}^{1/2}
\epsilonnd{eqnarray}
Returning to the question of the previous Section, we may want to compare this with the dwell time which, according to Eqs.(\ref{ga2}), (\ref{e4}) and (\ref{e5}), is given by
\begin{eqnarray}{\langle}bel{e9}
\tau^{dwell}_{[0,d]}(\psi_I)=\\ \nonumbern
i\int_{0}^\infty |A(p)|^2[T^*(p)\partial_{\langle}mbda T(p,{\langle}mbda=0)
+ R^*(p)\partial_{\langle}mbda R(p,{\langle}mbda=0)]dp
\epsilonnd{eqnarray}
As expected, the SWP result in Eq.(\ref{e8}) is different from the dwell time in (\ref{e9}).
Leavens \cite{Leav1} studied, mostly numerically, the case where the incident particle has a definite momentum $p_0$.
To arrive at his results from Eqs.(\ref{e8}) and (\ref{e9}) it is sufficient to choose a nearly monochromatic wave packet, so narrow in the momentum space, that the transmission and reflection amplitudes and their derivatives can be approximated by their values at $p_0$.
Since $\int_0^\infty |A(p)|^2dp=1$, this yields
\begin{eqnarray}{\langle}bel{e10}
\mathcal{T}_{SWP}(\text{all},[0,d],p_0)=\\ \nonumbern
\left [|\partial_{\langle}mbda T(p_0,{\langle}mbda=0)|^2
+ |\partial_{\langle}mbda R(p_0,{\langle}mbda=0)|^2\right ]^{1/2}
\epsilonnd{eqnarray}
and
\begin{eqnarray}{\langle}bel{e11}
\tau^{dwell}_{[0,d]}(p_0)=\\ \nonumbern
i[T^*(p_0)\partial_{\langle}mbda T(p_0,{\langle}mbda=0)
+ R^*(p_0)\partial_{\langle}mbda R(p_0,{\langle}mbda=0)]
\epsilonnd{eqnarray}
In \cite{Leav1} it was shown that a good agreement between the SWP result $\mathcal{T}_{SWP}(\text{all},[0,d],p_0)$
and the dwell time (\ref{e11}) is achieved
for free motion, if the width of the region, $d$, is sufficiently large. Good agreement between the two was also found for a barrier turned into a potential step,
e.g., if $d$ is sent to infinity, thus making transmission impossible.
The latter result follows immediately by putting in Eqs.(\ref{e10}) and (\ref{e11}) $T(p_0,{\langle}mbda)\epsilonquiv 0$ and $|R(p_0)|{\langle}mbda\epsilonquiv 1$, which gives
\begin{eqnarray}{\langle}bel{e11a}
\mathcal{T}_{SWP}(\text{all},[0,\infty],p_0)=\\ \nonumbern
-\partial_{\langle}mbda Arg[R(p_0,{\langle}mbda=0)]=\tau^{dwell}_{[0,\infty]}(p_0).\quad\quad\quad
\epsilonnd{eqnarray}
The case of a free particle crossing the region of a width $d$, requires a little more attention. We can neglect the reflection term in Eq.(\ref{e11}) but not in (\ref{e10}), and must evaluate both derivatives instead. Using Eq.(\ref{xy9}) we easily find
\begin{eqnarray}{\langle}bel{i9}\\ \nonumberonumber
\ref rac{\mathcal{T}_{SWP}(\text{all},[0,d],p_0)}{\tau^{dwell}_{[0,d]}(p_0)}=\hat{H}at{S}qrt{1+\left | \ref rac{\hat{H}at{S}in(p_0d)}{p_0d}\right |^2}_{p_0d\to \infty}\to 1,
\epsilonnd{eqnarray}
which explains the good agreement found by Leavens for broad regions.
Finally, another minor point regarding the analysis of \cite{Leav1} is consigned to the Appendix.
\\ \nonumberewline
To summarise, we can agree with Leavens on the general discrepancy between the dwell time, and what is measured by a calibrated SWP clock. We also have dexplained why this discrepancy must arise. However, we disagree
with the final conclusion of \cite{Leav1} that "it is only the dwell time, which does not distinguish between transmitted and reflected particles, that is a meaningful concept in conventional interpretations of quantum mechanics". The dwell time is, we argue, just a special case of the "complex time" and is no more, and no less, meaningful than the tunnelling and reflection times in Eqs.(\ref{e4}) and (\ref{e5}).
\begin{figure}
\centering
\includegraphics[width=8.5cm,height=5.5cm]{{FIG2.pdf}}
\caption{(Color online) An incident wave packet impacts on a potential barrier, and is divided into the transmitted (tunnelled) and reflected parts. What is the duration the particle has spent in the region $\Omega$ which contains the barrier? }
{\langle}bel{fig:2}
\epsilonnd{figure}
\hat{H}at{S}ection{Tunnel ionisation}
Our general analysis applies also to the case of tunnel ionisation, where the tunnelling time problem has attracted recent theoretical interest \cite{LansREV}.
In an ionisation experiment, an initially bound electron has a chance to escape by tunnelling across a potential barrier briefly created by a time dependent external field. One may be interested in the duration the escaped electron has spent in the classically forbidden region, and attempt to measure it by means of a weak SWP clock, perturbing tunnelling as little as possible.
A realistic calculation of such a measurement can be found, for example, in \cite{SWP2}, and here we will limit ourselves to the formulation of the problem, and the identification of the time parameters such a measurement would produce.
\\ \nonumberewline
A one-dimensional sketch of the setup is shown in Fig.3. Bound at $t=t_1$ in the single bound state of a potential well, $|\psi_I{\rangle}=|\psi_{0}{\rangle}$, the particle can escape to the continuum while an external field is converting the binding potential into a potential barrier. Long after the field is switched off, at some $t=t_2$, its wave function is divided into the "bound" part, describing the particles which failed to leave the well, and the "free" part, describing the escaped particles moving away from it. We, therefore, have
\begin{eqnarray}{\langle}bel{ti1}
\hat{H}at{U}_{part}(t_2,t_1)|\psi_I{\rangle}=|\psi_{bound}{\rangle}+|\psi_{free}{\rangle}\epsilonquiv \\ \nonumber
C(t_2,t_1)]|\psi_{0}{\rangle}+
\int_0^\infty B(p,t_2,t_1)|p{\rangle} dp.
\epsilonnd{eqnarray}
and find the ionisation probability to be given by,
\begin{eqnarray}{\langle}bel{iprob}
W(\text{ion})={\langle} \psi_{free} | \psi_{free}{\rangle} =\int_0^\infty |B(p,t_2,t_1)|^2dp.
\epsilonnd{eqnarray}
Let the particle be monitored by a weak SWP clock, with the magnetic field is localised in the classically forbidden region $\Omega$, as shown in Fig.3.
We will also have at our disposal a perfect remote detector, capable of determining whether the particle has escaped, and if it has, and able to evaluate its momentum $p$. With this, we can choose to post-select the particle in the free state, and record the clock's reading only if the particle was seen to escape. We can also post-select it in the bound state, and keep the readings only in the case the remote detector has not fired. Alternatively, we can choose not to post-select at all, and retain all of the clock's readings.
\\ \nonumberewline
There is a set of complex times which, as discussed in Sect. V, are related to the response of the system
to the introduction of a constant potential ${{\langle}mbda } \text{T}_\Omheta_\Omega(x)$ in the region of interest. If such a potential is introduced,
the wave function at $t_2$ retains the form (\ref{ti1}), but its coefficients should depend on ${\langle}mbda$, $C(t_2,t_1)\to C({{\langle}mbda },t_2,t_1)$, $B(p,t_2,t_1)\to B(p,{{\langle}mbda },,t_2,t_1)$.
Thus, for an escaped particle with a momentum $p$ we can define the complex time (\ref{b5}) and other complex "averages" (\ref{xy5}) as [we omit the time dependence of the coefficients $C$ and $B$, and recall that $ \overline{\tau_\Omega}\epsilonquiv \overline{\tau^1_\Omega}$]
\begin{eqnarray}{\langle}bel{ti2}
\overline{\tau^n_\Omega}(p,\psi_0,t_2,t_1)=(i)^nB(p, {{\langle}mbda }=0)^{-1}\partial^n_{{\langle}mbda } B(p,{{\langle}mbda }=0).\quad
\epsilonnd{eqnarray}
Similarly, for a particle which remained in the well, we have
\begin{eqnarray}{\langle}bel{ti2a}
\overline{\tau^n_\Omega}(\psi_0,\psi_0,t_2,t_1)=(i)^nC({{\langle}mbda }=0)^{-1}\partial^n_{{\langle}mbda } C({{\langle}mbda }=0).
\epsilonnd{eqnarray}
There is also a real valued dwell time, which does not distinguish between
the particles which have escaped and those which remained bound,
\begin{eqnarray}{\langle}bel{ti3}
{\tau^{dwell}_\Omega}(\psi_0)=
|C({{\langle}mbda }=0)|^2 \overline{\tau_\Omega}(\psi_0,\psi_0,t_2,t_1)\\ \nonumber
+\int_0^\infty |B(p,{{\langle}mbda }=0)|^2 \overline{\tau_\Omega}(p,\psi_0,t_2,t_1)dp.
\epsilonnd{eqnarray}
\\ \nonumberewline
What is measured in an experiment depends on how the clock is prepared and read.
If the weak SWP clock of Sect. IX is used, and the calibration procedure of Sect. X is applied,
the time found for the particles which remain bound in the potential well is
\begin{eqnarray}{\langle}bel{ti4}
\mathcal{T}_{SWP}(\text{bound},\Omega,\psi_0)=|\overline{\tau_\Omega}(\psi_0,\psi_0,t_2,t_1)|\\ \nonumber
=|\partial_{{\langle}mbda } \ln C({{\langle}mbda }=0)|.\quad\quad\quad\quad\quad\quad\quad\quad
\epsilonnd{eqnarray}
For the particles which leave the well with unspecified momentum, the measurement will yield
\begin{eqnarray}{\langle}bel{ti5}
\mathcal{T}_{SWP}(\text{free},\Omega,\psi_0)=\quad\quad\quad\quad\quad\quad\\ \nonumber
W(\text{ion})^{-1/2}\left [{\int_0^\infty|\overline{\tau_\Omega}(p,\psi_0,t_2,t_1)|^2 |B(p)|^2dp}\right ]^{1/2}\\ \nonumber
=W(\text{ion})^{-1/2}\left [{\int_0^\infty |\partial_{{\langle}mbda } B(p, {{\langle}mbda }=0)|^2dp}\right ]^{1/2}
\epsilonnd{eqnarray}
Finally, if the final state of the particles is not controlled, from (\ref{d11}) we have
\begin{eqnarray}{\langle}bel{ti6a}
\mathcal{T}_{SWP}(\text{all},\Omega,\psi_0)=\{[1- W(\text{ion})]\times\quad\quad\quad\quad\\ \nonumber
\mathcal{T}_{SWP}^2(\text{bound},\Omega,\psi_0)
+W(\text{ion}) \mathcal{T}_{SWP}^2(\text{free},\Omega,\psi_0)\}^{1/2}\\ \nonumber
=\left [|\partial_{{\langle}mbda } C({{\langle}mbda }=0)|^2+ \int_0^\infty |\partial_{{\langle}mbda } B(p, {{\langle}mbda }=0)|^2dp \right ]^{1/2},
\epsilonnd{eqnarray}
which is not the same as the dwell time in Eq.(\ref{ti3}).
\\ \nonumberewline
If, on the other hand, we follow Leavens \cite{Leav1} in choosing $|\gamma^I{\rangle}=|\beta^j{\rangle}$, (see Appendix),
the sum in the r.h.s. of Eq.(\ref{d99a}) will vanish, and to evaluate the new SWP time $\mathcal{T}_{SWP}'$, we would need to go to the next order
in $\omega_L$ in Eq.(\ref{c5b}).
For example, instead of (\ref{ti5}) from Eq.(\ref{Ap2}), we will have
\begin{eqnarray}{\langle}bel{ti4a}
\mathcal{T}_{SWP}'(\text{free},\Omega,\psi_0) =\\ \nonumbern
\epsilonnd{eqnarray}
\begin{eqnarray}{\langle}bel{ti4aa}\\ \nonumberonumber
W(\text{ion})^{-1/3}
\left \{ {\int_0^\infty \text{Re}[ \ttau(p,\psi_0)\overline{\tau^2_\Omega}^*(p,\psi_0)] |B(p)|^2dp}\right \}^{1/3}=\\ \nonumber
W(\text{ion})^{-1/3} \left \{ {\int_0^\infty \text{Im}[\partial_{{\langle}mbda } B(p,{{\langle}mbda }=0) \partial_{{\langle}mbda }^2 B^*(p,{{\langle}mbda }=0)dp}\right \}^{1/3}.
\epsilonnd{eqnarray}
and, as before, will not recover the dwell time (\ref{ti3}) in the case no post-selection is made.
\\ \nonumberewline
The dwell time would, however, occur naturally if instead of evaluating the averages (\ref{d4}) or (\ref{Ap2}), we would
employ a more general Larmor clock, described in Sect. VII, and consider a small difference in the probability
$P(k,\text{all})\epsilonquiv {\langle} \Psi(t_2)|\beta^k{\rangle}{\langle} \beta^k|\Psi(t_2){\rangle}$ for the clock to be found in a state $|\beta^k{\rangle}$
before and after it interacts with the particle. A simple calculation, using Eq.(\ref{c5b}), shows that this change
is proportional to $\tau^{dwell}_\Omega(\psi_0)$
\begin{eqnarray}{\langle}bel{ti5a}
\delta P(k,\text{all}) \epsilonquiv P(k,\text{all})-|{\langle} \beta^k|\gamma^I{\rangle}|^2=\\ \nonumber
2\omega_L \text{Im}[{\langle} \gamma^I|\beta^k{\rangle}{\langle} \beta^k|\hat{H}at{j}_z|\gamma^I{\rangle}] \tau^{dwell}_\Omega(\psi_0)+O(\omega_L^2)
\epsilonnd{eqnarray}
Defining the measured mean value as $\delta \text{T}_\Om(\text{all},\psi_I)\epsilonquiv \hat{H}at{S}um_{k=0}^{2j}\tau_k \delta P(k,\text{all})$,
we obtain
\begin{eqnarray}{\langle}bel{ti6}
\delta \text{T}_\Om(\text{all},\psi_I)= Q'(j) \tau^{dwell}_\Omega(\psi_0)+O(\omega_L),
\epsilonnd{eqnarray}
with $Q'(j)= 2\text{Im}\left \{\hat{H}at{S}um_{k=0}^{2j} \phi_k{\langle} \gamma^I|\beta^k{\rangle}{\langle} \beta^k|\hat{H}at{j}_z|\gamma^I{\rangle} \right \}$.
If the magnetic field is introduced everywhere in space, we find $\delta \text{T}_\Om^{free}(t_2-t_1)=Q'(j)(t_2-t_1)$.
Using this relation to calibrate the result (\ref{ti6}), as was done in Sect. X, shows that for this particular clock,
the duration imposed in the quantum case is $\tau^{dwell}_\Omega(\psi_0)$.
This is the case of linear calibration, studied by Leavens and McKinnon in \cite{Leav2}.
\\ \nonumberewline
Thus, also in the case of tunnel ionisation, application of a weak SWP clock does not yield a single real duration
the particle is supposed to spend in the classically forbidden region,
but rather a variety of complex valued time parameters, through which the real valued result of the measurement is expressed.
These parameters differ for different settings of the clock,
and reduce to a unique classical value only in the primitive semiclassical limit,
where a single classical trajectory connects the initial and final states.
In the next Section we give our conclusions.
\begin{figure}
\centering
\includegraphics[width=8.5cm,height=5.5cm]{{FIG3.pdf}}
\caption{(Color online) at first the particle is trapped in the ground state of a potential well.
A time dependent external field turns the potential step into a barrier, and then restores it to its original shape.
The particle's wave function is divided into the part still trapped, and the escaped part, freely propagating away from the well.
What is the duration the particle has spent in the classically forbidden region $\Omega$? }
{\langle}bel{fig:3}
\epsilonnd{figure}
\hat{H}at{S}ection{Conclusion and discussion}
Mathematical exercises presented above do not themselves form a basis for a discussion about "the amount of time a tunnelling particle spends in the barrier".
They only illustrate the far more general principle at stake. Most of the quantum transitions, and certainly tunnelling,
are interference phenomena, which require contributions from many virtual Feynman paths.
Each Feynman path spends certain amount of time, $\tau_\Omegaega[path]$, inside the region of interest $\Omega$. We can group together the paths
sharing the same value of $\tau_\Omegaega[path]$, and see a transition as a result of interference between all traversal times involved.
The difficulty in determining the duration, spent by a quantum particle in $\Omega$, is then the well known difficulty in answering the
"which way?" ("which $\tau$?) question in the presence of interference, the only mystery in quantum mechanics, according to Feynman \cite{FeynL}. In this paper we have examined in detail one particular way of trying to answer the question, while leaving the interference intact. Arguably, the general conclusions, which can be drawn from our analysis, are more important than any of its technical details. We will formulate these conclusions in a perhaps unusual form of attempting to ask the most relevant questions, and then trying to answer them the best we can.
{\it a) What is measured by the SWP clock?} Like every clock of the Larmor family, the SWP clock measures the net time $\tau$ the particle's Feynman paths spend in the region of interest.
{\it b) How is this time measured?} By modifying the contributions of different $\tau$'s to the particle's transition amplitude,
depending on final state in which the clock is observed.
{\it c) Does the SWP analysis come up with an "operator for the tunnelling time"?}
Strictly speaking, no. The operator (\ref{d4a}), often quoted in that capacity, acts on the variables of the clock,
and not on the variables of the particle. It defines, therefore, a von Neumann measurement which needs
to me made on the spin.
{\it d) To what accuracy is it measured?} If the function $G_{SWP}$ in Eq.(\ref{c4}) limits the values of $\tau$, which contribute to the
transition $|\psi_I{\rangle}|\beta^0{\rangle} \to |\psi_F{\rangle}|\beta^k{\rangle}$, to a region of a width $\Delta \tau$ around some value $\tau_k$, we can say that
by observing the clock in $|\beta^k{\rangle}$, we have measured a value $\tau_k$ to an accuracy $\Delta \tau$.
A weak ($\omega_L\to \infty$) SWP clock, whose main purpose is to perturb the transition as little as possible,
does not discriminate between different times in this way. Rather, it studies the response of a particle to the small variations
of the probability amplitudes defined in Eq.(\ref{b3}), and its accuracy is very poor.
{\it e) Is there a probability distribution for the traversal time in the case of tunnelling?}
Not unless it is created by an accurate clock, which destroys the interference between different values of $\tau$.
If a weak clock is employed, only the {\it probability amplitude distribution} $A(\psi_F, \psi_I, t_2,t_1|\tau)$ in Eq.(\ref{b3})
is available.
{\it f) Are complex traversal times inevitable?} Interfering (virtual) pathways should together be considered a single route connecting the initial and
final states of the system. By the Uncertainty Principle \cite{FeynL}, virtual pathways cannot be distinguished without destroying
interference between them. Accordingly, the response of a system to a weakly perturbing measurement of the traversal time functional (\ref{a1})
is always formulated in terms
of the complex valued sum of the corresponding amplitudes, $A(\psi_F, \psi_I, t_2,t_1|\tau)$ in Eq.(\ref{b3}), weighted by the values of the functional, $\tau$ \cite{FUNC2}.
This is a general result behind the so-called weak measurement theory \cite{WEAK11}, \cite{PLA2016}. The complex time $\ttau$ in (\ref{b5}) is the "weak value" of the functional (\ref{a1}).
{\it g) Can complex times be measured?} Certainly, for example by a weak SWP clock discussed above, and the fact that they are complex valued is no major obstacle.
However, since the result of a measurement must be real, it is impossible to say {\it apriori} whether a particular experiment
would yield $\text{Re} \ttau$, $\text{Im} \ttau$, $|\ttau|$, or, indeed, any other real valued combination of $\text{Re} \ttau$ and $\text{Im} \ttau$
(see also \cite{DSwp}). Our detailed analysis of the SWP clock used by Peres \cite{SWP3}, shows that what it measures is, in fact, $|\ttau|$.
{\it h) Are complex times related to physical time intervals?} In general, they are not. Any attempt at over-interpretation, by treating parts of $\ttau$ as if they were actual durations, would lead to insurmountable difficulties. For example, in the case described in Sect. X, one would face not only the chance of faster-than-light travel, but also the possibility of spending a month on the beach during a one-week leave from office. None of the two are offered by elementary quantum mechanics.
{\it i) What are the complex times then?} Just what their definition tells us. A complex time is what one would obtain by multiplying the amplitude to reach $|\psi_F{\rangle}$ from $|\psi_I{\rangle}$ and spend a duration $\tau$ in $\Omega$ by $\tau$, and sum over all the $\tau$'s which contribute to the transition.
{\it j) Is the dwell time more meaningful than other complex times?} No, it is a particular case of a complex time, whose
attractive properties can be traced to the fact that the operator $\hat{H}at{U}_{part}(t_2,t_1|{\langle}mbda)$ in Eq.(\ref{xy3}) is hermitian for any real ${\langle}mbda$ \cite{NEGAT}. In the quantum case, it does not always take the place of the classical duration, as was shown in Sect. XII.
The Uncertainty Principle does not forbid the weak values to look appealing in particular cases. Rather, it guarantees the existence
of "unappealing" results, should different initial and final states be chosen instead \cite{PLA2015}. It is these other results which should warn one against giving too much credit to the nice exceptions.
{\it k) Does the SWP clock measure the dwell time?}
As defined in \cite{SWP3} and in Sect. VIII, it does not. The choice of the states in which the clock is observed is such that the terms which add up to
the dwell time do not contribute to the result, even if the final state of the particle is not controlled.
With a different Larmor clock it would, however, be possible to evaluate $\tau^{dwell}_\Omega(\psi_I)$ \cite{Leav2}.
{\it l) Does tunnelling particle spend a finite amount of time in the barrier?} We could equally ask whether the electron in the Young's double slit experiment reaches the screen
by passing through the holes in the screen? All Feynman paths which contribute to tunnelling spend some time in the barrier.
Moreover, replacing the Schroedinger equation with a relativistic Klein-Gordon one \cite{Low}, leaves only the paths
spending in $\Omega$ a time longer than the $\ref rac{width\quad of\quad the\quad region}{speed\quad of \quad light}$ \cite{DSrel}. In every {\it virtual} scenario (i.e., the one to which we can ascribe an amplitude, but not the probability \cite{FUNC2} ) the electron goes through one of the holes, and the particle spends a reasonable duration inside the barrier.
{\it m) How much time does a tunnelling particle spend in the barrier?} We could equally ask "which hole did the electron go through?".
In standard (Feynman) quantum mechanics it goes through both, and through neither one in particular \cite{FeynL}.
In the same sense, the particle spends in the barrier all durations at the same time.
The question is meaningless in a very strong sense, and an attempt to force it brings an unsatisfactory answer, $\overline{\tau}_{\Omega}(\psi_I,\psi_F)$.
Consider two researchers using two weak Larmor clocks, but one determining $\text{Re}\ttau$, and the other $|\ttau|$,
for a transition where $\text{Re}\ttau$ is zero, but $|\ttau|$ is not.
To the first researcher the transition takes no time in $\Omega$, to the second researcher this time is finite.
Their subsequent argument would have no resolution, as both would be right about their results,
but both will be wrong in their final conclusions.
{\it n) Can one expect the complex time (\ref{b5}) to occur in other applications? } Only where the quantity of interest
can be obtained by integrating the amplitudes $A(\psi_F, \psi_I, t_2,t_1|\tau)$ over $\tau$. Some examples were given in
\cite{DSwp} and \cite{SBrouard}.
{\it o) Can there be other definitions of the tunnelling time?} In quantum mechanics, the failure to define one unique tunnelling time
does not mean that such times cannot be defined at all. On the contrary, it means that there are more possible time parameters, than in the classical case \cite{STEIN}. Firstly, there are $\text{Re} \ttau$, $\text{Im} \ttau$, $|\ttau|$ already mentioned. Then there are weak values of other functionals, e.g., of $\tau_{in/out}[x_{cl}(t)]$ in Eq.(\ref{a2}). There are also times not related to Feynman paths. One famous example is the phase time \cite{REV5}, which can be interpreted as the weak value of the spacial shift with which the particle leaves the scatterer, divided by the particle's velocity \cite{DSann}. Moreover, one can define other times, e.g., as the moments the front, the maximum, the rear, or the centre of mass of a wave packet passes through a chosen surface in space \cite{REV1}. The Pollack and Miller time \cite{PM}, and the times mentioned in Sect. III, provide further examples.
{\it p) Can there be a unique tunnelling time scale?} That is, could one leave aside all the details of the previous discussion, and simply be assured that tunnelling takes approximately $\tau_{approx}$ microseconds, so that all devices using it should not go faster that $\tau_{approx}$? The answer in standard (Feynman) quantum mechanics appears to be "no". If there were such a time scale, it could be found
by examining
the corresponding amplitude distribution $A(\psi_F, \psi_I, t_2,t_1|\tau)$.
For example, for a particle of a given energy,
tunnelling across a rectangular barrier, the amplitude distribution
is oscillatory, and exhibits a fractal behaviour \cite{SBrouard}. Hence, its Fourier spectrum contains all frequencies, and we cannot associate with it any specific time scale {\it a priori}. In a particular application, $A(\psi_F, \psi_I, t_2,t_1|\tau)$ may be
integrated with a smooth function $G(\tau)$, whose width $\Delta \tau$ determines which of the higher frequencies would be neglected. However, the process of making $\Delta \tau$ smaller will never converge to a result which no longer depends on $\Delta \tau$. Thus, we argue, any new tunnelling time measured in an experiment, or found theoretically, should be used strictly in the particular context it was obtained. For instance, a statement "the peak of the tunnelled wave packet has arrived at the detector $1$ fs. earlier than that of a free propagating one" is correct. Its extension "... and, therefore, the particle has spent $1$ fs. less in the barrier" is unwarranted. Any claim to find the universal tunnelling time, or time scale, is likely to be misleading.
{\it q) And the classical time scale?} One exception to $p)$ is the (semi) classical limit, where rapidly oscillating $A(\psi_F, \psi_I, t_2,t_1|\tau)$ develops a very narrow stationary region around single classical value $\tau_{cl}$ \cite{SBrouard}. If so, the contribution to any (within reason) integral over $\tau$, involving $A(\psi_F, \psi_I, t_2,t_1|\tau)$, comes from the vicinity of $\tau_{cl}$. Appearance of a single stationary region signals, therefore, return to the classical description.
{\it r) Could an extension, or alternative formulation of quantum mechanics help define the traversal time in a different way?}
Such a theory will have also solved the "which way?" problem for the double-slit experiment.
{\it s) Did Bohm's trajectories approach achieve that?.}
One approach which claims to achieve that is the Bohm' causal interpretation \cite{Holl}, \cite{Bohm2}.
In Bohm's theory, a particle moves along a streamline of a probability current calculated with a time dependent wave function
$\psi(x,t)$, and its initial position is distributed according to $|\psi(x,t=0)|^2$. The streamlines cannot cross,
and a Bohm's trajectory leading to a given point on the screen in the Young's experiment always passes through one of the slits.
Similarly, a particle crossing a region of space always spends there a unique amount of time.
A detailed comparison between the Bohm's trajectory and the Feynman path approaches to the tunnelling time problem was made in \cite{Leav3}, where the author concluded that the two approaches are incompatible.
It is not our purpose to continue this discussion, and we will limit ourselves to just two comments.
Firstly, the unperturbed Bohm's trajectories do not help us with the analysis of the SWP clock, while the Feynman paths do.
Bohm's trajectories are formulated in the absence of a measuring device, and must change once such a device is introduced,
in order to describe its effects.
Secondly, by using Feynman amplitudes, one can define the time any quantum system spends in an arbitrary subspace of its Hilbert space. For example we can define and measure the time a qubit spends in one of its states \cite{DSresid}, \cite{DSprl2}.
It is unclear how Bohm's approach can be extended to cover these cases.
In summary, we have analysed the work of a weakly perturbing Salecker-Wigner-Peres clock in terms of virtual Feynman paths, and related it to the complex traversal time first introduced in \cite{DSB}. We have shown that in the standard (Feynman) quantum mechanics the appearance of complex times in an inevitable consequence of the Uncertainty Principle. We also explained why these complex times, or their real valued combinations, should not be interpreted as physical durations, and tried to draw some of more general conclusions about the state of the tunnelling problem in quantum theory.
\hat{H}at{S}ection{Appendix: A different choice of the initial state for an SWP clock}
It is worth clarifying one difference between our results of Sect. X and those of \cite{Leav1}.
According to Eq.(26) of \cite{Leav1}, for a free running clock,
as $\omega_L\to 0$, we must have $\text{T}_\Om^{free}\hat{H}at{S}im \omega_L^2$, whereas according to our Eq. (\ref{dz1}) is should be proportional to
$\omega_L$.
The reason is that in \cite{Leav1} Leavens considered also choosing a different initial state for the clock, replacing
($j$ is an integer) $|\beta^0{\rangle}$ with $|\beta^j{\rangle}$, and effectively postulated a {\it negative} duration $\tau'_{k-j}=(\phi_k-\phi_j)/\omega_L<0$ each time the clock is found in $|\beta^k{\rangle}$ with $0\le k <j$. In this case, from Eq.(\ref{d2a}) we have
$G_{SWP}(\omega_L\tau|j,\beta^k,\beta^j)=G_{SWP}(\omega_L\tau|j,\beta^{k-j},\beta^0)$, and $|\beta^{k-j}{\rangle} \epsilonquiv\epsilonxp[-i\hat{H}at{j}_z(\phi_k-\phi_j)]|\beta^0{\rangle}$, so that Eq.(\ref{d4}) becomes
\begin{eqnarray}{\langle}bel{Ap1}
\text{T}_\Om'(\mathfrak{N} ,\psi_I)=\hat{H}at{S}um_{k=0}^{2j}\tau'_{k-j} P(k-j,\mathfrak{N} ),
\epsilonnd{eqnarray}
which is also Eq.(20) of \cite{Leav1}. Proceeding as in Sect. IX, we find that, with this choice, the contribution to $\text{T}_\Om'(\mathfrak{N} ,\psi_I)$, linear in $\omega_L$, vanishes, leaving
$\text{T}_\Om'(\mathfrak{N} ,\psi_I)$ proportional to $\omega_L^2$ as $\omega_L\to 0$. For a freely running clock, with the magnetic field introduced everywhere in space, we have $\text{T}_\Om'^{free}(t_2-t_1)\hat{H}at{S}im (t_2-t_1)^3$. Calculating $\text{T}_\Om'(\mathfrak{N} ,\psi_I)$ to the first non-vanishing order in $\omega_L$, and comparing the result with $\text{T}_\Om'^{free}(t_2-t_1)$, we find that the time $\mathcal{T}_{SWP}'(\mathfrak{N} ,\Omega,\psi_I)$, measured by the modified clock, is given by
\begin{eqnarray}{\langle}bel{Ap2}
\mathcal{T}_{SWP}'(\mathfrak{N} ,\Omega,\psi_I) =W(\mathfrak{N} ,\psi_I)^{-1/3}\times \quad\quad\quad\quad\\ \nonumber
\left \{ \hat{H}at{S}um_{N \in \mathfrak{N} } W(N,\psi_I) \text{Re}[ \ttau(N,\psi_I)\overline{\tau^2_\Omega}^*(N,\psi_I)] \right \}^{1/3},\quad\quad
\epsilonnd{eqnarray}
which involves also the complex valued square of the functional (\ref{a1}), defined in Eq.(\ref{xy5}).
\\ \nonumberewline
\hat{H}at{S}ection {Acknowledgements} Support of
MINECO and the European Regional Development Fund FEDER, through the grant
FIS2015-67161-P (MINECO/FEDER)
is gratefully acknowledged.
\begin{thebibliography}{10}
\bibitem{UFAST} F. Krausz and M. Ivanov, Rev. Mod. Phys., . \textbf{81}, 163 (2009).
\bibitem{McColl} L. A. MacColl, Phys. Rev. \textbf{40}, 621 (1932).
\bibitem{ZeroT} L.Torlina, F. Morales, J. Kaushal, I. Ivanov, A. Kheifets, A. Zielinski,
A. Scrinzi, H. G. Mulle, S. Sukiasyan, M. Ivanov, and O. Smirnova, Nat. Phys., \textbf{11}, 503 (2015).
\bibitem{Teeny1} N. Teeny, C. H. Keitel, and H. Bauke, Phys. Rev. A, \textbf{94}, 022104 (2016).
\bibitem{LansREV} A. Landsman and U. Keller, Phys. Rep. \textbf{60}, 1, (2015).
\bibitem{REV1} E. H. Hauge and J. A. Stoevneng, Rev. Mod. Phys. \textbf{61}, 917 (1989);
\bibitem{REV3} R. Landauer and Th. Martin, Rev. Mod. Phys. \textbf{66}, 217 (1994);
\bibitem{REV4}C. A. de Carvalho, H. M. Nussenzweig, Phys. Rep. \textbf{364}, 83 (2002);
\bibitem{REV5}V. S. Olkhovsky, E. Recami and J. Jakiel, Phys. Rep. \textbf{398}, 133 (2004);
\bibitem{REV2}H. G. Winful, Phys. Rep.\textbf{436}, 1 (2006).
\bibitem{vN}J. v. Neumann, {\it Mathematical Foundations of Quantum Mechanics} (Princeton University Press, Princeton, 1955),
p. 183.
\bibitem{FUNC1} D. Sokolovski and R. Sala Mayato, Phys. Rev. A \textbf{71}, 042101 (2005);
\textbf{73}, 052115 (2006); \textbf{76}, 039903(E) (2006).
\bibitem{FUNC3} D. Sokolovski, Phys. Rev. A \textbf{84}, 062117 (2011).
\bibitem{FUNC4} D. Sokolovski, Phys. Rev. D \textbf{87}, 076001 (2013).
\bibitem{FUNC2} D. Sokolovski, Mathematics, \textbf{4}, 56 (2016),
(Special Issue {\it Mathematics of Quantum Uncertainty}, open access.]
\bibitem{Buett2}M. Buettiker, Phys. Rev. B, \textbf{27}, 6178, (1983).
\bibitem{DSB} D. Sokolovski and L. M. Baskin, Phys. Rev. A \textbf{36}, 4604 (1987).
\bibitem{DSwp}D. Sokolovski and J. N. L. Connor, Phys. Rev. A \textbf{42}, 6512 (1990).
\bibitem{DSnp}D. Sokolovski and J. N. L. Connor, Phys. Rev. A \textbf{44}, 1500( 1991).
\bibitem{QUINT}D. Sokolovski and J. N. L. Connor, Phys. Rev. A\textbf{47}, 4677 (1993).
\bibitem{SBrouard}D. Sokolovski, S. Brouard. and J.N.L. Connor, Phys. Rev. A, \textbf{50}, 1240, (1994).
\bibitem{SBrapid}D. Sokolovski, Phys. Rev. A,\textbf{52}, R5(R), (1995).
\bibitem{DSPRL1}D. Sokolovski, Phys. Rev. Lett., \textbf{79}, 4946, (1997).
\bibitem{NEGAT}D. Sokolovski, Phys. Rev. A, \textbf{76}, 042125, (2007).
\bibitem{DSbook} D. Sokolovsky, in {\it Time in Quantum Mechanics}, edited by
J.G. Muga, R. Sala Mayato and I.L. Egusquiza (Second ed., Springer, Berlin, Heidelberg, New York, 2008), p. 195.
\bibitem{Larm1} A.I. Baz', Yad. Fiz. \textbf{4}, 252 (1966) [Sov. J. Nucl. Phys. \textbf{4}, 182 (1967)].
\bibitem{Larm3} A.I. Baz', Yad. Fiz. \textbf{5}, 229 (1967) [Sov. J. Nucl. Phys. \textbf{5}, 161 (1967)].
\bibitem{Larm4} V. F. Rybachenko, Yad. Fiz. \textbf{5}, 895 (1967) [Sov. J. Nucl. Phys. \textbf{5}, 635 (1967)].
\bibitem{Larm5} J.P. Falck and E.H. Hauge, Phys. Rev. B, \textbf{38}, 3287 (1988).
\bibitem{Larm6} C. R. Leavens and G. C. Aers, Phys. Rev. B, \textbf{40}, 5387 (1989).
\bibitem{Larm7} C.S.Park, Phys. Lett. A \textbf{377}, 741 (2013).
\bibitem{Larm2} J. Kausha, F. Morales1, L. Torlina, M. Ivanov, and O. Smirnova, J. Phys. B: Atomic, Molecular and Optical Physics, \textbf{48}, 234002 (2015).
\bibitem{SWP1} H. Salecker and E.P. Wigner, Phys. Rev., \textbf{109}, 571, (1958).
\bibitem{SWP3} A. Peres, Am. J. Phys, \textbf{48}, 553 (1980).
\bibitem{SWP4}P.C.W. Davies, J. Phys. A \textbf{19}, 2115 (1986).
\bibitem{SWP5} C. Foden and K.W.H. Stevens, IBM J. Res. Dev., \textbf{32}, 99 (1988).
\bibitem{Leav1} C.R. Leavens, Solid State Comm, \textbf{86}, 781 (1993).
\bibitem{Leav2} C.R. Leavens, W.R. McKinnon, Phys. Lett. A \textbf{194}, 12 (1994).
\bibitem{Leav3} C.R. Leavens, Found. Phys., \textbf{25}, 229 (1995).
\bibitem{Gon} D. Alonso, R. Sala Mayato and J.G. Muga, Phys. Rev. A, \textbf{67}, 032105 (2003).
\bibitem{SWPbook} R. Sala Mayato, D. Alonso and I.L. Egusquiza, in {\it Time in Quantum Mechanics}, (Ref. 25), p. 235.
\bibitem{SWP9} M. Calcada, J.T. Lunardi and L.A. Manzoni, Phys. Rev. A, \textbf{79}, 012110 (2009).
\bibitem{SWP10} J.T. Lunardi, L.A. Manzoni and A.T. Nystrom, Phys. Lett. A, \textbf{375}, 415 (2011).
\bibitem{SWP2} N. Teeny, C.H. Keitel, and H. Bauke, arXiv:1608.02854 [quant-ph] (2016).
\bibitem{LANprl} T. Zimmermann, S. Mishra, B.R. Doran, D.F. Gordon, and A.S. Landsman,
Phys. Rev.Lett., \textbf{116}, 233603 (2016).
\bibitem{Bohm} D. Bohm, {\it Quantum Theory}, (Addison?Wesley, Reading, MA, 1965).
\bibitem{Japha} Y. Japha, and G. Kuritzki, Phys. Rev. A, \textbf{53}, 586 (1996).
\bibitem{Muga1} J.G. Muga and C.R. Leavens, Phys. Rep,, \textbf{338}, 353, (2000).
\bibitem{DSann} D. Sokolovski and E. Akmatskaya, Ann. Phys. \textbf{339}, 307 (2013).
\bibitem{Poll1} E. Pollak, Phys. Rev. Lett., \textbf{118}, 070401, (2017).
\bibitem{Poll2} E. Pollak, J.Phys.Chem.Lett., \textbf{8}, 352, (2017).
\bibitem{Muga2} V. Delgado, S. Brouard, and J.G. Muga, Solid State Comm., \textbf{94}, 979, (1995).
\bibitem{Leav4} C.R. Leavens, Superlattices and Microstructures., \textbf{23}, 795 (1998).
\bibitem{Feyn} R. P. Feynman and A. R. Hibbs, {\it Quantum Mechanics and Path Integrals}, (McGraw-Hill, New York, 1965).
\bibitem{FeynLaw} R. P. Feynman, {\it The Character of Physical Law}, (MIT press, 1985)
\bibitem{Holl} P.R. Holland, {\it The Quantum Theory of Motion}, (Cambridge University Press, Cambridge 1993).
\bibitem{WEAK11} J. Dressel, M. Malik, F. M. Miatto, A. N. Jordan, and R. W. Boyd, Rev. Mod. Phys, {\it 86}, 307 (2014).
\bibitem{WEAK12} L. Vaidman, Found. Phys. {\bf 26}, 895 (1996).
\bibitem{PLA2016} D. Sokolovski, Phys. Lett. A, \textbf{380}, 1593 (2016).
\bibitem{FOOTbox} To simplify the notations we assume that the particle is in a large box, so its states $|N{\rangle}$ are discrete.
As the size of the box tends to infinity, the sums over $N$ should be replaced by the corresponding integrals.
\bibitem{FOOTswp} Note that $W(N,\psi_I)=0$ does not guarantee that the corresponding term
in the sum in Eq.(\ref{d10}) vanishes, since $|\ttau(N,\psi_I)|^2={\langle} \psi^{(1)}|\psi^{(1)}{\rangle}/W(N,\psi_I)$.
\bibitem{NKE} Y. Aharonov, S. Popescu, D. Rorhlich and L. Vaidman, Phys. Rev. A \textbf{48}, 4084 (1993).
\bibitem{AhHARDY} Y. Aharonov, A. Botero,S. Popescu, B. Reznik and J. Tollaksen, Phys. Lett. A \textbf{301}, 130 (2002).
\bibitem{AhBOOK} Y. Aharonov and L. Vaidman, in {\it Time in Quantum
Mechanics}, (Ref. 25), Vol. 1.
\bibitem{CAT} Y. Aharonov, S. Popescu, D. Rohrlich, and P. Skrzypczyk, New J. Phys., {\bf 15}, 113015 (2013).
\bibitem{v2013} L. Vaidman, Phys. Rev. A {\bf 87}, 052104 (2013).
\bibitem{vPRL} A. Danan, D. Farfurnik, S. Bar-Ad, and L. Vaidman, Phys. Rev. Lett. \textbf{111}, 240402 (2013).
\bibitem{Cher} D. Rohrlich, and Y. Aharonov, , Phys. Rev. A \textbf{66}, 042102 (2002).
\bibitem{PLA2015} D. Sokolovski, Phys. Lett. A, \textbf{379}, 1097 (2015).
\bibitem{PLAvaid} D. Sokolovski, Phys. Lett. A, \textbf{381}, 227 (2017).
\bibitem{FeynL}R. P. Feynman, R. Leighton, and M. Sands, {\it The Feynman Lectures on Physics III} (Dover Publications, Inc., New York, 1989).
\bibitem{Low} F.E. Low, Annln Phys. Leipzig \textbf{7}, 660 (1998).
\bibitem{DSrel}D. Sokolovski, Proc. Roy. Soc. A, \textbf{460}, 4999, (2004).
\bibitem{STEIN} E. Steinberg, in {\it Time in Quantum Mechanics}, (Ref. 25), p. 350.
\bibitem{PM} E. Pollak, and W.H. Miller, Phys. Rev. Lett. \textbf{53}, 115 (1984).
\bibitem{Bohm2} D. Bohm, B. J. Hiley and P. N. Kaloyerou, Phys. Rep. \textbf{144}, 323 (1987).
\bibitem{DSresid}D. Sokolovski, Proc. R. Soc. Lond. A, \textbf{460}, 1505, (2004).
\bibitem{DSprl2}D. Sokolovski, Phys. Rev. Lett., \textbf{102}, 230405, (2009).
\epsilonnd{thebibliography}
\epsilonnd{document}
|
math
|
\begin{document}
\title{Fidelity, susceptibility and critical exponents in the Dicke model}
\author{M. A. Bastarrachea-Magnani, O. Casta\~nos, E. Nahmad-Achar, R. L\'opez-Pe\~na, and J. G. Hirsch}
\address{Instituto de Ciencias Nucleares, Universidad Nacional Aut\'onoma de M\'exico \\ Apdo. Postal 70-543, M\'exico D. F., C.P. 04510}
\ead{[email protected]}
\begin{abstract}
We calculate numerically the fidelity and its susceptibility for the ground state of the Dicke model. A minimum in the fidelity identifies the critical value of the interaction where a quantum phase crossover, the precursor of a phase transition for finite number of atoms $\mathcal{N}$, takes place. The evolution of these observables is studied as a function of $\mathcal{N}$, and their critical exponents evaluated. Using the critical exponents the universal curve for the specific susceptibility is recovered. An estimate to the precision to which the ground state wave function is numerically calculated is given, and found to have its lowest value, for a fixed truncation, in a vicinity of the critical coupling.
\end{abstract}
\section{Introduction}
The Dicke Hamlitonian describes a system of $\mathcal{N}$ two-level atoms interacting with a single monochromatic electromagnetic radiation mode within a cavity \cite{Dicke54}. In terms of quantum computation, it can also describe a set of $\mathcal{N}$ qubits, realized with quantum dots, Bose-Einstein condensates or QED circuits \cite{Sche07}, interacting through a bosonic field. In recent years Dicke-like Hamiltonians, and in particular its quantum phase transition (QPT) from normal to superradiant behavior \cite{Hepp73,Wang73}, have attracted much attention. The QPT is an example of a quantum collective behavior and has a close connection with entanglement and quantum chaos. Besides, the Dicke Hamiltonian for a finite $\mathcal{N}$ provides a good description for the systems manipulated in the laboratory, especially in the light of the experimental realization of the superradiant phase transition in a BEC \cite{Bau10,Nag10}, the intense development in the control of single atoms and photons in a cavity, and the possibility of a QPT in a system of $\mathcal{N}$ QED circuits \cite{Vieh11,Cuiti12}.
The Dicke model can be written as ($\hbar=1$)
\begin{equation}
H_{D}=\omega a^{\dagger}a+\omega_{0}J_{z}+\frac{\gamma}{\sqrt{\mathcal{N}}}\left(a+a^{\dagger}\right)\left(J_{+}+J_{-}\right) ,
\end{equation}
where $\omega$ is the field frequency, $\omega_{0}$ is the atomic energy separation, $a^{\dagger}$ and $a$ are the creation and annihilation photon operators, respectively, and $\gamma$ is the coupling strength. $J_{z}$ and $J_{\pm}$ are collective atomic operators (pseudospin operators) which follow the SU(2) algebra, and denote the atomic relative population and the atomic transitions operators, respectively.
For a finite number of atoms $\mathcal{N}$, the model is in general non-integrable, and care must be taken when the first order in the $1/\mathcal{N}$ expansion is employed because of its singular behavior around the phase transition \cite{OCasta11a,OCasta11}. The Hamiltonian is integrable in at least two limits ($\gamma\rightarrow 0$ and $\omega_{0}\rightarrow 0$). In the thermodynamic limit, when the number of atoms $\mathcal{N}$ goes to infinity, the mean field description becomes exact. It provides analytic asymptotic solutions through a Holstein-Primakoff expansion \cite{Emary03}, which allows to extract the critical exponents for the ground state energy per particle, the fraction of excited atoms, the number of photons per atom, their fluctuations and the concurrence \cite{Emary03,Lam05,Vid06,Chen08}. Numerical solutions complement and confirm the theoretical predictions, and allow for the exploration of the system in regimes which are not described by the latter, like excited state phase transitions.
A concept emerging from quantum information theory, the fidelity, can be used to determine a sudden change in the ground state of a quantum system as a function of a control parameter. In recent years it has emerged as a powerful tool to study QPT in quantum many-body systems \cite{Gu10}. The fidelity describes the overlap between two quantum states. Considering a quantum many-body system, the general form of the Hamiltonian can be written as
\begin{equation}
H=H_{0}+\gamma H_{1} ,
\end{equation}
where $H_{1}$ is the interaction Hamiltonian and $\gamma$ is a control parameter. For two pure states $\left|\psi(\gamma)\right\rangle$ and $\left|\psi(\gamma')\right\rangle$ the fidelity is written as \cite{Gu10}
\begin{equation}
F(\gamma,\gamma')=|\left\langle\psi(\gamma)\right.\left|\psi(\gamma')\right\rangle| .
\end{equation}
The fidelity measures the amount of shared information between two quantum states, being its geometric interpretation the closeness of these states. Being a QPT a sudden change in the ground state properties of a system when a control parameter varies, a minimum in the fidelity allows to locate and characterize the QPT. Its second derivative, the fidelity susceptibility, is even more sensitive to the QPT. Expanding the fidelity around its minimum, for $\gamma-\gamma'$ small, we have \cite{Gu10}
\begin{equation}
F(\gamma,\gamma')=1-\frac{(\gamma-\gamma')^{2}}{2}\chi^{F}+...
\end{equation}
The fidelity susceptibility $\chi^{F}$ can be expressed as
\begin{equation}
\chi^{F}(\gamma)=\lim_{\gamma-\gamma'\rightarrow 0} \frac{-2\,\mbox{ln}F(\gamma,\gamma')}{(\gamma-\gamma')^{2}}=\frac{2(1-F(\gamma,\gamma'))}{(\gamma-\gamma')^{2}},
\end{equation}
being the first form in terms of the logarithmic fidelity. It is useful to choose $\gamma'=\gamma+d\gamma$ in order to vary $\gamma$ while taking the limit $d\gamma \rightarrow 0$.
In the thermodynamic limit, the fidelity goes to zero in the QPT, while the susceptibility goes to infinity. For finite systems, in the critical value of the coupling $\gamma_{max}$, the fidelity and its susceptibility show the \emph{precursor} of the QPT by obtaining a minimum and a maximum value, respectively. Calculating the behavior of these quantities (the critical coupling parameter and the maximum value of the susceptibility) allows us to derive their critical exponents as a function of the number of atoms $\mathcal{N}$ \cite{Ocasta12, Nahmad12}. Furthermore, one can obtain universal curves for some observables like the fidelity \cite{Gu12} or the susceptibility. For a finite scale analysis, we can define a universal quantity called the specific susceptibility \cite{Kwok08},
\begin{equation}
\chi_{s}=\frac{\chi^{F}(\gamma_{max})-\chi^{F}(\gamma)}{\chi^{F}(\gamma)} .
\end{equation}
The specific susceptibility is useful to compare systems with different number of atoms.
In this work we calculate the fidelity and its susceptibility for the ground state of the finite Dicke model, performing a numerical diagonalization of the Hamiltonian. Using the fidelity formalism we locate the precursor of the QPT for each $\mathcal{N}$. With it, we find numerically the critical exponent of the coupling parameter, which tends to $\gamma_{c}=\sqrt{\omega\omega_{0}}/2$, the critical value in the thermodynamic limit. We also study the behavior of the minimum of the fidelity and the maximum of its susceptibility as $\mathcal{N}$ grows, finding their critical exponents. We build the universal curve of the specific susceptibility, which confirms the value of the critical exponent. Finally, we make a brief discussion of the ground state wave function precision as a function of the coupling strength.
\section{Numerical solution}
In order to solve numerically the Dicke Hamiltonian we employ extended bosonic coherent states \cite{Chen08,Basta11}. They are built with the displaced boson operators $A^{\dagger}, A$, obtained by shifting the original annihilation operator $a$:
\begin{equation}
A=a+\frac{2\gamma}{\omega\sqrt{\mathcal{N}}}J_{x} .
\end{equation}
The new basis is $\{ \left|N;j,m\right\rangle \}$, where $N$ is an eigenvalue of the new number operator $A^{\dagger}A$, $j= \mathcal{N}/2$ and $m$ is an eigenvalue of $J_x$. It allows for the determination of ground state properties in the superradiant region far beyond previous attempts \cite{Chen08},
and also of excited states with a single truncation \cite{Basta12}.
To solve the Hamiltonian numerically we must truncate the Hilbert space, which is infinite due to the presence of the number operator in the Hamiltonian.
In order to estimate the minimal truncation to be employed, we use a criterion based on the precision of the wave function, which we call the $\Delta P$ criterion \cite{Basta13}. We express the ground state wave function as:
\begin{equation}
|\Psi(N_{max})\rangle=\sum\limits_{N=0}^{N_{max}} \sum\limits_{m=-j}^{j} C_{N,m} |N;j,m\rangle,
\end{equation}
where $C_{N,m}$ are the coefficients of the exact ground state wave function and $N_{max}$ is the value of the truncation in the number of displaced excitations. The probability $P_{N}$ of having $N$ excitations in the ground state is:
\begin{equation}
P_{N}=|\langle N|\Psi\rangle|^{2}=\sum_{m}|C_{N,m}|^{2}
\end{equation}
We define the precision in the calculated wave function as (see Appendix)
\begin{equation}
\Delta P=\sum\limits_{m=-j}^j \left|C_{N_{max}+1,m}(N_{max}+1)\right|^2.
\end{equation}
By diagonalizing the Hamiltonian with several truncations, if $ \Delta P$ is smaller than certain tolerance we consider that the solution has converged, being $N_{max}$ the minimum value of the truncation necessary for obtaining the exact numerical solution.
\section{Results}
We calculate the fidelity and its susceptibility as functions of the coupling $\gamma$ for the ground state by solving numerically the Hamiltonian. In figures \ref{fig:1} and \ref{fig:2} we show the fidelity for several values of $\mathcal{N}$ from $100$ to $1000$. The same goes for the fidelity susceptibility in figures \ref{fig:3} and \ref{fig:4}. In these calculations we use $\omega=\omega_{0}=1$ (resonance) being $\gamma_{c}=0.5$ the critical value of the coupling in the thermodynamic limit.
\begin{figure}
\caption{\label{fig:1}
\label{fig:1}
\end{figure}
\begin{figure}
\caption{\label{fig:2}
\label{fig:2}
\end{figure}
\begin{figure}
\caption{\label{fig:3}
\label{fig:3}
\end{figure}
\begin{figure}
\caption{\label{fig:4}
\label{fig:4}
\end{figure}
We can locate the coupling's critical value $\gamma_{max}$, the value where the quantum phase crossover (the precursor of the QPT) takes place, by identifying the minimum of the fidelity and the maximum of its susceptibility. In figure \ref{fig:5} the value of $\gamma_{max}$ is shown for each $\mathcal{N}$ in a logarithmic scale. A linear fit gives us
\begin{equation}
\begin{split}
Log_{10}\left(\gamma_{max}-\gamma_{c}\right)&=-0.285094 - 0.668233 \, Log_{10}\left(\mathcal{N}\right) ,\\
\left(\gamma_{max}-\gamma_{c}\right)&=0.518688 \, \mathcal{N}^{-0.668223} .
\end{split}
\end{equation}
Where we can obtain the critical exponent $\nu=0.668223\simeq 2/3$, which agrees with previous results \cite{Ocasta12,Nahmad12}.
\begin{figure}
\caption{\label{fig:5}
\label{fig:5}
\end{figure}
In figure \ref{fig:6} the logarithm of the minimum value of the fidelity $log_{10}\left(F_{min}\right)$ is plotted against the logarithm of the number of atoms.
\begin{figure}
\caption{\label{fig:6}
\label{fig:6}
\end{figure}
The points call for a quadratic fit, which is:
\begin{equation}
Log_{10}(F_{min})=0.000351536-6.90731\times 10^{-6} \mathcal{N}-4.23857\times 10^{-9} \mathcal{N}^{2} .
\end{equation}
We expect that, as we increase the number of atoms, the coefficient of the quadratic term will go to zero. In other words, the quadratic contribution is required by the small $\mathcal{N}$ values, from $100$ to $200$.
Fig. \ref{fig:7} displays the logarithm of maximum value of the fidelity susceptibility $\chi^{F}_{max}$ as a function of the logarithm of the number of atoms.
\begin{figure}
\caption{\label{fig:7}
\label{fig:7}
\end{figure}
Fitting linearly the logarithmic curve between the maximum of the susceptibility and $\mathcal{N}$ we obtain:
\begin{equation}
\begin{split}
Log_{10}\left(\chi^{F}_{max}\right)&=0.579291+ 1.36739 \, Log_{10}\left(\mathcal{N}\right),\\
\chi^{F}_{max}&=3.79569 \, \mathcal{N}^{1.36739} .
\end{split}
\end{equation}
The critical exponent is in this case $1.36739\simeq 4/3$ which agrees with the one found for the Lipkin-Meshkov-Glick model \cite{Hirsch13}, which belongs to the same universality class \cite{Dus04}.
Also, we can calculate the universal curve of the specific susceptibility for every value of $\mathcal{N}$. We show the curve in figure \ref{fig:8}. The universal curve guarantees that the critical exponent is correct, because the curves for all $\mathcal{N}$ converge to one curve in the region around the critical value of the coupling strength $\gamma_{max}$. The results of figure \ref{fig:8} agree with the ones in \cite{Liu09}.
\begin{figure}
\caption{\label{fig:8}
\label{fig:8}
\end{figure}
Finally, in figure \ref{fig:9} we show $\Delta P$ for the ground state as a function of the coupling for $\mathcal{N}=100$. As it can be observed, close to the phase transition precursor, which for this number of atoms takes place at $\gamma_{max}=0.523$, the numerical precision of the ground state wave function becomes smaller. The maximum of this curve occurs at a value of the coupling constant close to, but different from, the $\gamma_{max}$ calculated through the fidelity and its susceptibility. In all cases the $\Delta P$ is small enough to consider that the solution has converged. This behavior repeats for every $\mathcal{N}$. The maximum of the $\Delta P$ behaves in a similar way as $\gamma_{max}$ when the number of atoms grows, taking place closer and closer to $\gamma_c$ in the thermodynamic limit.
\begin{figure}
\caption{\label{fig:9}
\label{fig:9}
\end{figure}
\section{Conclusions}
We have calculated the fidelity and its susceptibility for the ground state of the finite Dicke model, as functions of the coupling parameter strength, in resonance, for several values of the number of atoms. We located the phase transition for each value of $\mathcal{N}$ using the fidelity formalism, and characterized the phase transition by calculating the critical exponents of the critical values of the coupling and the maximum values of the susceptibility, by fitting logarithmically the curves of both as functions of $\mathcal{N}$. The critical exponents are
\begin{equation}
\left(\gamma_{max}-\gamma_{c}\right)\simeq N^{-0.668223}\simeq N^{-2/3}\,\,\,\mbox{and}\,\,\,\chi^{F}_{max}\simeq N^{1.36739}\sim N^{4/3}.
\end{equation}
Also, we fitted a quadratic curve of the logarithm of the fidelity as a function of the number of atoms. We validated the values found for the critical exponents plotting the universal curve of the specific susceptibility. Finally, we exhibited that the precision of the ground state wave function (which we use to determine the minimal truncation necessary to have the exact numerical solution) have a maximum near the finite $\mathcal{N}$ phase crossover. Interestingly, those maxima occur at a coupling values slightly different from the ones obtained through the maximum of the fidelity susceptibility .
\section{Acknowledgments}
This work was partially supported by CONACyT-M\'exico and DGAPA-UNAM project IN102811.
\section{Appendix}
In order to estimate the convergence in the wave function $|\Psi(N_{max})\rangle$, we assume that a similar diagonalization was performed with a truncation $N_{max}-1$, which provides $|\Psi(N_{max}-1)\rangle$. To compare both wave functions we extend the latter by assigning $C_{N_{max},m}(N_{max}-1)=0$
We define the precision in the calculated wave function as:
\begin{equation}
\begin{split}
\Delta P &\equiv 1-\left|\langle \Psi(N_{max}-1)|\Psi(N_{max})\rangle \right| \nonumber \\
&= 1- \left|\sum\limits_{N,N'=0}^{N_{max}}\sum\limits_{m,m'=-j}^j C_{N',m'}(N_{max}-1) C_{N,m}(N_{max}) \langle N';j,m' | N;j,m\rangle \right| \\
&= 1- \left|\sum\limits_{N=0}^{N_{max}-1}\sum\limits_{m=-j}^j C_{N,m}(N_{max}-1) C_{N,m}(N_{max})\right|
\end{split}
\end{equation}
We assume that $N_{max}-1$ is large enough to allow the wave function to be close to convergence. It implies that adding to the Hilbert space the states with $N_{max}$ photon excitations, the components $C_{N,m}, N\le N_{max}-1$ will have small changes, conserving their respective phases (but for a global one) with their magnitude remaining constant or slightly decreasing to allow for non-zero $C_{N_{max},m}$ new contributions. This condition can be expressed as
\begin{equation}
\left|C_{N,m}(N_{max}-1)\right| \ge \left|C_{N,m}(N_{max})\right| , \,\,\, N\le N_{max}-1. \nonumber
\end{equation}
It follows that
\begin{equation}
\begin{split}
\left|\sum\limits_{N=0}^{N_{max}-1}\sum\limits_{m=-j}^j C_{N,m}(N_{max}-1) C_{N,m}(N_{max})\right| \ge
\sum\limits_{N=0}^{N_{max}-1}\sum\limits_{m=-j}^j \left|C_{N,m}(N_{max})\right|^2 \nonumber \end{split},
\end{equation}
and
\begin{equation}
\begin{split}
\Delta P &\leq 1- \sum\limits_{N=0}^{N_{max}-1}\sum\limits_{m=-j}^j \left|C_{N,m}(N_{max})\right|^2 \nonumber \\
&= \sum\limits_{m=-j}^j \left|C_{N_{max},m}(N_{max})\right|^2 . \nonumber
\end{split}
\end{equation}
We employ the equality to obtain an upper bound to the precision of the calculated wave functions.
\section*{References}
\end{document}
|
math
|
Resources > Datacenters list > POHODA-SERVIS spol. s r.o.
Name POHODA-SERVIS spol. s r.o.
|
english
|
इप्ल में आज चेन्नई और मुंबई के बीच भिड़ंत, ये हो सकती है प्लेइंग इलेवन | न्यूज़ २४
साथ ही इस सीजन में खेले गए पहले मैच में भी मुंबई ने चेन्नई को ३७ रनों से पराजित किया था। भले ही रिकार्डस में मुंबई इंडियंस का पलड़ा भारी हो, लेकिन इस सीजन में चेन्नई ने अब तक शानदार खेल दिखाया हैं। अंकतालिका में चेननई ११ मैचों में ८ जीत के साथ शीर्ष पर बरकरार हैं, तो वही मुंबई १० मैचो में ६ जीत और ४ हार के साथ तीसरे पायदान पर चल रही है।
ऐसे में मुंबई आज का मैच जीतकर टाप २ में शामिल होना चाहेगी। चेन्नई को अपने मिडिल आर्डर बल्लेबाजों से उम्मीद होंगी। इस सीजन में चेन्नई सुपर किंग्स के मिडिल आर्डर बल्लेबाजो ने काफी निराश किया है।टीम को केदार, रायूडु और रैना से अच्छी पारी की उम्मीद होगी। साथ ही, शेन वाटसन के फार्म में आने से चेन्नई ने राहत की सांस ली होगी।
गेंदबाजी में धोनी, अपने विजयी संयोजन के साथ बने रहना चाहेंगे। मुंबई के कप्तान रोहित शर्मा भी अब तक अपनी शुरुआत को बड़ी पारी में तब्दील नहीं कर पाए हैं। वहीं अंत में मुंबई के पास हार्दिक पांड्या जैसा खिलाड़ी है जो तेजी से रन बना सकता है। दूसरी तरफ, गेंदबाजी की बागडोर जसप्रीत बुमराह के हाथों में होगी। लसिथ मलिंगा का अनुभव भी मुंबई के लिए कारगार साबित हो सकता है। देखा जाए तो मौसम ज्यादा गर्म के कारण की वजह से पिच का ड्राई होना लगभग तय है। पिच से स्पिनरों को मदद मिल सकती है। पिच पर १६० का स्कोर भी चुनौतीपूर्ण हो सकता है। आपको बता दें कि इस सीजन में अब तक पिच स्पिन गेंदबाजों के लिए मददगार साबित हुई है।संभावित क्सी-चेन्नई सुपर किंग्सः शेन वॉटसन, फैफ डुप्लेसी, सुरेश रैना, अंबाती रायुडू, केदार जाधव, महेंद्र सिंह धौनी (कप्तान), रविंद्र जडेजा, ड्वेन ब्रावो, हरभजन सिंह, दीपक चाहर, इमरान ताहिर।मुंबई इंडियंसः रोहित शर्मा (कप्तान), क्विंटन डिकॉक, सूर्यकुमार यादव, इशान किशन, कीरन पोलार्ड, हार्दिक पांड्या, कुणाल पांड्या, राहुल चाहर, जेसन बेहरनडॉर्फ, लसिथ मलिंगा, जसप्रीत बुमराह।
मतगणना के दौरान हिंसा की आशंका, गृह मंत्रालय ने सभी राज्यों को भेजा अलर्ट
|
hindi
|
XD I just hope that the inspiration doesn't leave me when I go to sleep!
Luke, Jeni, and Ama three (four counting myself) HBHers online hahaha. Cools.
Haha well I know five for sure, after that IDK.Nm, oh I replyed to our thread on HBh Ama.
I thought you meant Chuck Norris for a minute hahahaha.
Maybe Chuck Norris is a chuck fan as well hahaha.
If he has any sense, he will be. Chuck is the most epic tv show ever.... even better than Heroes! .... And just surpassing Doctor Who. And Star Trek.
After I finish a post here i'll go check it out!
WHOOP!!! You will not regret it, my friend. Prepare to have your mind blown by the level of awesomeness!
NOTHING surpasses Star Trek and Doctor Who. Not even Merlin. So... there.
Chuck does. And this is coming from someone named after Jean-Luc who loves Star Trek, Doctor Who, Merlin and Heroes.
Starting the first episode of chuck it in 3..........2..............1............ now!!!!! I also love the last name I have here, I stole it from one of my favorite singers hahaha .
Lucien Davis wrote: And just surpassing Doctor Who. And Star Trek.
HOW DARE YOU SAY THAT!!!!! AND HOW CAN YOU BE A STAR TREK FAN!?!?! STAR WARS IS SOOOOOOOooooooooOOOOO MUCH BETTER!!!!
Because I love both Star Trek AND Star Wars!
Why did they have to kill Bryce? Matt Bomer (the guy who played all five seconds of Bryce) ss my favorite actor haha ! The show is awesome!
Grrrrr oh well, atleast I know now haha.
XD going back to the people from hbh and not from it..
*kicks site* C'mon guys! Wakey-wakey! I HAVE BACON!!!... Nothing? Reeeeeaaaaaally?
Herro Ama! Ivy's getting a reply up, and then I'll get mine done in the thread 8D How're ya today?
|
english
|
تہٕ شاید ما نِیہِ پننہِ کٔڈِتھ ژھٕنۍ مَژِ زنانہِ واپس تہٕ پَنہٕ نِس بہادر تہٕ چالاک نیٚچوِس بیٚہناوِ تختس
|
kashmiri
|
क्रिएटिव और फनी अंदाज में रिलीज हुआ 'लूटकेस' का फर्स्ट लुक पोस्टर
फ़िल्म का पोस्टर शेयर करते हुए फॉक्स स्टार स्टूडियो ने लिखा, यह कुछ जाना पहचाना सा लग रहा है, है ना? पर आशिकी आखिरकार किसके साथ चल रही है। #लूटकेस, इस बैग में कुछ काला है। यह फिल्म ११ अक्टूबर को रिलीज होगी।
फॉक्स स्टार स्टूडियो ने सोशल मीडिया पर एक मज़ेदार और पहले आधिकारिक पोस्टर के साथ अपनी आगामी फिल्म 'लूटकेस' की घोषणा कर दी है, साथ ही फ़िल्म की रिलीज की तारीख का भी ऐलान कर दिया है। फिल्म का पोस्टर 'आशिकी २' के पोस्टर से मिलता जुलता है, फर्क सिर्फ इतना है यहां पोस्टर में एक व्यक्ति ने लाल सूटकेस पकड़ा हुआ है।
इससे पहले, आज दिन की शुरुआत में एक्टर कुणाल खेमू ने ट्विटर पर एक वीडियो साझा किया था जो एक प्रेम पत्र था जहां अभिनेता ने व्यक्त किया कि वह अपने 'प्यार' को पा कर कितना भाग्यशाली महसूस कर रहे थे।
लुटकेस के निर्माताओं ने एक पुरानी फिल्म से प्रेरणा लेते हुए और एक अद्वितीय मार्केटिंग कैंपेन के साथ फिल्म का एक मज़ेदार पोस्टर जारी किया है जहां निर्माताओं ने मुख्य एलिमेंट को लाल सूटकेस के साथ बदल दिया है।
लुटकेस में मुख्य अभिनेता कुणाल खेमू के साथ गजराज राव, रसिका दुग्गल, रणवीर शौरी और विजय राज नज़र आएंगे। फिल्म राजेश कृष्णन द्वारा निर्देशित और फॉक्स स्टार स्टूडियो एवं सोडा फिल्म्स प्रोडक्शंस द्वारा निर्मित है।
'लूटकेस' के विचित्र पोस्टर्स के साथ ट्रेलर का हुआ अनाउंसमेंट!
फॉक्स स्टार की कॉमेडी फिल्म 'लूटकेस में खुणाल खेमू, रसिका दुग्गल और गजराज राव मचाएंगे धमाल
|
hindi
|
\begin{document}
\title{Counting Humps in Motzkin paths}
\author{Yun Ding and Rosena R. X. Du\footnote{Email: [email protected].} \\ \\ Department of Mathematics, East China Normal University\\
500 Dongchuan Road, Shanghai, 200241, P. R. China.}
\date{August 20, 2011}
\maketitle
\vskip 0.7cm \noindent{\bf Abstract.}
In this paper we study the number of humps (peaks) in Dyck, Motzkin and Schr\"{o}der paths.
Recently A. Regev noticed that the number of peaks in all Dyck paths of order $n$ is one half of the number of super Dyck paths of order $n$. He also computed the number of humps in Motzkin paths and found a similar relation, and asked for bijective proofs. We give a bijection and prove these results. Using this bijection we also give a new proof that the number of Dyck paths of order $n$ with $k$ peaks is the Narayana
number. By double counting super Schr\"{o}der
paths, we also get an identity involving products of
binomial coefficients.
\vskip 3mm \noindent {\it Keywords}: Dyck paths, Motzkin paths,
Schr\"{o}der paths, humps, peaks, Narayana number.
\noindent {\bf AMS Classification:} 05A15.
\section{Introduction}
A \emph{Dyck path} of order (semilength) $n$ is a lattice path in
$\mathbb{Z}\times\mathbb{Z}$, from $(0,0)$ to $(2n,0)$, using
up-steps $(1,1)$ (denoted by $U$) and down-steps $(1,-1)$ (denoted by
$D$) and never going below the $x$-axis. We use $\mathcal {D}_{n}$ to denote the set of Dyck paths of order $n$. It is well known that $\mathcal {D}_{n}$ is counted by the $n$-th \emph{Catalan number} (A000108 in \cite{sequence})
\[C_{n}=\frac{1}{n+1}{{2n}\choose{n}}.\]
A \emph{peak} in a Dyck path is two consecutive steps $UD$. It is also well known (see, for example, \cite{Deutsch, Narayana, stanleyec2}) that the number of Dyck paths of order $n$ with $k$
peaks is the \emph{Narayana number} (A001263):
\[N(n,k)=\frac{1}{n}{{n}\choose{k}}{{n}\choose{k-1}}.\]
Counting Dyck paths with restriction on peaks has been studied by many authors, see for example \cite{Mansour1, Mansour2, PeartWoan}. Here we are interested in counting peaks in all Dyck paths of order $n$. By summing over the above formula over $k$ we immediately get the following result: the total number of peaks in all Dyck paths of order $n$ is
\[pd_{n}=\sum_{k=1}^{n}kN(n,k)={{2n-1}\choose{n}}.\]
If we allow a Dyck path to go bellow the $x$-axis, we get a \emph{super Dyck path}. Let $\mathcal{SD}_{n}$ denote the set of super Dyck paths of order $n$. By standard arguments we have
\begin{equation}\label{2Dyck}
sd_{n}=\#\mathcal{SD}_{n}={{2n}\choose{n}}=2{{2n-1}\choose{n}}=2 pd_{n},
\end{equation}
That is, the number of super Dyck paths of order $n$ is twice the number of peaks in all Dyck paths of order $n$. This curious relation was first noticed by Regev \cite{HumpsRegev}, who also noticed that similar relation holds for Motzkin paths, which we will explain next.
A \emph{Motzkin path of order $n$} is a lattice path in
$\mathbb{Z}\times\mathbb{Z}$, from $(0,0)$ to $(n,0)$, using
up-steps $(1,1)$, down-steps $(1,-1)$ and flat-steps $(1,0)$ (denoted by $F$) that never goes below
the $x$-axis. Let $\mathcal {M}_{n}$ denote all
the Motzkin paths of order $n$. The cardinality of
$\mathcal {M}_{n}$ is the $n$-th \emph{Motzkin number} $m_{n}$ (A001006), which satisfies the following recurrence relation
\[m_{0}=1,~~m_{1}=1,~~m_{n}=m_{n-1}+\sum_{i=2}^{n}m_{i-2}m_{n-i}, ~~for~~ n\geq2,\]
and have generating function
\[\sum_{n\geq0}m_{n}x^{n}=\frac{1-x-\sqrt{1-2x-3x^{2}}}{2x^{2}}.\]
A \emph{hump} in a Motzkin path is an up step followed by zero or more flat steps followed by a down step. We use $hm_{n}$ to denote the total number of humps in all Motzkin paths of order $n$. We can similarly define \emph{super Motzkin paths} to be Motzkin paths that are allowed to go below the $x$-axis, and use $\mathcal{SM}_n$ to denote the set of super Motzkin paths of order $n$. Using a recurrence relation and the WZ method \cite{A=B,Zeilberger}, Regev (\cite{HumpsRegev}) proved that
\begin{equation}\label{2Motzkin}
sm_{n}=\#\mathcal{SM}_{n}=\sum_{j\geq0}{{n}\choose{j}}{{n-j}\choose{j}}=2 hm_{n}+1
\end{equation}
and asked for a bijective proof of \eqref{2Dyck} and \eqref{2Motzkin}. The main result of this paper is such a bijective proof.
Let $\mathcal{SM}_{n}^{UU}(k)$ ($\mathcal{SM}_{n}^{UD}(k)$) denote the set of paths in $\mathcal {SM}_{n}$ with $k$ peaks and the first non-flat step is $U$, and the last
non-flat step is $U$ ($D$). Let $\mathcal {SM}_{n}^{U*}$ denote all paths in $\mathcal {SM}_{n}$ whose first non-flat step is $U$, and define
\[\mathcal{HM}_{n}=\{(M,P)|M\in\mathcal{M}_{n},\text{$P$ is a hump of $M$}\}.
\]
The main result of this paper is the following:
\begin{theo}\label{th:main}
There is a bijection $\Phi: \mathcal{HM}_{n} \rightarrow \mathcal{SM}_{n}^{U*}$ such that if
$(M,P)\in\mathcal{HM}_{n}$ and $L=\Phi(M,P)$, then there are $k$ humps in $M$ if and only if $L \in\mathcal{SM}_{n}^{UU}(k-1)\cup\mathcal{SM}_{n}^{UD}(k).$
\end{theo}
The outline of the paper is as follows. In Section 2 we define the bijection $\Phi$ and prove Theorem \ref{th:main}. In section 3 we apply $\Phi$ to Dyck paths and give a new proof of the Narayana numbers. In section 4 we apply $\Phi$ to Schr\"{o}der paths and get an identity involving products of binomial coefficients by double counting super Schr\"{o}der paths whose $F$ steps are $m$-colored.
\section{The bijection $\Phi:\mathcal{HM}_{n}\leftrightarrow\mathcal{SM}_{n}^{U*}$}
Note that a Motzkin path $M$ of order $n$ can also be considered as a sequence
$M=M_{1}M_{2}\cdots M_{n},$ with $M_{i}\in\{U,F,D\},$ and the
number of $U$'s is not less than the number of $D$'s in every subsequence
$M_{1}M_{2}\cdots M_{k}$ of $M$. Hence a hump in $M$ is a subsequence $P=M_{i}M_{i+1}\cdots M_{i+k+1}, k\geq 0$, such that $M_{i}=U$, $M_{i+1}=M_{i+2}=\cdots=M_{i+k}=F$ and $M_{i+k+1}=D$. We call the end point of step $M_{i}$ a \emph{hump point}, and will also denoted as $P$. Similarly, if there exists
$i$ such that $M_{i}=D$, $M_{i+1}=M_{i+2}=\cdots=M_{i+k}=F, k\geq0$, $M_{i+k+1}=U$, then we
call the subsequence $M_{i}M_{i+1}\cdots M_{i+k+1}$ a \emph{valley} of $M$, and the end point of $M_{i+k}$ is called a
\emph{valley point}. The end point $(n,0)$ of $M$ is also considered as a
valley point.
Suppose $L$ is a path in $\mathbb{Z}\times\mathbb{Z}$ from $O(0,0)$ to $N(n,0)$, and $A$ a lattice point on $M$, we use $x_{A}$ and $y_{A}$ to denote the $x$-coordinate and $y$-coordinate of $A$, respectively. The sub-path of $L$ from point $A$ to point $B$ is denoted by
$L_{AB}$. We use $\bar{L}$ to denote the lattice path obtained from $L$ by interchanging all the up-steps and down-steps in $L$, and keep the
flat-steps unchanged.
Now we are ready to define the map $\Phi$ and prove Theorem \ref{th:main}.
\noindent {\it Proof of Theorem \ref{th:main}}:
(1) The map $\Phi:\mathcal{HM}_{n}\rightarrow\mathcal{SM}_{n}^{U*}$.
For any $(M,P)\in\mathcal{HM}_{n}$, we define $L=\Phi(M,P)$ by the following rules:
\begin{itemize}
\item Let $C$ be the leftmost valley point in $M$ such that $x_{C}>x_{P}$;
\item Let $B$ be the rightmost point in $M$ such that $x_{B}<x_{P},y_{B}=y_{C}$;
\item Let $A$ be the rightmost point in $M$ such that $y_{A}=0, x_{A}\leq x_{B}$;
\item Set $L_{0}=M_{OA}$, $L_{1}=M_{AB}$, $L_{2}=M_{BC}$, $L_{3}=M_{CN}$ (Note that $L_{0}$, $L_{1}$ and $L_{3}$ may be empty);
\item Define $L=\Phi (M,P)=L_{0} L_{2} \overline{L_{3}} \overline{L_{1}}$.
\end{itemize}
Now we will prove that ~$L\in \mathcal {S}\mathcal {M}_{n}^{U*}$. According to the above definition, $L_0$ and $L_{2}$ are both Motzkin paths, therefore $\#U=\#D$ in $L_{0}$ and $L_{2}$. And for $L_{1}$, we have $\#U-\#D=y_{B}-y_{A}=y_{B}=y_{C}$, for $L_{3}$, $\#U-\#D=-y_{C}$. Therefore the total number of $U$'s is as much as that of $D$'s in $L$. Thus $L$ is a super Motzkin
path of order $n$. Moreover, the first non-flat step in $L$ must be
in $L_{0}$ (when $L_{0}$ is not empty) or in $L_{2}$ (when $L_{0}$ is empty), and $L_{0}, L_{2}$ are both Motzkin paths, hence the first step leaving the $x$-axis must be a $U$. Therefore we proved that $L=\Phi (M,P)\in\mathcal{SM}_{n}^{U*}$.
(2) The inverse of $\Phi$.
For any $L\in \mathcal {S}\mathcal {M}_{n}^{U*}$, we define $\Psi$ by the following rules:
\begin{itemize}
\item Let $B$ be the leftmost point such that $y_{B}=0$, and $L$ goes below the $x$-axis after $B$. (If such a point does not exist, then set $B=N$);
\item Let $A$ be the rightmost point in $L$ such that $x_{A}<x_{B}, y_{A}=0$;
\item Let $C$ be the rightmost point in $L$ such that $x_{C}\geq x_{B}$, and $\forall G$, $x_{G}\geq x_{B}$ implies that $y_{C}\geq y_{G}$;
\item Let $P$ be the rightmost hump point in $L$ such that $x_{P}<x_{B}$;
\item Set $L_{0}=L_{OA}$, $L_{1}=L_{AB}$, $L_{2}=L_{BC}$, $L_{3}=L_{CN}$ (Note that $L_{0}$, $L_{2}$ and $L_{3}$ may be empty);
\item Set $M=L_{0}\overline{L_{3}}L_{1}\overline{L_{2}}$, and $\Psi(L)=(M,P)$.
\end{itemize}
Now we prove that $\Psi=\Phi^{-1}$. Since $C$ is the highest point in $L_{3}$, and
$\overline{L_{3}}$ and $L_{3}$ are symmetric with respect to the line
$y=y_{C}$, $C$ is mapped to the lowest point in
$\overline{L_{3}}$. Moreover, $L_{0}$ and $L_{1}$ are both Motzkin
paths, then ${L_{0}}\overline{L_{3}}L_{1}$ does not go below
the $x$-axis, and the $y$-coordinate of the end point of ${L_{0}}\overline{L_{3}}L_{1}$ is
$y_{C}$. In $\overline{L_{2}}$, the end point is the lowest point, and the start point of $\overline{L_{2}}$ is $y_{C}$ higher than the end point. So
$M=L_{0}\overline{L_{3}}L_{1}\overline{L_{2}}$ ends on the $x$-axis and never goes below it, i.e., $M \in \mathcal{M}_n$. Thus $\Psi(L) \in \mathcal{HM}_n$, and it is not hard to see that $\Psi=\Phi^{-1}$.
(3) There are $k$ humps in $M$ if and only if $\Phi(M,P)\in\mathcal {SM}_{n}^{UD}(k)\cup\mathcal{SM}_{n}^{UU}(k-1).$
Since $\Phi (M)=L_{0} L_{2} \overline{L_{3}} \overline{L_{1}}=L$, the number of humps changes only in sub-paths $\overline{L_{3}}$ and $ \overline{L_{1}}$ when $M$ is converted to $L$. If the last step of $L_{1}$ is $U$, then the last step in $\overline{L_{1}}$ becomes $D$. The
number of humps in $L_{1}$ is the same as the number of humps in $\overline{L_{1}}$, and the number of
humps in $\overline{L_{3}}$ is $1$ less than the number of humps in $L_{3}$. The
last step in $\overline{L_{3}}$ is $U$ step, so concatenating
$\overline{L_{1}}$ with $\overline{L_{3}}$ yields a new hump. Therefore the total number of humps in $L$ is the same as in $M$. Thus we have $\Phi(M,P)\in\mathcal
{S}\mathcal {M}_{n}^{UD}(k).$
If the last step in $L_{1}$ is $D$, then the last step in
$\overline{L_{1}}$ is $U$. The number of humps in $\overline L_{1}$
is $1$ less than the number of humps in ${L_{1}}$, and the humps in $\overline{L_{3}}$
is $1$ less than the number of humps in $L_{3}$. Moreover, the last step in
$\overline{L_{3}}$ is $U$, so concatenating $\overline{L_{1}}$ with
$\overline{L_{3}}$ yields a new hump. Therefore the total number of humps in $L$ is $1$ less than the number humps in $M$. Thus we have $\Phi(M,P)\in\mathcal {S}\mathcal
{M}_{n}^{UU}(k-1).$
\rule{4pt}{7pt}
As an example, Figure \ref{Fig1} shows a Motzkin path $M \in \mathcal{M}_{41}$ with a circled hump point $P$, and Figure \ref{Fig2} shows a super Motzkin path $L \in \mathcal{SM}_{41}^{U*}=\Phi(M,P)$.
\begin{figure}
\caption{A Motzkin path $M \in \mathcal{M}
\label{Fig1}
\end{figure}
\begin{figure}
\caption{A super Motzkin path $L=\Phi(M,P)$. \label{Fig2}
\label{Fig2}
\end{figure}
From Theorem \ref{th:main} we can easily get the following result.
\begin{coro}\label{th:theorem1} For all $n \geq 0$, we have
\begin{equation}\label{eq:smhm}
sm_{n}=2hm_{n}+1,
\end{equation}
and
\begin{equation}\label{eq:hm}
hm_{n}=\frac{1}{2}\left(\sum_{j\geq0}{{n}\choose{j}}{{n-j}\choose{j}}-1\right).
\end{equation}
\end{coro}
\noindent {\it Proof.} Equation \eqref{eq:smhm} follows immediately from Theorem \ref{th:main}. To prove \eqref{eq:hm} we count super Motzkin paths with $j$ $U$ steps.
We can first choose the $j$ $U$ steps among the total $n$ steps, then
choose $j$ steps as $D$ steps among the remaining $n-j$ steps. Thus we have
\[
sm_{n}=\sum_{j\geq0}{{n}\choose{j}}{{n-j}\choose{j}}.
\]
Combine with equation \eqref{eq:smhm} we get equation
\eqref{eq:hm}.
\rule{4pt}{7pt}
\section{Counting peaks in Dyck paths and the Narayana numbers}
Note that when restricted to Dyck paths, $\Phi$ is a bijection between super Dyck paths and peaks in Dyck paths. Therefore we have the following result.
\begin{coro}\label{th:pdn} For all $n \geq 0$, we have
\begin{equation*}
sd_{n}=2pd_{n},
\end{equation*}
and
\begin{equation*}
pd_{n}={{2n-1}\choose{n}}.
\end{equation*}
\end{coro}
Moreover, from the bijection $\Phi$ we can easily get a new proof for the Narayana numbers. To this end we need the following lemma.
\begin{lem}\label{yinli}
Let $\mathcal {SD}_{n}^{UD}(k)$ ($\mathcal {SD}_{n}^{UU}(k)$) denote the set of super Dyck paths of order $n$ with $k$ peaks whose first step is $U$ and last step is $D$ ($U$), then we have
\begin{eqnarray}
\#\mathcal {SD}_{n}^{UD}(k)={{n-1}\choose{k-1}}^{2},\label{udpeak}\\
\#\mathcal{SD}_{n}^{UU}(k)={{n-1}\choose{k-1}}{{n-1}\choose{k}}\label{uupeak},
\end{eqnarray}
and the number of super Dyck paths with $k$ peaks of order $n$ is
${{n}\choose{k}}^{2}.$
\end{lem}
\noindent {\it Proof.} Each $L\in\mathcal {SD}_{n}^{UD}(k)$ can be written uniquely as a word $L=U^{x_1}D^{y_1}U^{x_2}D^{y_2}\cdots U^{x_k}D^{y_k}$, such that
\begin{equation*}
\begin{cases}
x_{1}+x_{2}+\cdots+ x_{k}=n, & x_1, x_2, \cdots, x_k\geq 1, \\
y_{1}+y_{2}+\cdots+y_{k}=n, & y_1, y_2, \cdots, y_k\geq 1.
\end{cases}
\end{equation*}
The number of solutions for the $x_i$'s and for the $y_i$'s both equal to ${{n-k+k-1}\choose{k-1}}={{n-1}\choose{k-1}}$. Hence equation \eqref{udpeak} is proved.
Each $L^{\prime}\in\mathcal {SD}_{n}^{UU}(k)$ can be written uniquely as a word $L^{\prime}=U^{x_1}D^{y_1}U^{x_2}D^{y_2}\cdots U^{x_k}D^{y_k}U^{x_{k+1}}$,
such that
\begin{equation*}
\begin{cases}
x_{1}+x_{2}+\cdots+ x_{k}+x_{k+1}=n, & x_1, x_2, \cdots, x_{k+1}\geq 1 \\
y_{1}+y_{2}+\cdots+y_{k}=n, & y_1, y_2, \cdots, y_k\geq 1
\end{cases}
\end{equation*}
There are ${{n-k+k+1-1}\choose{k}}={{n}\choose{k}}$ solutions for the $x_i$'s and
${{n-1}\choose{k-1}}$ solutions for the $y_i$'s. Hence equation \eqref{uupeak} is proved.
From \eqref{udpeak} and \eqref{uupeak} we have that the number of super Dyck paths with $k$ peaks of
order $n$ is
\begin{equation*}
{{n-1}\choose{k-1}}^{2}+{{n-1}\choose{k}}^{2}+2{{n-1}\choose{k-1}}{{n-1}\choose{k}}
={{n}\choose{k}}^{2}.
\end{equation*}
\rule{4pt}{7pt}
\begin{coro}
The number of Dyck paths of order $n$ with $k$ peaks is:
\[N(n,k)=\frac{1}{n}{{n}\choose{k}}{{n}\choose{k-1}}.\]
\end{coro}
\noindent {\it Proof.}
From theorem \ref{th:main} we know that each Dyck path of
order $n$ with $k$ peaks is mapped to $k$ super Dyck paths, and each of the
$k$ super Dyck paths is either in $\mathcal{SD}_{n}^{UU}(k-1)$ or in $\mathcal{SD}
_{n}^{UD}(k)$. Therefore we have $kN(n,k)=\#\mathcal {S}\mathcal
{D}_{n}^{UU}(k-1)+\#\mathcal {S}\mathcal {D}_{n}^{UD}(k).$ From
Proposition \ref{yinli} we can conclude that \[
N(n,k)=\frac{1}{k}\left({{n-1}\choose{k-1}}^{2}
+{{n-1}\choose{k-2}}{{n-1}\choose{k-1}}\right)=\frac{1}{n}{{n}\choose{k}}{{n}\choose{k-1}}.
\]
\rule{4pt}{7pt}
Bijective proof of this result can also be found in \cite[Exercise 6.36(a)]{stanleyec2}.
\section{Humps in Schr\"{o}der paths}
In this section we count the number of humps in a third kind of lattice paths: Schr\"{o}der paths. A
\emph{Schr\"{o}der path} of order $n$ is a lattice path in
$\mathbb{Z}\times\mathbb{Z}$, from $(0,0)$ to $(n,n)$, using
up-steps $(0,1)$, down-steps $(1,0)$ and flat-steps $(1,1)$ (denoted
by $U$, $D$, $F$, respectively) and never going below the line $y=x$.
Note that Schr\"{o}der paths are different from rotating Motzkin paths 45 degrees counterclockwise, since the $F$ steps in these two kinds of paths are different. However, the bijection $\Phi$ still works when counting humps in Schr\"{o}der paths. Let $ss_n$ denote the number of super Schr\"{o}der paths of order $n$, and $hs_n$ denote the number of humps in all Schr\"{o}der paths of order $n$. We have the following result.
\begin{coro}\label{th:psn} For all $n \geq 0$, we have
\begin{equation}\label{sshs}
ss_{n}=2hs_{n}+1,
\end{equation}
and
\begin{equation}\label{hs}
hs_{n}=\frac{1}{2}\left(\sum_{k=0}^{n}{{n+k}\choose{2k}}{{2k}\choose{k}}-1\right).
\end{equation}
\end{coro}
\noindent {\it Proof.} Apply the bijection $\Phi$ to Schr\"{o}der paths we immediately get \eqref{sshs}. Next we will count $ss_{n}$. Let $L$ be a super Schr\"{o}der path of order $n$ with $k$ humps, then there are $k$ $U$ steps,
$k$ $D$ steps, and $n-k$ $F$ steps in $L$. We can first choose a super Dyck path of order $k$ and then ``insert" $n-k$ $F$ steps to get $L$. There are ${2k \choose k}$ ways to choose a super Dyck paths, and ${{n-k+2k+1-1}\choose{2k}}={{n+k}\choose{2k}}$ ways for
the insertion. Therefore we have
\[
ss_{n}=\sum_{k=0}^{n}{{n+k}\choose{2k}}{{2k}\choose{k}}.
\]
From the above formula and \eqref{sshs} we get \eqref{hs}.
\rule{4pt}{7pt}
The above proof inspired us to get the following identity, which is listed as an exercise in \cite[Exercise 3(g) of Chapter 1]{stanleynew}.
\begin{coro}For all $n \geq 0$, we have
\begin{equation}\label{schid}
\sum_{k=0}^{n} {{n}\choose{k}}^{2}(m+1)^{k}
=\sum_{k=0}^{n}{{n+k}\choose{2k}}{{2k}\choose{k}}m^{n-k}.
\end{equation}
\end{coro}
\noindent {\it Proof.} We will first prove \eqref{schid} $m=1$. From the proof of Corollary \ref{th:psn} we
know that the right hand side of \eqref{schid} is the number of super
Schr\"{o}der paths of order $n$ when $m=1$ . Now we count $ss_{n}$ with a different
method to obtain the left hand. Let $L$ be a super Dyck path of order $n$ with $k$ peaks, for each peak of $L$, we can either keep it invariant or change it into a $F$ step to we get two super
Schr\"{o}der paths. Hence each $L$ is mapped to $2^{k}$ super Schr\"{o}der
paths, thus the left hand side of \eqref{schid} when $m=1$ also equals $ss_n$. Therefore we proved \eqref{schid} for $m=1$.
For general $m$ we count the number of super Schr\"{o}der paths in which the $F$ steps are $m$-colored. Now every super Dyck path with $k$ peaks is mapped to $(m+1)^k$ colored super Schr\"{o}der paths. So the total
number of such path is $\sum_{k=0}^{n}
{{n}\choose{k}}^{2}(m+1)^{k}$. On the other hand, from the proof of
Theorem \ref{th:psn} we know that the right hand side of \eqref{schid} also counts the number of such paths, hence we proved \eqref{schid}.
\rule{4pt}{7pt}
\vskip 2mm \noindent{\bf Acknowledgments.} This work is partially supported by the National Science Foundation of China under Grant No. 10801053, Shanghai Rising-Star Program (No. 10QA1401900), and the Fundamental Research Funds for the Central Universities.
\end{document}
|
math
|
\begin{document}
\title{Extending Growth Mixture Model to Assess Heterogeneity in Joint Development with Piecewise Linear Trajectories in the Framework of Individual Measurement Occasions}
\begin{abstract}
Researchers continue to be interested in exploring the effects that covariates have on the heterogeneity in trajectories. The inclusion of covariates associated with latent classes allows for a more clear understanding of individual differences and a more meaningful interpretation of latent class membership. Many theoretical and empirical studies have focused on investigating heterogeneity in change patterns of a univariate repeated outcome and examining the effects on baseline covariates that inform the cluster formation. However, developmental processes rarely unfold in isolation; therefore, empirical researchers often desire to examine two or more outcomes over time, hoping to understand their joint development where these outcomes and their change patterns are correlated. This study examines the heterogeneity in parallel nonlinear trajectories and identifies baseline characteristics as predictors of latent classes. Our simulation studies show that the proposed model can tell the clusters of parallel trajectories apart and provide unbiased and accurate point estimates with target coverage probabilities for the parameters of interest in general. We illustrate how to apply the model to investigate the heterogeneity in the joint development of reading and mathematics ability from Grade K to $5$. In this real-world example, we also demonstrate how to select covariates that contribute the most to the latent classes and transform candidate covariates from a large set into a more manageable set with retaining the meaningful properties of the original set in the structural equation modeling framework.
\end{abstract}
\keywords{Growth Mixture Model \and Joint Development of Nonlinear Trajectories \and Feature Selection \and Feature Extraction \and Individual Measurement Occasions}
\section{Introduction}\label{intro}
\subsection{Motivating Example}
Multiple existing studies have examined the longitudinal records of mathematics achievement scores from the Early Childhood Longitudinal Study, Kindergarten Class (ECLS-K), with the hope of understanding the potential heterogeneity in trajectories and the possible causes. For example, \citet{Kohli2015PLGC1} and \citet{Liu2019BLSGMM} explored a random sample from ECLS-K and ECLS-K: 2011, respectively, and have demonstrated that the development of mathematics ability can be modeled as latent classes of trajectories. Additionally, \citet{Liu2019BLSGMM} examined how the baseline covariates, such as socioeconomic status and teacher-reported abilities, inform the latent class formation of nonlinear trajectories of mathematics development.
However, developmental processes rarely unfold in isolation. For instance, \citet{Peralta2020PBLSGM} and \citet{Liu2021PBLSGM} investigated a random subset from ECLS-K and ECLS-K: 2011, respectively, and have shown that the change patterns of the development of reading ability and mathematics ability are correlated over time. With these findings, it is of great interest to further explore the joint development of reading and mathematics ability to answer (1) whether there are latent classes of joint development of the two abilities, (2) if so, whether the latent classes of joint development are different from those of univariate developmental process, and (3) how the baseline characteristics, including demographic information, socioeconomic status, and teacher rating scales, inform the clusters of the joint development of the two abilities. To answer these questions, we propose a growth mixture model of joint development that includes covariates as predictors of class membership. Following these existing studies, we assume that both the mathematics and reading developmental trajectories take the bilinear spline functional form with an unknown knot due to theoretical and empirical considerations, which we will elaborate on later in the introduction section.
\subsection{Growth Mixture Models for Joint Development}
Theoretical and empirical researchers widely utilize finite mixture models \citep{Muthen1999GMM} to explain heterogeneity in a sample through multiple and a finite number of probability distributions together in the sense of a linear combination. In practice, researchers usually assume that the within-class probability density function follows a normal distribution with a class-specific mean and variance, although these distributions may come from different or multiple different families in some circumstances. A growth mixture model (GMM) is a type of multivariate normal finite mixture model. The outcome matrix (i.e., the growth factors of individual trajectories) in the GMM is a mix of two or more latent subpopulations, each composed of their own multivariate normal distributions.
The GMM framework has received considerable attention over the past twenty years, with many studies examining its benefits. First, in a GMM, the within-class trajectories can take on almost any functional form of underlying change patterns, including parametric functions, such as linear, quadratic, and Jenss-Bayley growth curves, as well as nonparametric functions, such as spline growth curve. More importantly, the functional forms of trajectories are not necessarily the same across latent classes. For example, in a two-class GMM, trajectories in one class may take a quadratic functional form, whereas the curves in the other class may take a linear function where the mean and variance of the latent quadratic slope and quadratic-related covariances are zero. Moreover, the GMM is a probability-based approach with consideration of uncertainty, where posterior probabilities of class membership for each individual can be calculated. Additionally, researchers can utilize several statistical fit indices to decide the optimal model since the GMM is a model-based clustering method \citep{Nylund2007number}.
Although most studies of GMMs focused on a univariate repeated outcome, some theoretical studies have proposed multiple ways of approaching multiple longitudinal outcomes. For example, \citet{Zucker1995PGMM} constructed a joint mixed-effects model to deal with longitudinal data involving multiple response variables, with each outcome variable postulated to take a linear functional form. Alternatively, \citet{Putter2008PGMM} proposed a two-stage model to estimate the parameters. The estimates from the first stage include the class-specific mean vector and variance-covariance structure, plus the mixing proportions based on the first longitudinal outcome. The relation between the latent classes and the other outcome(s) and covariates are examined in the second step. In addition, \citet{Saebom2017PGMM} proposed a latent variable model that allows for examining underlying joint patterns of multiple latent class variables. Empirical researchers also desire to investigate the heterogeneity in joint development. For instance, \citet{Hix2004PGMM} employed a multivariate associative growth mixture model to analyze the heterogeneity in adolescent alcohol and marijuana use over time. In this article, following \citet{Zucker1995PGMM}, we apply the GMM framework to analyze joint development of multivariate repeated outcomes; that is, the submodel in each cluster is a multivariate growth model (MGM) \cite[Chapter~8]{Grimm2016growth}, also referred to as a parallel process and correlated growth model \citep{McArdle1988Multi}. Note that the major differences between the current study and \citet{Zucker1995PGMM} lie in that (1) the GMM for joint development in this study is constructed in the structural equation modeling (SEM) framework, and (2) each of longitudinal processes under investigation in this study postulated to take a nonlinear function, specifically, the bilinear spline functional form.
\subsection{Introduction of Bilinear Spline Functional Form}
One of the essential aspects of modeling change patterns is to capture the trajectory shape accurately. In longitudinal processes, the change patterns exhibit a nonlinear relationship to time $t$ when there are periods where change is more rapid than in others. There are multiple functional forms, such as polynomial, Jenss-Bayley, or piecewise, to describe the nonlinear change patterns. The choice of the functional form is important when depicting nonlinear trajectories. Driven by theoretical considerations, researchers usually decide the functional form to estimate parameters with an interpretation that aligns with research questions directly \citep{Cudeck2007Nonlinear}. The choice can also be an empirical selection: fit a pool of candidate models with different functional forms and select the function that best describes the change patterns.
Linear spline growth curve models \cite[Chapter~11]{Grimm2016growth}, also referred to as piecewise linear models \citep{Harring2006nonlinear, Kohli2011PLGC, Kohli2013PLGC1, Kohli2013PLGC2, Sterba2014individually, Kohli2015PLGC1}, are a statistical tool that allows for different growth rates corresponding to different phases of a developmental process. In this type of model, the change-points or `knots' at which the two segments join together must be determined. The knots can be specified by domain knowledge, for example, \citet{Dumenci2019knee, Flora2008knot}, or be estimated as unknown parameters as multiple existing studies such as \citet{Cudeck2003knot_F, Harring2006nonlinear, Kohli2011PLGC, Kohli2013PLGC1}.
Theoretically, longitudinal processes usually consist of multiple stages in many domains. For example, in developmental studies, lots of psychological and educational phenomena are comprised of different phases. In the biomedical area, the recovery process from surgery, such as knee arthroplasty, is also considered in two stages. One possible index to evaluate the recovery process is the pain score: patients first recover from the surgical pain and then get better gradually \citep{Dumenci2019knee}. This linear spline functional form is of particular interest in estimating stage-specific change rates of these longitudinal processes. Additionally, the interpretation of the estimated knot, which allows for understanding when the transition from one stage to the other occurs, is unique to a piecewise function. More importantly, with an assumption that each repeated outcome follows a segmented linear growth curve when exploring joint development, we obtain stage-specific associations between multiple trajectories over time \citep{Liu2021PBLSGM, Peralta2020PBLSGM}.
Empirically, multiple existing studies have demonstrated that the growth rate in mathematics and reading skills slow down in developmental processes. The linear spline functional form can capture the underlying developmental patterns of these two abilities and outperforms other nonlinear functional forms, such as polynomial and Jenss-Bayley growth curve \citep{Liu2021PBLSGM, Peralta2020PBLSGM, Kohli2015PLGC2, Kohli2017PLGC}. These studies have also shown that the outcome-specific knot is individually different in the joint development of reading and mathematics abilities, assuming that all individuals are from one population. If we relax the one population assumption, another possible reason for the heterogeneity in knots is that these change points are different across latent classes.
Accordingly, we propose to utilize a parallel bilinear spline growth curve model (PBLSGM) with unknown fixed knots \citep{Liu2021PBLSGM} as the within-class model, assuming that the outcome-specific knot is roughly the same across all individuals in each class\footnote{It is possible to estimate both fixed and random effects of these class-specific knots. In this project, we only focus on the fixed effects since we want to build a relatively parsimonious model given that the mixture model for a joint development itself is complicated.}, to examine the motivating data. Similar to \citet{Liu2021PBLSGM}, we build the model in the framework of individual-measurement occasions with `definition variables' \citep{Mehta2000people, Mehta2005people}, which adjust model parameters to individual-specific values to avoid potential inadmissible estimation \citep{Blozis2008coding, Coulombe2015ignoring}.
In addition to applying the GMM with the proposed within-class model to explore possible clusters of the joint development, we can also employ the GMM in other fields, where latent classes are theoretically defensible. For example, \citet{Robertsson2000knee, Baker2007knee} have shown that although the majority of patients benefited from knee arthroplasty, a proportion of patients reported persistent pain or functional deficiencies in a year following the surgery, suggesting that there are responders and non-responders to the surgery. Physical function scales and pain scales are two possible indices to evaluate the recovery process \citep{Dumenci2019knee}. The proposed GMM allows for investigating the heterogeneity in short-term and long-term joint recovery processes.
\subsection{Implementation Challenges of Mixture Models for Joint Development}
Similar to the GMM with a univariate repeated outcome, implementing the GMM with multivariate repeated outcomes poses statistical challenges such as determining the optimal number of latent classes and deciding which covariates may inform class membership and how to add these covariates. For the GMM with a univariate repeated outcome, researchers usually conduct the enumeration process, which excludes any covariates, in an empirical approach: fitting a pool of candidate GMMs with different numbers of latent classes and selecting the `best' model and the optimal number of clusters via the Bayesian information criterion (BIC) \citep{Nylund2007number}. For the GMM with parallel repeated outcomes in the current study, we do not intend to develop a novel metric for choosing the number of latent classes. Instead, we can still follow the SEM literature convention and determine the optimal number of latent classes using the BIC from the statistical perspective. Alternatively, we can sometimes make this decision by answering a specific research question for the GMM with multivariate repeated outcomes in the scenario where the cluster information of univariate development is available.
We also need to decide to include which covariates in mixture models, which is also challenging. First of all, the candidate pool of independent variables in the educational and psychological domains where the GMM is widely employed is potentially huge. Some covariates are often highly correlated. In the statistics and machine learning literature, there are two common ways to shrink covariate space and address the potential collinearity issue: feature extraction and feature selection, which can be realized by the exploratory factor analysis (EFA) \citep{Spearman1904factor} and the structural equation model forests (SEM Forests) \citep{Brandmaier2016semForest} in the SEM framework. In this article, we follow \citet{Liu2019BLSGMM} and \citet{Liu2020MoE} to demonstrate how to utilize these two methods to deal with the candidate covariate set for the motivating example with an assumption that all independent variables only have indirect effects on the heterogeneity of joint development.
In the GMMs, the inclusion of covariates to inform the class formation can be realized in a one-step approach \citep{Clogg1981one, Goodman1974one, Haberman1979one, Hagenaars1993one, Vermunt1997one, Bandeen1997one, Dayton1988one, Kamakura1994one, Yamaguchi2000one} or stepwise methods, including a two-step \citep{Bakk2017two, Liu2019BLSGMM} or a three-step approach \citep{Bolck2004three, Vermunt2010three, Asparouhov2014three}. Multiple existing studies have shown that the one-step model outperforms the stepwise methods in terms of bias, mean squared error (MSE), and coverage probability (CP). Accordingly, we decided to follow the recommendation in multiple recent studies and construct a one-step mixture model in a stepwise fashion \citep{Liu2020MoE}, also referred to as the adjusted one-step approach \citep{Kim2016expert, Hsiao2020mediation}. These recent studies recommend (1) conducting the enumeration process without any covariates to have a stable number of clusters and (2) constructing a model with covariates and the determined number to estimate all parameters.
In the remainder of this article, we first describe the model specification and model estimation of the GMM with PBLSGM as the within-class model. We then depict the design of the Monte Carlo simulation for model evaluation. We evaluate how the proposed model works through the performance measures, including the relative bias, the empirical standard error (SE), the relative root-mean-squared-error (RMSE), and the empirical coverage for a nominal $95\%$ confidence interval of each parameter of interest. We also compare the accuracy of the proposed GMM to that of the GMM with a univariate repeated outcome. In the Application section, we analyze the motivating data, longitudinal reading and mathematics achievement scores from the Early Childhood Longitudinal Study, Kindergarten Class $2010-11$ (ECLS-K:2011)\footnote{We want to examine ECLS-K:2011 instead of ECLS-K because the former contains baseline teacher-rated students' behavior questions, including attentional focus and inhibitory control, whose effects are of our interest.}, to demonstrate how to shrink covariate space and construct the proposed GMMs. Finally, we present a broad discussion concerning practical considerations, methodological considerations as well as future directions.
\section{Method}\label{method}
\subsection{Bilinear Spline Growth Curve Model with a Fixed Knot}
In this section, we briefly describe the latent growth curve (LGC) model with a linear-linear piecewise functional form with a fixed knot, which is utilized to analyze a univariate change pattern and estimate a change-point with the assumption that the knot is roughly the same across all individuals. Each of the two stages takes a linear functional form in this model, and the two linear segments join at a change-point or a `knot'. In the framework of individual measurement occasions, the measurement $y_{ij}$ at the $j^{th}$ time point of $i^{th}$ individual $t_{ij}$ is
\begin{equation}\label{eq:fun}
y_{ij}=\begin{cases}
\eta^{[y]}_{0i}+\eta^{[y]}_{1i}t_{ij}+\epsilon^{[y]}_{ij} & t_{ij}\le\gamma^{[y]}\\
\eta^{[y]}_{0i}+\eta^{[y]}_{1i}\gamma^{[y]}+\eta_{2i}(t_{ij}-\gamma^{[y]})+\epsilon^{[y]}_{ij} & t_{ij}>\gamma^{[y]}\\
\end{cases}.
\end{equation}
\citet{Harring2006nonlinear} showed there are five parameters, including one intercept and slope for each linear piece, and a knot, in the linear-linear piecewise model, but the degrees-of-freedom of the bilinear spline is four as two linear pieces join at the knot. As shown in Equation (\ref{eq:fun}), we consider the initial status ($\eta^{[y]}_{0i}$), two slopes ($\eta^{[y]}_{1i}$ and $\eta^{[y]}_{2i}$), and the knot ($\gamma^{[y]}$) as the four free parameters in the current study, where $\eta^{[y]}_{0i}$, $\eta^{[y]}_{1i}$ and $\eta^{[y]}_{2i}$ are individual-level while $\gamma^{[y]}$ is population-level (or subpopulation-level when modeling latent classes of trajectories). All four parameters determine the change-pattern of the growth curve of $\boldsymbol{y}_{i}$.
The piecewise function defined in Equation (\ref{eq:fun}) cannot be specified directly in an existing SEM software such as \textit{Mplus} and the \textit{R} package \textit{OpenMx} because a conditional statement is not allowed when specifying a model. Accordingly, we have to reparameterize growth factors to unify pre- and post-knot expressions, which can be realized in multiple ways, as presented in earlier studies. For example, \citet{Harring2006nonlinear} proposed to reparameterize the initial status and two slopes to the average of the two intercepts, the average of the two slopes, and the half difference between the two slopes. Alternatively, \citet[Chapter~11]{Grimm2016growth} suggested reexpressing the three original growth factors (i.e., $\eta^{[y]}_{0i}$, $\eta^{[y]}_{1i}$ and $\eta^{[y]}_{2i}$) as the measurement of the knot and two slopes. In addition, \citet{Liu2019BLSGM} reparameterized the three growth factors as the measurement of the knot, the average of the two slopes, and the half difference between the two slopes.
Note that the only benefit of reparameterization lies in that it allows for specifying the model in Equation (\ref{eq:fun}). Although the model with original growth factors and reparameterized growth factors are mathematically equivalent, the reparameterized coefficients may no longer be directly related to the underlying developmental process and therefore lack meaningful and substantive interpretation. From this perspective, the approach proposed in \citet[Chapter~11]{Grimm2016growth} looks promising since all reparameterized coefficients are still directly related to the growth patterns. However, we need to call the \textit{minimum} and \textit{maximum} functions to specify the model in Equation (\ref{eq:fun}) with this method. Only the \textit{R} package \textit{OpenMx} allows for these two functions currently, which means it is impossible to apply this approach in \textit{Mplus}. Accordingly, in this study, we follow the reparameterized method in \citet{Liu2019BLSGM} because the transformation between the original and the reparameterized growth factors for joint development is well documented in \citet{Liu2021PBLSGM} and ready to use. We then write the repeated outcome as
\begin{equation}\label{eq:uni}
\boldsymbol{y}_{i}=\boldsymbol{\Lambda}_{i}^{[y]}\times\boldsymbol{\eta}^{[y]}_{i}+\boldsymbol{\epsilon}^{[y]}_{i},
\end{equation}
where
\begin{equation}\nonumber
\boldsymbol{\eta}_{i}^{[y]} = \left(\begin{array}{rrr}
\eta^{'[y]}_{0i} & \eta^{'[y]}_{1i} & \eta^{'[y]}_{2i}
\end{array}\right)^{T}
= \left(\begin{array}{rrr}
\eta^{[y]}_{0i}+\gamma^{[y]}\eta^{[y]}_{1i} & \frac{\eta^{[y]}_{1i}+\eta^{[y]}_{2i}}{2} & \frac{\eta^{[y]}_{2i}-\eta^{[y]}_{1i}}{2}
\end{array}\right)^{T}
\end{equation}
and
\begin{equation}\nonumber
\begin{aligned}
&\boldsymbol{\Lambda}_{i}^{[y]} = \left(\begin{array}{rrr}
1 & t_{ij}-\gamma^{[y]} & |t_{ij}-\gamma^{[y]}|
\end{array}\right)
&(j=1,\cdots, J).
\end{aligned}
\end{equation}
We provide the detailed deviation of the reparameterized growth factors and corresponding factor loadings in the Online Supplementary Document. The LGC with bilinear spline functional form can be extended to the GMM framework \citep{Kohli2011PLGC, Kohli2013PLGC1, Liu2019BLSGMM} or MGM framework \citep{Liu2021PBLSGM}. In the following sections, we demonstrate how to extend this model to the scenario with multivariate repeated outcomes and subpopulations (i.e., latent classes).
\subsection{Model Specification of Growth Mixture Model with Parallel Bilinear Spline Growth Curves with Fixed Knots}\label{method:spec}
In this section, we specify the GMM with a parallel bilinear growth curve model (PBLSGM) with unknown fixed knots as the within-class model to investigate the heterogeneity of joint development and its possible causes. Suppose we have bivariate growth curves of repeated outcomes $\boldsymbol{y}_{i}$ and $\boldsymbol{z}_{i}$ for each individual and $K$ pre-specified number of latent classes, for $k=1$ to $K$ latent classes and $i=1$ to $n$ individuals, we express the model as
\begin{align}
&p(\boldsymbol{y}_{i},\boldsymbol{z}_{i} |c_{i}=k,\boldsymbol{x}_{i})=\sum_{k=1}^{K}\pi(c_{i}=k|\boldsymbol{x}_{i})\times p(\boldsymbol{y}_{i},\boldsymbol{z}_{i}|c_{i}=k),\label{eq:GMM}\\
&\pi(c_{i}=k|\boldsymbol{x}_{i})=\begin{cases}
\frac{1}{1+\sum_{k=2}^{K}\exp(\beta_{0}^{(k)}+\boldsymbol{\beta}^{(k)T}\boldsymbol{x}_{i})} & \text{Reference Group ($k=1$)}\\
\frac{\exp(\beta_{0}^{(k)}+\boldsymbol{\beta}^{(k)T}\boldsymbol{x}_{i})} {1+\sum_{k=2}^{K}\exp(\beta_{0}^{(k)}+\boldsymbol{\beta}^{(k)T}\boldsymbol{x}_{i})} & \text{Other Groups ($k=2,\dots, K$)}
\end{cases},\label{eq:gating}\\
&\begin{pmatrix}
\boldsymbol{y}_{i} \\ \boldsymbol{z}_{i}
\end{pmatrix}|(c_{i}=k)=
\begin{pmatrix}
\boldsymbol{\Lambda}_{i}(\gamma^{[y]}) & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{\Lambda}_{i}(\gamma^{[z]})
\end{pmatrix}\times
\begin{pmatrix}
\boldsymbol{\eta}^{[y]}_{i} \\ \boldsymbol{\eta}^{[z]}_{i}
\end{pmatrix}|(c_{i}=k)+
\begin{pmatrix}
\boldsymbol{\epsilon}^{[y]}_{i} \\ \boldsymbol{\epsilon}^{[z]}_{i}
\end{pmatrix}|(c_{i}=k),\label{eq:expert1}\\
&\begin{pmatrix}
\boldsymbol{\eta}^{[y]}_{i} \\ \boldsymbol{\eta}^{[z]}_{i}
\end{pmatrix}|(c_{i}=k)=
\begin{pmatrix}
\boldsymbol{\mu_{\eta}}^{(k)[y]} \\ \boldsymbol{\mu_{\eta}}^{(k)[z]}
\end{pmatrix}+
\begin{pmatrix}
\boldsymbol{\zeta}^{[y]}_{i} \\ \boldsymbol{\zeta}^{[z]}_{i}
\end{pmatrix}|(c_{i}=k).\label{eq:expert2}
\end{align}
Equation (\ref{eq:GMM}) defines a GMM that combines mixing proportions, $\pi(c_{i}=k|\boldsymbol{x}_{i})$, and within-class models, $p(\boldsymbol{y}_{i}, \boldsymbol{z}_{i}|c_{i}=k)$. In Equation (\ref{eq:GMM}), $\boldsymbol{x}_{i}$, $(\boldsymbol{y}_{i}, \boldsymbol{z}_{i})$ and $c_{i}$ are the covariates, bivariate repeated outcomes, and membership of the $i^{th}$ individual, respectively. We assume that $\boldsymbol{y}_{i}$ and $\boldsymbol{z}_{i}$ are $J\times1$ vectors, in which $J$ is the number of measurements. There are two constraints in Equation (\ref{eq:GMM}): $0\le \pi(c_{i}=k|\boldsymbol{x}_{i})\le 1$ and $\sum_{k=1}^{K}\pi(c_{i}=k|\boldsymbol{x}_{i})=1$. With Equation (\ref{eq:gating}), which defines mixing components as logistic functions of covariates $\boldsymbol{x}_{i}$, we allow for an association between the covariates and class membership. In Equation (\ref{eq:gating}), $\beta_{0}^{(k)}$ and $\boldsymbol{\beta}^{(k)}$ are logistic coefficients.
Equations (\ref{eq:expert1}) and (\ref{eq:expert2}) together define the submodel in each latent class. Equation (\ref{eq:expert1}) expresses the bivariate repeated outcomes $(\boldsymbol{y}_{i},\boldsymbol{z}_{i})^{T}$ as a linear combination of growth factors. When the outcome-specific functional form is bilinear spline growth curve with an unknown fixed knot, Equation (\ref{eq:expert1}) can be viewed as an extension of Equation (\ref{eq:uni}) with joint development. Accordingly, $\boldsymbol{\eta}^{[u]}_{i}(u=y,z)$ is a $3\times1$ vector of outcome-specific growth factors and $\boldsymbol{\Lambda}_{i}(\gamma^{[u]})$ is a $J\times3$ matrix of corresponding factor loadings. Additionally, $\boldsymbol{\epsilon}^{[u]}_{i}$ is a $J\times 1$ vector of outcome-specific residuals of the $i^{th}$ individual. Equation (\ref{eq:expert2}) further expresses the growth factors as deviations from their class-specific means. In the equation, $\boldsymbol{\mu_{\eta}}^{(k)[u]}$ is a $3\times 1$ vector of the outcome-specific growth factor means in the $k^{th}$ latent class and $\boldsymbol{\zeta}^{[u]}_{i}$ is a $3\times 1$ vector of the outcome-specific residual deviations from the mean vector of the $i^{th}$ individual. With the assumption that the class-specific growth factors of bivariate repeated outcomes follow a multivariate Gaussian distribution, the vector $\begin{pmatrix} \boldsymbol{\zeta}^{[y]}_{i} & \boldsymbol{\zeta}^{[z]}_{i}\end{pmatrix}^{T}|(c_{i}=k)$ can be further expressed as
\begin{equation}\label{eq:expert3}
\begin{pmatrix}
\boldsymbol{\zeta}^{[y]}_{i} \\ \boldsymbol{\zeta}^{[z]}_{i}
\end{pmatrix}|(c_{i}=k)\sim \text{MVN}\bigg(\boldsymbol{0},
\begin{pmatrix}
\boldsymbol{\Psi}_{\boldsymbol{\eta}}^{(k)[y]} & \boldsymbol{\Psi}_{\boldsymbol{\eta}}^{(k)[yz]} \\
& \boldsymbol{\Psi}_{\boldsymbol{\eta}}^{(k)[z]}
\end{pmatrix}\bigg),
\end{equation}
where $\boldsymbol{\Psi}_{\boldsymbol{\eta}}^{(k)[u]}$ is a $3\times 3$ variance-covariance matrix of the outcome-specific growth factors and $\boldsymbol{\Psi}_{\boldsymbol{\eta}}^{(k)[yz]}$ is a $3\times 3$ matrix of the between-construct growth factor covariances in the $k^{th}$ latent class. To simplify the model, we assume that the outcome-specific residuals ($\boldsymbol{\epsilon}^{[u]}_{i}$) in Equation (\ref{eq:expert1}) are independent and identically normally distributed over time, and the class-specific residual covariances are homogeneous over time, that is,
\begin{equation}\nonumber
\begin{pmatrix}
\boldsymbol{\epsilon}^{[y]}_{i} \\ \boldsymbol{\epsilon}^{[z]}_{i}
\end{pmatrix}|(c_{i}=k)\sim \text{MVN}\bigg(\boldsymbol{0},
\begin{pmatrix}
\theta^{(k)[y]}_{\epsilon}\boldsymbol{I} & \theta^{(k)[yz]}_{\epsilon}\boldsymbol{I} \\
& \theta^{(k)[z]}_{\epsilon}\boldsymbol{I}
\end{pmatrix}\bigg),
\end{equation}
where $\boldsymbol{I}$ is a $J\times J$ identity matrix. As stated earlier, the reparameterized growth factors are no longer related to the underlying change patterns and need to be transformed back for interpretation purposes. We also extend the (inverse-)transformation functions and matrices for the reduced model in \citet{Liu2021PBLSGM} to the GMM framework. Through inverse-transformation, we can obtain the coefficients directly related to the underlying developmental processes, and therefore, meaningful and substantive interpretation. We provide the details of the class-specific (inverse-) transformation in the Online Supplementary Document.
\subsection{Model Estimation}\label{method:est}
In this section, we demonstrate how to estimate the parameters of interest from the proposed mixture model. We first write the within-class model implied mean vector and variance-covariance matrix of the bivariate repeated outcomes for the $i^{th}$ individual in the $k^{th}$ unobserved group as
\begin{equation}\label{eq:mean}
\boldsymbol{\mu}_{i}^{(k)}=\begin{pmatrix}
\boldsymbol{\mu}^{(k)[y]}_{i} \\ \boldsymbol{\mu}^{(k)[z]}_{i}
\end{pmatrix}=\begin{pmatrix}
\boldsymbol{\Lambda}_{i}(\gamma^{[y]}) & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{\Lambda}_{i}(\gamma^{[z]})
\end{pmatrix}\times\begin{pmatrix}
\boldsymbol{\mu}^{(k)[y]}_{\boldsymbol{\eta}} \\ \boldsymbol{\mu}^{(k)[z]}_{\boldsymbol{\eta}}
\end{pmatrix}
\end{equation}
and
\begin{equation}\label{eq:var}
\begin{aligned}
\boldsymbol{\Sigma}^{(k)}_{i}&=\begin{pmatrix}
\boldsymbol{\Sigma}^{(k)[y]}_{i} & \boldsymbol{\Sigma}^{(k)[yz]}_{i} \\
& \boldsymbol{\Sigma}^{(k)[z]}_{i}
\end{pmatrix}\\
&=\begin{pmatrix}
\boldsymbol{\Lambda}_{i}(\gamma^{[y]}) & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{\Lambda}_{i}(\gamma^{[z]})
\end{pmatrix}\times\begin{pmatrix}
\boldsymbol{\Psi}^{(k)[y]}_{\boldsymbol{\eta}} & \boldsymbol{\Psi}^{(k)[yz]}_{\boldsymbol{\eta}} \\
& \boldsymbol{\Psi}^{(k)[z]}_{\boldsymbol{\eta}}
\end{pmatrix}\times\begin{pmatrix}
\boldsymbol{\Lambda}_{i}(\gamma^{[y]}) & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{\Lambda}_{i}(\gamma^{[z]})
\end{pmatrix}^{T}+\begin{pmatrix}
\theta^{(k)[y]}_{\epsilon}\boldsymbol{I} & \theta^{(k)[yz]}_{\epsilon}\boldsymbol{I} \\
& \theta^{(k)[z]}_{\epsilon}\boldsymbol{I}
\end{pmatrix}.
\end{aligned}
\end{equation}
We then estimate the class-specific parameters and logistic coefficients for the GMM specified in Equations (\ref{eq:GMM}), (\ref{eq:gating}), (\ref{eq:expert1}) and (\ref{eq:expert2}). The parameters that need to be estimated include
\begin{equation}\label{eq:theta}
\begin{aligned}
\boldsymbol{\Theta}=&\{\boldsymbol{\mu}^{(k)[u]}_{\boldsymbol{\eta}}, \boldsymbol{\Psi}^{(k)[u]}_{\boldsymbol{\eta}}, \boldsymbol{\Psi}^{(k)[yz]}_{\boldsymbol{\eta}}, \theta^{(k)[u]}_{\epsilon}, \theta^{(k)[yz]}_{\epsilon}, \beta_{0}^{(k)}, \boldsymbol{\beta}^{(k)}\}\\
=&\{\mu^{(k)[u]}_{\eta_{0}}, \mu^{(k)[u]}_{\eta_{1}}, \mu^{(k)[u]}_{\eta_{2}}, \gamma^{(k)[u]}, \psi^{(k)[u]}_{00}, \psi^{(k)[u]}_{01}, \psi^{(k)[u]}_{02}, \psi^{(k)[u]}_{11}, \psi^{(k)[u]}_{12}, \psi^{(k)[u]}_{22},\\
&\psi^{(k)[yz]}_{00}, \psi^{(k)[yz]}_{01}, \psi^{(k)[yz]}_{02}, \psi^{(k)[yz]}_{10}, \psi^{(k)[yz]}_{11}, \psi^{(k)[yz]}_{12}, \psi^{(k)[yz]}_{20}, \psi^{(k)[yz]}_{21}, \psi^{(k)[yz]}_{22}, \ \ \ \ \ \ \ \ \ \ \ \\
& \theta^{(k)[u]}_{\epsilon}, \theta^{(k)[yz]}_{\epsilon}, \beta_{0}^{(k)}, \boldsymbol{\beta}^{(k)}\}\\
&u=y,\ z,\\
&k=2,\dots,K \text{ for } \beta_{0}^{(k)}, \boldsymbol{\beta}^{(k)},\\
&k=1,\dots,K \text{ for other parameters}.
\end{aligned}
\end{equation}
We estimate $\boldsymbol{\Theta}$ using the full information maximum likelihood (FIML) method to account for the possible heterogeneity in individual contributions to the likelihood function. The log-likelihood function of the model specified in Equations (\ref{eq:GMM}), (\ref{eq:gating}), (\ref{eq:expert1}) and (\ref{eq:expert2}) can be expressed as
\begin{equation}\nonumber
\begin{aligned}
\log lik(\boldsymbol{\Theta})&=\sum_{i=1}^{n}\log\bigg(\sum_{k=1}^{K}\pi(c_{i}=k|\boldsymbol{x}_{i})\times p(\boldsymbol{y}_{i},\boldsymbol{z}_{i}|c_{i}=k)\bigg)\\
&=\sum_{i=1}^{n}\log\bigg(\sum_{k=1}^{K}\pi(c_{i}=k|\boldsymbol{x}_{i})\times p(\boldsymbol{y}_{i},\boldsymbol{z}_{i}|\boldsymbol{\mu}_{i}^{(k)},\boldsymbol{\Sigma}_{i}^{(k)})\bigg).
\end{aligned}
\end{equation}
In the current study, the proposed GMM is built using the R package \textit{OpenMx} with CSOLNP optimizer \citep{Pritikin2015OpenMx, OpenMx2016package, User2020OpenMx, Hunter2018OpenMx}, which allows for matrix calculations so that we can implement the class-specific inverse-transformation function and matrix detailed in the Online Supplementary Document efficiently. In the online appendix (\url{https://github.com/Veronica0206/Extension_projects}), we provide the \textit{OpenMx} code for the proposed model and a demonstration. \textit{Mplus} 8 syntax is also provided for the proposed model in the online appendix for researchers who are interested in using \textit{Mplus}.
\section{Model Evaluation}\label{Evaluation}
In this section, we evaluate the proposed GMM with a PBLSGM as the within-class model using a Monte Carlo simulation study with two goals. The first goal is to assess how the proposed model performs when the two repeated outcomes are correlated over time. We evaluate the model through performance measures, including the relative bias, empirical standard error (SE), relative root-mean-square error (RMSE), and empirical coverage for a nominal $95\%$ confidence interval of each parameter. We list the definitions and estimates of the four performance metrics in Table \ref{tbl:metric}. We also want to examine how well the proposed mixture model can distinguish trajectory clusters. Since having true membership in the simulation study, we employ the metric accuracy, which is defined as the fraction of all correctly classified instances, to assess how the model separates samples into `correct' clusters \cite[Chapter~1]{Bishop2006pattern}.
\tablehere{1}
To calculate the accuracy, we first obtain the posterior probabilities that indicate each individual belongs to the $k^{th}$ latent class, which can be realized by Bayes' theorem
\begin{equation}\nonumber
p(c_{i}=k)=\frac{\pi(c_{i}=k|\boldsymbol{x}_{i})p(\boldsymbol{y}_{i}, \boldsymbol{z}_{i}|\boldsymbol{\mu}_{i}^{(k)},\boldsymbol{\Sigma}_{i}^{(k)})}{\sum_{k=1}^{K}\pi(c_{i}=k|\boldsymbol{x}_{i})p(\boldsymbol{y}_{i}, \boldsymbol{z}_{i}|\boldsymbol{\mu}_{i}^{(k)},\boldsymbol{\Sigma}_{i}^{(k)})},
\end{equation}
and assign each individual to the class with the highest posterior probability of which that individual most likely belongs. Following \citet{McLachlan2000FMM}, we broke the tie among competing classes randomly when their posterior probabilities were equal to the maximum value. The second goal is to compare the performance metrics and accuracy obtained from the clustering algorithm on the bivariate repeated outcomes to those from the GMM with univariate development, hoping to explore whether the algorithm performance would be improved when it works on bivariate repeated outcomes.
Guided by \citet{Morris2019simulation}, we decided the number of replications $S=1,000$ in the simulation study using an empirical method. In a pilot simulation study, standard errors of all parameters except the intercept variances were less than $0.15$. To keep the Monte Carlo standard error of the bias\footnote{$\text{Monte Carlo SE(Bias)}=\sqrt{Var(\hat{\theta})/S}$ \citet{Morris2019simulation}.} (the most important performance metric) below $0.005$, we needed at least $900$ repetitions. We then proceeded $S=1,000$ for more conservative consideration.
\subsection{Design of Simulation Study}\label{Evaluation:design}
We list all conditions that we considered in the simulation design in Table \ref{tbl:simu}. We fixed several conditions, including the sample size, the number of latent classes, the variance-covariance matrix of the outcome-specific growth factors in each latent class, the number of repeated measurements, and the time-window of individual measurement occasions, which are not the primary interest in this study. For example, we selected ten scaled and equally spaced waves as \citet{Liu2021PBLSGM} has shown that the parallel bilinear growth curve models performed decently in terms of the four performance measures and the shorter study duration (i.e., six scaled and equally spaced waves) only affected the model performance slightly. Similar to \citet{Liu2021PBLSGM}, the time-window of individual measurement occasions was set to be a medium level ($-0.25, +0.25$) around each wave \citep{Coulombe2015ignoring}. The variance-covariance structure of the growth factors usually varies with the time scale and measurement scale; we fixed it and kept the index of dispersion ($\sigma^{2}/\mu$) of each growth factor at a one-tenth scale \citep{Bauer2003GMM, Kohli2011PLGC, Kohli2015PLGC1}. Additionally, the correlations between outcome-specific growth factors in each latent class were set to be a moderate level ($\rho^{(k)[u]}=0.3$).
\tablehere{2}
The characteristic of the greatest importance for a model-based clustering method is how well the model can detect heterogeneity in samples and estimate class-specific parameters. The major condition hypothesized to influence such performance is the separation between latent classes, which is gauged by the difference in knot locations and the Mahalanobis distance between class-specific growth factors \citep{Kohli2015PLGC1, Liu2019BLSGM, Liu2020MoE} in this project. We set $0.50$, $0.75$ and $1.00$ as a small, medium, and large difference in outcome-specific knot locations in the simulation design\footnote{In the simulation design of multiple existing studies, the three levels were set to be $1.00$, $1.50$ and $2.00$ for the GMM with a univariate repeated outcome \citep{Kohli2015PLGC1, Liu2019BLSGMM, Liu2020MoE}.}.
In this study, we kept the within-construct Mahalanobis distance as $0.86$ (a small distance as in \citet{Kohli2015PLGC1}). Since the proposed model is for joint development, how the correlation between two trajectories affects model performance is worth exploring. We considered three levels of the between-construct growth factor correlation, $\pm0.3$ and $0$, for two considerations. On the one hand, the value of the between-construct growth factor correlation can help adjust Mahalanobis distance of the bivariate repeated outcomes slightly. Specifically, the Mahalanobis distance is $1.22$, $1.18$ and $1.35$ when the correlation is $0$, $+0.3$ and $-0.3$, respectively. On the other hand, with $0$ and $\pm{0.3}$ correlation conditions, it was of interest to investigate how the zero or positive (negative) moderate correlation affects the model performance.
The allocation ratio that is roughly controlled by the intercept coefficient ($\beta_{0}$) in the logistic function was set as $1$:$1$ ($\beta_{0}=0$) or $1$:$2$ ($\beta_{0}=0.775$). The class mixing proportion $1$:$1$ was selected as it is a balanced allocation, while the other condition $1$:$2$ was chosen as we were interested in examining whether a more challenging condition in mixing proportions would affect the performance measures and accuracy. Additionally, we investigate several common change patterns, as shown in Table \ref{tbl:simu} (Scenario $1$, $2$ and $3$). We changed the knot location and the intercept mean for one repeated outcome (i.e., the mean trajectory of two latent classes were parallel) in all three scenarios. However, for the other repeated outcome, in addition to the knot location, we adjusted the mean values of the intercept, the first slope, and the second slope for the Scenario $1$, $2$, and $3$, respectively. We also considered two levels of residual variance ($1$ or $2$) to assess how the measurement precision affects the proposed model.
\subsection{Data Generation and Simulation Step}\label{evaluation:step}
For each condition listed in Table \ref{tbl:simu}, we carried out the following two-step data generation for the proposed model. We obtained the membership $c_{i}$ from covariates $\boldsymbol{x}_{i}$ for each individual in the first step. We then generated the bivariate repeated outcomes $\boldsymbol{y}_{i}$ and $\boldsymbol{z}_{i}$ for each latent class simultaneously. The general steps are:
\begin{enumerate}
\item Obtain membership $c_{i}$ for the $i^{th}$ individual:
\begin{enumerate}
\item Generate individual-level covariates $\boldsymbol{x}_{i}$,
\item Calculate the probability vector for each individual based on the covariates and a set of specified coefficients with a logit link, and assign each individual to the group with the highest probability,
\end{enumerate}
\item Generate growth factors of bivariate repeated outcomes simultaneously with the prespecified mean vector and variance-covariance matrix for each latent class (listed in Table \ref{tbl:simu}) using the \textit{R} package \textit{MASS} \citep{Venables2002Statistics},
\item Generate the scaled and equally-spaced time structure with ten repeated measures and obtain individual measurement occasions by allowing the time-window set as $t_{ij}\sim U(t_{j}-0.25, t_{j}+0.25)$ around each wave,
\item Calculate factor loadings of each outcome for each individual from corresponding knot location and individual measurement occasions,
\item Obtain the values of the bivariate repeated outcomes from the class-specific growth factors, corresponding factor loadings, class-specific knots and residual variances,
\item Implement the proposed model on the generated data set, estimate the parameters, and construct corresponding $95\%$ Wald CIs, along with accuracy,
\item Repeat steps $1$ through $6$ until achieving $1,000$ convergent solutions.
\end{enumerate}
\section{Results}\label{results}
\subsection{Model Convergence}
In this section, we investigate the convergence rate of the proposed GMM with a PBLSGM as the within-class model\footnote{In this study, we define \textit{convergence} as the solution with \textit{OpenMx} status code $0$ that suggests a successful optimization until up to $10$ runs with different sets of initial values \citep{OpenMx2016package}.}. When the two repeated outcomes are correlated over time, the model converged satisfactorily. Specifically, the proposed model's convergence rate was at least $94\%$ across the conditions with $\pm0.3$ between-construct growth factor correlation. The convergence rate in the scenarios with the large difference in knot locations (i.e., the difference in outcome-specific knot locations is $1.00$) was $100\%$. The worst condition had a non-convergence rate of $68/1068$, indicating that there were $68$ non-convergent datasets and required $1,068$ replications to reach $1,000$ converged solutions. It occurred under the condition with the unbalanced allocation (i.e., the ratio is $1$:$2$), the small difference (i.e., $0.5$) in outcome-specific knot locations, and the positive between-construct correlation (i.e., $\rho=0.3$, note that as mentioned earlier, the Mahalanobis distance of joint development is the smallest under the conditions with the positive between-construct correlation if the within-construct Mahalanobis distance is the same). Additionally, we noticed that the proposed model did not converge well when it was over-specified. Under the conditions with the zero between-construct correlation, where the GMM with joint development was not supposed to be utilized, the convergence rate was $54\%$-$77\%$. Due to the high non-convergence rate of these overspecified models, we do not evaluate their performance measures in the main text.
\subsection{Performance Measures}
In this section, we present the simulation results of performance measures, including relative bias, empirical SE, relative RMSE, and empirical coverage probability of a nominal $95\%$ confidence interval for each parameter across all non-zero between-construct correlation conditions. In general, the proposed model is capable of providing unbiased and accurate point estimates with target coverage probabilities. We named the latent class with earlier knots as Class $1$ (i.e., the left cluster) while that with later knots as Class $2$ (i.e., the right cluster) in this section. Given the size of parameters and simulation conditions, we first calculated each performance measure across $1,000$ replications for each parameter under each condition. We then summarized the values of each performance metric from all the conditions under examination as the corresponding median and range for each parameter. The summary of each performance measure is provided in the Online Supplementary Document.
The proposed model provided unbiased point estimates with small empirical SEs. Specifically, the magnitude of the relative biases of growth factor means, growth factor variances, between-construct growth factor covariances, and logistic coefficients were under $0.018$, $0.036$, $0.068$, and $0.097$, respectively. The magnitude of empirical SE of all parameters except intercept coefficients (i.e., intercept means, variances, and covariance) and logistic coefficients was under $0.29$. The empirical SEs of $\mu_{\eta0}^{(k)[u]}$, $\psi_{00}^{(k)[u]}$ and $\psi_{00}^{(k)[yz]}$ were around $0.50$, $3.00$, and $2.30$ respectively.
Moreover, the proposed model was capable of estimating parameters accurately. The magnitude of the relative RMSE of the growth factor means, growth factor variances, and growth factor covariance was under $0.14$, $0.29$, and $0.66$, respectively. The relative RMSE magnitude of the logistic coefficients was around $0.40$.
Generally, the proposed GMM performed well in terms of empirical coverage probabilities of growth factor means, variances, and covariances since the median values of their coverage probabilities were around $0.92$. We noted that knots' coverage probabilities could be unsatisfactory. We then plotted the coverage probabilities of the class-specific knots stratified by the difference in the outcome-specific knot locations in Figure \ref{fig:KnotCP}. We noticed that the coverage probabilities of all knots were around $0.95$ under the conditions with large separation, although the coverage probabilities of knots, especially the $\boldsymbol{Y}$'s knot in Class $1$ and the $\boldsymbol{Z}$'s knot in Class $2$, were conservative under other conditions.
\figurehere{1}
To summarize, we generally obtained unbiased and accurate point estimates with target coverage probabilities from the proposed models. Some factors, such as separation in latent classes, influenced performance metrics. Specifically, greater separation improved model performance. Additionally, for the conditions with the unbalanced allocation (where the ratio is $1$:$2$), the performance metrics of the parameters in Cluster $2$ were better than those in Cluster $1$. It is not surprising given the larger sample size in the second latent class. Other conditions, such as the between-construct correlation magnitude or sign, did not affect the performance measures meaningfully (We provide the detailed summary of relative bias and empirical SE under the conditions with zero between-construct growth factor correlation in the Online Supplementary Document).
\subsection{Accuracy}\label{R:Acc}
In this section, we evaluate accuracy across all conditions listed in Table \ref{tbl:simu}. We first calculated the mean of accuracy values over $1,000$ replications for each condition. We then plotted these mean values stratified by allocation ratio, separation in the outcome-specific knot locations, trajectory shapes, and the sign and magnitude of between-construct growth factor correlation, as shown in Figure \ref{fig:acc}. Generally, the mean value of accuracy was the greatest under the conditions with the large separation in outcome-specific knot locations (i.e., $1.00$), followed by the conditions with the medium separation (i.e., $0.75$) and then the small separation (i.e., $0.50$). The mean values of accuracy achieved $80\%$ when the difference was $1.00$.
\figurehere{2}
Moreover, the accuracy value under the conditions with negative between-construct correlations was greater than the value under the other conditions in general. It is not unexpected since the Mahalanobis distance between class-specific growth factors was relatively large when the correlation is negative, as stated earlier ($1.22$, $1.18$ and $1.35$ for $0$, $+0.3$ and $-0.3$ between-construct correlation when the within-construct Mahalanobis distance was fixed as $0.86$). Additionally, unbalanced allocation produced relatively higher accuracy, but trajectory shapes only affected the accuracy slightly.
\subsection{Comparison to Models with Univariate Repeated Outcome}\label{R:compare}
In this section, we compare the GMM with joint development and those with univariate development concerning point estimates and accuracy. We noticed that the GMM with joint development outperformed the models for univariate development since the relative biases and empirical SEs of the joint development model were smaller than those from the univariate development models. We provide the median and range of relative bias and empirical SE of each parameter obtained from three models across the conditions with the large outcome-specific knot locations (i.e., $1.00$) in the Online Supplementary Document. Additionally, Figure \ref{fig:acc_compare} presents the mean accuracy of three models stratified by between-construct correlations, from which we observed that the accuracy of the joint development model was much higher than that of the univariate development model.
\figurehere{3}
\section{Application}\label{application}
We have two goals in the application section. First, we demonstrate how to utilize the proposed GMM with a PBLSGM as the within-class model to analyze a real-world data set. Second, we extend two methods, the EFA and the SEM Forests, that can shrink the covariate space of the GMM with univariate development to the GMM with joint development. We extracted $500$ students randomly from ECLS-K: 2011 with complete records of repeated reading item response theory (IRT) scaled scores, mathematics IRT scaled scores, demographic information (sex, race/ethnicity, and age in months at each wave), socioeconomic status (including baseline family income and the highest education level between parents), baseline teacher-reported social skills (including self-control ability, interpersonal skills, externalizing problem and internalizing problem), baseline teacher-reported approach-to-learning, baseline teacher-reported children behavior question (including attentional focus and inhibitory control), and school information (baseline school type and location)\footnote{The total sample size of ECLS-K: 2011 is $n=18174$. After removing records with missing values (i.e., rows with any of NaN/-9/-8/-7/-1), the number of individuals is $n=1838$.}.
ECLS-K: 2011 is a nationwide longitudinal study of US children enrolled in about $900$ kindergarten programs beginning from the $2010-2011$ school year. In ECLS-K: 2011, children's reading and mathematics IRT scores were evaluated in nine waves: fall and spring of kindergarten, first and second grade, respectively, as well as spring of $3^{rd}$, $4^{th}$ and $5^{th}$ grade, respectively. Only about $30\%$ students were evaluated in $2011$ fall semester and $2012$ fall semester \citep{Le2011ECLS}. There are two time structures in the dataset, children's age (in months) and their grade-in-school. In this analysis, we used children's age (in months) to obtain individual measurement occasions. In the subset, $49.8\%$ and $50.2\%$ of students were boys and girls. Additionally, the sample was diverse with representations from White ($49.0\%$), Black ($5.2\%$), Latinx ($31.2\%$), Asian ($8.4\%$), and others ($6.2\%$). We dichotomized the variable race to be White ($49.0\%$) and others ($51.0\%$). At the start of the study, $10.8\%$ and $89.2\%$ of students were from private and public schools, respectively. All other covariates were treated as continuous variables in this analysis.
\subsection{Enumeration Process}\label{app:number}
This section demonstrates how to decide the number of latent classes of the GMM with joint development. Following the SEM literature convention, we select the model with the optimal number of classes without adding any covariates. We first fit one-, two- and three-class models for each univariate development and joint development. All nine models converged. Table \ref{tbl:compare} provides the estimated likelihood, information criteria (AIC and BIC), proportions of each latent class of each model, from which we can see that the optimal number of latent classes for the univariate development models and the joint development model was $3$ and $2$ determined by the BIC, respectively. This is not surprising. The BIC is a criterion that penalizes model complexity (i.e., the number of parameters), and the penalty of adding one latent class in the joint development model (that contains $32$ parameters in submodel) is much larger than that in the univariate development models (that have $11$ parameters in each latent class).
\tablehere{3}
Alternatively, the enumeration process of the joint development model can be driven by empirical knowledge or research interest. The optimal univariate development models suggest three clusters of either reading development trajectories or mathematics development trajectories in this application. Accordingly, a follow-up question of greater interest is to explore the joint development trajectories in three latent classes. Figures \ref{fig:traj_uni} and \ref{fig:traj_bi} present the model implied curves on the smooth lines that obtained from raw trajectories of each latent class of each ability obtained from the univariate development models and the joint development model, respectively. The estimated mixing proportions of the joint development changed: the mixing proportion of Class $1$ ($32.60\%$) increased while that of Class $2$ ($44.20\%$) and Class $3$ ($23.20\%$) decreased. Additionally, the margin of estimated trajectories of mathematics IRT scores in the pre-knot stage between Class $1$ and Class $2$ was wider in the joint development model.
\figurehere{4}
\figurehere{5}
\subsection{Shrinking Covariate Space}\label{app:cov}
\citet{Liu2019BLSGMM} and \citet{Liu2020MoE} proposed to employ the EFA and the SEM Forests to shrink covariate space of the GMM with univariate development by conducting feature extraction and feature selection, respectively. Specifically, \citet{Liu2019BLSGMM} proposed to employ the EFA to address covariate spaces with high-dimension and highly correlated covariate subsets, which are common in psychological and educational domains. \citet{Liu2020MoE} recommended only including covariates that have great effects on the sample heterogeneity, which is decided by the output named `variable importance' of SEM Forests, in a GMM with univariate development. In this section, we extend the two methods to the GMM with joint development.
\subsection*{Feature Extraction: Exploratory Factor Analysis}
We employ the EFA to address the potential collinearity issue for socioeconomic variables and teacher-reported ability/problem variables and derive an informative but non-redundant covariate set with fewer variables. Following \citet{Liu2019BLSGMM}, the EFA was conducted using the \textit{R} function \textit{factanal} in the \textit{stats} package \citep{Core2020stat}. Several criteria, including the eigenvalues greater than $1$ (EVG1) component retention criterion, scree test \citep{Cattell1966EFA, Cattell1967EFA}, and parallel analysis \citep{Horn1965EFA, Humphreys1969EFA, Humphreys1975EFA}, all suggested that two factors can explain the variance of socioeconomic variables and teacher-reported skills/problems. Additionally, we employed an orthogonal rotation, varimax, assuming that the factor of the socioeconomic variables and that of teacher-rated scores were independent. As a result, the first factor differentiates between teacher-reported skills and teacher-rated problems; the second factor can be interpreted as general socioeconomic status (the detailed output of the factor loadings and explained variance from the EFA is provided in the Online Supplementary Document). We then used the factor scores obtained by Bartlett's weighted least-squares methods \citep{Bartlett1937score} as well as sex, race/ethnicity, school type, and school location in the proposed model.
\subsection*{Feature Selection: Structural Equation Model Forests}
Guided by \citet{Liu2020MoE}, we built SEM Forests for the univariate development models and the joint development model using the \textit{R} package \textit{semtree}. In addition to the original data set and the pool of candidate covariates, the input of the SEM Forests algorithm also includes a one-group model as the template model (i.e., a LGC for univariate development or a MGM for joint development). One output of SEM Forests is the variable importance scores in terms of predicting the model-implied mean vector and variance-covariance structure \citep{Brandmaier2016semForest}. For the parameter setting in this study, we used the bootstrapping sample method, $128$ trees and $2$ subsampled covariates at each node following \citet{Liu2020MoE}.
The top four predictors of all three GMMs were parents' highest education, family income, attentional focus, and learning approach, although these variables' (relative) importance scores varied across models. We provide figures of variable importance scores of the three models in the Online Supplementary Document and will discuss the difference in the (relative) importance scores in the Discussion section. We decided to keep these four covariates and demographic information, including sex and race/ethnicity, as covariates in the proposed model.
\subsection{Proposed Models}\label{app:model}
Tables \ref{tbl:GMM_selection} and \ref{tbl:GMM_reduction} present the estimates from the proposed GMM for joint development with covariates from feature selection and those from feature extraction, respectively. We first noticed that the estimated mixing proportions of both models were different from those of the joint development model without any covariates, and the proportions of these two models were also different. Upon further examination, the clusters obtained from the joint development model in Section \ref{app:number} agreed better with those from the model in Table \ref{tbl:GMM_selection} (i.e., the GMM with covariates from feature selection) (Dumenci's Latent Kappa\footnote{Note that the equations to calculate latent Kappa is the same as those to calculate Kappa statistics. The only difference lies in that the former was developed for the latent categorical variables \citep{Dumenci2011kappa, Dumenci2019knee}. In this project, we calculate latent Kappa using the \textit{R} package \textit{fmsb} \citep{Nakazawa2019fmsb}.}: $0.75$ with $95\%$ CI ($0.70$, $0.80$), $74$ out of $500$ students were assigned to different classes by the two models) than those from the model in Table \ref{tbl:GMM_reduction} (i.e., the GMM with covariates from feature reduction) (Kappa statistics: $0.69$ with $95\%$ CI ($0.63$, $0.74$), $98$ out of $500$ students were assigned to different classes by two models). The agreement of latent classes of the two GMM with covariates was better (Kappa statistics: $0.79$ with $95\%$ CI ($0.75$, $0.84$), $62$ out of $500$ students were assigned to different classes by the two models). Additionally, the clustering models can identify students in Class $3$ from the other two latent classes, although the students in Class $1$ and $2$ may switch membership when adding or changing covariates in this example.
\tablehere{5}
\tablehere{6}
We observed that the class-specific estimates obtained from the two GMMs for joint development are similar. On average, students in Class $1$ had the lowest reading and mathematics achievement levels during the entire study duration. On average, students in Class $2$ had a better academic performance at the beginning of the survey and during the pre-knot development stage than those in Class $1$. Students in Class $3$ had the best academic performance on average throughout the entire duration. Post-knot development in reading and mathematics skills slowed substantially for all three classes, and the change to the slower growth rate occurred earlier in reading ability than in mathematics ability. Additionally, students who had higher reading ability performance tended to have higher mathematics IRT scores in general. However, the association in the development of two abilities varied among the three classes. Specifically, this association was significant during the whole duration for students in Class $1$, while significant at the beginning and during the pre-knot development stage for students in Class $2$, and while significant only at the initial status for students in Class $3$.
The effects of baseline characteristics were different in the two models. Specifically, from the model in Table \ref{tbl:GMM_selection}, students from families with higher income and parents' education were more likely to be in Class $2$, while girls from families with higher socioeconomic status were more likely to be in Class $3$. In addition to the above insights, the model in Table \ref{tbl:GMM_reduction} also suggests that students with higher values in the scores of factor $1$ (i.e., the differentiation in teacher-reported ability and teacher-rated problems) tended to have better academic performance (i.e., be separated in Class $2$ or $3$).
\section{Discussion}\label{discussion}
This article proposes a GMM with a PBLSGM as the within-class model to investigate the heterogeneity in joint nonlinear development and the effects that baseline characteristics have on the class membership. We demonstrate the proposed model using simulation studies and a real-world data analysis. We performed in-depth investigations on the convergence rate, the performance metrics, and the accuracy value of the clustering algorithm through simulation studies. The convergence rate of the proposed model achieved at least $94\%$ under the conditions where two repeated outcomes were correlated. In general, we obtained unbiased and accurate point estimates with target coverage probabilities from the proposed GMM. The simulation study also showed that several factors, especially the separation between outcome-specific knot locations and the correlation between the two outcomes, affect the accuracy value of the clustering algorithm. The accuracy values were at least $80\%$ when we set the difference in outcome-specific knot locations as $1.00$. We also illustrate how to apply the proposed model on a random subset with $n=500$ from ECLS-K:2011 and provide general steps for implementing the model in practice.
In addition to providing insights of the association between developmental processes and the heterogeneity in such associations, the proposed model can also improve performance measures and clustering performance (i.e., accuracy), as shown in the simulation study. This is not unexpected. As stated earlier, the Mahalanobis distance and the separation between knot locations increase when we consider multiple developmental processes simultaneously. The increased separation between two latent classes improves the clustering performance, quantified by the accuracy value; the higher accuracy value, indicating the algorithm groups more trajectories into the correct clusters, results in better within-class estimates that are only based on the trajectories separated into the corresponding cluster. We also noticed that the estimated mixing proportions obtained from the joint development model and each univariate development model differed in the simulation study and the real-world data analysis. For the empirical example, this difference can be attributed to the joint development model focusing on class membership on both reading and mathematics ability, whereas the univariate development model can only separate reading or mathematics ability trajectories.
\subsection{Practical Considerations}
As shown in the simulation study, the proposed model suffered a severe non-convergence issue (the convergence rate was only $54\%$ under some conditions) when the two processes in the `joint' development were actually isolated (i.e., the between-construct growth factor covariance was $0$). Accordingly, whether to investigate the heterogeneity in joint development should be decided before constructing the proposed GMM. If it is of interest, we recommend testing whether the processes are associated using the PBLSGM that converged well even under conditions with zero between-construct correlation, as shown in \citet{Liu2021PBLSGM}. Additionally, the challenges of the GMM with univariate development, such as determining the optimal number of latent classes and deciding the covariates for the model, are even more challenging for the GMM with joint development. Given these considerations, we recommend building the proposed GMM in a stepwise fashion, although we proposed it as a one-step model. The recommended steps are:
\begin{enumerate}
\item{Univariate Analysis: Exclusion of any covariates, construct a latent growth curve model and growth mixture models with different numbers of latent classes to select the optimal number by the BIC for each developmental process,}
\item{Association Analysis: Test whether the processes are associated using the PBLSGM,}
\item{If at least one optimal number of latent classes from Step 1 is two or above and these processes are associated, then construct GMMs for joint development:}
\begin{enumerate}
\item{Decide the number of latent classes, which can be driven by the BIC as in Step 1 or driven by answering a question as we did in the Application section,}
\item{Conduct feature selection by constructing a SEM Forests model, or feature extraction by conducting the EFA, or both to shrink covariate space,}
\item{Build the proposed GMM(s) with covariate set(s) obtained from Step 3(b).}
\end{enumerate}
\end{enumerate}
In addition to the stepwise list, we still want to present a collection of recommendations for potential issues that empirical researchers may face in practice. First of all, as shown in the Application section, the number of latent classes of the joint development model decided by the BIC can differ from that of the univariate development models. This is not surprising as the addition of one latent class of the proposed model includes additional $32$ parameters; for such a complex model, the BIC tends to select the model with fewer latent classes as it penalizes model complexity (i.e., the number of parameters). Alternatively, the selection of the optimal number of clusters can be driven by \textit{a priori} knowledge obtained from univariate development models, as we did in the Application section. In practice, suppose we have already known that three latent classes exist in the development of reading or mathematics ability; one reasonable research question is to examine the heterogeneity in joint development of reading and mathematics skills with the three clusters assumption.
Furthermore, we need to decide to include which covariates in the proposed model to inform the cluster formation. The covariate space usually has a high dimension and highly correlated subsets in educational and psychological domains where the GMM is widely used. Two approaches, feature selection and feature extraction, can help reduce covariate dimension and address the possible collinearity issue in the statistical and machine learning literature. Both have their counterparts in the SEM framework. For example, the SEM Forests can select covariates with the highest importance scores in predicting the model implied mean vector and variance-covariance structure, while the EFA can reduce the number of covariates by replacing a large number of those highly correlated variables with a small number of factors. Early studies have demonstrated that these two methods can be used for the GMM with univariate development. In this study, we extended these two methods to the GMM with joint development.
Though it is not our aim to comprehensively examine both methods in this study, we still want to add four notes on these approaches for empirical researchers. First, no method is universally preferred. For the SEM Forest, variable importance scores are generated by the template growth curve model and candidate covariates. As shown in the Application section, we can construct a SEM Forests model for joint development and each univariate development, which allows us to evaluate the (relative) importance of covariates for each model, and then examine the causes of the heterogeneity in each development efficiently. For example, patients' highest education was the factor with a high importance score in three models. However, its impact on the developmental processes varied, as its relative importance score is much higher in reading development than in mathematics development. This difference can also provide insights to us: reading ability is an ability that is more related to exposure, and parents with a higher educational level can provide a better environment that helps improve reading skills. We cannot obtain such insights from the feature extraction method since the EFA produces factors that can explain the variance of a larger data set only from the covariates themselves.
Second, the variable importance scores of SEM Forests only tell us which characteristics have a (relatively) greater impact on sample heterogeneity, but it does not provide how these characteristics affect the heterogeneity. For example, sex had opposite effects on the univariate development of reading ability and mathematics ability. Specifically, boys tended to perform better in mathematics while girls outperformed in reading, which can only be observed by adding the covariate to the univariate development models.
Additionally, the estimated mixing proportions varied if we included different covariates in the model for joint development. We have the same issue for GMMs with univariate development. Because we decided on the covariates by data-driven approaches and the agreement between the cluster labels obtained from the two models is good enough\footnote{As \citet{Nakazawa2019fmsb, Landis1977kappa}, a value of latent Kappa above $0.8$ indicates an almost perfect agreement, while a value greater than $0.6$ suggests a substantial agreement. }, it should not be a major concern to put which covariate set in the model; instead, a question of greater research interest could be examining the individuals who were re-classified by different models. For example, the proposed algorithm can identify students in Class $3$, but sometimes failed to distinguish students in the other two classes, which may suggest that the boundary between students in Class $1$ and $2$ is not so consistent when we add or change covariate(s).
Last, the interpretation of logistic coefficients of the GMM with covariates obtained from the two methods could be different. For example, the GMM with covariates from the feature selection method only suggests that socioeconomic variables were positively associated with academic performance, while that with covariates from the feature extraction method also suggests that teacher-reported abilities and approach-to-learning were positively associated with academic performance while internalizing/externalizing problems were negatively associated with academic achievement. Again, it is not our aim to compare and contrast the two approaches to shrinking covariate space; instead, we want to demonstrate how to obtain a more holistic evaluation of the heterogeneity in joint development by the proposed model and these methods.
\subsection{Methodological Considerations and Future Directions}
There are several future directions for the current study. First of all, we assumed that the outcome-specific knots in each latent class are roughly the same across individuals (i.e., the heterogeneity in knot locations is only due to the existence of subpopulations) to build a parsimonious model. However, the outcome-specific knots in each cluster can also be individually different. Accordingly, one possible future model is to relax the fixed class-specified knots assumption and examine their random effects so that we can assess individual-level knots.
Second, in this study, we build the model assuming that all baseline covariates only have indirect effects on the heterogeneity in trajectories (i.e., only informing the cluster formation). However, these covariates can also directly affect the heterogeneity in trajectories (i.e., explaining the variance of class-specific growth factors) \citep{Kim2016expert, Masyn2017Direct, Liu2020MoE}. The proposed model can also be extended accordingly. One limitation of this assumption lies in that it does not allow for examining time-varying covariates. Fortunately, \citet{Liu2020MoE} has demonstrated how to evaluate the effects of time-varying covariates on the heterogeneity in univariate development. It should be extended for analyzing joint development straightforwardly.
Third, the mixing proportions in the current study are determined by the logistic functions that only allow for (generalized) linear models, which is also a possible explanation that the variables approach-to-learning and attentional focus were important in the SEM Forests but were not statistically significant in the GMM model. Accordingly, another possible extension of the current study is to develop other functional forms for the mixing proportions that may allow for nonlinear models.
\subsection{Concluding Remarks}
In this article, we propose to use a GMM to investigate the heterogeneity in nonlinear joint development and the effects of the baseline characteristics on sample heterogeneity with an assumption that these characteristics only inform the cluster formation. Overall, we have shown the performance and application of the GMM with a PBLSGM as the within-class model. Given that the nonlinear underlying developmental process could be other functional forms other than bilinear spline for either theoretical or empirical considerations, we provide the GMM with joint quadratic trajectories and that with joint Jenss-Bayley growth curve in the online appendix for researchers who are willing to utilize them.
\renewcommand\thefigure{\arabic{figure}}
\setcounter{figure}{0}
\begin{figure}
\caption{Coverage Probabilities of Outcome-Specific Knot in Each Cluster}
\label{fig:KnotCP}
\end{figure}
\begin{figure}
\caption{Mean Accuracy of the Proposed Model across All Conditions}
\label{fig:acc}
\end{figure}
\begin{figure}
\caption{Comparison of Mean Accuracy of GMMs for Joint Development and Univariate Development with Large Separation in Outcome-specific Knot Locations}
\label{fig:acc_compare}
\end{figure}
\begin{figure}
\caption{Trajectory of Reading Ability}
\label{fig:traj_reading_uni}
\caption{Trajectory of Math Ability}
\label{fig:traj_math_uni}
\caption{Model Implied Trajectory and Smooth Line of Univariate Repeated Outcome}
\label{fig:traj_uni}
\end{figure}
\begin{figure}
\caption{Trajectory of Reading Ability}
\label{fig:traj_reading_bi}
\caption{Trajectory of Math Ability}
\label{fig:traj_math_bi}
\caption{Model Implied Trajectory and Smooth Line of Bivariate Repeated Outcome}
\label{fig:traj_bi}
\end{figure}
\renewcommand\thetable{\arabic{table}}
\setcounter{table}{0}
\begin{table}
\centering
\begin{threeparttable}
\setlength{\tabcolsep}{5pt}
\renewcommand{0.75}{0.75}
\caption{Performance Metrics: Definitions and Estimates}
\begin{tabular}{p{4cm}p{4.5cm}p{5.5cm}}
\hline
\hline
\textbf{Criteria} & \textbf{Definition} & \textbf{Estimate} \\
\hline
Relative Bias & $E_{\hat{\theta}}(\hat{\theta}-\theta)/\theta$ & $\sum_{s=1}^{S}(\hat{\theta}_{s}-\theta)/S\theta$ \\
Empirical SE & $\sqrt{Var(\hat{\theta})}$ & $\sqrt{\sum_{s=1}^{S}(\hat{\theta}_{s}-\bar{\theta})^{2}/(S-1)}$ \\
Relative RMSE & $\sqrt{E_{\hat{\theta}}(\hat{\theta}-\theta)^{2}}/\theta$ & $\sqrt{\sum_{s=1}^{S}(\hat{\theta}_{s}-\theta)^{2}/S}/\theta$ \\
Coverage Probability & $Pr(\hat{\theta}_{\text{low}}\le\theta\le\hat{\theta}_{\text{upper}})$ & $\sum_{s=1}^{S}I(\hat{\theta}_{\text{low},s}\le\theta\le\hat{\theta}_{\text{upper},s})/S$\\
\hline
\hline
\end{tabular}
\label{tbl:metric}
\begin{tablenotes}
\small
\item[1]{$\theta$: the population value of the parameter of interest} \\
\item[2]{$\hat{\theta}$: the estimate of $\theta$} \\
\item[3]{$S$: the number of replications and set as $1,000$ in our simulation study} \\
\item[4]{$s=1,\dots,S$: indices the replications of the simulation} \\
\item[5]{$\hat{\theta}_{s}$: the estimate of $\theta$ from the $s^{th}$ replication} \\
\item[6]{$\bar{\theta}$: the mean of $\hat{\theta}_{s}$'s across replications} \\
\item[7]{$I()$: an indicator function}
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{table}
\centering
\resizebox{1.15\textwidth}{!}{
\begin{threeparttable}
\caption{Simulation Design for the Proposed GMM (Within-class Model: PBLSGM with Fixed Knots)}
\begin{tabular}{p{8cm}p{12.8cm}}
\hline
\hline
\multicolumn{2}{c}{\textbf{Fixed Conditions}} \\
\hline
\textbf{Variables} & \textbf{Conditions} \\
\hline
Variance of Intercept & $\psi_{00}^{(k)[u]}=25$, $u=y, z$; $k=1, 2$ \\
\hline
Variance of Slopes & $\psi_{11}^{(k)[u]}=\psi_{22}^{(k)[u]}=1$, $u=y, z$; $k=1, 2$\\
\hline
Correlations of GFs & $\rho^{(k)[u]}=0.3$, $u=y, z$; $k=1, 2$ \\
\hline
Time (\textit{t}) & $10$ scaled and equally spaced $t_{j} (j=0, \cdots, J-1, J=10)$ \\
\hline
Individual \textit{t} & $t_{ij} \sim U(t_{j}-\Delta, t_{j}+\Delta) (j=0, \cdots, J-1; \Delta=0.25)$ \\
\hline
Sample Size & $n=500$ \\
\hline
Within-construct Mahalanobis distance & $d=0.86$ \\
\hline
Residual Correlation & $\rho_{\epsilon}=0.3$ \\
\hline
\hline
\multicolumn{2}{c}{\textbf{Manipulated Conditions}} \\
\hline
\hline
\textbf{Variables} & \textbf{Conditions} \\
\hline
\multirow{2}{*}{Logistic Coefficients} & $\beta_{0}=0$ (Allocation ratio is about $1:1$), $\beta_{1}=\log(1.5)$, $\beta_{2}=\log(1.7)$\\
& $\beta_{0}=0.775$ (Allocation ratio is about $1:2$), $\beta_{1}=\log(1.5)$, $\beta_{2}=\log(1.7)$ \\
\hline
Residual Variance & $\theta_{\epsilon}^{(k)[u]}=1$ or $2$, $u=y, z$; $k=1, 2$ \\
\hline
\multirow{3}{*}{Locations of knots} & $\mu_{\gamma}^{(1)[y]}=4.00$; $\mu_{\gamma}^{(2)[y]}=4.50$; $\mu_{\gamma}^{(1)[z]}=4.50$; $\mu_{\gamma}^{(2)[z]}=5.00$ \\
& $\mu_{\gamma}^{(1)[y]}=3.75$; $\mu_{\gamma}^{(2)[y]}=4.50$; $\mu_{\gamma}^{(1)[z]}=4.50$; $\mu_{\gamma}^{(2)[z]}=5.25$ \\
& $\mu_{\gamma}^{(1)[y]}=3.50$; $\mu_{\gamma}^{(2)[y]}=4.50$; $\mu_{\gamma}^{(1)[z]}=4.50$; $\mu_{\gamma}^{(2)[z]}=5.50$ \\
\hline
Between-construct Correlation of GF & $\rho=-0.3,0,0.3$ \\
\hline
\hline
\multicolumn{2}{l}{\textbf{Scenario 1: Different Intercept Mean and Knot Mean for $u=y$ and $u=z$}} \\
\hline
\textbf{Variables} & \textbf{Conditions} \\
\hline
Means of Slope 1's & $\mu_{\eta_{1}}^{(k)[u]}=5$ $(k=1, 2)$ \\
\hline
Means of Slope 2's
& $\mu_{\eta_{2}}^{(k)[u]}=2.6$ $(k=1, 2)$ \\
\hline
Means of Intercepts & $\mu_{\eta_{0}}^{(1)[y]}=98$, $\mu_{\eta_{0}}^{(2)[y]}=102$, $\mu_{\eta_{0}}^{(1)[z]}=98$, $\mu_{\eta_{0}}^{(2)[z]}=102$ \\
\hline
\hline
\multicolumn{2}{l}{\textbf{\makecell[l]{Scenario 2: Different Intercept Mean and Knot Mean for $u=y$, \\ Different First Slope Mean and Knot Mean for $u=z$}}}\\
\hline
\textbf{Variables} & \textbf{Conditions} \\
\hline
Means of Intercepts & $\mu_{\eta_{0}}^{(1)[y]}=98$, $\mu_{\eta_{0}}^{(2)[y]}=102$, $\mu_{\eta_{0}}^{(k)[z]}=100$ $(k=1,2)$ \\
\hline
Means of Slope 2's & $\mu_{\eta_{2}}^{(k)[y]}=2.6$, $\mu_{\eta_{2}}^{(k)[z]}=2$ \\
\hline
Means of Slope 1's & $\mu_{\eta_{1}}^{(k)[y]}=5.0$ $(k=1,2)$, $\mu_{\eta_{1}}^{(1)[z]}=4.4$, $\mu_{\eta_{1}}^{(2)[z]}=3.6$ \\
\hline
\hline
\multicolumn{2}{l}{\textbf{\makecell[l]{Scenario 3: Different Intercept Mean and Knot Mean for $u=y$, \\ Different Second Slope Mean and Knot Mean for $u=z$}}}\\
\hline
\textbf{Variables} & \textbf{Conditions} \\
\hline
Means of Intercepts & $\mu_{\eta_{0}}^{(1)[y]}=98$, $\mu_{\eta_{0}}^{(2)[y]}=102$, $\mu_{\eta_{0}}^{(k)[z]}=100$ $(k=1,2)$ \\
\hline
Means of Slope 1's & $\mu_{\eta_{1}}^{(k)[y]}=5.0$, $\mu_{\eta_{1}}^{(k)[z]}=4.4$ \\
\hline
Means of Slope 2's & $\mu_{\eta_{2}}^{(k)[y]}=2.6$ $(k=1,2)$, $\mu_{\eta_{2}}^{(1)[z]}=2.0$, $\mu_{\eta_{2}}^{(2)[z]}=2.8$ \\
\hline
\hline
\end{tabular}
\label{tbl:simu}
\end{threeparttable}}
\end{table}
\begin{table}
\centering
\resizebox{1.15\textwidth}{!}{
\begin{threeparttable}
\caption{Summary of Model Fit Information for GMMs}
\begin{tabular}{lrrrrrrr}
\hline
\hline
\multicolumn{7}{c}{\textbf{GMM with Development in Reading Ability}}\\
\hline
$\#$ of Clusters & -2ll & AIC & BIC & $\%$ of Class $1$ & $\%$ of Class $2$ & $\%$ of Class $3$ & $\#$ of Para. \\
\hline
$1$ & $32696.90$ & $32718.90$ &$32765.27$ & $100.0\%$ & ---\tnote{1} & --- & $11$\\
$2$ & $32298.79$ & $32344.79$ &$32441.73$ & $33.4\%$ & $66.6\%$ & --- & $23$ \\
$3$& $32133.83$ & $32203.83$ & $32351.34$ & $27.4\%$ & $49.2\%$ & $23.4\%$ & $35$ \\
\hline
\hline
\multicolumn{7}{c}{\textbf{GMM with Development in Mathematics Ability}}\\
\hline
$\#$ of Clusters & -2ll & AIC & BIC & $\%$ of Class $1$ & $\%$ of Class $2$ & $\%$ of Class $3$ & $\#$ of Para. \\
\hline
$1$ & $31579.12$ & $31601.12$ &$31647.48$ & $100.0\%$ & --- & --- & $11$\\
$2$ & $31385.75$ & $31431.75$ & $31528.68$ & $36.6\%$ & $63.4\%$ & --- & $23$\\
$3$& $31235.90$ & $31305.90$ & $31453.42$ & $23.2\%$ & $48.0\%$ & $28.8\%$ & $35$\\
\hline
\hline
\multicolumn{7}{c}{\textbf{GMM with Joint Development in Reading \& Mathematics Ability}}\\
\hline
$\#$ of Clusters & -2ll & AIC & BIC & $\%$ of Class $1$ & $\%$ of Class $2$ & $\%$ of Class $3$ & $\#$ of Para. \\
\hline
$1$ & $63328.02$ & $63392.02$ & $63526.89$ & $100.0\%$ & --- & --- & $32$\\
$2$ & $62793.03$ & $62923.03$ & $63268.39$ & $34.0\%$ & $66.0\%$ & --- & $65$\\
$3$& $62573.31$ & $62769.31$ & $63318.20$ & $32.6\%$ & $44.2\%$ & $23.2\%$ & $98$\\
\hline
\hline
\end{tabular}
\label{tbl:compare}
\begin{tablenotes}
\small
\item[2] --- indicates that the metric was not available for the model.
\end{tablenotes}
\end{threeparttable}}
\end{table}
\begin{table}
\centering
\resizebox{1.15\textwidth}{!}{
\begin{threeparttable}
\setlength{\tabcolsep}{5pt}
\renewcommand{0.75}{0.75}
\caption{Estimates of GMM with Joint Development of Reading and Mathematics Ability with Covariates from Feature Selection}
\begin{tabular}{lrrrrrr}
\hline
\hline
& \multicolumn{6}{c}{\textbf{Reading Ability}} \\
\hline
& \multicolumn{2}{c}{\textbf{Class 1 ($\boldsymbol{30.6\%}$)}} & \multicolumn{2}{c}{\textbf{Class 2 ($\boldsymbol{50.2\%}$)}}& \multicolumn{2}{c}{\textbf{Class 3 ($\boldsymbol{19.2\%}$)}} \\
\hline
\textbf{Mean of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept}\tnote{1} & $33.478$ ($0.932$) & $<0.0001^{\ast}$ & $39.998$ ($0.878$) & $<0.0001^{\ast}$ & $55.155$ ($2.140$) & $<0.0001^{\ast}$ \\
\textbf{Slope $1$} & $1.697$ ($0.047$) & $<0.0001^{\ast}$ & $2.197$ ($0.038$) & $<0.0001^{\ast}$ & $2.549$ ($0.085$) & $<0.0001^{\ast}$ \\
\textbf{Slope $2$} & $0.667$ ($0.040$) & $<0.0001^{\ast}$ & $0.678$ ($0.022$) & $<0.0001^{\ast}$ & $0.705$ ($0.022$) & $<0.0001^{\ast}$ \\
\hline
\hline
\textbf{Additional Parameter} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Knot} & $104.404$ ($0.883$) & $<0.0001^{\ast}$ & $92.757$ ($0.456$) & $<0.0001^{\ast}$ & $84.475$ ($0.528$) & $<0.0001^{\ast}$ \\
\hline
\hline
\textbf{Variance of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept} & $53.709$ ($13.141$) & $<0.0001^{\ast}$ & $63.992$ ($11.869$) & $<0.0001^{\ast}$ & $351.823$ ($61.995$) & $<0.0001^{\ast}$ \\
\textbf{Slope $1$} & $0.149$ ($0.024$) & $<0.0001^{\ast}$ & $0.132$ ($0.021$) & $<0.0001^{\ast}$ & $0.432$ ($0.094$) & $<0.0001^{\ast}$ \\
\textbf{Slope $2$} & $0.093$ ($0.021$) & $<0.0001^{\ast}$ & $0.034$ ($0.007$) & $<0.0001^{\ast}$ & $0.013$ ($0.006$) & $0.0303^{\ast}$ \\
\hline
\hline
& \multicolumn{6}{c}{\textbf{Mathematics Ability}} \\
\hline
& \multicolumn{2}{c}{\textbf{Class 1 ($\boldsymbol{30.6\%}$)}} & \multicolumn{2}{c}{\textbf{Class 2 ($\boldsymbol{50.2\%}$)}}& \multicolumn{2}{c}{\textbf{Class 3 ($\boldsymbol{19.2\%}$)}} \\
\hline
\textbf{Mean of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept} & $19.128$ ($0.898$) & $<0.0001^{\ast}$ & $26.253$ ($0.776$) & $<0.0001^{\ast}$ & $38.773$ ($1.263$) & $<0.0001^{\ast}$ \\
\textbf{Slope $1$} & $1.572$ ($0.035$) & $<0.0001^{\ast}$ & $1.847$ ($0.029$) & $<0.0001^{\ast}$ & $1.909$ ($0.046$) & $<0.0001^{\ast}$ \\
\textbf{Slope $2$} & $0.695$ ($0.039$) & $<0.0001^{\ast}$ & $0.704$ ($0.024$) & $<0.0001^{\ast}$ & $0.761$ ($0.033$) & $<0.0001^{\ast}$ \\
\hline
\hline
\textbf{Additional Parameter} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Knot} & $107.954$ ($1.016$) & $<0.0001^{\ast}$ & $100.232$ ($0.591$) & $<0.0001^{\ast}$ & $96.487$ ($0.696$) & $<0.0001^{\ast}$ \\
\hline
\hline
\textbf{Variance of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept} & $46.387$ ($10.604$) & $<0.0001^{\ast}$ & $47.648$ ($9.781$) & $<0.0001^{\ast}$ & $107.252$ ($19.352$) & $<0.0001^{\ast}$ \\
\textbf{Slope $1$} & $0.067$ ($0.013$) & $<0.0001^{\ast}$ & $0.069$ ($0.012$) & $<0.0001^{\ast}$ & $0.073$ ($0.021$) & $0.0005^{\ast}$ \\
\textbf{Slope $2$} & $0.039$ ($0.015$) & $0.0093^{\ast}$ & $0.009$ ($0.009$) & $0.3173$ & $0.041$ ($0.012$) & $0.0006^{\ast}$ \\
\hline
\hline
& \multicolumn{6}{c}{\textbf{Association between Reading and Mathematics Ability}} \\
\hline
& \multicolumn{2}{c}{\textbf{Class 1 ($\boldsymbol{30.6\%}$)}} & \multicolumn{2}{c}{\textbf{Class 2 ($\boldsymbol{50.2\%}$)}}& \multicolumn{2}{c}{\textbf{Class 3 ($\boldsymbol{19.2\%}$)}} \\
\hline
\textbf{Mean of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept} & $35.308$ ($9.365$) & $0.0002^{\ast}$ & $51.965$ ($8.804$) & $<0.0001^{\ast}$ & $75.535$ ($27.023$) & $0.0052^{\ast}$ \\
\textbf{Slope $1$} & $0.045$ ($0.014$) & $0.0013^{\ast}$ & $0.046$ ($0.012$) & $0.0001^{\ast}$ & $0.021$ ($0.032$) & $0.5117$ \\
\textbf{Slope $2$} & $0.026$ ($0.013$) & $0.0455^{\ast}$ & $-0.003$ ($0.005$) & $0.5485$ & $0.006$ ($0.007$) & $0.3914$ \\
\hline
\hline
& \multicolumn{6}{c}{\textbf{Logistic Coefficients}} \\
\hline
& \multicolumn{2}{c}{\textbf{Class 1 ($\boldsymbol{30.6\%}$)}} & \multicolumn{2}{c}{\textbf{Class 2 ($\boldsymbol{50.2\%}$)}}& \multicolumn{2}{c}{\textbf{Class 3 ($\boldsymbol{19.2\%}$)}} \\
\hline
& \multicolumn{2}{r}{OR ($95\%$ CI)\tnote{3}} & \multicolumn{2}{r}{OR ($95\%$ CI)} & \multicolumn{2}{r}{OR ($95\%$ CI)} \\
\hline
\textbf{Family Income} & \multicolumn{2}{r}{---\tnote{4}} & \multicolumn{2}{r}{$1.091$ ($1.020$, $1.165$)$^{\ast}$} & \multicolumn{2}{r}{$1.131$ ($1.043$, $1.227$)$^{\ast}$} \\
\textbf{Parents' Highest Education} & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$1.201$ ($1.006$, $1.434$)$^{\ast}$} & \multicolumn{2}{r}{$1.772$ ($1.410$, $2.226$)$^{\ast}$} \\
\textbf{Attentional Focus} & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$0.965$ ($0.678$, $1.373$)} & \multicolumn{2}{r}{$1.350$ ($0.907$, $2.010$)} \\
\textbf{approach-to-learning} & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$1.708$ ($0.868$, $3.362$)} & \multicolumn{2}{r}{$1.995$ ($0.919$, $4.329$)} \\
\textbf{Sex} ($0$---Boy; $1$---Girl) & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$1.217$ ($0.691$, $2.144$)} & \multicolumn{2}{r}{$2.227$ ($1.142$, $4.342$)$^{\ast}$} \\
\textbf{Race} ($0$---White; $1$---Others) & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$1.082$ ($0.567$, $2.066$)} & \multicolumn{2}{r}{$1.642$ ($0.792$, $3.407$)} \\
\hline
\hline
\end{tabular}
\label{tbl:GMM_selection}
\begin{tablenotes}
\small
\item[1] Intercept was defined as mathematics IRT scores at 60-month old in this case.
\item[2] $^{\ast}$ indicates statistical significance at $0.05$ level.
\item[3] OR ($95\%$ CI) indicates Odds Ratio ($95\%$ Confidence Interval).
\item[4] We set Class $1$ as the reference group.
\end{tablenotes}
\end{threeparttable}}
\end{table}
\begin{table}
\centering
\resizebox{1.15\textwidth}{!}{
\begin{threeparttable}
\setlength{\tabcolsep}{5pt}
\renewcommand{0.75}{0.75}
\caption{Estimates of GMM with Joint Development of Reading and Mathematics Ability with Covariates from Feature Reduction}
\begin{tabular}{lrrrrrr}
\hline
\hline
& \multicolumn{6}{c}{\textbf{Reading Ability}} \\
\hline
& \multicolumn{2}{c}{\textbf{Class 1 ($\boldsymbol{20.0\%}$)}} & \multicolumn{2}{c}{\textbf{Class 2 ($\boldsymbol{59.8\%}$)}}& \multicolumn{2}{c}{\textbf{Class 3 ($\boldsymbol{20.2\%}$)}} \\
\hline
\textbf{Mean of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept}\tnote{1} & $33.917$ ($1.093$) & $<0.0001^{\ast}$ & $38.670$ ($0.828$) & $<0.0001^{\ast}$ & $53.774$ ($1.979$) & $<0.0001^{\ast}$ \\
\textbf{Slope $1$} & $1.574$ ($0.052$) & $<0.0001^{\ast}$ & $2.159$ ($0.039$) & $<0.0001^{\ast}$ & $2.557$ ($0.077$) & $<0.0001^{\ast}$ \\
\textbf{Slope $2$} & $0.652$ ($0.055$) & $<0.0001^{\ast}$ & $0.657$ ($0.021$) & $<0.0001^{\ast}$ & $0.706$ ($0.020$) & $<0.0001^{\ast}$ \\
\hline
\hline
\textbf{Additional Parameter} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Knot} & $108.144$ ($1.304$) & $<0.0001^{\ast}$ & $94.206$ ($0.513$) & $<0.0001^{\ast}$ & $84.837$ ($0.463$) & $<0.0001^{\ast}$ \\
\hline
\hline
\textbf{Variance of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept} & $58.917$ ($14.522$) & $<0.0001^{\ast}$ & $72.138$ ($12.242$) & $<0.0001^{\ast}$ & $342.166$ ($54.118$) & $<0.0001^{\ast}$ \\
\textbf{Slope $1$} & $0.115$ ($0.024$) & $<0.0001^{\ast}$ & $0.128$ ($0.024$) & $<0.0001^{\ast}$ & $0.401$ ($0.081$) & $<0.0001^{\ast}$ \\
\textbf{Slope $2$} & $0.090$ ($0.030$) & $0.0027^{\ast}$ & $0.035$ ($0.007$) & $<0.0001^{\ast}$ & $0.012$ ($0.006$) & $0.0455^{\ast}$ \\
\hline
\hline
& \multicolumn{6}{c}{\textbf{Mathematics Ability}} \\
\hline
& \multicolumn{2}{c}{\textbf{Class 1 ($\boldsymbol{20.0\%}$)}} & \multicolumn{2}{c}{\textbf{Class 2 ($\boldsymbol{59.8\%}$)}}& \multicolumn{2}{c}{\textbf{Class 3 ($\boldsymbol{20.2\%}$)}} \\
\hline
\textbf{Mean of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept} & $18.744$ ($1.104$) & $<0.0001^{\ast}$ & $25.097$ ($0.717$) & $<0.0001^{\ast}$ & $38.167$ ($1.151$) & $<0.0001^{\ast}$ \\
\textbf{Slope $1$} & $1.530$ ($0.040$) & $<0.0001^{\ast}$ & $1.829$ ($0.024$) & $<0.0001^{\ast}$ & $1.892$ ($0.036$) & $<0.0001^{\ast}$ \\
\textbf{Slope $2$} & $0.642$ ($0.051$) & $<0.0001^{\ast}$ & $0.696$ ($0.021$) & $<0.0001^{\ast}$ & $0.768$ ($0.030$) & $<0.0001^{\ast}$ \\
\hline
\hline
\textbf{Additional Parameter} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Knot} & $110.725$ ($1.218$) & $<0.0001^{\ast}$ & $100.93$ ($0.043$) & $<0.0001^{\ast}$ & $96.505$ ($0.642$) & $<0.0001^{\ast}$ \\
\hline
\hline
\textbf{Variance of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept} & $48.441$ ($12.058$) & $0.0001^{\ast}$ & $46.792$ ($8.952$) & $<0.0001^{\ast}$ & $103.326$ ($17.628$) & $<0.0001^{\ast}$ \\
\textbf{Slope $1$} & $0.063$ ($0.014$) & $<0.0001^{\ast}$ & $0.069$ ($0.012$) & $<0.0001^{\ast}$ & $0.075$ ($0.016$) & $<0.0001^{\ast}$ \\
\textbf{Slope $2$} & $0.042$ ($0.020$) & $0.0357^{\ast}$ & $0.013$ ($0.007$) & $0.0633$ & $0.038$ ($0.012$) & $0.0015^{\ast}$ \\
\hline
\hline
& \multicolumn{6}{c}{\textbf{Association between Reading and Mathematics Ability}} \\
\hline
& \multicolumn{2}{c}{\textbf{Class 1 ($\boldsymbol{20.0\%}$)}} & \multicolumn{2}{c}{\textbf{Class 2 ($\boldsymbol{59.8\%}$)}}& \multicolumn{2}{c}{\textbf{Class 3 ($\boldsymbol{20.2\%}$)}} \\
\hline
\textbf{Mean of Growth Factor} & Estimate (SE) & P value & Estimate (SE) & P value & Estimate (SE) & P value \\
\hline
\textbf{Intercept} & $36.751$ ($11.744$) & $0.0018^{\ast}$ & $55.778$ ($8.866$) & $<0.0001^{\ast}$ & $80.666$ ($23.683$) & $0.0007^{\ast}$ \\
\textbf{Slope $1$} & $0.038$ ($0.013$) & $0.0035^{\ast}$ & $0.047$ ($0.014$) & $0.0008^{\ast}$ & $0.021$ ($0.025$) & $0.4009$ \\
\textbf{Slope $2$} & $0.025$ ($0.020$) & $0.2113$ & $0.001$ ($0.005$) & $0.8415$ & $0.005$ ($0.008$) & $0.5320$ \\
\hline
\hline
& \multicolumn{6}{c}{\textbf{Logistic Coefficients}} \\
\hline
& \multicolumn{2}{c}{\textbf{Class 1 ($\boldsymbol{20.0\%}$)}} & \multicolumn{2}{c}{\textbf{Class 2 ($\boldsymbol{59.8\%}$)}}& \multicolumn{2}{c}{\textbf{Class 3 ($\boldsymbol{20.2\%}$)}} \\
\hline
& \multicolumn{2}{r}{OR ($95\%$ CI)\tnote{3}} & \multicolumn{2}{r}{OR ($95\%$ CI)} & \multicolumn{2}{r}{OR ($95\%$ CI)} \\
\hline
\textbf{Factor $1$} & \multicolumn{2}{r}{---\tnote{4}} & \multicolumn{2}{r}{$1.637$ ($1.019$, $2.631$)$^{\ast}$} & \multicolumn{2}{r}{$2.600$ ($1.403$, $4.818$)$^{\ast}$} \\
\textbf{Factor $2$} & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$1.885$ ($1.175$, $3.023$)$^{\ast}$} & \multicolumn{2}{r}{$4.715$ ($2.725$, $8.157$)$^{\ast}$} \\
\textbf{Sex} ($0$---Boy; $1$---Girl) & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$1.359$ ($0.709$, $2.605$)} & \multicolumn{2}{r}{$2.411$ ($1.129$, $5.146$)$^{\ast}$} \\
\textbf{Race} ($0$---White; $1$---Others) & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$0.814$ ($0.440$, $1.506$)} & \multicolumn{2}{r}{$0.927$ ($0.481$, $1.786$)} \\
\textbf{School Location} & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$0.776$ ($0.528$, $1.140$)} & \multicolumn{2}{r}{$0.664$ ($0.425$, $1.038$)} \\
\textbf{School Type} ($0$---Public; $1$---Private) & \multicolumn{2}{r}{---} & \multicolumn{2}{r}{$2.149$ ($0.593$, $7.793$)} & \multicolumn{2}{r}{$2.929$ ($0.581$, $14.772$)} \\
\hline
\hline
\end{tabular}
\label{tbl:GMM_reduction}
\begin{tablenotes}
\small
\item[1] Intercept was defined as mathematics IRT scores at 60-month old in this case.
\item[2] $^{\ast}$ indicates statistical significance at $0.05$ level.
\item[3] OR ($95\%$ CI) indicates Odds Ratio ($95\%$ Confidence Interval).
\item[4] We set Class $1$ as the reference group.
\end{tablenotes}
\end{threeparttable}}
\end{table}
\end{document}
|
math
|
کرٛیب ماز کِتھ پٲٹھۍ چھِ رَنان
|
kashmiri
|
विवाह पंचमी ०१ डेक 2०१9 (सुन)
स्कन्द षष्टी/चंपा षष्टी महत्व, पूजा विधि & कथा ०२ डेक २०१९ (मों)
दुर्गा अष्टमी पूजा का महत्व और पूजाविधि ०४ डेक २०१९ (वेड)
जानिए वैभव लक्ष्मी व्रत की महिमा और खास पूजन विधि ०६ डेक २०१९ (फ्री)
जानिए क्या है गीता जयंती का महत्त्व ०८ डेक २०१९ (सुन)
मोक्षदा एकादशी ०८ डेक २०१९ (सुन)
सभी प्रकार के संकटों को दूर करती है मत्स्य द्वादशी ०९ डेक २०१९ (मों)
सोम प्रदोष व्रत विधि व कथा ०९ डेक २०१९ (मों)
जानिए क्या है पिशाच मोचन श्राद्ध का महत्व और विधान १० डेक २०१९ (तुए)
कार्तिगाई दीपम १० डेक २०१९ (तुए)
जानिए त्रिदेवों के अवतार दत्तात्रेय से जुड़ी कुछ खास बातें ११ डेक २०१९ (वेड)
पूर्णिमा व्रत के लाभ और पूजन विधि ११ डेक २०१९ (वेड)
सत्यनारायण व्रत कथा ११ डेक २०१९ (वेड)
रोहिणी व्रत - जैन समुदाय को मह्त्तवपूर्ण त्यौहार ११ डेक २०१९ (वेड)
घर को धन-धान्य से परिपूर्ण रखने के लिए मनाए अन्नपूर्णा जयंती १२ डेक २०१९ (तु)
भैरवी जयंती १२ डेक २०१९ (तु)
पौष माह शुरू १३ डेक २०१९ (फ्री)
गौरी तृतीया १५ डेक २०१९ (सुन)
संकष्टी चतुर्थी १५ डेक २०१९ (सुन)
धनु संक्रांति १६ डेक २०१९ (मों)
कालाष्टमी १९ डेक 20१९ (तु)
सफला एकादशी २२ डेक २०१९ (सुन)
सोम प्रदोष व्रत विधि व कथा २३ डेक २०१९ (मों)
मासिक शिवरात्रि का महत्व २४ डेक २०१९ (तुए)
पौष अमावस्या २६ डेक २०१९ (तु)
चंद्र दर्शन २७ डेक २०१९ (फ्री)
आइए जानें कैसे करें विनायक चतुर्थी का पूजन ३० डेक २०१९ (मों)
स्कन्द षष्टी/चंपा षष्टी महत्व ३१ डेक २०१९ (तुए)
पौष माह शुरू ऑन १३ डेक २०१९
इस महीने में मध्य रात्रि की साधना उपासना त्वरित फलदायी होती है| इस महीने में गर्म वस्त्रों और नवान्न का दान काफी उत्तम होता है| इस महीने में लाल और पीले रंग के वस्त्र भाग्य में वृद्धि करते हैं| इस महीने में घर में कपूर की सुगंध का प्रयोग स्वास्थ्य को खूब अच्छा रखता है|
गौरी तृतीया ऑन १५ डेक २०१९
संकष्टी चतुर्थी सुन्दए, १५ डेक २०१९
संकष्टी चतुर्थी ऑन १५ डेक २०१९
धनु संक्रांति ऑन १६ डेक २०१९
हिंदूधर्म में सूर्यपंचांग के अनुसार धनुसंक्रांति के दिन से ही हिन्दुपंचांग के नौवें महीने का आरंभ हो जाता है। धनु संक्रांति के दिन सूर्यदेव की आराधना का बहुत महत्व है। हिन्दू पंचांग के अनुसार माना जाता है की पौष माह की धनु संक्रांति से पौष संक्रांति का आरम्भ हो जाता है।
कालाष्टमी ऑन १९ डेक 20१९
सफला एकादशी ऑन २२ डेक २०१९
पौष मास के कृष्ण पक्ष की एकादशी तिथि को सफला एकादशी के नाम से जाना जाता है और इसका बहुत ही अधिक मह्तव है। इस विशेष दिन भगवान श्रीकृष्ण जी की पूजा करना बहुत ही ही विशेष माना जाता है। साल के पहले दिन एकादशी और यादि यह मंगलवार के दिन पड़ती है तो इसका महत्व और भी अधिक ब़ढ जाता है। ऐसा भी माना जाता है इस शुभ दिन कुछ खास काम करने से घर में और अधिक सुख-समृद्धि आती है।
सोम प्रदोष व्रत विधि व कथा मोंड्य, २३ डेक २०१९
सोम प्रदोष व्रत विधि व कथा ऑन २३ डेक २०१९
सोम प्रदोष व्रत विधि
३. सुबह नहाने के बाद साफ और चमकदार श्वेत वस्त्र पहनें।
मासिक शिवरात्रि का महत्व तुएस्ड्य, २४ डेक २०१९
मासिक शिवरात्रि का महत्व ऑन २४ डेक २०१९
शिवरात्रि प्रमुख हिंदू त्योहारों में से एक है जो भगवान शिव को पूरी तरह से समर्पित है। हिंदू धर्म के प्रमुख देवताओं में से एक भगवान शिव अपने भक्तों के बीच काफी लोकप्रिय है। हिंदू भक्तों के अनुसार शिवरात्रि ही एक ऐसा अवसर है जो लोगों की आत्मा, मन और शरीर को शुद्ध करता है।
हम में से अधिकांश लोग इस तथ्य से अवगत नहीं हैं कि शिवरात्रि केवल एक वर्ष में एक बार नहीं मनाई जाती है, बल्कि यह वर्ष के प्रत्येक महीने में अलग-अलग तिथियों पर पड़ती है और इसे मासिक शिवरात्रि कहा जाता है। इसकी रौनक देखते ही बनती है। प्राचीन मान्यताओं के आधार पर लोग ने भगवान को प्रसन्न करने के लिए व्रत का पालन किया।
पौष अमावस्या ऑन २६ डेक २०१९
पौष अमावस्या के दिन बुरी शक्तियों का प्रभाव बहुत ही अधिक होता है । इस दिन नकारात्मक शक्तियों का आसानी से वास हो जाता है। इस दिन मृत पितरों के लिए श्राद्ध और तर्पण करने को भी काफी अधिक शुभ माना जाता है।
चंद्र दर्शन ऑन २७ डेक २०१९
आइए जानें कैसे करें विनायक चतुर्थी का पूजन मोंड्य, ३० डेक २०१९
आइए जानें कैसे करें विनायक चतुर्थी का पूजन ऑन ३० डेक २०१९
१. ब्रह्म मुहूर्त (सूर्य उदय के पूर्व) में उठकर, पीले रंग के वस्त्र धारण करें। भगवन गणेश के व्रत का संकल्प लें|
२. पूजन के समय, एक चौकी रखें उसपे हरे रंग का कपडा बिछाएं और गणेश मूर्ति की स्थापना करें|
३. मूर्ति स्थापना के पश्चात कलश स्थापना करें, एक लोटे में जल लें उसपे आम के पत्ते और श्री फल रखें|
स्कन्द षष्टी/चंपा षष्टी महत्व तुएस्ड्य, ३१ डेक २०१९
स्कन्द षष्टी/चंपा षष्टी महत्व ऑन ३१ डेक २०१९
१. स्कन्द षष्टी दक्षिणी भारत में मनाये जाने वाला एक बहुत ही महत्वपूर्ण पर्व है| इस दिन गौरी शंकर भगवान के पुत्र कार्तिकेय की पूजा करि जाती है|
२. भगवान् स्कन्द को मुरुगन,कार्तिकेयन, सुब्रमण्या के नाम से भी जाना जाता है| यह भाद्रपद मॉस के शुक्ल पक्ष की षष्टी तिथि को मनाया जाता है| कार्तिकेय के पूजन से रोग, दुःख और दरिद्रता का निवारण होता है।
३. कथाओं के अनुसार भगवान शिव के तेज से उत्पन्न छह मुख वाले बालक स्कन्द की छह कृतिकाओं ने स्तनपान करा कर रक्षा की थी, इसीलिए कार्तिकेय' नाम से पुकारा जाने लगा।
|
hindi
|
Our second day in Boracay involved helmet diving and a visit to Puka Beach. For a non-swimmer like me, it was a real struggle to see better views of the underwater world by only looking through goggles while wearing a life jacket. No matter how I wanted to do a free dive, I couldn’t cos it’s not advisable if you don’t know how to swim like a pro. So thanks to whoever discovered helmet diving, it helped me experience what was it like down in the sea without worrying about drowning. Yaaaayyy!
We ate quick brunch at around 11:00 AM before heading to our first activity of the day, helmet diving. From the agency booth, we rode a speed boat going to the Helmet Diving Floating Platform. Upon arrival, we were asked to wait until 1:30 PM because the divers who will assist us were still on a lunch break. It wasn’t much of a big deal cos they allowed us to jump in the sea and handed us life rings and goggles. Swimming around kept us entertained as we waited for our turn. From the surface, hundreds of fishes were already visible, what more at the bottom floor?
Finally, we were called for our turn. They took a photo of us prior to the activity and explained to us some hand signals to be used once we reached the bottom of the sea. Obviously, you can barely hear anything from down there except for the sea sound. That was why basic hand signals were provided in case we needed to communicate to one another. They also taught us different ways to recover when experiencing too much pressure in the ears. Try to remember what to do cos the pressure at the bottom is high. But you may always seek help using the emergency hand signal if the pressure is already unbearable.
We lined up one by one as they assisted us to the floor of the sea and I was second in the line. Upon reaching the bottom, the diver asked me several times if I was okay, I responded using the “I’m okay” hand signal taught to us. He stayed there for a long minute ensuring that I was really okay, and yes I was okay! haha! I felt discomfort in my ears due to pressure but I did what they told us to do, I swallow every single time to recover and it never failed me.
There was an abundance of fish at the bottom! They were everywhere! The divers also provided us with pieces of bread so that the fishes will come near to us making it easier to catch picture perfect moments, but guess not. Cos they were so many that they were covering our faces from the photos already. Photos above were some of the decent ones we had. The divers were taking photos and videos as souvenirs too, so no need to worry if you do not have any underwater camera with you. It’s included in the package. We stayed there for a good 15 minutes if you are wondering.
Next stop, Puka Beach! We heard that food at Puka beach was more overpriced compared to Station 1, 2 and 3. So we dropped to a nearby convenient store and bought snacks so we could have something to eat. But of course, products at the convenient store were already overpriced in itself because again, we were on an island. haha! We rode a tricycle going to Puka Beach and paid Php 300.00 for all the five of us. The sun was at its peak when we arrived and as much as we hated to, we bought 16 oz sprite worth Php 200.00 so we could avail a seat and table with shade. We felt robbed!
The sand wasn’t as powdery compared to Station 1, 2 and 3 but there were fewer people there. So if you are after a quite relaxing trip, then feel free to visit Puka Beach. There were also a lot of souvenir stores in the area, you may check them out as well. We didn’t stay too long cos we needed to catch the Ash Wednesday in the church by 6:00 PM. By the way, it isn’t true that there were no people around us in these photos. Don’t be deceived! It happens when you removed the photobombers in the photos. haha!
We ate at a Filipino-inspired buffet restaurant in Station 3. We were required to remove our footwear upon entering the restaurant following an Asian tradition. It was the first time I experienced such in a restaurant and it wasn’t a biggie to me at all but I’m not sure how foreigners would react to it, though. I love the ambiance of the place. There was also a live song number played with an acoustic guitar, we loved all the songs he played and his voice too. It completed the romantic and relaxing ambiance of the place as if he was serenading the people. Good job, Kuya!
After dinner, we went on a long walk by the seashore and chill to one of the bars there. I only ordered hot coffee, cos coffee is life! After an hour or so, we went to a club and checked out what the fuss about Boracay night life was about. Boracay had full of life at night with all the people around and the loud music here and there! To be honest, we were only checking around, and we didn’t have plans to stay there for long. We went back to our room after an hour. We were all tired and sleepy, but happy of course for another amazing day that concluded.
She graduated with a Bachelor's Degree in Computer Engineering. A full time IT Specialist based in Manila, Philippines who enjoys designing, reading and blogging. She fuels her day with a cup of good coffee in the morning and concludes the night thinking about life.
Hi! I am Dianne. This is my humble abode in the web, where I document my thoughts and life experiences in black and white. Join me as I tick off my never-ending bucket list!
|
english
|
भत्ते खत्म के मुद्दे पर कर्मचारी व शिक्षक कल से काली पट्टी बांधकर करेंगे काम व २७ से प्रदर्शन। शीघ्र निर्णय न होने पर कोर्ट का विकल्प। -
भत्ते खत्म के मुद्दे पर कर्मचारी व शिक्षक कल से काली पट्टी बांधकर करेंगे काम व २७ से प्रदर्शन। शीघ्र निर्णय न होने पर कोर्ट का विकल्प।
लखनऊ। उत्तर प्रदेश राज्य कर्मचारी महासंघ ने डीए फ्रीज किए जाने व नगर प्रतिकर भत्ते सहित छह भत्तों को समाप्त किए जाने पर रोक लगाने के लिये प्रतीकात्मक आन्दोलन का कार्यक्रम तय किया है। अध्यक्ष अजय सिंह, महामंत्री राजेश सिंह व मिनिस्टीरियल फेडरेशन के महामंत्री क्रतार्थ सिंह ने बताया कि प्रदेश के समस्त पदाधिकारियों व जनपद शाखाओं के पदाधिकारियों ने तय किया है कि २७ मई को कर्मचारी अपने कार्यस्थल पर काली पट्टी बांधकर कार्य करेंगे। उधर दूसरा संगठन उत्तर प्रदेश राज्य कर्मचारी महासंघ के प्रान्तीय अध्यक्ष कमलेश मिश्रा और प्रवक्ता सीपी श्रीवास्तव ने बताया कि मुख्य पदाधिकारियों से विचार-विमर्श के बाद तय किया गया है कि १८ से २५ मई तक प्रदेश के समस्त कर्मचारी काला फीता बांधकर कार्य करेगें। प्रत्येक जनपद से मुख्यमंत्री को सम्बोधित विरोध पत्र भेजा जाएगा।
नगर प्रतिकर भत्ते पर कोर्ट जा सकते हैं
राज्य कर्मचारी संयुक्त परिषद के अध्यक्ष जे एन तिवारी ने शनिवार को एक प्रेस विज्ञप्ति जारी करते हुए बताया कि प्रदेश के राज्य कर्मचारियों का महंगाई भत्ता रोके जाने और नगर प्रतिकर भत्ता समाप्त किए जाने के प्रकरण पर उन्होंने मुख्य सचिव को पत्र लिखकर विचार करने को कहा है। शीघ्र निर्णय न लेने पर संगठन ने कोर्ट जाने की चेतावनी दी।
उधर भत्तों को खत्म करने से नाराज कर्मचारी-शिक्षक समन्वय समिति ने १८ मई से सांकेतिक आंदोलन का एलान किया है। समिति ने तय किया है कि १८ से २५ मई तक कर्मचारी व शिक्षक काली पट्टी बांधकर काम करेंगे। सरकार ने फैसले पर पुनर्विचार न किया तो आंदोलन को तेज किया जाएगा। समिति ने रेड जोन में माध्यमिक शिक्षक संघ के मूल्यांकन कार्य बहिष्कार के समर्थन की भी घोषणा की है। कर्मचारी-शिक्षक समन्वय समिति के पदाधिकारियों ने शनिवार को ऑनलाइन बैठक में महंगाई भत्ता, महंगाई राहत फ्रीज करने, १८ माह का एरियर जब्त करने, नगर प्रतिकर भत्ता सहित ८ भत्तों के समाप्त करने पर नाराजगी जताई।
|
hindi
|
Welcome to my full Swagbucks review! By the end, you should have a pretty good idea as to whether or not Swagbucks is right for you.
If you have any questions after reading through this review, feel free to place a comment below and I’ll get back to you shortly.
Swagbucks is a website that pays you to search the web, complete surveys, do various tasks, and more. Swagbucks is one of the most well-known and popular GPT (Get Paid To) websites, and has been around since 2008.
As you’ve probably seen already, there are a lot of Swagbucks reviews out there. Most claim it’s a legit site and not a scam, but let’s dive into exactly how it works, and my experience using it.
Owners: Scott Dudelson, Josef Gorowitz, Ron Leshem and Eron Zehavi.
Swagbucks pays you for completing certain activities on their website (I’ll describe these below), and for using their search engine.
You won’t be able to replace your income with Swagbucks, but it can be a good way to make an extra couple hundred a year for a few minutes of work each day.
The Swagbucks “currency” is fittingly named “swag bucks”, or “SB” for short. 1 SB is worth $0.01 (a penny).
Signing up for Swagbucks is easy – all you need is an email and a password. You’ll also be asked a security question (such as “what’s your favorite hobby?”), to help protect against others hacking into your account. Click here to sign up.
There’s also the option to sign up with your Facebook account.
The word “scam” implies something that takes your money; a fraud. I have been using Swagbucks for about a year and half now with no problems.
Swagbucks does not cost anything, in fact, quite the opposite: it pays YOU!
So, since Swagbucks can’t take your money, what about your private information?
This is definitely a concern, as you do have to give some personal information when doing surveys and offers. But your information is pooled with millions of other people’s information, and it’s only used for research purposes.
If this is a concern for you, there are ways to make money from Swagbucks that don’t require giving out your personal information.
By using the Swagbucks search engine, you can actually earn money while browsing the web.
Swagbucks’ search engine is powered by Yahoo, so the results you’ll get will be more or less the same as you get with Google, Bing, or any other search engine for that matter.
While surfing the web, Swagbucks will occasionally reward you a random amount of SB. The rewards are very random, but if you do a lot of searching you’ll get a few SB rewards per day.
The rewards start as low as 4 SB, but some users have reported earning up to 100 SB for one search. On average, however, 6-10 SB is pretty standard.
The highest I’ve earned with one search was 30 SB.
Well, count me into the “earned 100 SB for one search” club! That was probably the easiest dollar I’ve ever made. 😉 In fact, I wrote a post about it which you can check out here.
Taking surveys is one of the fastest and easiest ways to earn SB. The payout is pretty bad for most surveys, but every now and then you’ll see a 5-minute survey offering a payout of 100 or more swag bucks. Unfortunately, like most survey sites, you will disqualify from a lot of the surveys you attempt.
One user on Reddit reported (with proof) making just over 1,000 swag bucks in one day just by doing surveys. I wouldn’t recommend trying this yourself unless you NEED $10 right now, because it would take almost all day. And you’d probably disqualify from half the surveys anyway. Nonetheless, it’s an interesting stat and if you could do that every day for a year, you’d wind up making $3,650.
Swagbucks has a list of offers that when completed, can each earn you several dollars. Completing offers is easily the fastest way to earn a bunch of swag bucks.
However, most of the offers require you to sign up for a free trial which you’ll have to remember to cancel, and others you actually have to pay for. Some of them will send you a ton of spam emails as well.
Unless you’re genuinely interested in these offers, I would not suggest doing them (here’s why).
Although watching videos won’t earn you very many swag bucks, (something like 1-2 SB for every 6 videos), most of the videos are about trending topics which a lot of people will watch anyway. So why not get paid for it?
Some people like to let the videos run while doing other things, so they don’t have to waste their time watching for a long while only to earn a few cents. That way it’s essentially passive income, and can earn you a dollar or two per day.
Keep in mind that you’ll have to regularly click on the next playlist to watch, after the one before it finishes – so it’s not 100% passive.
A fun way to earn some extra SB is by playing games.
There are lots of games to choose from, but most of them seem to be slots-related.
You can earn 18 swag bucks for every $1 you spend on in-game purchases, or by playing Swagbucks’ own games, you can earn a couple SB now and then without having to spend anything.
I played one of their games four times, and twice I earned 2 SB for a total of 4 SB. It only took a couple minutes, and the game was actually pretty fun.
One of the best ways to earn swag bucks is to get cash back for shopping online.
If you plan to purchase something online, make sure to go to the store through Swagbucks in order to get cash back. Almost every major online retailer gives cash back in the form of swag bucks, including Amazon and eBay.
Some offer as low as 1 SB per dollar, while others offer up to 50 SB per dollar. Savvy shoppers have saved a TON of money by doing this.
Every day, Swagbucks posts a poll for its users. Answering it only takes a second or two, and you’ll be rewarded with 1 SB.
That’s $3.65 every year just for answering a poll each day!
Swagbucks has hundreds of coupons available for all kinds of groceries.
For example, there’s currently a coupon for $2 off any two Pepsi Cola 12oz 12pk cans, and a coupon for 50 cents off any Windex product.
Each coupon you redeem at your local grocery store will not only save you money, but also earn you 10 SB!
A couple times throughout the day, Swagbucks will post “Swagcodes” on their social media profiles and on their blog.
Each code will earn you a small amount (usually 2-3 SB) when you redeem them in the Swagcode box on the Swagbucks website or search engine.
Every once in a while, there will be a “Swagcode Extravaganza”, where Swagbucks will post a bunch of high value Swagcodes in a single day. On these days, it’s possible to earn 20-30 SB just from Swagcodes alone!
Available for free on both Android and iOS devices, the Swagbucks app offers the same sort of things that their website offers, but you can also earn an additional 50 SB per day for watching videos on the app.
The videos can be run in the background, so it’s virtually passive income.
Swagbucks has many sweepstakes or “Swagstakes” posted at any given time, and anyone can join them.
You have to pay a certain amount of SB to join, but if you’re randomly chosen as the winner, you can earn it back and then some.
I’m not the type to participate in these kinds of things, but I did try one that had a prize of 50 SB and cost 2 SB to join.
No, I didn’t win. What did you expect?
The Swagstakes definitely are legitimate, and plenty of people have been lucky with them. But it’s like that with any lottery. My advice is to stick with the more dependable ways of earning SB.
A great way to earn some consistent swag bucks is by getting referrals. You make 10% of all the earnings your referral makes, so if they make 500 SB, you’d make 50 SB.
Also, once your referral reaches 300 SB, you both get an extra $3 (300 SB).
If you take a lot of surveys, do all your browsing through the Swagbucks search engine, and are actively utilizing Swagbucks’ features, you can expect to earn a pretty decent amount from Swagbucks. Probably in the range of several hundred a year, but it really depends on how active you are.
I almost exclusively earn swag bucks through their search engine, and have already earned well over $20 in passive income.
That’s equal to 56,095 swag bucks per year, or $560.95!
That’s enough to pay for a nice brand-new computer, or Christmas for an entire family.
As you can see, taking surveys and playing videos on the mobile app are easily the most lucrative ways to make money with Swagbucks.
But even if you only use the search engine feature, that’s still $26 per year. Not bad, considering it requires no extra work on your part.
There are many ways to redeem your SB.
The most common way is to redeem them for gift cards. There are a vast number of gift cards available, including all the big names such as Amazon, eBay and iTunes.
You can redeem gift cards for as low as 300 SB, and up to 50,000 SB.
You can also redeem SB for PayPal cash once you have 2,500 SB.
You also have the option to donate your SB to a charity of your choice.
Yes, you need at least 300 SB to redeem certain gift cards. If you want PayPal cash, you’ll need at least $25 worth of SB before you can cash out your earnings.
So, although it’s quite easy to rack up 300 SB, Swagbucks won’t be the answer if you need cash RIGHT NOW. Qmee would be the better option in that situation, since it has no minimum cash out amount.
This is true, but the thing is, Swagbucks isn’t supposed to earn you a full-time income.
Also, if you just use the search engine and don’t waste your time taking surveys, you can actually make some decent passive income each month for just browsing the web.
Take advantage of the passive income opportunities Swagbucks presents, and you won’t be disappointed.
Some people are having trouble getting SB for offers they completed. Although this is unfortunate, it’s just another reason to stay away from the offers (like I said earlier).
Unless you are genuinely interested in an offer, I advise that you ignore it altogether.
Almost all survey sites pose this risk, and Swagbucks is no exception. However, if you want to reduce the chance of this happening, be sure to fully fill out your “survey profile”.
I actually found the Swagbucks surveys to be more reliable than, say, Qmee’s surveys, since I was actually able to successfully complete a couple of them (out of like 5 attempts).
When people send in support tickets, customer service rarely gets back in a timely manner. Sadly, most similar companies have this same annoying problem.
Swagbucks has been around since 2008, and throughout this time has maintained good reputation.
You aren’t guaranteed to qualify for every survey – in fact, you’ll probably only qualify for a small percentage of the ones you attempt.
Final Thoughts – Scam or Legit?
Swagbucks is not a scam. It’s a legitimate way to earn money online.
By just using their search engine, you can make some decent pocket change each month. If you’re an active user, take surveys, complete offers, and use the site to its full potential, you can make a modest side income.
I haven’t experienced any issues with Swagbucks except for disqualifying from most of the surveys I tried, but that’s normal with any survey site.
In my opinion, Swagbucks offers some excellent ways to earn a little extra each month, and can even pay for Christmas if you utilize everything it has to offer.
While Swagbucks is a nice way to earn a little extra pocket change, it certainly won’t make you a full-time income like some online ventures.
The amount of money you can make is virtually unlimited – some people make millions per year!
Since affiliate marketing is a real business, you won’t make money right away (like you can with Swagbucks). But if you put forth a serious effort, you will start to see your earnings grow, and possibly be making enough to quit your job.
It takes time, yes, but trust me: it’s well worth it.
Have you ever used Swagbucks before? What do you think of it? Feel free to leave a comment below, and if you have any questions, I’d love to help out!
Taking your numbers above and expanding on your maths: Assuming and average of 35 minutes per week typing searches, five minutes per video, 10 minutes per week finding and printing coupons, 2 minutes to load and complete polls, an average of 20 minutes per day for one survey, 10 minutes a day to play games and one hour per year to setup and send referrals….
earned you 78,500 SB for the year, which means you were effectively paid 36SB an hour or $0.36 per hour….
Very valid point. And that’s why I suggest if people really want to make money online, they pursue something like this which can replace any income in a few years.
However, for those who don’t feel they have the time to start an online business, Swagbucks can be helpful and cover small costs. The time is difficult to justify though as you imply.
Why do they need my PayPal password to redeem $25. No one should ask for a password!
Are you sure it’s not PayPal asking for your password in order to log in? I know with PayPal, oftentimes it will be a popup over the other website, which can make it look as if it’s the website, not PayPal, asking for your password.
When it comes to using Swagbucks, I try to stick to taking the surveys versus doing the offers. I definitely think that it is doable to make at least $3-5 a day if you keep up with it for sure!
Please take the time and review the hundreds of complaints regarding Swagbucks practices. They do not credit your account unless you file a complaint and then you may never see your rewards. Something is seriously wrong with this site and I may never see the $60 PayPal payment that is owed me.
I have never experienced this. Can you provide more details about your case?
How do you uninstall this annoying product?
If you are using Chrome, you can delete the extension by right clicking it and selecting “Remove from Chrome…”. If you are using a different browser, you’ll want to do a quick search on how to remove extensions on the browser you’re using.
If you set Swagbucks as your default browser and would like to revert to a different browser, you should find the option to do so in your browser settings.
That’s a very thorough review on Swagbucks and you have really covered all bases. I strongly believe your article will help people in their decision making. Thanks for the useful information I will come back to your website to learn more information. Keep up the great work. Wishing you great success!
True a scam is someone who takes your money without a return. Swagbucks has a tracking problem. I completed 2 charity SB offers. Never got my SBs. They wanted screenshots. Isn’t tracking sufficient? Sounds like a scam to me.
Some offers require specific steps (such as screenshot proof) that others may not, so you just have to be prepare to complete each step. It can be quite a hassle sometimes. I’ve just stopped doing offers, and don’t recommend them as a good way to earn money on a ‘get paid to’ type of site like Swagbucks.
Article says “1 SB is worth $0.01 (a penny)”. I believe 1 SB is worth $1.00 one dollar.
I just went to Swagbucks to double check. It appears that 1 SB actually is worth one cent, and this can be confirmed when you visit the Rewards Store. For example, in order to claim a $5 Amazon gift card, you need 500 SB, and in order to cash out $25 to PayPal, you need 2500 SB.
|
english
|
होम लेख बाबा साहेब के जन्म के बारे में आप ये नहीं जानते होंगे...
बाबा साहब डा. भीम राव अम्बेडकर भारतीय संविधान के निर्माता, दलितों के मुक्तिदाता
बाबा साहेब के बारे में बहुत सारी बातें हे जिन्हे लोग सुन्ना, समझना और जानना चाहतें हे !
बाबा साहेब के मूलग्रंथो से हम आपको वो सारी घटनाये बताने और दिखाने की कोशिश करेंगे जो बाबा साहेब ने अपने जीवन में अनुभव करी जिनको जानने के लिए हर कोई उत्सुक रहता हे !
बाबा साहेब के इस पहले एपिसोड में हम आपको बातएंगे की बाबा साहेब का जनम कब और कहा हुआ ? और उनके माता-पिता का क्या नाम था !
बाबा साहेब का जनम १४ अप्रैल १८९१ को महाराष्ट्र के रत्नागिरी जिले में महुछावली में हुआ उनकी माता का नाम भीमा बाई और पिता का नाम सूबेदार राम जी राव था बाबा साहेब डा. भीम राव अम्बेडकर अपने माता पिता की चौदवी संतान के रूप में जन्मे !
बाबा साहेब डा. भीम राव अम्बेडकर का जनम एक महार जाती में हुआ ! इस जाती को बहुत ही निचला वर्ग माना जाता था बचपन से ही भीम बहुत ही प्रतिभाशाली थे लेकिन उनकी प्रतिभा खुश भी काम नहीं आ पा रही थी क्युकी बाबा साहेब के परिवार के साथ सामाजिक और आर्थिक रूप से गहरा भेदभाव किया जाता था
इनका बचपन का नाम राम जी सतपाल था अम्बेडकर के पूर्वज लम्बे समय तक ब्रिटिश कास्ट इंडिया कंपनी की सेना में कार्यरत्त थे उनके पिता बहुत ही निडर और ईमानदार व्यक्ति थे भीम राव अम्बेडकर के पिता ने हमेशा ही अपने बच्चो की शिक्षा पर जोर दिया !
सन १८९४ में भीम राव अम्बेडकर जी के पिता सेवानिवृत हो गए और इसके दो साल बाद उनकी माता जी भीमा बाई अम्बेडकर का भी निधन हो गया बच्चो की देखभाल ( भीम राव अम्बेडकर की देखभाल ) उनकी चाची ने कठिन परिस्थितयों में रहते हुए की राम जी सतपाल के केवल तीन बेटे बलराम , आन्नद राव और भीम राव और उनकी दो बेटियां मंजुला और तुलसा ही इन कठिन परिस्थयों में जीवित रह पाए !
ये थी बाबा साहेब की जनम की कहानी अगले भाग में हम आपको बातएंगे !
बाबा साहेब के स्कूल के बारे में की उन्होंने पढ़ाई करते समय किस छूआ छूट को अनुभव किया !
प्रेवियस आर्टियलगूगल ने ईरान से जुड़े कई यू ट्यूब चैनल के अन्य खातों पर लगाई रोक
नेक्स्ट आर्टियलफ्यूचर ग्रुप खरीदने के लिए गूगल अलीबाबा और एमेजॉन में होड़
|
hindi
|
\begin{document}
\title{Partial regularity for BV minimizers}
\tilde{h}nks{Version 22/3/2018}
\author[F.~Gmeineder]{Franz Gmeineder}
\author[J.~Kristensen]{Jan Kristensen}
\operatorname{m}aketitle
\begin{abstract}
We establish an $\varepsilon$-regularity result for the derivative of a map of bounded variation that minimizes a strongly
quasiconvex variational integral of linear growth, and, as a consequence, the partial regularity of such $\operatorname{BV}$ minimizers.
This result extends the regularity theory for minimizers of quasiconvex integrals on Sobolev spaces to the context of
maps of bounded variation. Previous partial regularity results for $\operatorname{BV}$ minimizers in the linear growth set-up were confined
to the convex situation.
\end{abstract}
\section{Introduction}
In this paper we investigate the local regularity properties of minimizers for variational integrals defined on Dirichlet classes
of maps of bounded variation. In order to describe more precisely our set-up and why it is natural we consider
a continuous real-valued function defined on $N \times n$ matrices, $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$, that we henceforth call an integrand.
Assume that $F$ is of linear growth, that is, for some constant $L>0$ we have
\begin{equation}\label{1grow}
|F(z)| \leq L \bigl( |z|+1 \bigr)
\end{equation}
for all matrices $z \in \operatorname{m}athbb{R}^{N \times n}$. The reader is referred to Section \ref{sec:prelims} for undefined notation and terminology.
For a bounded Lipschitz domain $\Omega$ in $\operatorname{m}athbb{R}n$ and a given $\operatorname{W}^{1,1}=\operatorname{W}^{1,1}( \Omega , \operatorname{m}athbb{R}N )$ Sobolev map
$g \colon \Omega \to \operatorname{m}athbb{R}N$ as boundary datum we seek to minimize
\begin{align}\label{intro1}
\int_{\Omega} \! F(\nabla v(x)) \, \operatorname{m}athrm{d} x
\end{align}
over $v \in \operatorname{W}^{1,1}_{g}=\operatorname{W}^{1,1}_{g}( \Omega , \operatorname{m}athbb{R}N )$, the $\operatorname{W}^{1,1}$ Dirichlet class determined by $g$. Here $\nabla v$ denotes the
approximate Jacobi matrix that we recall coincides with the distributional derivative $Dv = \nabla v \operatorname{m}athscr{L}^{n} \lfloor \Omega$ when
$v$ is a $\operatorname{W}^{1,1}$ Sobolev map, thus $\nabla v(x) := \bigl[ \partial v_{j}/ \partial x_{i} (x) \bigr]$, where $j$ is
the row number and $i$ is the column number whereby $\nabla v$ is $\operatorname{m}athbb{R}^{N \times n}$-valued.
The standard approach to the variational problem (\ref{intro1}) is to let the functional set-up be dictated by the coercivity inherent
to the problem. Under the linear growth hypothesis (\ref{1grow}) the best we can hope for is that \emph{all} minimizing sequences for
(\ref{intro1}) on $\operatorname{W}^{1,1}_{g}$ are bounded in the Sobolev space $\operatorname{W}^{1,1}$. Building on \cite{CK} we show in Proposition
\ref{sharpening} below that this is equivalent to the existence of constants $c_{1}>0$, $c_2 \in \operatorname{m}athbb{R}$ such that
\begin{equation}\label{mean}
\int_{\Omega} \! F(\nabla v(x)) \, \operatorname{m}athrm{d} x \geq \int_{\Omega} \biggl( c_{1}| \nabla v(x)| + c_{2} \biggr) \, \operatorname{m}athrm{d} x
\end{equation}
holds for all $v \in \operatorname{W}^{1,1}_{g}$. We express (\ref{mean}) by saying that $F$ is mean coercive. In turn, Proposition \ref{sharpening} also
establishes the equivalence between mean coercivity and the existence of a constant $\ell > 0$ such that $F-\ell E$ is \emph{quasiconvex}
at some $z_{0} \in \operatorname{m}athbb{R}^{N \times n}$. Here $E \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ is our \emph{reference integrand} defined as
\begin{equation}\label{defE}
E(z) = \sqrt{1+|z|^{2}}-1.
\end{equation}
It is of course a multi-dimensional generalization from $n \geq 2$, $N=1$ of the area integrand (and of the curve length integrand when
$n=1$, $N \geq 1$). By quasiconvexity we mean the notion introduced by \textsc{Morrey} in \cite{Morrey}, its definition is recalled in
Section 2 below. We emphasize that for $n=1$ or $N=1$, quasiconvexity is just ordinary convexity, whereas in the multi-dimensional
vectorial case $n$, $N >1$, considered in this paper, there exists many nonconvex quasiconvex integrands of linear growth.
The question of existence of minimizers can then be successfully tackled if we assume that (\ref{mean}) holds and allow maps of bounded
variation as minimizers. Indeed, a minimizing sequence $( u_j )$ for the problem (\ref{intro1}) is then bounded in $\operatorname{W}^{1,1}$ and so admits
a subsequence $( u_{j_k})$ so that for some $u \in \operatorname{BV} = \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$ we have $u_{j_k} \to u$ in $\operatorname{L}^1$ and of course still
$\sup_{k} \int_{\Omega} \! | \nabla u_{j_k}| \, \operatorname{m}athrm{d} x < \infty$. We express this by writing $u_{j_k} \wstar u$ in $\operatorname{BV}$ and
recall that $u \colon \Omega \to \operatorname{m}athbb{R}N$ is of bounded variation, written $u \in \operatorname{BV}$, if it is $\operatorname{L}^1$ and its distributional
partial derivatives are measures: $Du = [ \partial u_{i}/\partial x_{j} ]$ is a bounded $\operatorname{m}athbb{R}^{N \times n}$-valued Radon measure on $\Omega$.
We must extend the functional (\ref{intro1}) to such $u$ in a meaningful way, which in the present context is most conveniently
done by semicontinuity following a procedure used by \textsc{Lebesgue}, \textsc{Serrin} and for quasiconvex integrals of anisotropic growth
\textsc{Marcellini} \cite{Marcel}:
\begin{align}\label{intro3}
\operatorname{m}athscr{F} [u,\Omega ]:=\inf\left\{\liminf_{j \to \infty} \int_{\Omega} \! F(\nabla u_{j}) \, \operatorname{m}athrm{d} x\colon\; (u_{j})\subset \operatorname{W}^{1,1}_{g} (\Omega , \operatorname{m}athbb{R}N ),
\;u_{j}\to u\; \text{in} \; \operatorname{L}^{1}(\Omega ,\operatorname{m}athbb{R}N) \right\}
\end{align}
Building on the works by \textsc{Ambrosio \& Dal Maso} \cite{AmbrosioDalMaso} and \textsc{Fonseca \& M\"{u}ller}
\cite{FonsecaMueller} an integral representation for the functional $\operatorname{m}athscr{F} [u, \Omega ]$ was found in \cite{KR1} under the assumptions of
quasiconvexity, linear growth (\ref{1grow}) and mean coercivity (\ref{mean}). For such integrands we define the
\emph{recession integrand} by
\begin{align*}
F^{\infty}(z):=\limsup_{t\nearrow\infty}\frac{F(tz)}{t},\qquad z \in\operatorname{m}athbb{R}^{N \times n} .
\end{align*}
Then $F^{\infty}$ is quasiconvex and positively $1$-homogeneous \cite{Mu}. Given $u\in \operatorname{BV}$ we can write the
Lebesgue--Radon--Nikod\'{y}m decomposition of $Du$ into its absolutely continuous and singular parts
with respect to $\operatorname{m}athscr{L}^{n}$ as
$$
D u=D^{ac}u+D^{s}u=\nabla u\operatorname{m}athscr{L}^{n}+\tfrac{\operatorname{div}f D^{s}u}{\operatorname{div}f |D^{s}u|}|D^{s}u|,
$$
and have then
\begin{align}\label{intro4}
\operatorname{m}athscr{F}[u, \Omega ]=\int_{\Omega} \! F(\nabla u)\, \operatorname{m}athrm{d} x + \int_{\Omega}\! F^{\infty}\left(\frac{\operatorname{div}f D^{s}u}{\operatorname{div}f |D^{s}u|}\right)\operatorname{div}f |D^{s}u|+
\int_{\partial\Omega} \! F^{\infty}\big( (g-u)\otimes \nu_{\Omega} \big)\operatorname{div}f\operatorname{m}athcal{H}^{n-1},
\end{align}
where $\nu_{\Omega}$ is the outward unit normal on $\partial \Omega$.
The last term, akin to a penalization term for failure to satisfy the Dirichlet boundary condition, must be there because the trace
operator is not weak$\operatorname{m}box{}^\ast$ continuous on $\operatorname{BV}$.
We shall use the shorthand
$$
\int_{\Omega} \! F(Du) := \int_{\Omega} \! F(\nabla u) \, \operatorname{m}athrm{d} x + \int_{\Omega} \! F^{\infty}\left(\frac{\operatorname{div}f D^{s}u}{\operatorname{div}f |D^{s}u|}\right)\operatorname{div}f |D^{s}u|
$$
for the first two terms on the right-hand side in (\ref{intro4}).
It turns out that this expression also coincides with an extension by (area-strict) continuity of the
integral (\ref{intro1}) initially defined on the Sobolev space $\operatorname{W}^{1,1}$ (see \cite[Theorem 4]{KR1} and
Lemmas \ref{Eapprox} and \ref{Econt} below).
Let us summarize, under the above assumptions on $F$, we have that all minimizing sequences admit a weakly$\operatorname{m}box{}^\ast$ convergent subsequence
whose limit $u \in \operatorname{BV}$ is a minimizer for the functional defined at (\ref{intro4}): $\operatorname{m}athscr{F} [u,\Omega ] \leq \operatorname{m}athscr{F} [v,\Omega ]$ holds
for all $v \in \operatorname{BV}$.
In particular we have for $v \in \operatorname{BV}$ so $u-v$ has compact support in $\Omega$ that
\begin{equation}\label{intro5}
\int_{\Omega} \! F(Du) \leq \int_{\Omega} \! F(Dv)
\end{equation}
holds. It is clear that we should not expect that the minimality condition (\ref{intro5}) under the above assumptions on $F$
would entail regularity of $u$ on the Schauder $\operatorname{C}^{k, \alpha}$ scale for a $k \geq 1$. For that we must evidently impose on $F$
a stronger quasiconvexity condition, one that in particular ensures that $F$ cannot be affine on any open subset of matrix
space $\operatorname{m}athbb{R}^{N \times n}$. In view of the above discussion it is natural to require that, for some fixed positive constant $\ell > 0$,
$F-\ell E$ is quasiconvex at \emph{all} $z \in \operatorname{m}athbb{R}^{N \times n}$. That this turns out to be sufficient for regularity is our main result:
\begin{theorem}\label{thm:main}
Let $\ell$, $L > 0$ be positive constants and
suppose the integrand $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ satisfies the following three hypotheses:
\begin{equation}\label{H}
\begin{array}{ll}
(\operatorname{m}athrm{H}0) \hspace{1cm} & F\;\text{ is } \operatorname{C}^{2,1}_{\operatorname{m}athrm{loc}}\\
{} & {}\\
(\operatorname{m}athrm{H}1) \hspace{1cm} & |F(z)| \leq L(|z| + 1) \quad \forall \, z \in \operatorname{m}athbb{R}^{N \times n}\\
{} & {}\\
(\operatorname{m}athrm{H}2) \hspace{1cm} & z \operatorname{m}apsto F(z)-\ell E(z)
\text{ is quasiconvex,}
\end{array}\nonumber
\end{equation}
where $E \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ is the reference integrand defined in (\ref{defE}).
Then for each $m>0$ there exists $\varepsilon_{m}=\varepsilon_{m}(\ell /L, F^{\prime \prime})>0$ with the following property.
If $u \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$ is a minimizer in the sense of (\ref{intro5}), and $B=B_{r}(x_{0}) \subset \Omega$ is a ball such that
\begin{equation}\label{sma}
|(Du)_{B}| := \left| \frac{Du (B)}{\operatorname{m}athscr{L}^{n}(B)} \right| < m \quad \operatorname{m}box{ and } \quad
\frac{1}{\operatorname{m}athscr{L}^{n}(B)}\int_{B} \! E\bigl( Du-(Du)_{B}\operatorname{m}athscr{L}^{n}\bigr) < \varepsilon_m ,
\end{equation}
then $u$ is $\operatorname{C}^{2,\alpha}$ on $B_{r/2}(x_{0})$ for each $\alpha < 1$. More precisely, $u$ is $\operatorname{C}^2$ on $B_{r/2}(x_{0})$ and there
exists a constant $c=c(\alpha ,\ell /L,F^{\prime \prime} )$ such that
\begin{equation}\label{keyregest}
\sup_{\stackrel{x,y \in B_{r/2}(x_{0})}{x \neq y}} \frac{| \nabla^{2}u (x)-\nabla^{2}u(y)|^{2}}{|x-y|^{2\alpha}} \leq
\frac{c}{r^{n+2+2\alpha}} \int_{B_{r}(x_{0})} \! E\bigl( Du-(Du)_{B_{r}(x_{0})}\operatorname{m}athscr{L}^{n}\bigr).
\end{equation}
In particular, it follows that the minimizer $u$ is partially
regular, in the sense that there exists an open subset $\Omega_{u} \subset \Omega$ such that $\operatorname{m}athscr{L}^{n}( \Omega \setminus \Omega_{u} ) =0$
and $u$ is $\operatorname{C}^{2,\alpha}_{\operatorname{loc}}$ on $\Omega_u$ for each $\alpha < 1$.
\end{theorem}
It is important to note that without the smallness condition (\ref{sma}) we do not expect the minimizer to be regular in the sense
of (\ref{keyregest}). This is a feature of the multi-dimensional vectorial case $n$, $N \geq 2$ rather than our assumptions, at least when
$n \geq 3$, $N \geq 2$. Indeed, for dimensions $n \geq 3$, $N \geq 2$ there exists a regular variational integrand $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$
(meaning that $F$ is $\operatorname{C}^\infty$ smooth, has bounded second derivative $|F^{\prime \prime}| \leq L$ and $z \operatorname{m}apsto F(z)-\ell |z|^{2}$ is convex) that
admits a Lipschitz but non-$\operatorname{C}^1$ minimizer, see \cite{MoSa}. In higher dimensions, the minimizers of regular variational integrals can be more
singular, for instance, non-Lipschitz when $n \geq 3$, $N \geq 5$ and unbounded when $n \geq 5$, $N \geq 14$, see
\cite{SverakYan1,SverakYan2}.
When $n=2$, $N \geq 2$ it is a result due to \textsc{Morrey} \cite{MorreyB} that minimizers of regular variational integrals must be smooth, but it is
not clear precisely how big the singular set $\Omega \setminus \Omega_u$ can be when $n \geq 3$, $N \geq 2$. Higher differentiability and
\textsc{Gehring}'s lemma (in the adapted form \cite[Proposition 5.1]{GM1})) yield for regular variational problems that its Hausdorff dimension
is strictly smaller than $n-2$, see \cite{BeFr,Giaquinta,Giusti,GRM} for a comprehensive discussion of this and related matters.
In the quasiconvex $p$-growth case these methods do not apply. The only result at present is \cite{KM} where it is shown that the singular set
will be uniformly porous (and so in particular of outer Minkowski dimension strictly smaller than $n$) under the additional assumption that
the minimizer is Lipschitz.
The underlying ideas for the proof of Theorem \ref{thm:main} have many sources and it is not easy to give proper credit.
However, the proof strategy can be traced back to at least \textsc{De Giorgi} \cite{DeGiorgi1} and \textsc{Almgren} \cite{Almgren1,Almgren2} in their
works on minimal surfaces in the parametric context of geometric measure theory. The first to adapt their strategy to the nonparametric case
seem to be \textsc{Giusti \& Miranda} \cite{GiustiMiranda} and \textsc{Morrey} \cite{Morrey1}, who proved partial regularity for minimizers to
regular variational problems and weak solutions to certain nonlinear elliptic systems. The key step in these proofs is to establish a
so-called excess decay estimate, which amounts to an integral expression of H\"{o}lder continuity. This is achieved by use of the very
robust excess decay estimates that hold for solutions to linear elliptic systems with constant coefficients. Indeed, these excess decay
estimates are then transferred to the minimizer/weak solution by means of a linearization procedure and Caccioppoli inequalities. In the presence
of convexity/monotonicity the required Caccioppoli inequalities are derived by use of the difference-quotient method in some form. This
method cannot be applied in the quasiconvex case. The difficulty was overcome by \textsc{Evans} \cite{Evans} who adapted an argument
used by \textsc{Widman} \cite{Widman} in another context to derive Caccioppoli inequalities of the second kind. Hereby he proved partial regularity
of minimizers under controlled quadratic growth conditions (see \cite{Giusti} and \cite{Giaquinta} for the terminology).
Shortly afterwards \textsc{Fusco \& Hutchinson} \cite{FuHu} and \textsc{Giaquinta \& Modica} \cite{GiMo} extended the result to
minimizers of variational integrals with general integrands $F=F(x,u,\nabla u)$ of controlled $p$-growth in the $\nabla u$ variable for $p \geq 2$.
This was further extended by \textsc{Acerbi \& Fusco} \cite{AcerbiFusco1} to integrands of natural $p$-growth for $p \geq 2$. A more
direct proof of this result was subsequently obtained by \textsc{Giaquinta} \cite{Gigrowth} who also established Caccioppoli inequalities for
minimizers in the general case $F=F(x,u,\nabla u)$ with $p$-growth for $p \geq 2$. Let us remark that the main role of the Caccioppoli
inequalities in these proofs is to provide \emph{compactness} in some suitable context dependent sense. This is clearly seen in the blow-up
arguments used in for instance \cite{Evans,FuHu,AcerbiFusco1}, and it was noticed by \textsc{Evans \& Gariepy} \cite{EG1} that it is possible
to extract the necessary compactness information without explicitly going through a Caccioppoli inequality.
Partial regularity in the general subquadratic case was established by
\textsc{Carozza, Fusco \& Mingione} in \cite{CarozzaFuscoMingione}, and many interesting extensions have followed since then, these include
\cite{AcerbiFusco2,AcMi,CFPdN,FoMi,FuHu1,JCC,DLSV,DGK,DuMi,Hamburger,CH,schmidtpq}. The monograph \cite{Giusti} gives a good summary of
the situation around the mid 90s. All the above results concern the case of variational integrals that are coercive on a Sobolev space
$\operatorname{W}^{1,p}$ for some $p>1$ and do not concern the linear growth case. The only previous partial regularity results in the
multi-dimensional vectorial case for minimizers of variational integrals of linear growth were based on a method proposed by
\textsc{Anzellotti \& Giaquinta} in \cite{AnGi}. While this method has been adapted by \textsc{Schmidt} \cite{Schmidt1,Schmidt2} to
cover also some degenerate convex cases, the method still crucially relies on convexity, and it cannot work for quasiconvex integrands.
Further references on various interesting aspects of existence and regularity of minimizers in the BV context with a standard
convexity assumption include \cite{BeSc1,Bildhauer,BildhauerFuchs,GiMoSo}.
\begin{remark}
The main point of Theorem \ref{thm:main} is that the smallness condition (\ref{sma}) under the hypotheses $\operatorname{m}athrm{(H0)}$,
$\operatorname{m}athrm{(H1)}$, $\operatorname{m}athrm{(H2)}$ yields $\operatorname{C}^1$ regularity of the minimizer near the point $x_0$. The fact that we obtain $\operatorname{C}^{2,\alpha}$
regularity on $B_{r/2}(x_{0})$ for all $\alpha < 1$ is a standard outcome of this type of proof. In this connection we emphasize our
hypothesis $\operatorname{m}athrm{(H0)}$ that is stronger than the usual assumption of $\operatorname{C}^2$ that is normally used in this context. We invite
the reader to check that our proof also yields $\operatorname{C}^2$ regularity on $B_{r/2}(x_{0})$ of minimizers under the smallness condition
(\ref{sma}) when $\operatorname{m}athrm{(H0)}$ is relaxed to
$$
(\underline{\operatorname{m}athrm{H}0}) \hspace{1cm} F \operatorname{m}box{ is } \operatorname{C}^{2,\beta}_{\operatorname{m}athrm{loc}}
$$
for some $\beta > 1-\tfrac{1}{n}$. However, the proof does seem to require a local smoothness assumption on the integrand
that is stronger than $\operatorname{C}^2$ and it is even unclear if one can relax it beyond $(\underline{\operatorname{m}athrm{H}0})$.
\end{remark}
As indicated above, we prove Theorem \ref{thm:main} by adapting the linearization procedure and Caccioppoli inequalities to
the linear growth $\operatorname{BV}$ scenario. In doing this there are a number of difficulties that must be overcome. The main difficulty
turns out to be the linearization procedure, where one cannot work in the natural energy space $\operatorname{W}^{1,2}$ for the linear elliptic
system that corresponds to a suitable second Taylor polynomial of the integrand. This happens already in the case of subquadratic
growth integrands on Sobolev space $\operatorname{W}^{1,p}$, but the situation in the linear growth case is more severe as it by its very nature
must be degenerate at infinity. The usual ways for implementing this step do seem to require modification. Our variant consists in
an explicit construction of a test map that upon use delivers the required estimate. We believe this approach could be a useful
alternative also in the standard $p$-growth case, and intend to return to this and other applications in future work.
The Caccioppoli inequality of the second kind is established following the proof given by \textsc{Evans} \cite{Evans} and
presents no problem. It is however important to emphasize that in the linear growth case these Caccioppoli inequalities do not
allow us to establish a reverse H\"{o}lder inequality for the gradient and so we cannot prove higher integrability by use of Gehring's Lemma.
Indeed, such higher integrability is ruled out by a counterexample due to \textsc{Buckley \& Koskela} \cite{BuKo}. This can also be directly seen from
the example of the sign function on $(-1,1)$ which \emph{does satisfy a Caccioppoli inequality} and belongs to $\operatorname{BV} (-1,1) \setminus \operatorname{W}^{1,1}(-1,1)$.
A brief discussion of the compactness that can be inferred from a Caccioppoli inequality of the second kind is contained in Remark \ref{caccpt} below.
We refer the interested reader to \cite{FG} for more details on this, but remark here that it is for this reason that we have so far
not been able to treat the case of minimizers for the general linear growth case $F=F(x,u,\nabla u)$.
Finally we note that the proof of Theorem \ref{thm:main} is fairly robust. However, in view of the failure of Korn's inequality in $\operatorname{L}^1$, and
its consequence, that the space of maps of \emph{bounded deformation} $\operatorname{m}athrm{BD}$ is strictly larger than $\operatorname{BV}$, the extension of our results
to a $\operatorname{m}athrm{BD}$ context under natural assumptions is not immediate. The main difficulty in transferring the proofs is that $\operatorname{m}athrm{BD}$ maps
do not have an obvious \emph{Fubini property} as do $\operatorname{BV}$ maps (see Lemma \ref{bvrestrict}). Nevertheless this obstacle can be overcome and the
first author has extended some of the results presented here to $\operatorname{m}athrm{BD}$ in his DPhil thesis \cite{FG}.
\subsection{Organization of the paper}
In Section~\ref{sec:prelims} we fix notation, collect basic facts about $\operatorname{BV}$-functions and record various auxiliary estimates.
We mention here in particular Subsection 2.5 on quasiconvexity that, besides recalling the relevant definitions and elementary facts,
also makes explicit the very flexible and possibly \emph{nonconvex} nature of integrands satisfying the hypotheses $\operatorname{m}athrm{(H0)}$, $\operatorname{m}athrm{(H1)}$,
$\operatorname{m}athrm{(H2)}$. Section~\ref{minseq} contains the proof of Proposition \ref{sharpening} that, as mentioned above, clarifies the role of our
strong quasiconvexity assumption $\operatorname{m}athrm{(H2)}$. The subsequent Section~\ref{sec:main} is devoted to the proof of Theorem~\ref{thm:main}
that we have spelled out into 5 steps, each presented in a subsection. Probably the most interesting aspect of the proof is contained in Subsection
4.3 on approximation by harmonic maps, alas the linearization procedure. Finally, we end the paper by briefly indicating possible extensions
and variants of Theorem \ref{thm:main} that can be easily established by variants of the proof given in Section~\ref{sec:main}.
\subsection*{Acknowledgments}
Both authors gratefully acknowledge the hospitality and financial support of the Max-Planck-Institute for Mathematics in the
Natural Sciences during a stay in Leipzig in Spring 2017, where large parts of this project were concluded. The first author
moreover acknowledges financial support by the EPSRC throughout his doctoral studies at Oxford during 2013--17 and the Hausdorff Centre of
Mathematics in Bonn for his current postdoc position.
\section{Preliminaries}\label{sec:prelims}
\subsection{Functions of measures}\label{sec:functionsofmeasures}
Here we fix the notation and recall background facts about measures. Our reference for measure theory is \cite{AFP} whose notation and
terminology we also follow. Let $\operatorname{m}athbb{H}$ be a finite dimensional Hilbert space and let $\operatorname{m}u$ be an $\operatorname{m}athbb{H}$--valued Radon measure on
the open subset $\Omega$ of $\operatorname{m}athbb{R}n$. Its total variation measure, denoted $| \operatorname{m}u |$ and defined using the norm of $\operatorname{m}athbb{H}$, is a nonnegative
(possibly infinite) Radon measure on $\Omega$. We say that $\operatorname{m}u$ is a bounded Radon measure if it has finite total variation on $\Omega$:
$| \operatorname{m}u | (\Omega ) < \infty$. With respect to the $n$--dimensional Lebesgue measure $\operatorname{m}athscr{L}^{n}$ we have the Lebesgue--Radon--Nikod\'{y}m
decomposition of $\operatorname{m}u$:
$$
\operatorname{m}u=\frac{\operatorname{div}f\operatorname{m}u}{\operatorname{div}f\operatorname{m}athscr{L}^{n}}\operatorname{m}athscr{L}^{n}+\frac{\operatorname{div}f\operatorname{m}u}{\operatorname{div}f |\operatorname{m}u^{s}|}\operatorname{m}u^{s}.
$$
For a Borel function $f\colon \Omega \times \operatorname{m}athbb{H} \to \operatorname{m}athbb{R}$ satisfying for some constant $c \geq 0$ the linear growth, or $1$-growth, condition
$|f(x,z)| \leq c\bigl( |z|+1 \bigr)$ for all $(x,z) \in \Omega \times \operatorname{m}athbb{H}$ we define the (upper) recession function as
\begin{equation}\label{urecession}
f^{\infty}(x,z):=\limsup_{\stackrel{x^{\prime} \to x, z^{\prime} \to z}{t \to \infty}} \frac{f(x^{\prime},tz^{\prime})}{t} ,\qquad (x,z) \in\Omega \times \operatorname{m}athbb{H}.
\end{equation}
Hereby $f^{\infty} \colon \Omega \times \operatorname{m}athbb{H} \to \operatorname{m}athbb{R}$ is Borel, satisfies the growth condition $|f^{\infty}(x,z)| \leq c|z|$
for all $(x,z) \in \Omega \times \operatorname{m}athbb{H}$ and is positively $1$-homogeneous in its second argument: $f^{\infty}(x,tz)=tf^{\infty}(x,z)$ for
$t \geq 0$. For $\operatorname{m}u$, $f$ as above we define the signed Radon measure $f(\cdot, \operatorname{m}u )$ by
prescribing for each Borel set $A$ whose closure is compact and contained in $\Omega$ that
$$
\int_{A} \! f(\cdot , \operatorname{m}u ) := \int_{A} \! f\left( \cdot \, , \frac{\operatorname{div}f\operatorname{m}u}{\operatorname{div}f\operatorname{m}athscr{L}^{n}} \right) \,
\operatorname{m}athrm{d} \operatorname{m}athscr{L}^{n} + \int_{A} \! f^{\infty} \left(\cdot \, , \frac{\operatorname{div}f\operatorname{m}u}{\operatorname{div}f |\operatorname{m}u^{s}|}\right) \, \operatorname{m}athrm{d} |\operatorname{m}u^{s}| .
$$
When $\operatorname{m}u$ is a bounded Radon measure the above formula extends to all Borel sets $A \subseteq \Omega$ and we easily check that
it hereby defines a bounded Radon measure on $\Omega$. When, in addition to the above, $f$ is assumed continuous and the limes superior in
(\ref{urecession}) is a limit for all $(x,z)$, then we say that $f$ admits a regular recession function. It is then easily seen that
$f^{\infty}$ must be continuous too (as a locally uniform limit of continuous functions). Note that the function $f=1_{\Omega} \otimes E$
satisfies the above conditions and admits a regular recession function, $f^{\infty}=1_{\Omega} \otimes | \cdot |$. In fact, as is easily seen,
any continuous function $f \colon \Omega \times \operatorname{m}athbb{H} \to \operatorname{m}athbb{R}$ satisfying the above $1$-growth condition and so $z \operatorname{m}apsto f(x,z)$ is
convex, admits a regular recession function.
We apply in particular the above notation to functions that do not depend explicitly on $x$, so $f\colon \operatorname{m}athbb{H} \to \operatorname{m}athbb{R}$, and in this case
we write interchangably $f(\operatorname{m}u )(A)$ and $\int_{A} \! f(\operatorname{m}u )$ for the measure. This notation is consistent in the sense that for $f= | \cdot |$,
$f(\operatorname{m}u )$ is simply the total variation measure of $\operatorname{m}u$ and for $f=E$, $f(\operatorname{m}u )+\operatorname{m}athscr{L}^{n}$ is the total variation measure of the $\operatorname{m}athbb{H} \times \operatorname{m}athbb{R}$-valued
measure $(\operatorname{m}u , \operatorname{m}athscr{L}^{n} )$.
It is well-known that these two functionals give rise to useful notions of convergence for sequences of Radon measures. For bounded
$\operatorname{m}athbb{H}$-valued Radon measures on $\Omega$ we say that $\operatorname{m}u_j \to \operatorname{m}u$ strictly on $\Omega$ iff $\operatorname{m}u_j \wstar \operatorname{m}u$ in $\operatorname{C}_{0}( \Omega, \operatorname{m}athbb{H})^{\ast}$
and $| \operatorname{m}u_{j}|(\Omega ) \to | \operatorname{m}u |(\Omega )$. A slightly stronger mode of convergence is $E$-strict or area-strict convergence on $\Omega$:
$\operatorname{m}u_j \wstar \operatorname{m}u$ in $\operatorname{C}_{0}( \Omega ,\operatorname{m}athbb{H})^{\ast}$ and $\int_{\Omega} \! E(\operatorname{m}u_{j}) \to \int_{\Omega} \! E(\operatorname{m}u )$. Any Radon measure can
be area-strictly approximated by smooth maps using mollification and a well-known result of Reshetnyak \cite{Reshetnyak} (and \cite[Appendix]{KR1})
states that for a continuous function $f \colon \Omega \times \operatorname{m}athbb{H} \to \operatorname{m}athbb{R}$ of $1$-growth and admitting a regular recession function we have
$$
\int_{\Omega} \! f( \cdot , \operatorname{m}u_{j}) \to \int_{\Omega} \! f( \cdot , \operatorname{m}u )
$$
whenever $\operatorname{m}u_j \to \operatorname{m}u$ area-strictly on $\Omega$. Finally we shall often use the short-hand
$$
\int_{\Omega} \! f(\operatorname{m}u -z) := \int_{\Omega} \! f \bigl( \operatorname{m}u - z \operatorname{m}athscr{L}^{n} \bigr)
$$
for $z \in \operatorname{m}athbb{H}$ and $\operatorname{m}athbb{H}$-valued Radon measures $\operatorname{m}u$.
\subsection{Mappings of bounded variation}
Our reference for maps of bounded variation is \cite{AFP} and we follow the notation and terminology used there. Here we briefly recall
a few definitions and background results.
Let $\Omega$ be a bounded, open subset of $\operatorname{m}athbb{R}n$. We say that an integrable map $u\colon\Omega\to\operatorname{m}athbb{R}N$ has bounded variation if its distributional
gradient can be represented by a bounded $\operatorname{m}athbb{R}^{N \times n}$--valued Radon measure, that is, if
\begin{align*}
|Du|(\Omega):=\sup\left\{\int_{\Omega}u\operatorname{div}(\varphi)\operatorname{div}f x\colon\;\varphi\in \operatorname{C}_{c}^{1}(\Omega ,\operatorname{m}athbb{R}^{N \times n} ),\;|\varphi|\leq 1 \right\}<\infty.
\end{align*}
Here and in what follows, the divergence operator, $\operatorname{div}$, applied to $\operatorname{m}athbb{R}^{N\times n}$--valued distributions is understood to act row--wise.
The space of maps of bounded variation is denoted by $\operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$ and it is a Banach space under the norm $\|v\|_{\operatorname{BV}}:=\|v\|_{\operatorname{L}^{1}}+|D v|(\Omega)$.
We shall use freely the results from \cite{AFP} for such maps, including in particular Poincar\'{e} and Sobolev type inequalities.
We stress that we throughout the paper consider integrable maps in terms of their precise representatives that we define as follows.
Assume $u \in \operatorname{L}^{1}_{\operatorname{m}athrm{loc}}( \Omega , \operatorname{m}athbb{H})$, where as in the previous subsection $\operatorname{m}athbb{H}$ denotes a finite dimensional Hilbert
space. We say that $u$ has approximate limit $y \in \operatorname{m}athbb{H}$ at $x_{0} \in \Omega$, and write
$$
\operatorname{m}athrm{ap}\lim_{x \to x_{0}} u(x) = y
$$
provided that
$$
\lim_{r \searrow 0} \Xint-_{B_{r}(x_{0})} \! |u(x)-y| \, \operatorname{m}athrm{d} x = 0.
$$
The set $S_u$ of points in $\Omega$ where no such limit exists is the approximate discontinuity set for $u$:
$S_{u} = \{ x \in \Omega : \, u \operatorname{m}box{ has no approximate limit at } x \}$. It is an $\operatorname{m}athscr{L}^{n}$ negligible
Borel set and the precise representative is defined for each $x \in \Omega \setminus S_{u}$ by (a slight abuse of notation):
$$
u(x) := \operatorname{m}athrm{ap}\lim_{x^{\prime} \to x} u(x^{\prime}).
$$
Then $u \colon \Omega \setminus S_{u} \to \operatorname{m}athbb{H}$ is Borel measurable, and it is not so important for the developments of this paper how we define
the precise representative on the set $S_u$. Note that when $(\rho_{\varepsilon})_{\varepsilon > 0}$ is a standard smooth mollifier and
$u \in \operatorname{L}^{1}_{\operatorname{m}athrm{loc}}(\Omega , \operatorname{m}athbb{H} )$, then $u_{\varepsilon} = \rho_{\varepsilon} \ast u$ is $\operatorname{C}^{\infty}$ on
$\Omega_{\varepsilon} = \{ x \in \Omega : \, \operatorname{m}athrm{dist}(x,\partial \Omega ) > \varepsilon \}$ and $u_{\varepsilon}(x) \to u(x)$ as $\varepsilon \searrow 0$
for each $x \in \Omega \setminus S_u$ (as well as locally in $\operatorname{L}^1$ on $\Omega$).
When $u$ is of bounded variation the above convergence holds in a stronger sense, though not
in the $\operatorname{BV}$ norm defined above. Partly for this reason it is useful to consider other modes of convergence too. We say that a sequence $(u_{k})$ in
$\operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$ converges to $u\in\operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$ in the weak*--sense if $u_{k}\to u$ strongly in $\operatorname{L}^{1}(\Omega , \operatorname{m}athbb{R}N )$ and
$D u_{k}\wstar D u$ in $\operatorname{C}_{0}(\Omega ,\operatorname{m}athbb{R}^{N \times n} )^{\ast}$ as $k\to\infty$.
We further say that $(u_{k})$ converges to $u$ in the $\operatorname{BV}$ strict sense on $\Omega$ if $u_{k}\wstar u$ and
$|D u_{k}|(\Omega)\to |D u|(\Omega)$ as $k\to\infty$. Lastly, we say that $(u_{k})$ converges to $u$ in the
$\operatorname{BV}$ area--strict sense on $\Omega$ if $u_{k}\wstar u$ and
$$
\int_{\Omega} \! E(Du_{k}) \to \int_{\Omega} \! E(Du)
$$
as $k \to \infty$. We recall that smooth maps are dense in $\operatorname{BV} (\Omega ,\operatorname{m}athbb{R}N )$ in the $\operatorname{BV}$ area--strict sense, and more precisely:
\begin{lemma}\label{Eapprox}
Let $B=B_{R}(x_{0})$ be a ball and $u \in \operatorname{BV} (B,\operatorname{m}athbb{R}N )$. Then there exists a sequence $(u_{j} )$ of $\operatorname{C}^{\infty}$ maps $u_{j}\colon B \to \operatorname{m}athbb{R}N$,
each of Sobolev class $\operatorname{W}^{1,1}(B, \operatorname{m}athbb{R}N )$, satisfying $u_{j}|_{\partial B} = u|_{\partial B}$ and so $u_{j} \to u$ $\operatorname{BV}$ area--strictly on $B$.
\end{lemma}
\noindent
See for instance \cite[Lemma B.2]{Bildhauer} or \cite[Lemma 1]{KR2} for a proof that works on general domains.
\begin{lemma}\label{Econt}
Let $G \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ be rank-one convex and of linear growth: $|G(z)| \leq c(|z|+1)$ for all $z \in \operatorname{m}athbb{R}^{N \times n}$.
If $u$, $u_{j} \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$, where $\Omega$ is a bounded Lipschitz domain in $\operatorname{m}athbb{R}n$, and
$u_{j} \to u$ $\operatorname{BV}$ area--strictly on $\Omega$, then
$$
\int_{\Omega} \! G(Du_{j}) \to \int_{\Omega} \! G(Du) \quad \operatorname{m}box{ as } \quad j \to \infty .
$$
\end{lemma}
\noindent
We refer to \cite[Theorem 4]{KR1} for a proof.
\begin{lemma}\label{bvrestrict}
For a ball $B = B_{R}(x_{0})$ let $u \in \operatorname{BV} (B , \operatorname{m}athbb{R}N )$. Then for $\operatorname{m}athscr{L}^1$ almost all radii $r \in (0,R)$ the pointwise restriction
$u|_{\partial B_{r}}$ coincides with the traces from $B_{r}$ and from $B \setminus \overline{B_{r}}$ of $u$
and is BV on $\partial B_{r}$. Furthermore, given two radii $0<r<s<R$ we can find a radius $t \in (r,s)$ such that
$u|_{\partial B_{t}}$ is as above and its total variation over $\partial B_{t}$ is bounded as
\begin{equation}\label{goodrestrict}
\int_{\partial B_{t}} \! |D_{\tau}(u|_{\partial B_{t}})| \leq \frac{c}{s-r}\int_{B_{s}\setminus \bar{B_r}} \! |Du|,
\end{equation}
where $c=c(n,N)$ is a constant and $D_{\tau}(u|_{\partial B_{t}})$ denotes the tangential derivative (see (\ref{tangent}) below).
\end{lemma}
\begin{proof}
We can assume that $x_0 = 0$. For a standard smooth mollifier $( \rho_{\varepsilon})_{\varepsilon > 0}$
we put $u_{\varepsilon} = \rho_{\varepsilon} \ast u$. Then $u_{\varepsilon} \in \operatorname{C}^{\infty}(B_{R-\varepsilon} , \operatorname{m}athbb{R}N )$ and
we have $u_{\varepsilon} \to u$ $\operatorname{BV}$ strictly on $B_{s'}\setminus \overline{B}_{r'}$ for any radii $r \leq r' < s' \leq s$ with
$|Du|(\partial B_{s'} \cup \partial B_{r'})=0$. Furthermore, $u_{\varepsilon}(x) \to u(x)$ for each
$x \in B \setminus S_{\bar{u}}$ as $\varepsilon \searrow 0$.
The tangential derivative of $u_{\varepsilon}$ at $x \in \partial B_{t}$ on
the sphere $\partial B_{t}$ is given by
\begin{equation}\label{tangent}
\nabla_{\tau}(u_{\varepsilon}|_{\partial B_{t}})(x) = \nabla u_{\varepsilon}(x)\bigl( I - \tfrac{x \otimes x}{t^{2}} \bigr)
\end{equation}
so by integration in polar coordinates
\begin{eqnarray*}
\int_{r}^{s} \! \int_{\partial B_{t}} \! |D_{\tau}(u_{\varepsilon}|_{\partial B_{t}})| \, \operatorname{m}athrm{d} t &=&
\int_{r}^{s} \! \int_{\partial B_{t}} \! |\nabla_{\tau}(u_{\varepsilon}|_{\partial B_{t}})| \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1} \, \operatorname{m}athrm{d} t\\
&\leq& \int_{r}^{s} \! \int_{\partial B_{t}} \! |\nabla u_{\varepsilon}| \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1} \, \operatorname{m}athrm{d} t\\
&=& \int_{B_{s} \setminus B_{r}} \! | \nabla u_{\varepsilon}| \, \operatorname{m}athrm{d} x = \int_{B_{s} \setminus B_{r}} \! |Du_{\varepsilon}|.
\end{eqnarray*}
The set $M = \{ t \in (r,s) : \, \operatorname{m}athcal{H}^{n-1}(S_{u} \cap \partial B_{t}) > 0 \}$ is $\operatorname{m}athscr{L}^1$ negligible, and for $t \in (r,s)\setminus M$
we have that, as $\varepsilon \searrow 0$, $u_{\varepsilon}(x) \to u(x)$ for $\operatorname{m}athcal{H}^{n-1}$ a.e. $x \in \partial B_t$ and by the trace theorem
(see \cite{AFP} Th. 3.77) also in $\operatorname{L}^{1}(\partial B_{t}, \operatorname{m}athbb{R}N )$.
Next, Fatou's lemma and the strict convergence give for the radii $r \leq r' < s' \leq s$ selected above that
$$
\int_{r'}^{s'} \! \liminf_{\varepsilon \searrow 0} \int_{\partial B_{t}} \! |\nabla_{\tau}(u_{\varepsilon}|_{\partial B_{t}})|
\, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1} \, \operatorname{m}athrm{d} t \leq \int_{B_{s}\setminus \bar{B_{r}}} \! |Du| ,
$$
and hence taking $r' \searrow r$ and $s' \nearrow s$ we get
$$
\int_{r}^{s} \! \liminf_{\varepsilon \searrow 0} \int_{\partial B_{t}} \! |\nabla_{\tau}(u_{\varepsilon}|_{\partial B_{t}})|
\, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1} \, \operatorname{m}athrm{d} t \leq \int_{B_{s}\setminus \bar{B_{r}}} \! |Du| .
$$
For each $t \in (r,s) \setminus M$ such that
$$
\liminf_{\varepsilon \searrow 0} \int_{\partial B_{t}} \! |\nabla_{\tau}(u_{\varepsilon}|_{\partial B_{t}})|
\, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1} < \infty
$$
which is $\operatorname{m}athscr{L}^1$ almost all $t$, we can find a subsequence $\varepsilon_{j}=\varepsilon_{j}(t) \searrow 0$ such that
$u_{\varepsilon_{j}}|_{\partial B_t} \to u|_{\partial B_t}$ in $\operatorname{L}^{1}(\partial B_{t} , \operatorname{m}athbb{R}N )$ and pointwise $\operatorname{m}athcal{H}^{n-1}$ a.e., and
$$
\lim_{j \to \infty} \int_{\partial B_{t}} \! |\nabla_{\tau}(u_{\varepsilon_{j}}|_{\partial B_{t}})| \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1} < \infty .
$$
This implies that $u|_{\partial B_{t}} \in \operatorname{BV} (\partial B_{t}, \operatorname{m}athbb{R}N )$. Finally, the last assertion follows because we can select
$t \in (r,s) \setminus M$ so
$$
\liminf_{\varepsilon \searrow 0} \int_{\partial B_{t}} \! |\nabla_{\tau}(u_{\varepsilon}|_{\partial B_{t}})|
\, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1} \leq \tfrac{2}{s-r} \int_{B_{s}\setminus \bar{B_{r}}} \! |Du|,
$$
and then conclude by selecting a suitable subsequence $\varepsilon_{j} \searrow 0$ as above.
It follows that the pointwise restriction of the precise representative $u|_{\partial B_t} \in \operatorname{BV} (\partial B_{t}, \operatorname{m}athbb{R}N )$ coincides
$\operatorname{m}athcal{H}^{n-1}$ a.e. with the traces of $u$ from $B_{t}$ and from $B_{s}\setminus \overline{B}_{t}$ and that (\ref{goodrestrict}) holds.
\end{proof}
\noindent
For the statement of the next result we recall that for a ball $B=B_{R}(x_{0})$ in $\operatorname{m}athbb{R}n$, $s \in (0,1)$ and $p \in (1,\infty )$ the
Sobolev-Slobodecki\u{\i} spaces $\operatorname{W}^{s,p}(B, \operatorname{m}athbb{R}N )$ and $\operatorname{W}^{s,p}(\partial B , \operatorname{m}athbb{R}N )$ consist of all integrable maps $u \colon B \to \operatorname{m}athbb{R}N$,
$v \colon \partial B \to \operatorname{m}athbb{R}N$ for which the Gagliardo norm
$$
\| u \|_{\operatorname{W}^{s,p}(B , \operatorname{m}athbb{R}N )} = \left( \| u \|_{\operatorname{L}^{p}(B, \operatorname{m}athbb{R}N )}^{p}+| u |_{\operatorname{W}^{s,p}(B , \operatorname{m}athbb{R}N )}^{p} \right)^{\frac{1}{p}},
$$
$$
\| v \|_{\operatorname{W}^{s,p}(\partial B , \operatorname{m}athbb{R}N )} = \left( \| v \|_{\operatorname{L}^{p}(\partial B, \operatorname{m}athbb{R}N )}^{p}+| v |_{\operatorname{W}^{s,p}(\partial B , \operatorname{m}athbb{R}N )}^{p} \right)^{\frac{1}{p}}
$$
is finite, respectively. Here we define the corresponding semi-norms as, respectively,
$$
| u |_{\operatorname{W}^{s,p}(B , \operatorname{m}athbb{R}N )} = \left( \int_{B} \int_{B} \! \frac{|u(x)-u(y)|^{p}}{|x-y|^{n-1+sp}} \, \operatorname{m}athrm{d} x \, \operatorname{m}athrm{d} y \right)^{\frac{1}{p}}.
$$
and
$$
| v |_{\operatorname{W}^{s,p}(\partial B , \operatorname{m}athbb{R}N )} = \left( \int_{\partial B} \int_{\partial B} \! \frac{|v(x)-v(y)|^{p}}{|x-y|^{n-1+sp}} \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1}(x) \,
\operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1}(y) \right)^{\frac{1}{p}}.
$$
\begin{lemma}\label{bvembedding}
Assume the dimension $n \geq 3$.
Let $B=B_{R}(x_{0})$ be a ball and $v \in \operatorname{BV} (\partial B,\operatorname{m}athbb{R}N )$. Then $v \in \operatorname{W}^{\frac{1}{n},\frac{n}{n-1}}(\partial B , \operatorname{m}athbb{R}N )$ and
$$
\left( \Xint-_{\partial B} \int_{\partial B} \! \frac{|v(x)-v(y)|^{\frac{n}{n-1}}}{|x-y|^{n-1+\frac{1}{n-1}}} \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1}(x) \,
\operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1}(y) \right)^{1-\frac{1}{n}} \leq cR^{1-\frac{1}{n}}\Xint-_{\partial B} \! |D_{\tau}v| ,
$$
where $c=c(n,N)$ is a constant.
\end{lemma}
We refer to \cite[Lemma D.2]{BoBrMi} for a proof that $\operatorname{BV} (\operatorname{m}athbb{R}^{n-1} )$ for dimensions $n \geq 3$ embeds into $\operatorname{W}^{\frac{1}{n},\frac{n}{n-1}}(\operatorname{m}athbb{R}^{n-1})$.
Lemma \ref{bvembedding} can be recovered from this result by the usual arguments involving local coordinates and a partition of unity. Note that
the embedding fails for dimension $n=2$: an indicator function for a circular arc has bounded variation on $\partial B$ but it is not of class
$\operatorname{W}^{\frac{1}{2},2}(\partial B)$. In the two-dimensional case we instead have an embedding into the larger $\operatorname{L}^2$ based Nikolski\u{\i} space that
we in this context may define as
$$
\operatorname{m}athrm{B}^{\tfrac{1}{2},2}_{\infty}(\partial B , \operatorname{m}athbb{R}N ) = \left\{ v \in \operatorname{L}^{2}(\partial B , \operatorname{m}athbb{R}N ) : \, \sup_{0<|h|< R/2} \int_{\partial B} \!
| v \left( \tfrac{x+h}{|x+h|}\right)-v(x)|^{2} \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{1}(x)/|h| < \infty \right\} .
$$
This definition is easily seen to be equivalent to the one obtained by transferring the usual definition on the interval $(-1,1)$ by local coordinates
and a partition of unity. A proof of the aforementioned embedding can therefore be inferred from \cite[Lemma 38.1]{Tartar}. In combination with a
Sobolev embedding result (see \cite[Lemma 22.2, (34.4) and Lemma 36.1]{Tartar} or \cite[Theorem 4.6.1(a)]{Triebel}) we then deduce:
\begin{lemma}\label{bvembedding2}
Assume the dimension $n=2$.
Let $B=B_{R}(x_{0}) \subset \operatorname{m}athbb{R}^2$ be a ball and $v \in \operatorname{BV} (\partial B,\operatorname{m}athbb{R}N )$. Then $v \in \operatorname{W}^{1-\frac{1}{p},p}(\partial B , \operatorname{m}athbb{R}N )$ for each $p \in (1,2)$
and
$$
\left( \Xint-_{\partial B} \int_{\partial B} \! \frac{|v(x)-v(y)|^{p}}{|x-y|^{p}} \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{1}(x) \,
\operatorname{m}athrm{d} \operatorname{m}athcal{H}^{1}(y) \right)^{\frac{1}{p}} \leq cR^{\frac{1}{p}}\Xint-_{\partial B} \! |D_{\tau}v| ,
$$
where $c=c(N,p)$ is a constant.
\end{lemma}
When $u \in \operatorname{C}^{0}( \overline{\Omega},\operatorname{m}athbb{R}N )$ we denote by $\operatorname{m}athrm{Tr}_{\Omega}(u)=u|_{\partial \Omega}$ the
primitive trace operator of $u$ on $\partial \Omega$, and when we write $\operatorname{m}athrm{Tr}_{\Omega}(v)$ for more general Sobolev
mappings $v$ below we understand as usual this trace as the extension by continuity of the primitive trace operator to the relevant
space.
We refer to \cite{Tartar,Triebel} for further background on Besov and Sobolev-Slobodecki\u{\i} spaces. However, for later reference we explicitly recall two
instances of Gagliardo's trace theorem here.
\begin{lemma}\label{bvtrace}
For bounded Lipschitz domains $\Omega$ in $\operatorname{m}athbb{R}n$ the trace operator $u \operatorname{m}apsto u|_{\partial \Omega}$ extends from smooth maps on $\overline{\Omega}$
by strict continuity to a well-defined strictly continuous linear surjective operator
$$
\operatorname{m}athrm{Tr}_{\Omega} \colon \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N ) \to \operatorname{L}^{1}(\partial \Omega , \operatorname{m}athbb{R}N ).
$$
Furthermore, we already have $\operatorname{m}athrm{Tr}_{\Omega} \bigl( \operatorname{W}^{1,1}(\Omega , \operatorname{m}athbb{R}N ) \bigr) = \operatorname{L}^{1}(\partial \Omega , \operatorname{m}athbb{R}N )$.
In particular we have for a ball $B=B_{R}(x_{0})$, writing $\bar{u}=\operatorname{m}athrm{Tr}_{B}(u)$ for $u \in \operatorname{BV} (B, \operatorname{m}athbb{R}N )$ that
\begin{equation}\label{sharptrace}
\int_{\partial B} \! \left| \bar{u}-\Xint-_{\partial B} \bar{u} \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1} \right| \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1} \leq c\int_{B} \! |Du|,
\end{equation}
where $c=c(n,N)$ is a constant.
\end{lemma}
\begin{lemma}\label{gagtrace}
For the unit ball $\operatorname{m}athbb{B}=B_{1}(0)$ there exists a bounded linear extension operator
$$
\operatorname{m}athrm{E} \colon \operatorname{W}^{k-\frac{1}{p},p}(\partial \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N ) \to \operatorname{W}^{k,p}( \operatorname{m}athbb{B}, \operatorname{m}athbb{R}N ) , \quad k \in \operatorname{m}athbb{N} , \quad 1<p< \infty .
$$
More precisely, $\operatorname{m}athrm{E}$ does not depend on $k$, $p$ and is a bounded linear operator such that
$\operatorname{m}athrm{Tr}_{\operatorname{m}athbb{B}} \circ \operatorname{m}athrm{E}$ is the identity on $\operatorname{W}^{k-\frac{1}{p},p}(\partial \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$.
\end{lemma}
\subsection{Auxiliary estimates for the reference integrand $E$}
We write $E(z)$ for the reference integrand defined at (\ref{defE}) whenever $z \in \operatorname{m}athbb{H}$
and $\operatorname{m}athbb{H}$ is a finite dimensional Hilbert space. Firstly, elementary estimations yield
\begin{equation}\label{minb}
\left\{
\begin{array}{l}
(\sqrt{2}-1)\operatorname{m}in \{ |z|,|z|^{2} \} \leq E(z) \leq \operatorname{m}in \{ |z|,|z|^{2} \}\\
\operatorname{m}box{ }\\
E(az) \leq a^{2}E(z) \quad \operatorname{m}box{ and } \quad E(z+w) \leq 2\bigl( E(z)+E(w) \bigr)
\end{array}
\right.
\end{equation}
for all $z$, $w \in \operatorname{m}athbb{H}$ and $a\geq 1$.
For the following, define for a measurable subset $A$ of $\operatorname{m}athbb{R}^{n}$ and a $\operatorname{m}athbb{H}$--valued Radon
measure $\operatorname{m}u$ on $\operatorname{m}athbb{R}^{n}$ the mean value $\operatorname{m}u_{B}:=\operatorname{m}u(B)/\operatorname{m}athscr{L}^{n} (B)$.
\begin{lemma}\label{estE1}
Let $\phi$ be a bounded $\operatorname{m}athbb{H}$--valued Radon measure on an open ball $B$ in $\operatorname{m}athbb{R}n$. Then
\begin{equation}\label{qminE}
\int_{B} \! E( \phi -\phi_{B}) \leq 4\int_{B} \! E( \phi -z)
\end{equation}
for all $z \in \operatorname{m}athbb{H}$.
\end{lemma}
\begin{proof}
By mollification we can asssume that $\phi \in \operatorname{L}^{1}(B, \operatorname{m}athbb{H})$. From (\ref{minb}) and convexity we find
\begin{eqnarray*}
\int_{B} \! E( \phi -\phi_{B}) \, \operatorname{m}athrm{d} x
&\leq& 2\int_{B} \! E(\phi -z) \, \operatorname{m}athrm{d} x +2\operatorname{m}athscr{L}^{n} (B)E(\phi_{B}-z)\\
&\leq& 4\int_{B} \! E(\phi -z) \, \operatorname{m}athrm{d} x
\end{eqnarray*}
as required.
\end{proof}
\begin{lemma}\label{estE2}
Let $\phi$ be a bounded $\operatorname{m}athbb{H}$--valued Radon measure on an open ball $B$ in $\operatorname{m}athbb{R}n$.
Then
$$
\Xint-_{B} \! | \phi | \leq \sqrt{{\operatorname{m}athscr{E}^{2}+2\operatorname{m}athscr{E}}}, \quad \operatorname{m}box{ where } \, \operatorname{m}athscr{E} = \Xint-_{B} \! E(\phi ) .
$$
In particular, for $\operatorname{m}athscr{E} \leq 1$ we have
\begin{equation}\label{smallE}
\Xint-_{B} \! | \phi | \, \operatorname{m}athrm{d} x \leq \sqrt{3\operatorname{m}athscr{E}}.
\end{equation}
\end{lemma}
\begin{proof}
By mollification we can asssume that $\phi \in \operatorname{L}^{1}(B, \operatorname{m}athbb{H})$. From Jensen's inequality
$$
E\left( \Xint-_{B} \! | \phi | \, \operatorname{m}athrm{d} x \right) \leq \Xint-_{B} \! E( \phi ) \, \operatorname{m}athrm{d} x = \operatorname{m}athscr{E},
$$
and hence solving for the $\operatorname{L}^1$ norm we easily conclude.
\end{proof}
\subsection{Estimates for Legendre-Hadamard elliptic systems}
The space of symmetric and real bilinear forms on $\operatorname{m}athbb{R}^{N \times n}$ is denoted by $\bigodot^{2}( \operatorname{m}athbb{R}^{N \times n} )$ and equipped with the operator norm, denoted
and defined for $\operatorname{m}athbb{A} \in \bigodot^{2}( \operatorname{m}athbb{R}^{N \times n} )$ as $| \operatorname{m}athbb{A}| = \sup \{ \operatorname{m}athbb{A}[z,w] : \, |z|, |w| \leq 1 \}$. Observe that
the precise meaning of $| \cdot |$ can be understood from the context, and for a matrix $z \in \operatorname{m}athbb{R}^{N \times n}$ we use it to denote the usual euclidean
norm: $|z|^{2} = \operatorname{m}box{trace} (z^{t}z)$. Likewise for vectors in $\operatorname{m}athbb{R}^k$.
Fix $\operatorname{m}athbb{A} \in \bigodot^{2}( \operatorname{m}athbb{R}^{N \times n} )$ and assume it satisfies the strong Legendre-Hadamard condition
\begin{equation}\label{sLH}
\left\{
\begin{array}{l}
\alpha | y |^{2}| x |^{2} \leq \operatorname{m}athbb{A} [ y \otimes x , y \otimes x ]
\quad \forall y \in \operatorname{m}athbb{R}N , \, \forall x \in \operatorname{m}athbb{R}n\\
| \operatorname{m}athbb{A} | \leq \beta ,
\end{array}
\right.
\end{equation}
where $\alpha$, $\beta > 0$ are constants. Any $\operatorname{m}athbb{R}N$-valued distribution $u$ on
$\Omega$ satisfying
$$
-\operatorname{m}athrm{div} \, \operatorname{m}athbb{A}Du = 0 \quad \operatorname{m}box{ in the distributional sense on } \Omega
$$
where $\operatorname{m}athrm{div}$ is understood to act row-wise, is called $\operatorname{m}athbb{A}$-harmonic, or simply harmonic when $\operatorname{m}athbb{A}$ is
clear from the context.
The next lemma is a standard Weyl-type result and can for instance be proved using the difference-quotient method (see
\cite{Giaquinta,Giusti,Mit,MorreyB}).
\begin{lemma}\label{Weyl}
Let $\operatorname{m}athbb{A}\in \bigodot^{2}( \operatorname{m}athbb{R}^{N \times n} )$ satisfy (\ref{sLH}). Then there exists a constant $c=c(\frac{\beta}{\alpha},n,N)$ with
the following propeties. Let $B=B_{R}(x_{0})$ be a ball in $\operatorname{m}athbb{R}n$ and assume that $h \in \operatorname{W}^{1,1}(B, \operatorname{m}athbb{R}N )$ is harmonic in $B$:
$-\operatorname{m}athrm{div} \operatorname{m}athbb{A}\nabla h = 0$ in $B$. Then $h$ is $\operatorname{C}^{\infty}$ on $B$ and for any $z \in \operatorname{m}athbb{R}^{N \times n}$ we have
$$
\sup_{B_{\frac{R}{2}}} | \nabla h-z| + R\sup_{B_{\frac{R}{2}}} | \nabla^{2} h| \leq c\Xint-_{B_{R}} \! |\nabla h -z| \, \operatorname{m}athrm{d} x.
$$
\end{lemma}
Finally we state two basic existence and regularity results for inhomogeneous Legendre-Hadamard elliptic systems that are
instrumental for our arguments below.
\begin{proposition}\label{exH}
Let $\operatorname{m}athbb{A}\in \bigodot^{2}( \operatorname{m}athbb{R}^{N \times n} )$ satisfy (\ref{sLH}) and fix exponents $p \in (1,\infty )$ and $q \in [2, \infty )$.
Denote $\operatorname{m}athbb{B} = B_{1}(0)$, the open unit ball in $\operatorname{m}athbb{R}n$.
(a) For each $g \in \operatorname{W}^{1-\tfrac{1}{p},p}(\partial \operatorname{m}athbb{B} ,\operatorname{m}athbb{R}N )$ there exists a unique solution $h \in \operatorname{W}^{1,p}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ to the
elliptic system
\begin{equation}\label{sys1}
\left\{
\begin{array}{ll}
-\operatorname{m}athrm{div } \operatorname{m}athbb{A}\nabla h = 0 & \operatorname{m}box{ in } \operatorname{m}athbb{B}\\
h|_{\partial \operatorname{m}athbb{B}} = g & \operatorname{m}box{ on } \partial \operatorname{m}athbb{B} ,
\end{array}
\right.
\end{equation}
and
$$
\| h \|_{\operatorname{W}^{1,p}} \leq c \| g \|_{\operatorname{W}^{1-\frac{1}{p},p}}
$$
where $c=c(n,N,p,\tfrac{\alpha}{\beta})$.
(b) For each $f \in \operatorname{L}^{q}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ there exists a unique solution $w \in \operatorname{W}^{2,q}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ to the
elliptic system
\begin{equation}\label{sys2}
\left\{
\begin{array}{ll}
-\operatorname{m}athrm{div } \operatorname{m}athbb{A} \nabla w = f & \operatorname{m}box{ in } \operatorname{m}athbb{B}\\
w|_{\partial \operatorname{m}athbb{B}} = 0 & \operatorname{m}box{ on } \partial \operatorname{m}athbb{B} ,
\end{array}
\right.
\end{equation}
and
$$
\| w \|_{\operatorname{W}^{2,q}} \leq c\| f \|_{\operatorname{L}^q},
$$
where $c=c(n,N,q,\tfrac{\alpha}{\beta})$.
\end{proposition}
While these results are well-known we have been unable to find a precise reference. They can
be inferred from more general results stated in \cite{MorreyB}, see in particular Theorems 6.4.8 and 6.5.5 there, and also from
\cite{MaSh}, Lemma 3.2 (taking the remark on page 106 into account). The last reference does not provide details
for the general Legendre-Hadamard elliptic case, but the reader can find the nontrivial calculations and further background
in the book \cite{Mit}.
All the above mentioned proofs rely on boundary layer methods, and the work on these is still ongoing
with many interesting open questions remaining, see for instance \cite{M3M}. However the proof of Proposition \ref{exH}
need not be so sophisticated. An easier route goes via the elegant approach exposed by \textsc{Giusti} in \cite[Chapter 10]{Giusti}. As stated
there it builds on earlier works by \textsc{Stampacchia} \cite{Stamp} and \textsc{Campanato} \cite{Camp}, and derives $\operatorname{L}^p$ estimates from simple $\operatorname{L}^2$
estimates and interpolation. For the convenience of the reader we provide a brief sketch along these lines.
\noindent
\textit{Sketch of Proof.}
(a): By virtue of Gagliardo's trace theorem, as stated in Lemma \ref{gagtrace}, we can find an extension
$\bar{g} \in \operatorname{W}^{1,p}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ with $\bar{g}|_{\partial \operatorname{m}athbb{B}}=g$ and
\begin{equation}\label{gagsub}
\| \bar{g} \|_{\operatorname{W}^{1,p}} \leq c\| g \|_{\operatorname{W}^{1-\frac{1}{p},p}}
\end{equation}
for a constant $c=c(n,N,p)$. If we put $\bar{h}=h-\bar{g}$, then by simple substitution we see that we can shift attention
from (\ref{sys1}) to the system
\begin{equation}\label{sys1sub}
\left\{
\begin{array}{ll}
-\operatorname{m}athrm{div} \operatorname{m}athbb{A}\nabla \bar{h} = -\operatorname{m}athrm{div} V & \operatorname{m}box{ in } \operatorname{m}athbb{B} ,\\
\bar{h}|_{\partial \operatorname{m}athbb{B}}=0 & \operatorname{m}box{ on } \partial \operatorname{m}athbb{B} ,
\end{array}
\right.
\end{equation}
where $V=\operatorname{m}athbb{A}\nabla \bar{g} \in \operatorname{L}^{p}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}^{N \times n} )$. Now for $p \in [2, \infty )$ existence, uniqueness and $\operatorname{L}^p$ estimate all
follow from \cite[Theorem 10.15]{Giusti} and (\ref{gagsub}).
It remains to consider the subquadratic case $p \in (1,2)$.
In this situation we take $V_j \in \operatorname{L}^{2}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}^{N \times n} )$ so $\| V-V_j \|_{\operatorname{L}^p} \to 0$, and let
$\bar{h}_j \in \operatorname{W}^{1,2}_{0}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ be the unique solution to
\begin{equation}\label{sys1sub1}
\left\{
\begin{array}{ll}
-\operatorname{m}athrm{div} \operatorname{m}athbb{A}\nabla \bar{h}_j = -\operatorname{m}athrm{div} V_j & \operatorname{m}box{ in } \operatorname{m}athbb{B} ,\\
\bar{h}_{j}|_{\partial \operatorname{m}athbb{B}}=0 & \operatorname{m}box{ on } \partial \operatorname{m}athbb{B} .
\end{array}
\right.
\end{equation}
Note that $W_j = | \nabla \bar{h}_{j}|^{p-2}\nabla \bar{h}_j \in \operatorname{L}^{p^{\prime}}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}^{N \times n} )$, where $p^{\prime} \in (2,\infty )$ is the H\"{o}lder
conjugate exponent of $p$. Consequently, we infer from the above concluded superquadratic case that the elliptic system
\begin{equation}\label{sys1sub2}
\left\{
\begin{array}{ll}
-\operatorname{m}athrm{div} \operatorname{m}athbb{A}\nabla \varphi_j = -\operatorname{m}athrm{div} W_j & \operatorname{m}box{ in } \operatorname{m}athbb{B} ,\\
\varphi_{j}|_{\partial \operatorname{m}athbb{B}}=0 & \operatorname{m}box{ on } \partial \operatorname{m}athbb{B}
\end{array}
\right.
\end{equation}
admits a unique solution $\varphi_j \in \operatorname{W}^{1,p^{\prime}}_{0}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ with
\begin{equation}\label{estfi}
\| \varphi_j \|_{\operatorname{W}^{1,p^{\prime}}} \leq c \| W_j \|_{\operatorname{L}^{p^{\prime}}} = c \| \nabla \bar{h}_{j} \|_{\operatorname{L}^p}^{p-1}
\end{equation}
where $c=c(n,N,p^{\prime},\tfrac{\alpha}{\beta})$. If we test (\ref{sys1sub1}) with $\varphi_j$ and use that $\operatorname{m}athbb{A}$ is symmetric, then
$\| \nabla \bar{h}_j \|_{\operatorname{L}^p} \leq c \| V_j \|_{\operatorname{L}^p}$ results. Now Poincar\'{e}'s inequality and (\ref{gagsub}) easily allow us to conclude
that there exists a solution to (\ref{sys1}) satisfying the $\operatorname{L}^p$ estimate. It remains to prove uniqueness in the subquadratic case. To that
end we assume $h \in \operatorname{W}^{1,p}_{0}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ satisfies $-\operatorname{m}athrm{div} \operatorname{m}athbb{A}\nabla h = 0$ in $\operatorname{m}athbb{B}$. From Lemma \ref{Weyl} we know that
$h \in \operatorname{C}^{\infty}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ and so if we for $r \in (0,1)$ define $h_{r}(x)=h(rx)$, then clearly
$h_{r}|_{\partial \operatorname{m}athbb{B}} \in \operatorname{W}^{\frac{1}{2},2}( \partial \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ and $-\operatorname{m}athrm{div} \operatorname{m}athbb{A}\nabla h_{r}=0$ in $\operatorname{m}athbb{B}$. By uniqueness of $\operatorname{W}^{1,2}$
solutions it follows from the above that $\| h_{r} \|_{\operatorname{W}^{1,p}} \leq c\| h_{r}|_{\partial \operatorname{m}athbb{B}} \|_{\operatorname{W}^{1-\frac{1}{p},p}}$. But clearly $h_r \to h$ in
$\operatorname{W}^{1,p}( \operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ as $r \nearrow 1$, so $\| h_{r}|_{\partial \operatorname{m}athbb{B}} \|_{\operatorname{W}^{1-\frac{1}{p},p}} \to 0$ as $r \nearrow 1$ by the continuity of trace,
and thus $h=0$.
(b): Since $q \in [2, \infty )$ the assertion follows directly from \cite{Giusti}, see (10.60)--(10.63)
on pp.~369--370.
$\square$
\subsection{Quasiconvexity}
We start by displaying \textsc{Morrey}'s definition of quasiconvexity \cite{Morrey,MorreyB}:
\begin{definition}\label{defqc}
A continuous integrand $G \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ is quasiconvex at $z_{0} \in \operatorname{m}athbb{R}^{N \times n}$ provided
$$
G(z_{0})\leq \int_{(0,1)^{n}} \! G(z_{0}+\nabla \varphi (x))\, \operatorname{m}athrm{d} x
$$
holds for all compactly supported Lipschitz maps $\varphi \colon (0,1)^{n} \to \operatorname{m}athbb{R}N$. It is quasiconvex if it is quasiconvex at all $z_{0} \in \operatorname{m}athbb{R}^{N \times n}$.
\end{definition}
It is well-known (see \cite{Dacorogna,MorreyB}) that quasiconvexity implies rank-one convexity, and that rank-one convexity and
linear growth, say $|G(z)| \leq L(|z|+1)$ for all $z \in \operatorname{m}athbb{R}^{N \times n}$, yield a Lipschitz bound that for $\operatorname{C}^1$ integrands takes the form
\begin{equation}\label{lip}
|G^{\prime}(z)| \leq cL \quad \forall \, z \in \operatorname{m}athbb{R}^{N \times n} .
\end{equation}
The proof in \cite{BKK} gives (\ref{lip}) with the constant $c=\sqrt{\operatorname{m}in \{ n,N \}}$.
When a quasiconvex integrand $G$ has linear growth it means that the quasiconvexity inequality can be tested by more general maps.
We have from \cite[Proposition 1]{KR1}:
\begin{lemma}\label{1qc}
Assume $G \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ is quasiconvex and of linear growth. If $\omega$ is a bounded Lipschitz domain in $\operatorname{m}athbb{R}n$,
$\varphi \in \operatorname{BV} ( \omega , \operatorname{m}athbb{R}N )$ and $a \colon \operatorname{m}athbb{R}n \to \operatorname{m}athbb{R}N$ is affine, then
$$
\operatorname{m}athscr{L}^{n} (\omega ) G( \nabla a) \leq \int_{\omega} \! G(D\varphi ) + \int_{\partial \omega} \! G^{\infty}
\bigl( (a-u) \otimes \nu_{\omega} \bigr) \, \operatorname{m}athrm{d} \operatorname{m}athscr{H}^{n-1}
$$
holds, where $\nu_{\omega}$ is the outward unit normal on $\partial \omega$.
\end{lemma}
As explained in the Introduction our quasiconvexity assumption $\operatorname{m}athrm{(H2)}$, that we shall refer to as
\emph{strong quasiconvexity}, is very natural when compared to the minimal set of conditions that allows one to prove
existence of a $\operatorname{BV}$ minimizer by use of the direct method.
We emphasize that quasiconvexity is much more general than convexity and refer to \cite{Dacorogna} for a long list
of examples of nonconvex quasiconvex integrands. That there exists nonconvex quasiconvex integrands of linear growth
is also well-known (see \cite{Mu,KZ}). Here we shall briefly illustrate the abundance of nonconvex integrands $F$
satisfying the hypotheses $\operatorname{m}athrm{(H0)}$, $\operatorname{m}athrm{(H1)}$, $\operatorname{m}athrm{(H2)}$. In fact many of these integrands are
nonconvex in the sense that also the functional
$$
v \operatorname{m}apsto \int_{\Omega} \! F( \nabla v) \, \operatorname{m}athrm{d} x
$$
is nonconvex on the Dirichlet class $\operatorname{W}^{1,1}_{g}$.
\begin{proposition}\label{noncvx}
Let $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ be quasiconvex and assume that for some exponent $p \in (1,\infty )$ and constant $L \geq 1$
we have the $p$-coercivity-growth condition:
$$
|z|^{p} \leq F(z) \leq L\bigl( |z|^{p}+1 \bigr) \quad \forall \, z \in \operatorname{m}athbb{R}^{N \times n} .
$$
Then there exists a sequence $(F_j )$ of integrands $F_{j} \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ satisfying for
some constants $\ell_j$, $L_j > 0$,
$$
\begin{array}{ll}
(0) \hspace{1cm} & F_{j}\;\text{ is } \operatorname{C}^{\infty}\\
{} & {}\\
(1) \hspace{1cm} & |z|-1 \leq F_{j}(z) \leq L_{j}(|z| + 1) \quad \forall \, z \in \operatorname{m}athbb{R}^{N \times n}\\
{} & {}\\
(2) \hspace{1cm} & z \operatorname{m}apsto F(z)-\ell_{j} E(z)
\text{ is quasiconvex,}
\end{array}
$$
such that $F_{j}(z) \nearrow F(z)$ as $j \nearrow \infty$ pointwise in $z \in \operatorname{m}athbb{R}^{N \times n}$.
\end{proposition}
The proof is an easy adaptation of \cite[Proposition 1.10]{JK}. Observe that nonconvexity of $F$ or the
corresponding functional must be inherited by elements of the approximating sequence $F_j$ for sufficiently
large values of $j$. We could therefore for instance apply Proposition \ref{noncvx} to the integrands constructed
in \cite{MuSv} to get the required examples. In fact, in view of the flexibility of the constructions in \cite{MuSv} we
could also arrange it so that the Euler-Lagrange system $-\operatorname{m}athrm{div}F^{\prime}_{j}( \nabla v) =0$ admits, say compactly
supported Lipschitz maps that are nowhere $\operatorname{C}^1$ as weak solutions. It is thus clear that all kinds of behaviour of
quasiconvex integrands of $p$-growth that play out in bounded sets of matrix space can be reproduced by integrands
satisfying the hypotheses $\operatorname{m}athrm{(H0)}$, $\operatorname{m}athrm{(H1)}$, $\operatorname{m}athrm{(H2)}$. In particular, in view of the nonconvex
nature of the variational problems it becomes relevant to investigate the regularity of various classes of local
minimizers as done in the $p$-growth case in \cite{KT,CaNa,Sz}. We leave this for future investigations and focus in the
present paper entirely on absolute minimizers in the sense of (\ref{intro5}).
\subsection{Extremality of minimizers}
The following result is closely related to \cite[Theorem 3.7]{Anz}, but it concerns more general
integrands that are not covered there.
\begin{lemma}\label{extremal}
Assume that $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ is $\operatorname{C}^1$, rank-one convex and that $|F(z)| \leq L(|z|+1)$ holds for all $z \in \operatorname{m}athbb{R}^{N \times n}$.
Then for any local minimizer $u \in \operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$ of the variational integral
$\operatorname{m}athfrak{F}(v, \Omega ) = \int_{\Omega} \! F(Dv)$ we have that $F^{\prime}(\nabla u) \in \operatorname{L}^{\infty}( \Omega , \operatorname{m}athbb{R}^{N \times n} )$
and
\begin{equation}\label{extrem}
-\int_{\Omega} \! F^{\infty}(D^{s}\varphi ) \leq \int_{\Omega} \! F^{\prime}(\nabla u)[ \nabla \varphi ] \, \operatorname{m}athrm{d} x \leq
\int_{\Omega} \! F^{\infty}(-D^{s}\varphi )
\end{equation}
holds for all $\varphi \in \operatorname{BV}_{0}( \Omega , \operatorname{m}athbb{R}N )$. In particular, $F^{\prime}( \nabla u)$ is row-wise divergence free.
\end{lemma}
\begin{proof}
First we recall that linear growth and rank-one convexity combine to give Lipschitz continuity
(\ref{lip}), hence the matrix valued map $F^{\prime}( \nabla u)$ is bounded. Next, for $\varphi \in \operatorname{BV} ( \Omega ,\operatorname{m}athbb{R}N )$
with compact support in $\Omega$ and each $\varepsilon \geq 0$ we put $\operatorname{m}u := |D^{s}(u+\varepsilon \varphi )|+|D^{s}u|+|D^{s}\varphi |$.
Then we may write
$$
F^{\infty} \bigl( D^{s}(u+\varepsilon \varphi ) \bigr) - F^{\infty} \bigl( D^{s}u \bigr) = \biggl( F^{\infty} \left(
\frac{\operatorname{m}athrm{d} D^{s}u}{\operatorname{m}athrm{d} \operatorname{m}u} + \varepsilon \frac{\operatorname{m}athrm{d} D^{s}\varphi}{\operatorname{m}athrm{d} \operatorname{m}u} \right) - F^{\infty} \left( \frac{\operatorname{m}athrm{d} D^{s}u}{\operatorname{m}athrm{d} \operatorname{m}u} \right)
\biggr) \operatorname{m}u .
$$
Here we have according to \cite{Alberti} that
$$
\operatorname{m}athrm{rank} \biggl( \frac{\operatorname{m}athrm{d} D^{s}\varphi}{\operatorname{m}athrm{d} \operatorname{m}u} \biggr) \leq 1 \quad \operatorname{m}u \operatorname{m}box{--a.e.}
$$
and thus from \cite[Lemma 2.5]{KK} and the assumptions on $F$ we infer that
$$
F^{\infty}\bigl( D^{s}(u+\varepsilon \varphi) \bigr) - F^{\infty} \bigl( D^{s}u \bigr) \leq \varepsilon F^{\infty} \bigl( D^{s}\varphi \bigr).
$$
Consequently, by local minimality:
\begin{eqnarray*}
0 &\leq& \int_{\Omega} \! F \bigl( (D(u+\varepsilon\varphi) \bigr) - \int_{\Omega} \! F \bigl( Du \bigr)\\
&\leq& \int_{\Omega} \! \int_{0}^{1} \! F^{\prime} (\nabla u +t\varepsilon \nabla \varphi )[\varepsilon \nabla \varphi ] \, \operatorname{m}athrm{d} t \, \operatorname{m}athrm{d} x
+\varepsilon \int_{\Omega} \! F^{\infty} \bigl( D^{s}\varphi \bigr) ,
\end{eqnarray*}
and hence, invoking the Lipschitz bound and Lebesgue's dominated convergence theorem, we arrive at
$$
0 \leq \int_{\Omega} \! F^{\prime}(\nabla u)[ \nabla \varphi ] \, \operatorname{m}athrm{d} x +\int_{\Omega} \! F^{\infty} \bigl( D^{s}\varphi \bigr) .
$$
Finally, we extend the above inequality by continuity to hold for all $\varphi \in \operatorname{BV}_{0}( \Omega , \operatorname{m}athbb{R}N )$.
\end{proof}
\section{Boundedness of minimizing sequences and strong quasiconvexity}\label{minseq}
\begin{proposition}\label{sharpening}
Assume $F\colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ is a continuous integrand of linear growth, let $\Omega \subset \operatorname{m}athbb{R}n$ be a bounded Lipschitz domain and
$g \in \operatorname{W}^{1,1}( \Omega , \operatorname{m}athbb{R}N )$. Then minimizing sequences for the variational problem
\begin{equation}\label{vp1}
\inf_{u \in \operatorname{W}^{1,1}_{g}( \Omega , \operatorname{m}athbb{R}N )} \int_{\Omega} \! F(\nabla u ) \, \operatorname{m}athrm{d} x
\end{equation}
are all bounded in $\operatorname{W}^{1,1}$ if and only if there exist $\ell > 0$ and $z_{0} \in \operatorname{m}athbb{R}^{N \times n}$ such that $F-\ell E$ is quasiconvex at $z_0$.
\end{proposition}
\begin{proof}
The \emph{if} part follows from \cite[Theorem 1.1]{CK} and to prove the \emph{only if} part we must adapt the proofs from \cite{CK}.
We proceed in three steps.
\noindent
\emph{Step 1.} Let $X$ be a simplex in $\operatorname{m}athbb{R}n$ and $z_{0} \in \operatorname{m}athbb{R}^{N \times n}$. We show that if all minimizing sequences for the variational problem
(\ref{vp1}) in the special case $\Omega =X$ and $g(x) = z_{0}x$ are $\operatorname{W}^{1,1}$ bounded, then we can find constants $\alpha > 0$, $\beta \in \operatorname{m}athbb{R}$
depending only on $F$, $X$, $z_0$, so
\begin{equation}\label{meancoercive}
\int_{X} \! F( z_{0}+\nabla \varphi ) \, \operatorname{m}athrm{d} x \geq \int_{X} \! \biggl( \alpha | \nabla \varphi | + \beta \biggr) \, \operatorname{m}athrm{d} x
\end{equation}
holds for all $\varphi \in \operatorname{W}^{1,1}_{0}(X , \operatorname{m}athbb{R}N )$. We express this by saying that $F$ is mean coercive, and recall from
\cite[Theorem 1.1]{CK} that this is a property of $F$ (so that we have a bound like (\ref{meancoercive}) for any bounded Lipschitz
domain $\Omega$ and any $g \in \operatorname{W}^{1,1}( \Omega , \operatorname{m}athbb{R}N )$ with $\alpha$, $\beta$ now depending on $F$, $\Omega$, $g$).
Following \cite{CK} we consider the auxiliary function
$$
\Theta (t) = \inf \left\{ \Xint-_{X} \! F(z_{0}+\nabla \varphi ) \, \operatorname{m}athrm{d} x : \, \varphi \in \operatorname{W}^{1,1}_{0}(X, \operatorname{m}athbb{R}N ), \,
\Xint-_{X} \! | \nabla \varphi | \, \operatorname{m}athrm{d} x \geq t \right\} \quad (t \geq 0)
$$
Because $F$ has linear growth the $\operatorname{W}^{1,1}$ boundedness of minimizing sequences clearly implies that $\Theta$ is a real-valued
non-decreasing function. According to \cite[Proposition 3.2]{CK} it is also convex. Consequently, if $\Theta$ is bounded from above, then it must
be constant: $\Theta (t) \equiv \theta$ for all $t \geq 0$, where $\theta \in \operatorname{m}athbb{R}$. But this is impossible as it leads to the
existence of minimizing sequences for (\ref{vp1}) that are not bounded in $\operatorname{W}^{1,1}$. Hence $\Theta$ is not bounded from above, and so by convexity
we conclude that for some constants $\alpha > 0$, $\beta \in \operatorname{m}athbb{R}$ we must have $\Theta (t) \geq \alpha t + \beta$ for all $t \geq 0$.
Unravelling the definitions we have shown that (\ref{meancoercive}) holds.
\noindent
\emph{Step 2.} We show that if all minimizing sequences for (\ref{vp1}) are $\operatorname{W}^{1,1}$ bounded, then $F$ is mean coercive.
For this it is easiest to argue by contradiction: Assume that all minimizing sequences for (\ref{vp1}) are $\operatorname{W}^{1,1}$ bounded, but
that $F$ is not mean coercive. The former, taken together with the linear growth of $F$, means in particular that
$$
m := \inf_{u \in \operatorname{W}^{1,1}_{g}( \Omega , \operatorname{m}athbb{R}N )} \int_{\Omega} \! F(\nabla u ) \, \operatorname{m}athrm{d} x \in \operatorname{m}athbb{R} .
$$
The latter allows us by Step 1 to conclude that for any simplex $X \subset \operatorname{m}athbb{R}n$ and any
$z_{0} \in \operatorname{m}athbb{R}^{N \times n}$, the variational problem (\ref{vp1}) with $\Omega =X$ and $g(x) = z_{0}x$ admits a minimizing sequence that is
unbounded in $\operatorname{W}^{1,1}$. Fix a polygonal open subset $\Omega^{\prime} \Subset \Omega$ and note that since $F$ is continuous and of
linear growth, the functional $v \operatorname{m}apsto \int_{\Omega} \! F(\nabla v) \, \operatorname{m}athrm{d} x$ is continuous on $\operatorname{W}^{1,1}( \Omega , \operatorname{m}athbb{R}N )$.
By density of piecewise affine maps in $\operatorname{W}^{1,1}$ we can therefore find a minimizing sequence $( u_j )$ for (\ref{vp1}) such
that each restriction $u_{j}|_{\Omega^{\prime}}$ is piecewise affine. Let $\tau_j$ be the regular and finite triangulation of $\Omega^{\prime}$
so that $u_{j}$ is affine on each simplex of $\tau_j$. We apply the existence of $\operatorname{W}^{1,1}$ unbounded minimizing sequences for (\ref{vp1})
for each $\Omega = X \in \tau_{j}$, $z_{0} = \nabla u_{j}|_{X}$ to find $\varphi_{j,X} \in \operatorname{W}^{1,1}_{0}(X, \operatorname{m}athbb{R}N )$ so
$$
j\operatorname{m}athscr{L}^{n} (X) < \int_{X} \! | \nabla \varphi_{j,X}| \, \operatorname{m}athrm{d} x \operatorname{m}box{ and } \int_{X} \! F(\nabla u_{j}+\nabla \varphi_{j,X}) \, \operatorname{m}athrm{d} x \leq
\int_{X} \bigg( F(\nabla u_{j}) + \frac{1}{j} \biggr) \, \operatorname{m}athrm{d} x.
$$
Defining $v_{j} := u_{j}+\sum_{X \in \tau_{j}} \varphi_{j,X}$, where we extend each $\varphi_{j,X}$ by $0 \in \operatorname{m}athbb{R}N$ off $X$, we have a
$\operatorname{W}^{1,1}$ unbounded minimizing sequence for (\ref{vp1}), a contradiction that finishes the proof of Step 2.
\noindent
\emph{Step 3.} Conclusion from (\ref{meancoercive}). We may assume that $\operatorname{m}athscr{L}^{n} (X)=1$.
Now $E(z) \leq |z|$ for $z \in \operatorname{m}athbb{R}^{N \times n}$, so if we take $\ell \in (0,\alpha )$, put $c=\alpha -\ell$
and $G=F-\ell E$, then (\ref{meancoercive}) yields
\begin{equation}\label{coer1}
\int_{X} \! G(\nabla \varphi ) \, \operatorname{m}athrm{d} x \geq c\int_{X} \! | \nabla \varphi | \, \operatorname{m}athrm{d} x + \beta
\end{equation}
for all $\varphi \in \operatorname{W}^{1,1}_{0}(X,\operatorname{m}athbb{R}N )$. Recalling the Dacorogna formula for the quasiconvex envelope (see \cite{Dacorogna}
and the discussion in \cite{CK}) we take a sequence $( \varphi_j )$ in $\operatorname{W}^{1,1}_{0}(X, \operatorname{m}athbb{R}N )$ so
$$
\int_{X} \! G(\nabla \varphi_j ) \, \operatorname{m}athrm{d} x \to G^{\operatorname{m}athrm{qc}}(0),
$$
the quasiconvex envelope of $G$ at $0$. Obviously, $G^{\operatorname{m}athrm{qc}}(0) \geq \beta$, so $G^{\operatorname{m}athrm{qc}}$ is a real-valued quasiconvex integrand
satisfying $G^{\operatorname{m}athrm{qc}} \leq G$. Because $G$ has linear growth, so does $G^{\operatorname{m}athrm{qc}}$ (see \cite{CK}). The probability measures
$\nu_j$ on $\operatorname{m}athbb{R}^{N \times n}$ defined for Borel sets $A \subset \operatorname{m}athbb{R}^{N \times n}$ by
$$
\nu_j (A) := \operatorname{m}athscr{L}^{n} \biggl( X \cap (\nabla \varphi_{j})^{-1}(A) \biggr)
$$
all have centre of mass at $0$ and uniformly bounded first moments:
$$
c\int_{\operatorname{m}athbb{R}^{N \times n}} \! |z| \, \operatorname{m}athrm{d} \nu_k + \beta \leq \sup_{j} \int_{X} \! G( \nabla \varphi_{j}) \, \operatorname{m}athrm{d} x < \infty
$$
for $k \in \operatorname{m}athbb{N}$. But then Banach-Alaoglu's theorem applied in $\operatorname{C}_{0}( \operatorname{m}athbb{R}^{N \times n} )^{\ast}$ yields a subsequence (not relabelled) and
$\nu \in \operatorname{C}_{0}( \operatorname{m}athbb{R}^{N \times n} )^{\ast}$ such that $\nu_{j} \wstar \nu$ in $\operatorname{C}_{0}( \operatorname{m}athbb{R}^{N \times n} )^{\ast}$. It is not hard to see that $\nu$ must again
be a probability measure on $\operatorname{m}athbb{R}^{N \times n}$, and
$$
\int_{\operatorname{m}athbb{R}^{N \times n}} \! |z| \, \operatorname{m}athrm{d} \nu \leq \liminf_{j \to \infty} \int_{\operatorname{m}athbb{R}^{N \times n}} \! |z| \, \operatorname{m}athrm{d} \nu_j < \infty .
$$
Since $G-G^{\operatorname{m}athrm{qc}} \geq 0$ is continuous we get by routine means that
$$
0\leq \int_{\operatorname{m}athbb{R}^{N \times n}} \! \biggl( G-G^{\operatorname{m}athrm{qc}} \biggr) \, \operatorname{m}athrm{d} \nu \leq \liminf_{j \to \infty}
\int_{\operatorname{m}athbb{R}^{N \times n}} \! \biggl( G-G^{\operatorname{m}athrm{qc}} \biggr) \, \operatorname{m}athrm{d} \nu_{j}=0,
$$
and thus $G=G^{\operatorname{m}athrm{qc}}$ on the support of $\nu$. This completes the proof.
\end{proof}
\begin{remark}\label{cvgenergy}
It is not difficult to show that under assumptions $\operatorname{m}athrm{(H1)}$, $\operatorname{m}athrm{(H2)}$ we have a \emph{principle of convergence of energies}
in the sense that if $u_{j} \wstar u$ in $\operatorname{BV}$, $u_{j}|_{\partial \Omega} \to u|_{\partial \Omega}$ in $\operatorname{L}^{1}(\partial \Omega , \operatorname{m}athbb{R}N )$ and
$$
\int_{\Omega} \! F(Du_{j}) \to \int_{\Omega} \! F(Du),
$$
then $u_j \to u$ in the area-strict sense in $\operatorname{BV}$. We do not give the details here and intend to return to this in a more general framework
elsewhere.
\end{remark}
\section{Proof of Theorem \ref{thm:main}}\label{sec:main}
We split the proof into five steps, each of which is presented in a subsection.
\subsection{Bounds for shifted integrands}
For a $\operatorname{C}^2$ integrand $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ we define for each $w \in \operatorname{m}athbb{R}^{N \times n}$ the shifted integrand $F_{w} \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ by
\begin{eqnarray}\label{shifted}
F_{w}(z) &=& F(z+w)-F(w)-F^{\prime}(w)[z]\nonumber\\
&=& \int_{0}^{1} \! (1-t)F^{\prime \prime}(w+tz)[z,z] \, \operatorname{m}athrm{d} t
\end{eqnarray}
We use the same notation for shifted versions $E_w$ of the reference integrand $E$, and record the
following elementary result for later reference.
\begin{lemma}\label{elemE}
For $w$, $z \in \operatorname{m}athbb{R}^{N \times n}$ we have (with obvious interpretation for $w = 0$ or $z=0$)
\begin{equation}\label{elemE1}
E^{\prime \prime}(w)[z,z] = \frac{1+|w|^{2}-|w|^{2}\left( \tfrac{w}{|w|} \cdot \tfrac{z}{|z|} \right)^{2}}{\bigl( 1+|w|^{2} \bigr)^{\frac{3}{2}}}|z|^{2}
\end{equation}
and
\begin{equation}\label{elemE2}
E_{w}(z) \geq 2^{-4}\bigl( 1+|w|^{2} \bigr)^{-\frac{3}{2}}E(z).
\end{equation}
\end{lemma}
The proof of this result is straightforward and is omitted here.
Next, we record the following elementary properties that $F_w$ inherits from $F$:
\begin{lemma}\label{propshift}
Suppose $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ satisfies $\operatorname{m}athrm{(H0)}$, $\operatorname{m}athrm{(H1)}$, $\operatorname{m}athrm{(H2)}$.
For each $m>0$ there exists a constant $c=c(m) \in [1,\infty )$ with the following properties.
Fix $w \in \operatorname{m}athbb{R}^{N \times n}$ with $|w| \leq m$. Then
\begin{equation}\label{sbound1}
|F_{w}(z)| \leq cLE(z) , \quad \quad |F^{\prime}_{w}(z)| \leq cL \operatorname{m}in \{ |z| ,1 \} ,
\end{equation}
\begin{equation}\label{sbound2}
|F^{\prime \prime}_{w}(0)z-F^{\prime}_{w}(z)| \leq cLE(z)
\end{equation}
holds for all $z \in \operatorname{m}athbb{R}^{N \times n}$,
\begin{equation}\label{sqc}
\int_{B} \! F_{w}(\nabla \varphi (x)) \, \operatorname{m}athrm{d} x \geq \tfrac{\ell}{c}\int_{B} \! E( \nabla \varphi (x)) \, \operatorname{m}athrm{d} x
\end{equation}
holds for all $\varphi \in \operatorname{W}^{1,1}_{0}(B, \operatorname{m}athbb{R}N )$ and
\begin{equation}\label{src}
F^{\prime \prime}(w)[y \otimes x, y \otimes x] \geq \tfrac{\ell}{c}|y|^{2}|x|^{2}
\end{equation}
holds for all $x \in \operatorname{m}athbb{R}n$, $y \in \operatorname{m}athbb{R}N$.
\end{lemma}
\begin{proof}
For the bounds (\ref{sbound1}) and (\ref{sbound2}) we distinguish the cases $|z| \leq 1$ and $|z| > 1$.
The bounds in (\ref{sbound1}) follow then easily from the definition of $F_w$ and (\ref{lip}).
We leave the details of this to the reader, and instead focus on (\ref{sbound2}). Here we have for $|z| \leq 1$ that
\begin{eqnarray*}
|F^{\prime \prime}_{w}(0)z-F^{\prime}_{w}(z)| &\leq& \int_{0}^{1} \! \bigl|
F^{\prime \prime}(w)-F^{\prime \prime}(w+tz) \bigr| \, \operatorname{m}athrm{d} t |z|\\
&\leq& \operatorname{lip} (F^{\prime \prime},B_{m+1}(0))|z|^{2}
\end{eqnarray*}
and the latter is finite for each fixed $m$ by hypothesis (H0). Next, for $|z| > 1$ we use (\ref{lip}) to estimate:
\begin{eqnarray*}
|F^{\prime \prime}_{w}(0)z-F^{\prime}_{w}(z)| &\leq& |F^{\prime \prime}(w)||z|+cL\\
&\leq& \bigl( \sup_{|v| \leq m}|F^{\prime \prime}(v)| +cL \bigr)|z| ,
\end{eqnarray*}
and so we deduce (\ref{sbound2}) from (\ref{minb}). Finally we turn to the quasiconvexity condition (\ref{sqc}). From
(H2) we get
$$
\int_{B} \! F_{w}(\nabla \varphi ) \, \operatorname{m}athrm{d} x \geq \ell \int_{B} \! E_{w}(\nabla \varphi ) \, \operatorname{m}athrm{d} x
$$
and so from (\ref{elemE2}) we get (\ref{sqc}) with $c=2^{4}(1+m^{2})^{\frac{3}{2}}$. Finally, since quasiconvexity implies
rank one convexity, (H2) yields in particular that
\begin{eqnarray*}
F^{\prime \prime}(w)[y \otimes x, y \otimes x] &\geq& \ell E^{\prime \prime}(w)[y \otimes x, y \otimes x]\\
&\stackrel{(\ref{elemE1})}{\geq}& \frac{\ell}{(1+m^{2})^{\frac{3}{2}}}|y|^{2}|x|^{2} ,
\end{eqnarray*}
which of course implies (\ref{src}).
\end{proof}
\subsection{Caccioppoli inequality of the second kind}\label{caccioppoli2}
This is an important part of the proof, and in fact it is the only place where both the quasiconvexity and minimality
assumptions are used. However, the proof in the considered linear growth case does not differ much from the usual ones
as it follows that given by Evans in \cite{Evans} and relies crucially on Widman's hole filling trick \cite{Widman}.
\begin{proposition}\label{caccioppoli}
Suppose $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ satisfies $\operatorname{m}athrm{(H0)}$, $\operatorname{m}athrm{(H1)}$, $\operatorname{m}athrm{(H2)}$ and that $u \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$
is a minimizer. Then each $m>0$ there exists a constant $c=c(m,n,N,\tfrac{L}{\ell}) \in [1,\infty )$ with the following property.
Let $a \colon \operatorname{m}athbb{R}n \to \operatorname{m}athbb{R}N$ be an affine mapping with $| \nabla a| \leq m$ and $B_{R}(x_{0}) \subset \Omega$.
Then we have
\begin{equation}\label{caccio}
\int_{B_{\frac{R}{2}}(x_{0})} \! E(D(u-a)) \leq c\int_{B_{R}(x_{0})} \! E \left( \frac{u-a}{R} \right) \, \operatorname{m}athrm{d} x.
\end{equation}
\end{proposition}
\begin{proof}
Denote $\tilde{F} = F_{\nabla a}$ and $\tilde{u} = u-a$. Observe that $\tilde{u}$ is minimizing the integral functional
corresponding to the shifted integrand $\tilde{F}$. Fix two radii $\tfrac{R}{2} < r < s < R$, and let $\rho \colon \Omega \to \operatorname{m}athbb{R}$
be a Lipschitz cut-off function satisfying $\operatorname{m}athbf{1}_{B_{r}} \leq \rho \leq \operatorname{m}athbf{1}_{B_{s}}$ and
$| \nabla \rho | \leq \frac{1}{s-r}$. Put $\varphi = \rho \tilde{u}$ and $\psi = (1-\rho )\tilde{u}$. For a standard smooth mollifier
$( \phi_{\varepsilon})$ we let $\varphi_{\varepsilon} = \rho (\phi_{\varepsilon} \ast \tilde{u} )$, so that
$\varphi_{\varepsilon} \in \operatorname{W}^{1,1}_{0}(B_{s},\operatorname{m}athbb{R}N )$. Hence by the consequence (\ref{sqc}) of the quasiconvexity assumption (H2) we get
$$
\frac{\ell}{c}\int_{B_{s}} \! E(\nabla \varphi_{\varepsilon}) \, \operatorname{m}athrm{d} x \leq
\int_{B_{s}} \! \tilde{F} (\nabla \varphi_{\varepsilon}) \, \operatorname{m}athrm{d} x .
$$
Observe that as $\varepsilon \searrow 0$, $\varphi_{\varepsilon} \to \varphi$ in $\operatorname{L}^{1}$ and (since $\rho = 0$ on $\partial B_s$) that
$$
\int_{B_{s}} \! E(\nabla \varphi_{\varepsilon}) \, \operatorname{m}athrm{d} x \to \int_{B_{s}} \! E(D\varphi ).
$$
We can therefore employ Lemma \ref{Econt} to find, by taking $\varepsilon \searrow 0$ in the above inequality,
$$
\frac{\ell}{c}\int_{B_{s}} \! E(D\varphi ) \leq \int_{B_{s}} \! \tilde{F} (D\varphi ).
$$
Consequently, we have using minimality of $\tilde{u}$, (\ref{sbound1}), convexity of $E$ and (\ref{minb}):
\begin{eqnarray*}
\frac{\ell}{c}\int_{B_{r}} \! E(D\tilde{u} ) &\leq& \int_{B_{s}} \! \tilde{F} (D\tilde{u} ) + \int_{B_{s}} \! \tilde{F} (D\varphi ) - \int_{B_{s}} \! \tilde{F} (D\tilde{u} )\\
&\leq& \int_{B_{s}} \! \tilde{F} (D\psi ) + \int_{B_{s}} \! \tilde{F} (D\varphi ) - \int_{B_{s}} \! \tilde{F} (D\tilde{u} )\\
&\leq& cL\int_{B_{s}\setminus B_{r}} \! E(D\tilde{u} ) + cL\int_{B_{s}\setminus B_{r}} \! E(\rho D\tilde{u} + \tilde{u} \otimes \nabla \rho )\\
&& +cL\int_{B_{s}\setminus B_{r}} \! E((1-\rho )D\tilde{u} - \tilde{u} \otimes \nabla \rho )\\
&\leq& 5cL\int_{B_{s}\setminus B_{r}} \! E(D\tilde{u} ) +4cL\int_{B_s} \! E \left( \frac{\tilde{u}}{s-r} \right) \, \operatorname{m}athrm{d} x.
\end{eqnarray*}
We fill the hole whereby on denoting $\theta = 5cL/(5cL + \tfrac{\ell}{c}) \in (0,1)$ we arrive at
\begin{eqnarray*}
\int_{B_r} \! E(D \tilde{u} ) &\leq& \theta \int_{B_s} \! E(D \tilde{u} ) + \theta
\int_{B_s} \! E\left( \frac{\tilde{u}}{s-r} \right) \, \operatorname{m}athrm{d} x\\
&\leq& \theta \int_{B_s} \! E(D \tilde{u} ) + \theta
\int_{B_R} \! E\left( \frac{\tilde{u}}{s-r} \right) \, \operatorname{m}athrm{d} x.
\end{eqnarray*}
The conclusion now follows in a standard way from the iteration Lemma \ref{iterate} below.
\end{proof}
\begin{lemma}\label{iterate}
Let $\theta \in (0,1)$, $A \geq 1$ and $R>0$. Assume that $\Phi$, $\Psi \colon (0,R] \to \operatorname{m}athbb{R}$ are
nonnegative functions, that $\Phi$ is bounded, $\Psi$ is decreasing with $\Psi (\tfrac{t}{2}) \leq A\Psi (t)$ for
all $t \in (0,R]$ and that
\begin{equation}\label{ineqiterate}
\Phi (r) \leq \theta \Phi (s) + \Psi (s-r)
\end{equation}
holds for all $r$, $s \in [\tfrac{R}{2},R]$ with $r<s$. Then there exists a constant $C=C(\theta , A) >0$
such that
\begin{equation}\label{iterated}
\Phi \left( \tfrac{R}{2} \right) \leq C\Psi (R).
\end{equation}
\end{lemma}
The proof follows closely that of, for instance, \cite[Lemma 6.1]{Giusti} and so we leave the details to the reader.
\noindent
As mentioned in the Introduction it is not possible to use the Poincar\'{e}-Sobolev inequality to get a reverse H\"{o}lder
inequality from which higher integrability can be deduce by use of Gehring's Lemma. However, the Caccioppoli inequality
(\ref{caccio}) still encodes some compactness as can be seen from the following remark that is stated in terms of
Young measures and where we use the terminology from \cite{KR2}. The reader can get a good overview of this general
formalism and other developments in the calculus of variations context in the recent monograph \cite{FR}.
\begin{remark}\label{caccpt}
Let $(u_j )$ be a sequence in $\operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$ satisfying the Caccioppoli inequality (\ref{caccio}) above uniformly:
for each $m > 0$ there exists a constant $c_m$ (independent of $j$) such that for any affine map $a \colon \operatorname{m}athbb{R}n \to \operatorname{m}athbb{R}N$
with $| \nabla a| \leq m$ and any ball $B_{R}=B_{R}(x_0 ) \subset \Omega$ we have
\begin{equation}\label{caccj}
\int_{B_{\frac{R}{2}}(x_{0})} \! E(D(u_{j}-a)) \leq c_m \int_{B_{R}(x_{0})} \! E \left( \frac{u_{j}-a}{R} \right) \, \operatorname{m}athrm{d} x.
\end{equation}
If $(u_j )$ is bounded in $\operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$, then (any subsequence) admits a subsequence (not relabelled) that
converges weakly$\operatorname{m}box{}^\ast$ in $\operatorname{BV}$ to a map $u \in \operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$ and whose derivatives $Du_j$ generate
a Young measure $\nu = \bigl( ( \nu_x )_{x \in \Omega} , \lambda , ( \nu^{\infty}_{x} )_{x \in \overline{\Omega}} \bigr)$.
The compactness encoded in (\ref{caccj}) amounts to
$$
\nu_{x} = \delta_{\nabla u(x)} \quad \operatorname{m}athscr{L}^{n}\operatorname{m}box{-a.e.} \quad \operatorname{m}box{ and } \quad |D^{s}u| \leq \lambda \lfloor \Omega \leq c|D^{s}u| ,
$$
where $c=c(n)c_0$.
\end{remark}
\begin{proof}
The existence of the subsequence with the asserted properties follows from \cite[Theorem 8]{KR2}. Thus we have
for some subsequence (not relabelled), $u \in \operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$ and Young measure $\nu$ that
$$
u_j \wstar u \operatorname{m}box{ in } \operatorname{BV} \, \operatorname{m}box{ and } \, Du_j \toY \nu.
$$
By a result of Calder\'{o}n and Zygmund \cite[Theorem 3.83]{AFP}, $u$ is approximately differentiable $\operatorname{m}athscr{L}^{n}$ almost everywhere.
Let $x_0 \in \Omega$ be such a point and take $a(x) = u(x_{0})+\nabla u(x_{0})(x-x_{0})$. With $m=| \nabla u(x_{0})|$
we get from (\ref{caccj}) on a ball $B_{2r}=B_{2r}(x_{0}) \subset \Omega$ after taking $j \nearrow \infty$:
$$
\int_{B_{r}} \! \int_{\operatorname{m}athbb{R}^{N \times n}} \! E \bigl( \cdot - \nabla u(x_{0}) \bigr) \, \operatorname{m}athrm{d} \nu_{x} \, \operatorname{m}athrm{d} x + \lambda (B_{r}) \leq
c_{m} \int_{B_{2r}} \! E \left( \frac{u-a}{r} \right) \, \operatorname{m}athrm{d} x.
$$
Divide by $\operatorname{m}athscr{L}^{n} (B_r )$ and take $r \searrow 0$ to get by Lebesgue's differentiation theorem
$$
\int_{\operatorname{m}athbb{R}^{N \times n}} \! E \bigl( \cdot - \nabla u(x_{0}) \bigr) \, \operatorname{m}athrm{d} \nu_{x_0} + \frac{\operatorname{m}athrm{d} \lambda}{\operatorname{m}athrm{d} \operatorname{m}athscr{L}^{n}}(x_{0}) \leq 0
$$
for $\operatorname{m}athscr{L}^{n}$ almost all such $x_0$. But then both terms on the left-hand side must be $0$, and so, using the strict convexity
of $E$ for the first term, we conclude that
$$
\nu_{x_{0}} = \delta_{\nabla u(x_{0})} \, \operatorname{m}box{ for $\operatorname{m}athscr{L}^{n}$-a.e. } x_0 \, \operatorname{m}box{ and } \, \lambda \perp \operatorname{m}athscr{L}^{n} .
$$
We always have $|D^{s}u| \leq \lambda \lfloor \Omega$ (see for instance \cite{KR2}). For the upper bound we fix an arbitrary ball
$B_{2r} \subset \Omega$ take $a=u_{B_{2r}}$ above and pass to the limit whereby
$$
\int_{B_{r}} \! E \bigl( \nabla u \bigr) \, \operatorname{m}athrm{d} x + \lambda ( B_{r}) \leq c_{0}\int_{B_{2r}} \! E \left( \frac{u-u_{B_{2r}}}{r} \right) \, \operatorname{m}athrm{d} x
$$
results. Using that $E(z) \leq |z|$ for all $z$ and Poincar\'{e}'s inequality on the right-hand side we get
$$
\int_{B_{r}} \! E \bigl( \nabla u \bigr) \, \operatorname{m}athrm{d} x + \lambda ( B_{r}) \leq c_{0}c |Du|(B_{2r}).
$$
Put $\operatorname{m}u = c_{0}c|Du|$; then $\lambda (B) \leq \operatorname{m}u (2B)$ for any ball $B$ for which
$2B \subset \Omega$. We reformulate this bound in terms of cubes as follows. For a closed ball $\overline{B}$ we let $Q$ denote the largest
closed cube with sides parallel to the coordinate axes that is contained in $\overline{B}$ and we let $\hat{Q}$ denote the smallest such cube that
contains $s\overline{B}$ for some fixed $s>2$. Then $Q$ and $\hat{Q}$ are concentric and the sidelengths satisfy $\ell (\hat{Q}) = s\sqrt{n}\ell (Q)$.
Clearly given a cube $Q$ with sides parallel to the coordinate axes, the cube $\hat{Q}$ just described is uniquely determined and we must in particular
have $\lambda (Q) \leq \operatorname{m}u ( \hat{Q})$ for all cubes $Q$ with $\hat{Q} \subset \Omega$. Now fix a closed cube $Q \subset \Omega$ and
consider the system of its $Q$-dyadic subcubes at level $k \in \operatorname{m}athbb{N}$:
$$
Q = \bigcup_{j=1}^{2^{k}} Q^{(k)}_{j}.
$$
For $k$ sufficiently large we have that each $\hat{Q}^{(k)}_{j} \subset \Omega$ since $\ell (\hat{Q}^{(k)}_{j}) = s\sqrt{n}2^{-k}\ell (Q)$,
$Q^{(k)}_{j} \subset \hat{Q}^{(k)}_{j} \cap Q \Subset \Omega$, and so $\lambda (Q^{(k)}_{j}) \leq \operatorname{m}u (\hat{Q}^{(k)}_{j})$, hence
$$
\lambda (Q) \leq \sum_{j=1}^{2^k} \operatorname{m}u (\hat{Q}^{(k)}_{j}) = \int \! \sum_{j=1}^{2^k} \operatorname{m}athbf{1}_{\hat{Q}^{(k)}_{j}} \, \operatorname{m}athrm{d} \operatorname{m}u \leq c(n,s) \operatorname{m}u (Q_k ),
$$
where $Q_k = \bigcup_j \hat{Q}^{(k)}_{j}$ and we used that the family of cubes satisfies a uniform bounded overlap property. Taking $k \nearrow \infty$
we arrive at $\lambda (Q) \leq c(n,s) \operatorname{m}u (Q )$. Now since the cube $Q \subset \Omega$ was arbitrary and $\lambda$ is singular the proof is complete.
\end{proof}
\subsection{Approximation by harmonic maps}\label{approxharm}
We turn to the announced approximation by harmonic maps. This step, where the minimizer is compared with
the solution to a suitably linearized problem, is standard fare in partial regularity proofs and goes back to the works
\cite{Almgren1,Almgren2,DeGiorgi1}. However, due to the $\operatorname{L}^1$ set-up the usual ways of implementing this linearization
(such as for instance \cite{AcerbiFusco1,AcerbiFusco2,CarozzaFuscoMingione,DGK,
DLSV,Giusti,Hamburger}) do seem to require modification. Fortunately, our variant is quite straightforward and proceeds
by explicit construction of a test map that yields the required estimate. In fact, we believe that when this construction is
applied in the cases covered previously in the literature, it also offers a useful alternative argument there.
Because the approximation result is achieved by a linearization argument it is more natural if we also replace the key assumptions
(H2) and minimality by their corresponding linearizations. More precisely, we shall replace the quasiconvexity hypothesis (H2) on the
integrand $F$ by its linearization, namely the corresponding weaker rank-one convexity hypothesis:
$$
(\operatorname{m}athrm{H2W}) \hspace{1cm} z \operatorname{m}apsto F(z)-\ell E(z) \, \operatorname{m}box{ is rank-one convex}.
$$
Instead of assuming that $u$ is a minimizer, we assume that $u \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$ satisfies the extremality condition (\ref{extrem}).
We then have the following:
\begin{proposition}\label{approxharmprop}
Let $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ satisfy $\operatorname{m}athrm{(H0)}$, $\operatorname{m}athrm{(H1)}$ and $\operatorname{m}athrm{(H2W)}$ and assume that $u \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$
satisfies (\ref{extrem}). Fix a number $m>0$. For any affine map $a \colon \operatorname{m}athbb{R}n \to \operatorname{m}athbb{R}N$ with $| \nabla a| \leq m$ and each ball
$B=B_{R}(x_{0}) \subset \Omega$ so that $u|_{\partial B} \in \operatorname{BV} (\partial B , \operatorname{m}athbb{R}N )$ and $|Du|( \partial B)=0$ the elliptic system
\begin{equation}\label{defh}
\left\{
\begin{array}{ll}
-\operatorname{m}athrm{div} F^{\prime \prime}(\nabla a)\nabla h = 0 & \operatorname{m}box{ in } B\\
h=u|_{\partial B} & \operatorname{m}box{ on } \partial B,
\end{array}
\right.
\end{equation}
admits a unique solution $h \in \operatorname{W}^{1,1}(B, \operatorname{m}athbb{R}N )$. This solution $h$ satisfies
\begin{equation}\label{boundharm}
\left( \Xint-_{B} \! | \nabla h-\nabla a|^{p} \, \operatorname{m}athrm{d} x \right)^{\frac{1}{p}} \leq c \Xint-_{\partial B} \! |D_{\tau}(u-a) |
\end{equation}
for exponents $p \in (1,2)$ when $n=2$ and $p \in (1,\tfrac{n}{n-1}]$ when $n \geq 3$ and a corresponding constant $c=c(n,N,m,p,\tfrac{L}{\ell})$.
Moreover, for each exponent $q \in (1,\tfrac{n}{n-1})$,
\begin{equation}\label{keyapprox}
\Xint-_{B} \! E \left( \frac{u-h}{R} \right) \, \operatorname{m}athrm{d} x \leq C\left( \Xint-_{B} \! E \bigl( D(u-a) \bigr) \right)^{q},
\end{equation}
where $C=C(m,n,N,q,L,\ell )$.
\end{proposition}
\begin{proof}
We give the details for the case $n \geq 3$ only and leave it to the reader to check that the same proof applies for $n=2$, where
the only difference is that Lemma \ref{bvembedding2} is used instead of Lemma \ref{bvembedding}.
Let $x_{0} \in \Omega$ and fix a number $m>0$. By virtue of Lemma \ref{bvrestrict} $\operatorname{m}athscr{L}^1$ a.e.
radii $R \in (0, \operatorname{m}athrm{dist}(x_{0}, \partial \Omega ))$ have the property that $u |_{\partial B} \in \operatorname{BV} (\partial B , \operatorname{m}athbb{R}N )$ and $|Du|(\partial B)=0$,
where we wrote $B=B_{R}(x_{0})$.
We fix such a radius $R$ and write as already indicated $B=B_{R}(x_{0})$. For an affine map $a \colon \operatorname{m}athbb{R}n \to \operatorname{m}athbb{R}N$ with
$| \nabla a| \leq m$ we put as in the previous subsection $\tilde{F} = F_{\nabla a}$ and $\tilde{u} = u-a$. Clearly, $\tilde{u} |_{\partial B} \in \operatorname{BV} (\partial B , \operatorname{m}athbb{R}N )$
remains true. From (H0) and (H2W) we infer that
\begin{equation}\label{LH}
\tilde{F}^{\prime \prime}(0)[ y \otimes x ,y \otimes x ] \geq \tfrac{\ell}{c}| y |^{2} | x |^{2} \quad \forall y \in \operatorname{m}athbb{R}N, \, \forall
x \in \operatorname{m}athbb{R}n \quad \operatorname{m}box{ and } \quad |\tilde{F}^{\prime \prime}(0)| \leq c,
\end{equation}
where $c=c(m)>0$ is a constant that as indicated depends on $m$.
As is customary in this context, we make use of (\ref{extrem}) in
a linearized form by rewriting it for $\varphi \in \operatorname{C}^{\infty}_{c}(B, \operatorname{m}athbb{R}N )$ as
\begin{eqnarray*}
\int_{B} \! \tilde{F}^{\prime \prime}(0)[ D\tilde{u} , \nabla \varphi ]
&=& \int_{B} \! \tilde{F}^{\prime \prime}(0)[ D^{s}\tilde{u} , \nabla \varphi ]\\
&& +\int_{B} \! \langle \tilde{F}^{\prime \prime}(0)\nabla \tilde{u} -\tilde{F}^{\prime}(\nabla \tilde{u} ),\nabla \varphi \rangle \, \operatorname{m}athrm{d} x\\
&\stackrel{(\ref{sbound2})}{\leq}& c\int_{B} \! |D^{s}\tilde{u} | | \nabla \varphi |\\
&& +cL\int_{B} \! E(\nabla \tilde{u} )| \nabla \varphi | \, \operatorname{m}athrm{d}
x\\
&\leq& c\int_{B} \! E(D\tilde{u} )| \nabla \varphi |.
\end{eqnarray*}
It is at this stage we take advantage of the particular choice of radius $R$ whereby $\tilde{u} |_{\partial B}$
is BV on $\partial B$ and $|D\tilde{u} |(\partial B)=0$. The latter ensures that we may extend the above bound by continuity to hold for all
$\varphi \in (\operatorname{W}^{1,\infty}_{0} \cap \operatorname{C}^{1})(B, \operatorname{m}athbb{R}N )$. The former gives in combination with the embedding result of
Lemma \ref{bvembedding} that $\tilde{u} |_{\partial B} \in \operatorname{W}^{\frac{1}{n},\frac{n}{n-1}}(\partial B, \operatorname{m}athbb{R}N )$
and
$$
\left( \Xint-_{\partial B} \! \int_{\partial B} \! \frac{| \tilde{u} (x) - \tilde{u} (y)|^{\frac{n}{n-1}}}{|x-y|^{n-1+\frac{1}{n-1}}} \, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1}(x)
\, \operatorname{m}athrm{d} \operatorname{m}athcal{H}^{n-1}(y) \right)^{1-\frac{1}{n}} \leq cR^{1-\frac{1}{n}}\Xint-_{\partial B} \! |D_{\tau}\tilde{u} |
$$
for a dimensional constant $c=c(n,N)$.
In view of (\ref{LH}) and Theorem \ref{exH} we can then find a unique solution $\tilde{h} \in \operatorname{W}^{1,\frac{n}{n-1}}(B,\operatorname{m}athbb{R}N )$ to the boundary value
problem
\begin{equation}\label{harmcomp}
\left\{
\begin{array}{ll}
-\operatorname{m}athrm{div} \operatorname{m}athbb{A}\nabla \tilde{h} = 0 & \operatorname{m}box{ in } B\\
\tilde{h} = \tilde{u} & \operatorname{m}box{ on } \partial B,
\end{array}
\right.
\end{equation}
where $\operatorname{m}athbb{A}= \tilde{F}^{\prime \prime}(0)$. In particular we record that
\begin{equation}\label{Esys}
\int_{B} \! \operatorname{m}athbb{A} [ \nabla \tilde{h} , \nabla \varphi ] \, \operatorname{m}athrm{d} x =0
\end{equation}
holds for all $\varphi \in \operatorname{W}^{1,n}_{0}(B, \operatorname{m}athbb{R}N )$ and also that the integral estimate (\ref{boundharm}) holds.
Put $\psi = \tilde{u} - \tilde{h}$ so that $\psi \in \operatorname{BV}_{0}(B,\operatorname{m}athbb{R}N )$ and
\begin{equation}\label{almosth}
\int_{B} \! \operatorname{m}athbb{A}[ \nabla \psi , \nabla \varphi ] \, \operatorname{m}athrm{d} x \leq c\int_{B} E(D \tilde{u} )| \nabla \varphi |
\end{equation}
holds for all $\varphi \in (\operatorname{W}^{1,\infty}_{0} \cap \operatorname{C}^{1})(B, \operatorname{m}athbb{R}N )$, where $c=c(m,L)$.
We extract information from (\ref{almosth}) by constructing a suitable test map $\varphi$.
It is convenient to change variables and refer everything to the open unit ball as follows: Put for $x \in \operatorname{m}athbb{B} := B_{1}(0)$
$$
\Psi (x) = \frac{1}{R}\psi (x_{0}+Rx),\quad \Phi (x) = \frac{1}{R}\varphi (x_{0}+Rx), \quad U(x)=\frac{1}{R}\tilde{u} (x_{0}+Rx).
$$
Then (\ref{almosth}) becomes
\begin{equation}\label{almosthB}
\int_{\operatorname{m}athbb{B}} \! \operatorname{m}athbb{A}[ D\Psi , \nabla \Phi ] \, \operatorname{m}athrm{d} x \leq c\int_{\operatorname{m}athbb{B}} \! E(DU )| \nabla \Phi | \quad \forall
\, \Phi \in (\operatorname{W}^{1,\infty}_{0} \cap \operatorname{C}^{1})(\operatorname{m}athbb{B}, \operatorname{m}athbb{R}N ).
\end{equation}
Denote by $T \colon \operatorname{m}athbb{R}N \to \operatorname{m}athbb{R}N$ the truncation mapping defined by
$$
T(y) = \left\{
\begin{array}{ll}
y & \operatorname{m}box{ if } |y| \leq 1\\
\tfrac{y}{|y|} & \operatorname{m}box{ if } |y| > 1,
\end{array}
\right.
$$
and consider the elliptic system
\begin{equation}\label{Esystest}
\left\{
\begin{array}{ll}
-\operatorname{m}athrm{div} \, \operatorname{m}athbb{A}\nabla \Phi = T(\Psi ) & \operatorname{m}box{ in } \operatorname{m}athbb{B}\\
\Phi = 0 & \operatorname{m}box{ on } \partial \operatorname{m}athbb{B}.
\end{array}
\right.
\end{equation}
Evidently the right-hand side is bounded and we have a unique solution $\Phi \in \operatorname{W}^{1,2}_{0}(\operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$.
From Proposition \ref{exH} it follows that $\Phi$ is
of Sobolev class $\operatorname{W}^{2,p}(\operatorname{m}athbb{B} ,\operatorname{m}athbb{R}N )$ for each exponent $p \in (1, \infty )$ with bound
\begin{equation}\label{CZp}
\int_{\operatorname{m}athbb{B}} \! | \nabla^{2} \Phi |^{p} \, \operatorname{m}athrm{d} x \leq C \int_{\operatorname{m}athbb{B}} \! |T(\Psi )|^{p} \, \operatorname{m}athrm{d} x
\end{equation}
where $C=C(m,n,N,p,L,\ell )$ is a constant. If we take $p>n$, then we have that $\Phi \in \operatorname{C}^{1,1-\frac{n}{p}}(\operatorname{m}athbb{B}, \operatorname{m}athbb{R}N )$ and since
$(\nabla \Phi )_{\operatorname{m}athbb{B}}=0$ it follows from Morrey's inequality (see for instance \cite[Sect.~4.5, Th.~3]{EvGa}) that
$$
\| \nabla \Phi \|_{\operatorname{L}^{\infty}} \leq c\| \nabla^{2} \Phi \|_{\operatorname{L}^{p}} \leq c \| T(\Psi ) \|_{\operatorname{L}^p}.
$$
In particular, $\Phi \in (\operatorname{W}^{1,\infty}_{0} \cap \operatorname{C}^{1})(\operatorname{m}athbb{B} , \operatorname{m}athbb{R}N )$ so that $\Phi$ indeed qualifies as a test map in (\ref{almosthB}) and then,
in turn, by approximation, $\Psi \in \operatorname{BV}_{0}(\operatorname{m}athbb{B} ,\operatorname{m}athbb{R}N )$ qualifies as a test map in (\ref{Esystest}).
We also note that a simple estimation using (\ref{minb}) yields
$$
\| T( \Psi ) \|_{\operatorname{L}^p} \leq c\left( \int_{\operatorname{m}athbb{B}} \! E(\Psi ) \, \operatorname{m}athrm{d} x \right)^{\tfrac{1}{p}},
$$
and consequently
\begin{equation}\label{basic}
\| \nabla \Phi \|_{\operatorname{L}^{\infty}} \leq c \left( \int_{\operatorname{m}athbb{B}} \! E(\Psi ) \, \operatorname{m}athrm{d} x \right)^{\tfrac{1}{p}}
\end{equation}
holds for exponents $p \in (n,\infty )$ and corresponding constants $c=c(m,n,N,p,L,\ell )$. We plug this $\Phi$ into (\ref{almosthB});
recalling that $\Psi$ can be used to test (\ref{Esystest}) and that $\operatorname{m}athbb{A}$ is symmetric the following string
of inequalities results:
\begin{eqnarray*}
\int_{\operatorname{m}athbb{B}} \! \operatorname{m}in \{ | \Psi |^{2},| \Psi | \} \, \operatorname{m}athrm{d} x &=& \int_{\operatorname{m}athbb{B}} \! \langle \Psi , T( \Psi ) \rangle \, \operatorname{m}athrm{d} x\\
&\stackrel{(\ref{Esystest})}{=}& \int_{\operatorname{m}athbb{B}} \! \langle \operatorname{m}athbb{A} \nabla \Phi , \nabla \Psi \rangle \, \operatorname{m}athrm{d} x\\
&=& \int_{\operatorname{m}athbb{B}} \! \langle \operatorname{m}athbb{A} \nabla \Psi , \nabla \Phi \rangle \, \operatorname{m}athrm{d} x\\
&\stackrel{(\ref{almosthB}), (\ref{basic})}{\leq}& c\int_{\operatorname{m}athbb{B}} \! E(DU)
\left( \int_{\operatorname{m}athbb{B}} \! E(\Psi ) \, \operatorname{m}athrm{d} x \right)^{\frac{1}{p}},
\end{eqnarray*}
and thus (using again (\ref{minb}))
$$
\left( \int_{\operatorname{m}athbb{B}} \! E(\Psi ) \, \operatorname{m}athrm{d} x \right)^{1-\frac{1}{p}} \leq c\int_{\operatorname{m}athbb{B}} \! E(DU).
$$
Hence we have shown that
\begin{equation}\label{pkeyapprox}
\int_{\operatorname{m}athbb{B}} \! E(\Psi ) \, \operatorname{m}athrm{d} x \leq C\left( \int_{\operatorname{m}athbb{B}} \! E(DU) \right)^{q}
\end{equation}
where $q=p/(p-1) \in (1, \tfrac{n}{n-1} )$ is the dual exponent and $C=C(m,n,N,q,L,\ell )$ is a constant. Finally, we change
back variables $x \operatorname{m}apsto x_{0}+Rx$ and recall that $\psi = \tilde{u} - \tilde{h}$ whereby (\ref{pkeyapprox}) turns into (\ref{keyapprox})
thus completing the proof.
\end{proof}
\subsection{Excess decay estimate}\label{excessdecay}
For a map $u \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$ and a ball $B_{r}(x_{0}) \subset \Omega$ the relevant excess functional is
$$
\operatorname{m}athscr{E}(x_{0},r) = \int_{B_{r}(x_{0})} \! E \bigl( Du-(Du)_{B_{r}(x_{0})} \bigr) .
$$
The goal of this subsection is the following excess decay estimate:
\begin{proposition}\label{edprop}
Suppose $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ satisfies $\operatorname{m}athrm{(H0)}$, $\operatorname{m}athrm{(H1)}$, $\operatorname{m}athrm{(H2)}$ and that $u \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$
is a minimizer. Then each $m>0$ and $q \in (1,\tfrac{n}{n-1})$ there exists a constant $c=c(m,q,n,N,\tfrac{L}{\ell})$ with
the following property. For a ball $B_R = B_{R}(x_{0}) \subset \Omega$ such that
\begin{equation}\label{assump1}
|(Du)_{B_{R}}| < m
\end{equation}
and
\begin{equation}\label{assump2}
\Xint-_{B_{R}} \! |Du-(Du)_{B_{R}}| \leq 1
\end{equation}
we have that
\begin{equation}\label{keyexcessdecay}
\operatorname{m}athscr{E} (x_{0},\sigma R) \leq c \left( \sigma^{n+2} + \left( \frac{\operatorname{m}athscr{E}(x_{0},R)}{\operatorname{m}athscr{L}^{n} (B_{R}(x_{0}))} \right)^{q-1} \right) \operatorname{m}athscr{E}(x_{0},R)
\end{equation}
holds for all $\sigma \in (0,1)$.
\end{proposition}
\begin{proof}
We give the details for the case $n \geq 3$ only and leave it to the reader to check that the same proof applies for $n=2$, where
the only difference is that Lemma \ref{bvembedding2} is used instead of Lemma \ref{bvembedding}. As in the previous subsections we put
$\tilde{u} = u-a$ and $\tilde{F} = F_{\nabla a}$ and remark that by virtue of our assumptions both results from subsections 3.2 and 3.3 are now available.
In view of Lemma \ref{bvrestrict} we can select $r \in (\frac{9}{10}R,R)$ such that $\tilde{u} |_{\partial B_{r}} \in \operatorname{BV} (\partial B_{r}, \operatorname{m}athbb{R}N )$ and
\begin{equation}\label{boundR}
\int_{\partial B_{r}} \! |D_{\tau}(\tilde{u} |_{\partial B_{r}})| \leq \frac{20}{R}\int_{B_{R}} \! |D \tilde{u} |.
\end{equation}
Now the harmonic map $\tilde{h}$ determined at (\ref{harmcomp}) satisfies (\ref{boundharm}) and (\ref{keyapprox}). Let
$A \colon \operatorname{m}athbb{R}n \to \operatorname{m}athbb{R}N$ be the affine map $A(x)= \tilde{h} (x_{0})+\nabla \tilde{h} (x_{0})(x-x_{0})$ and put $a_{0}=a+A$.
Then $a_0$ is clearly affine and in order to estimate $| \nabla a_0 |$ we note that according to Lemma \ref{Weyl} we have
for a constant $c=c(n,N,m,\tfrac{L}{\ell})$:
\begin{eqnarray*}
| \nabla \tilde{h} (x_{0})| &\leq& \sup_{B_{\frac{r}{2}}} | \nabla \tilde{h} | \leq c\Xint-_{B_r} \! | \nabla \tilde{h} | \, \operatorname{m}athrm{d} x\\
&\leq& c\left( \Xint-_{B_r} \! | \nabla \tilde{h} |^{\frac{n}{n-1}} \, \operatorname{m}athrm{d} x\right)^{\frac{n-1}{n}}\\
&\stackrel{(\ref{boundharm})}{\leq}& c\Xint-_{\partial B_r} \! |D_{\tau}(\tilde{u} |_{\partial B_r})|\\
&\stackrel{(\ref{boundR})}{\leq}& \frac{c}{R r^{n-1}}\int_{B_{R}} \! |D \tilde{u} |\\
&\leq& c\Xint-_{B_{R}} \! |D \tilde{u} |.
\end{eqnarray*}
In view of (\ref{assump2}) we therefore have that
\begin{eqnarray*}
| \nabla a_0 | &\leq& |(Du)_{B_{R}}| + c\Xint-_{B_{R}} \! | Du-(Du)_{B_{R}}|\\
&<& m+c(m) =: C_{m}
\end{eqnarray*}
holds. For $\sigma \in (0,\frac{1}{5})$ we have by (\ref{qminE})
$$
\int_{B_{\sigma R}} \! E(Du-(Du)_{B_{\sigma R}}) \leq 12 \int_{B_{\sigma R}} \! E(D(u-a_0 )).
$$
Next, we apply the Caccioppoli inequality (\ref{caccioppoli2}) on the ball $B_{2\sigma R}=B_{2\sigma R}(x_{0})$ and with the
affine map $a_0$ defined above:
$$
\int_{B_{\sigma R}} \! E(D(u-a_0 )) \leq c\int_{B_{2\sigma r}} \! E\left( \frac{u-a_{0}}{2\sigma r}\right) \, \operatorname{m}athrm{d} x
$$
where $c=c(m)$ is a constant obtained from Proposition \ref{caccioppoli} and estimation of the right-hand side using
$R \in (\tfrac{9}{10}r,r)$ and (\ref{minb}).
We combine these bounds and use (\ref{minb}) again twice:
\begin{eqnarray*}
\int_{B_{\sigma R}} \! E(Du-(Du)_{x_{0},\sigma R}) &\leq& C\int_{B_{2\sigma R}} \!
\left( E\left( \frac{\tilde{u}-\tilde{h}}{\sigma R}\right) +E\left( \frac{\tilde{h}-A}{2\sigma R}\right) \right) \, \operatorname{m}athrm{d} x\\
&\leq& \frac{c}{\sigma^{2}}\int_{B_{r}} \! E\left( \frac{\tilde{u} -\tilde{h}}{r}\right) \, \operatorname{m}athrm{d} x+c\int_{B_{2\sigma R}} \!
E\left( \frac{\tilde{h} -A}{2\sigma R}\right) \, \operatorname{m}athrm{d} x.
\end{eqnarray*}
Here we have for the first term according to (\ref{keyapprox}) for each exponent $q \in (1,\tfrac{n}{n-1})$ and $C=C(m,n,N,q,L,\ell )$ that
$$
\int_{B_{r}} \! E \left( \frac{\tilde{u} -\tilde{h}}{r} \right) \, \operatorname{m}athrm{d} x \leq C\left( \Xint-_{B_{r}} \! E(D \tilde{u} ) \right)^{q}\operatorname{m}athscr{L}^{n} (B_{R}).
$$
The second term is estimated using Lemma \ref{Weyl}. Accordingly we have for $x \in B_{2\sigma R} \subset B_{\frac{r}{2}}$ and in view
of our choice of the affine map $A$:
\begin{eqnarray*}
\frac{|\tilde{h} (x)-A(x)|}{\sigma R} &\leq& c\sup_{x \in B_{\frac{r}{2}}} \left( | \nabla^{2}\tilde{h} (x) | \frac{|x-x_{0}|^2}{\sigma R} \right)\\
&\stackrel{\text{Lemma }\ref{Weyl}}{\leq}& c\Xint-_{B_r} \! | \nabla \tilde{h} | \, \operatorname{m}athrm{d} x \sigma\\
&\stackrel{(\ref{boundharm}), (\ref{boundR})}{\leq}& c\Xint-_{B_{R}} \! |Du-(Du)_{B_{R}}| \sigma\\
&\stackrel{(\ref{assump2}), (\ref{smallE})}{\leq}& c\sigma \left( \Xint-_{B_{R}} \! E(Du-(Du)_{B_{R}}) \right)^{\frac{1}{2}} .
\end{eqnarray*}
Consequently we have
\begin{eqnarray*}
\int_{B_{2\sigma R}} \! E\left( \frac{\tilde{h} -A}{2\sigma R}\right) \, \operatorname{m}athrm{d} x &\leq& c(\sigma R)^{n}
E \left( \sigma \left( \Xint-_{B_{R}} \! E(Du-(Du)_{B_{R}}) \right)^{\frac{1}{2}} \right)\\
&\leq& c\sigma^{n+2}\int_{B_{R}} \! E(Du-(Du)_{B_{R}}),
\end{eqnarray*}
and hence we arrive upon collection of the bounds at (\ref{keyexcessdecay}). Increasing the constant $c$ if necessary we see that the bound actually
extends to hold for $\sigma \in [\tfrac{1}{5},1)$ too. The proof is complete.
\end{proof}
\subsection{Iteration and conclusion}
With the excess decay result of Proposition \ref{edprop} at hand we can conclude in a standard manner.
The first step is obtained by an iteration argument and is in terms of the normalized excess:
$$
\Phi (x_{0},r) = \frac{\operatorname{m}athscr{E}(x_{0},r)}{\operatorname{m}athscr{L}^{n}(B_{r}(x_{0}))}=
\Xint-_{B_{r}(x_{0})} \! E \bigl( Du-(Du)_{B_{r}(x_{0})} \bigr) .
$$
\begin{proposition}\label{ite}
Suppose $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ satisfies $\operatorname{m}athrm{(H0)}$, $\operatorname{m}athrm{(H1)}$, $\operatorname{m}athrm{(H2)}$ and that $u \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$
is a minimizer. Let $\alpha \in (0,1)$ and $m>0$. Then there exist positive constants $c=c(n,N,\tfrac{L}{\ell},m)$ and
$\varepsilon = \varepsilon (n,N,\tfrac{L}{\ell},m,\alpha )$ with the following property. If a ball $B_{R}(x_{0}) \subset \Omega$
satisfies
\begin{equation}\label{cond1}
|(Du)_{B_{R}(x_{0})}| < m
\end{equation}
and
\begin{equation}\label{cond2}
\Phi (x_{0},R) < \varepsilon ,
\end{equation}
then
\begin{equation}\label{concl}
\Phi (x_{0},r) \leq c\left( \frac{r}{R} \right)^{2\alpha}\Phi (x_{0},R)
\end{equation}
for all $r \in (0,R)$.
\end{proposition}
\begin{proof}
For ease of notation we write $B_{r}=B_{r}(x_{0})$ and $\Phi (r) = \Phi (x_{0},r)$.
First recall from Lemma \ref{estE2} that for $\Phi (r) \leq 1$ we have
\begin{equation}\label{pf1}
\Xint-_{B_{r}} \! |Du-(Du)_{B_{r}}| \leq \sqrt{3\Phi (r)}
\end{equation}
Consequently, if for a ball $B_{r} \subset \Omega$ we have $|(Du)_{B_{r}}| < m$ and
$\Phi (r) \leq \tfrac{1}{3}$, then Proposition \ref{edprop} yields
$$
\Phi (\sigma r) \leq c \left( \sigma^{2}+\sigma^{-n} \Phi (r)^{q-1} \right) \Phi (r)
$$
for $q \in (1,\frac{n}{n-1})$, $c=c(n,N,\tfrac{L}{\ell},m,q)$ and $\sigma \in (0,1)$. Fix $q \in (1,\frac{n}{n-1})$
and denote
\begin{equation}\label{pf2}
C = c(n,N,\tfrac{L}{\ell},m+1,q)
\end{equation}
where we emphasize that we take the constant corresponding to $m+1$ rather than to $m$. With this choice we then
select $\sigma \in (0,1)$ satisfying $C\sigma^{2} < \tfrac{1}{2}\sigma^{2\alpha}$. For definiteness we fix
\begin{equation}\label{pf3}
\sigma = (3C)^{-\frac{1}{2(1-\alpha )}}.
\end{equation}
Next, take an $\varepsilon_{0} \in (0,\tfrac{1}{3})$ so $C\sigma^{-n}\varepsilon_{0}^{q-1} < \tfrac{1}{2}\sigma^{2\alpha}$, say
\begin{equation}\label{pf4}
\varepsilon_{0} = \left( \frac{\sigma^{n+2\alpha}}{3C} \right)^{\frac{1}{q-1}}.
\end{equation}
Observe that with these choices we have for any ball $B_{r} \subset \Omega$ satisfying $|(Du)_{B_{r}}| < m+1$
and $\Phi (r) < \varepsilon_0$ that
\begin{equation}\label{pf5}
\Phi (\sigma r) \leq \sigma^{2\alpha}\Phi (r) .
\end{equation}
We iterate this as follows. Let $\varepsilon \in (0, \varepsilon_{0}]$, further restrictions will be imposed below. For the remainder
of the proof we fix a ball $B_{R}=B_{R}(x_{0}) \subset \Omega$
satisfying (\ref{cond1})--(\ref{cond2}). We then have in particular that $\Phi (\sigma R) \leq \sigma^{2\alpha}\varepsilon \leq \varepsilon_0$.
Also, in a standard manner we can estimate
\begin{eqnarray*}
|(Du)_{B_{\sigma R}}| &\leq& |(Du)_{B_{R}}| + |(Du)_{B_{\sigma R}}-(Du)_{B_{R}}|\\
&<& m + \Xint-_{B_{\sigma R}} \! |Du - (Du)_{B_{R}}|\\
&\leq& m+\sigma^{-n}\Xint-_{B_{R}} \! |Du - (Du)_{B_{R}}|\\
&\stackrel{(\ref{smallE})}{\leq}& m+ \sigma^{-n}\sqrt{3\varepsilon}.
\end{eqnarray*}
We require that $\sigma^{-n}\sqrt{3\varepsilon} \leq 1$, that is,
\begin{equation}\label{pf6}
\varepsilon \leq \frac{\sigma^{2n}}{3}.
\end{equation}
Thus in view of (\ref{pf5}) we have shown that
\begin{equation}\label{pf7}
\Phi (\sigma^{j}R) \leq \sigma^{2\alpha j}\Phi (R)
\end{equation}
holds for $j=1$, $2$. Let $k \in \operatorname{m}athbb{N}$ and suppose that (\ref{pf7}) holds for $j \in \{ 1, \, \dots \, , \, k \}$. Then
$\Phi (\sigma^{j}R) \leq \sigma^{2\alpha j} \Phi (R) < \sigma^{2\alpha j}\varepsilon < \varepsilon_0$ for each $j \leq k$ and
as above we estimate
\begin{eqnarray*}
|(Du)_{B_{\sigma R}}| &\leq& m+ \sum_{j=1}^{k} \sigma^{-n}\sqrt{3\Phi (\sigma^{j-1}R)}\\
&\leq& m+ \sum_{j=1}^{k} \sigma^{-n}\sqrt{3\sigma^{2\alpha (j-1)}\varepsilon}\\
&<& m+\frac{\sqrt{3\varepsilon}}{\sigma^{n}}\frac{1}{1-\sigma^{\alpha}}.
\end{eqnarray*}
We require that $\frac{\sqrt{3\varepsilon}}{\sigma^{n}}\frac{1}{1-\sigma^{\alpha}} \leq 1$. This is acheived if we take
\begin{equation}\label{pf8}
\varepsilon = \operatorname{m}in \{ \varepsilon_{0},\frac{(\sigma^{n}-\sigma^{n+\alpha})^{2}}{3} \} .
\end{equation}
Thus with these choices we have for balls $B_{R}(x_{0}) \subset \Omega$ that satisfy (\ref{cond1})--(\ref{cond2}) shown
that (\ref{pf7}) holds for all $j \in \operatorname{m}athbb{N}$.
The conclusion follows in a standard manner from this.
\end{proof}
Using the excess decay estimate of Proposition \ref{ite} we conclude in a routine way with the following $\varepsilon$-regularity
result that in view of Lebesgue's differentiation theorem also implies the last part of Theorem \ref{thm:main}.
\begin{theorem}\label{datheo}
Suppose $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ satisfies $\operatorname{m}athrm{(H0)}$, $\operatorname{m}athrm{(H1)}$, $\operatorname{m}athrm{(H2)}$ and that $u \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$
is a minimizer. Then for each $m>0$ there exists $\varepsilon_{m}=\varepsilon_{m} (F) \in (0,1]$ with the following property. If
the ball $B_{R}(x_{0}) \subset \Omega$ satisfies
\begin{equation}\label{1}
|(Du)_{B_{R}(x_{0})}| < m
\end{equation}
and
\begin{equation}\label{2}
\Phi (x_{0},R) < \varepsilon_m ,
\end{equation}
then $u$ is $\operatorname{C}^{2,\alpha}_{\operatorname{m}athrm{loc}}$ on $B_{\frac{R}{2}}(x_{0})$ for each $\alpha < 1$, and
\begin{equation}\label{3}
\sup_{\stackrel{x,y \in B_{R/4}(x_{0})}{x \neq y}} \frac{| \nabla^{2}u (x)-\nabla^{2}u(y)|^{2}}{|x-y|^{2\alpha}} \leq c\frac{\Phi (x_{0},R)}{R^{2+2\alpha}}
\end{equation}
where $c=c(n,N,\tfrac{L}{\ell},m,\alpha )$ is a constant.
\end{theorem}
\begin{proof}
We merely sketch the proof as it is essentially standard once the excess decay estimate from Proposition \ref{ite}
has been established. Fix $m>0$ and consider the corresponding
$$
\tilde{\varepsilon} = \varepsilon (n,N,\tfrac{L}{\ell},m+1,\tfrac{1}{2})>0
$$
that was determined in Proposition \ref{ite}. Note that we take the number that corresponds to $m+1$ rather than to $m$. Let
$\varepsilon \in (0,\tilde{\varepsilon}]$ and assume that $B_{R}(x_{0}) \subset \Omega$ is a ball so that
(\ref{cond1})--(\ref{cond2}) hold. We shall determine $\varepsilon$ in the course of the proof.
Let $x \in B_{R/2}(x_{0})$ and note that the ball $B_{R/2}(x) \subset B_{R}(x_{0})$ satisfies
$$
\Phi (x,\tfrac{R}{2}) \stackrel{\text{Lemma }\ref{estE1}}{\leq} 4 \cdot 2^{n} \Phi (x_{0},R) < 2^{n+2}\varepsilon
$$
and, proceeding as above,
\begin{eqnarray*}
|(Du)_{B_{\frac{R}{2}}(x)}| &<& m+2^{n}\Xint-_{B_{R}(x_{0})} \! | Du-(Du)_{B_{R}(x_{0})}|\\
& \stackrel{(\ref{smallE})}{\leq} & m+2^{n}\sqrt{3\Phi (x_{0},R)}\\
&<& m+2^{n}\sqrt{3\varepsilon}.
\end{eqnarray*}
Thus if we take $\varepsilon = \operatorname{m}in \{ \tfrac{\tilde{\varepsilon}}{2^{n+2}}, \tfrac{1}{3 \cdot 2^{2n}} \}$, then Proposition
\ref{ite} yields the bound
$$
\Phi (x,r) \leq c\frac{r}{R} \Phi (x,\tfrac{R}{2}) \leq c_{1}\frac{\Phi (x_{0},R)}{R}r \quad \operatorname{m}box{ with } \quad c_{1} = 2^{n+2}c
$$
valid for all $x \in B_{R/2}(x_{0})$ and all $r \in (0,\tfrac{R}{2})$. In view of Lemma \ref{estE2} we can deduce a more familiar looking
excess decay estimate:
\begin{eqnarray*}
\left( \Xint-_{B_{r}(x)} \! |Du - (Du)_{B_{r}(x)}| \right)^{2} &\leq& \Phi (x,r)^{2}+2\Phi (x,r)\\
&\leq& c_{1}^{2}\left( \tfrac{r}{R} \right)^{2}\Phi (x_{0},R)^{2}+2c_{1}\tfrac{r}{R}\Phi (x_{0},R)\\
&\leq& c\frac{\Phi (x_{0},R)}{R}r
\end{eqnarray*}
for all $x \in B_{R/2}(x_{0})$ and $r \in (0,R/2)$. (Here $c=c_{1}^{2}+2c_{1}$ and we used that $\Phi (x_{0},R) \leq 1$.)
Using the Campanato-Meyers integral characterization of H\"{o}lder continuity we conclude that $u$ is $\operatorname{C}^{1,\frac{1}{2}}$ on $B_{R/2}(x_{0})$
and that we have
$$
\sup_{\stackrel{x,y \in B_{R/2}(x_{0})}{x \neq y}} \frac{| \nabla u (x)-\nabla u(y)|^{2}}{|x-y|} \leq c\frac{\Phi (x_{0},R)}{R}
$$
for some constant $c=c(n,N,\tfrac{L}{\ell},m)$. Finally, in order to boost the regularity of $u$ we employ the difference-quotient method
and elliptic Schauder estimates for linear Legendre-Hadamard elliptic systems. Put $B=B_{R/2}(x_{0})$, let $\delta > 0$ be small and denote for
increments $h \in \operatorname{m}athbb{R}$ with $|h| < \delta R$ the finite difference of $\nabla u$ in
the $j$-th coordinate direction by $Delta_{j,h}\nabla u (x) = \nabla u(x+he_j )-\nabla u(x)$, $x \in B^{\prime} := B_{(1-\delta )R/2}(x_{0})$.
Define the $x$-dependent symmetric bilinear forms (for $x \in B^{\prime}$, $|h| < \delta R$ and $1 \leq j \leq n$) by
$$
Q(x)[z,w] = Q_{j,h}(x)[z,w] = \int_{0}^{1} \! F^{\prime \prime}(\nabla u(x)+tDelta_{j,h}\nabla u(x))[z,w] \, \operatorname{m}athrm{d} t \quad (z, \, w \in \operatorname{m}athbb{R}^{N \times n} )
$$
From (H0) and the above follows that $Q \in \operatorname{C}^{0,\tfrac{1}{2}}(B^{\prime}, \bigodot^{2}( \operatorname{m}athbb{R}^{N \times n} ))$ with the corresponding Schauder norm of $Q$
bounded uniformly in $|h| < \delta R$ and $1 \leq j \leq n$. By virtue of Lemma \ref{propshift} the form $Q$ is uniformly strongly
Legendre-Hadamard elliptic: there exists a positive constant $c=c(n,N,\tfrac{L}{\ell},m,\operatorname{m}athrm{diam }\Omega )$ such that for all
$x \in B^{\prime}$ and $a \in \operatorname{m}athbb{R}N$, $b \in \operatorname{m}athbb{R}n$,
$$
Q(x)[a \otimes b,a \otimes b] \geq \tfrac{1}{c}|a|^{2}|b|^{2} \quad \operatorname{m}box{ and } \quad |Q(x)| \leq c
$$
hold. Freezing coefficients and using a partition of unity we establish the following G{\aa}rding inequality ($\alpha$, $\beta > 0$)
$$
\int_{B^{\prime}} \! Q(x)[\nabla \varphi,\nabla \varphi] \, \operatorname{m}athrm{d} x \geq \int_{(B^{\prime}} \! \bigl( \alpha |\nabla \varphi |^{2}-\beta | \varphi |^{2} \bigr) \, \operatorname{m}athrm{d} x
$$
valid for all $\varphi \in \operatorname{W}^{1,\infty}_{0} (B^{\prime}, \operatorname{m}athbb{R}N )$, $|h| < \delta R$, $1 \leq j \leq n$. Using these bounds for the form $Q$
and testing the Euler-Lagrange system by $\varphi = Delta_{j,-h}\bigl( \rho^{2}Delta_{j,h}u \bigr)$ for a suitable cut-off function $\rho$ we
find in a standard manner that $u \in \operatorname{W}^{2,2}_{\operatorname{m}athrm{loc}}(B , \operatorname{m}athbb{R}N )$ and that for each direction $1 \leq j \leq n$,
\begin{equation}\label{linearized}
\int_{B} \! F^{\prime \prime}(\nabla u)[\nabla D_{j}u, \nabla \varphi ] \, \operatorname{m}athrm{d} x = 0 \quad \forall \varphi \in \operatorname{C}^{1}_{c}(B , \operatorname{m}athbb{R}N )
\end{equation}
It follows by Schauder estimates, see \cite[Theorem 3.2]{Giaquinta}, that $D_j u$ is $\operatorname{C}^{1,1/2}_{\operatorname{m}athrm{loc}}$ on $B$, and hence
that $u$ is $\operatorname{C}^{2,1/2}_{\operatorname{m}athrm{loc}}$ on $B$. But then the coefficients $F^{\prime \prime}(\nabla u)$ in the linear elliptic system (\ref{linearized})
are locally Lipschitz and the desired regularity and bound (\ref{3}) follow using Schauder estimates again (see \cite[Theorem 3.3]{Giaquinta}).
The proof is complete.
\end{proof}
\section{Extensions}
Let $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ be an integrand of linear growth (\ref{1grow}) which is mean coercive (\ref{mean}), but possibly non-quasiconvex.
Then for $v \in \operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$ and a Lipschitz subdomain $O \subset \Omega$ we define as in (\ref{intro3}) the relaxation from $\operatorname{W}^{1,1}$:
$$
\operatorname{m}athscr{F} [v,O] = \inf\left\{\liminf_{j \to \infty} \int_{O} \! F(\nabla v_{j}) \, \operatorname{m}athrm{d} x\colon\; (v_{j})\subset \operatorname{W}^{1,1}_{v} (O , \operatorname{m}athbb{R}N ),
\;v_{j}\to v\; \text{in} \; \operatorname{L}^{1}(O ,\operatorname{m}athbb{R}N) \right\} .
$$
The integral representation (\ref{intro4}) remains valid provided we replace $F$ by its quasiconvex envelope $F^{\operatorname{m}athrm{qc}}$, see \cite{KR1}.
In \cite{Almgren2} \textsc{Almgren} extended the elliptic regularity theory in the parametric context for minimizers to also cover various
classes of \emph{almost minimizers}. This allowed him to treat also variational problems with constraints. In the nonparametric context
of quasiconvex variational integrals of $p$-growth for $p>1$ this has been done by \textsc{Duzaar, Grotowski \& Kronz} in \cite{DGK}.
Here we extend Theorem \ref{thm:main} to almost minimizers in the $\operatorname{BV}$ case of linear growth and at the same time localize the result in
the spirit of \textsc{Acerbi \& Fusco} \cite{AcerbiFusco2} (and \cite{AnGi} in the convex case).
For an increasing continuous function $\omega \colon [0,\infty ) \to \operatorname{m}athbb{R}$ with $\omega (0)=0$ we say that $u \in \operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$
is a $\omega$-almost minimizer for $\operatorname{m}athscr{F}$ provided for each ball $B_{r}(x_{0}) \subset \Omega$ we have
\begin{equation}\label{almost}
\operatorname{m}athscr{F} [u,B_{r}(x_{0})] \leq \operatorname{m}athscr{F} [v,B_{r}(x_{0})]+\omega (r)\int_{B_{r}(x_{0})} \! \biggl( |Dv| + \operatorname{m}athscr{L}^{n} \biggr)
\end{equation}
whenever $v \in \operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$ and $u-v$ is supported in $B_{r}(x_{0})$.
\begin{theorem}\label{general1}
Let $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ be globally Lipschitz and mean coercive (\ref{mean}). Suppose $u \in \operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$ satisfies (\ref{almost}) for
some function $\omega$ verifying $\limsup_{r \searrow 0} \omega (r)/r^{2\alpha} < \infty$, where $\alpha \in (0,1)$.
Let $z_0 \in \operatorname{m}athbb{R}^{N \times n}$ and assume that
$$
\Xint-_{B_{r}(x_0 )} \! E(Du-z_{0}\operatorname{m}athscr{L}^{n} ) \to 0 \operatorname{m}box{ as } r \searrow 0.
$$
If $F$ is $\operatorname{C}^{2,1}$ near $z_0$ and if for some $\ell > 0$ the integrand $z \operatorname{m}apsto F(z)-\ell E(z)$ is quasiconvex at $z_0$,
then $u$ is $\operatorname{C}^{1,\alpha}$ near $x_0$.
\end{theorem}
\noindent
We are not giving the detailed proof for Theorem \ref{general1} here since it follows closely the proof from Section \ref{sec:main}
of Theorem \ref{thm:main}. In order to execute the modified proof one requires the following observation that is closely related
to \cite[Lemma 2.2]{AcerbiFusco2}:
\begin{lemma}\label{modify}
Let $F \colon \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ be globally Lipschitz and mean coercive (\ref{mean}), and fix $z_{0} \in \operatorname{m}athbb{R}^{N \times n}$. If $F$ is $\operatorname{C}^2$ near $z_0$
and for some $\ell > 0$ the integrand $z \operatorname{m}apsto F(z)-\ell E(z)$ is quasiconvex at $z_0$, then the quasiconvex envelope $F^{\operatorname{m}athrm{qc}}$
of $F$ is real-valued, satisfies (\ref{mean}), $\operatorname{m}athrm{lip}(F^{\operatorname{m}athrm{qc}})=\operatorname{m}athrm{lip}(F)$, $z \operatorname{m}apsto F^{\operatorname{m}athrm{qc}}(z)-\ell E(z)$
is quasiconvex at $z_0$ and $F^{\operatorname{m}athrm{qc}}=F$ near $z_0$.
\end{lemma}
\begin{proof}
Since $F \geq F^{\operatorname{m}athrm{qc}} \geq (F-\ell E)^{\operatorname{m}athrm{qc}} + \ell E$ and equality holds at $z_0$ we infer that $F^{\operatorname{m}athrm{qc}}-\ell E$
is quasiconvex at $z_0$. In particular, $F^{\operatorname{m}athrm{qc}}$ is then a real-valued quasiconvex integrand. From \cite[Lemma 3.1]{CK}
we deduce that $F^{\operatorname{m}athrm{qc}}$ satisfies (\ref{mean}) with the same constants as $F$. That $\operatorname{m}athrm{lip}(F^{\operatorname{m}athrm{qc}})=\operatorname{m}athrm{lip}(F)$
is a consequence of \cite[Lemma 5.1, Corollary 5.2]{Mat}. Finally, if$F$ is $\operatorname{C}^2$ on the ball $B_{r}(z_0 )$ and we assume, as we may, that
$F(z_0 ) =0$, $F^{\prime}(z_0 ) =0$, then
\begin{equation}\label{goodbound}
|F(z)| \leq c \Theta \bigl( |z-z_{0}| \bigr) E\bigl( |z-z_{0}| \bigr) \quad \forall z \in \operatorname{m}athbb{R}^{N \times n}
\end{equation}
for some constant $c$ and modulus of continuity $\Theta$. We can arrange that $\Theta \colon [0, \infty ) \to [0,1]$ is continuous,
increasing, concave and $\Theta (0)=0$, $\Theta (1)=1$. The proof of (\ref{goodbound}) is implicit in the proof of Lemma 2.2 in
\cite{AcerbiFusco2} that we may also follow to conclude that $F^{\operatorname{m}athrm{qc}}=F$ on $B_{r/2}(z_{0})$.
\end{proof}
\noindent
As we have dealt with the case of autonomous integrands in the main part of this paper, let us finish by briefly addressing
the case of $x$-dependent integrands and explain how these can be handled. From a technical perspective,
the way in which functions are applied to vectorial Radon measures is equally covered by Section~\ref{sec:functionsofmeasures}.
We focus here on a special case and merely state a result that can be made to follow from Theorem \ref{general1}.
\begin{corollary}\label{general2}
Let $F \colon \Omega \times \operatorname{m}athbb{R}^{N \times n} \to \operatorname{m}athbb{R}$ be continuous and assume that for some constants $\ell$, $L > 0$ and $\alpha \in (0,1)$ we have
for $x$, $x_1$, $x_2 \in \Omega$ and $z \in \operatorname{m}athbb{R}^{N \times n}$,
$$
\left\{
\begin{array}{l}
\ell |z| \leq F(x,z) \leq L(|z|+1),\\
|F(x_{1},z)-F(x_{2},z)| \leq L \operatorname{m}in \{ 1,|x_{1}-x_{2}|^{2\alpha} \} (|z|+1),\\
z \operatorname{m}apsto F(x,z) \operatorname{m}box{ is } \operatorname{C}^3 \operatorname{m}box{ and } \partial^{3}F(x,z)/\partial z^{3} \operatorname{m}box{ is jointly continuous in } (x,z)\\
z \operatorname{m}apsto F(x,z)-\ell E(z) \operatorname{m}box{ is quasiconvex.}
\end{array}
\right.
$$
Suppose that $u \in \operatorname{BV} (\Omega , \operatorname{m}athbb{R}N )$ is a minimizer in the sense that
$$
\int_{\Omega} \! F(x,Du) \leq \int_{\Omega} \! F(x,Dv)
$$
holds for all $v \in \operatorname{BV} ( \Omega , \operatorname{m}athbb{R}N )$ for which $v-u$ has compact support in $\Omega$.
Then there exists an open subset $\Omega_{u} \subset \Omega$ such that $\operatorname{m}athscr{L}^{n} ( \Omega \setminus \Omega_{u})=0$ and
$u$ is $\operatorname{C}^{1,\alpha}_{\operatorname{m}athrm{loc}}$ on $\Omega_u$.
\end{corollary}
\noindent
Finally we remark that all the above stated regularity results would extend if instead of the integrand $F=F(Du)$ (or $F=F(x,Du)$) we
considered the integrand $F(Du)+f(x,u)$, where $f \colon \Omega \times \operatorname{m}athbb{R}N \to \operatorname{m}athbb{R}$ is Carath\'{e}odory and satisfies the growth condition
$$
0 \leq f(x,y) \leq c\bigl( |y|^{\tfrac{n}{n-1}} +1 \bigr) \quad \forall (x,y) \in \Omega \times \operatorname{m}athbb{R}N ,
$$
where $c>0$ is a constant (see \cite{Hamburger} for general results in this spirit in the $p$-growth context).
We could also cover the more general notions of almost minimizers considered in \cite{Schmidt1} for the purpose of treating
some image restoration problems.
\noindent
Mathematisches Institut der Univ.~Bonn\\
Endenicher Allee 60, 53111 Bonn\\
Germany
\noindent
Mathematical Institute, University of Oxford, Andrew Wiles Building\\
Radcliffe Observatory Quarters, Woodstock Road, Oxford OX2 6GG\\
United Kingdom
\end{document}
|
math
|
زیادٕہ تر معاملاتن منز چُھ آکسیجن تہٕ waste product کِس طورس پیٹھ جٲری گژھان۔
|
kashmiri
|
\braegin{document}
\text{\sz{CNOT}} \hsextittle{Classical-Quantum Noise Mitigation for \text{\sz{CNOT}} \hsext{\leftarrowrge NISQ} Hardware}
\dotate{\text{\sz{CNOT}} \hsoday}
\author{Andrew Shaw}
\email[Electronic Address: ]{[email protected]}
\affiliation{University of Maryland, College Park, MD 20742, USA}
\braegin{abstract}
In this work, the \text{\sz{CNOT}} \hsextit{global white-noise model} is proved from first principles. The adherence of NISQ hardware to the global white-noise model is used to perform noise mitigation using \text{\sz{CNOT}} \hsextit{CLAssical White-noise Extrapolation} (\text{\sz{CLAWE}} \hsA).
\end{abstract}
\title{Classical-Quantum Noise Mitigation for \text{\large NISQ}
\section{Global White-Noise Model}\leftarrowbelel{sec:gwn}
Universal quantum computation involves the encoding of algorithms into sequences of \text{\sz{CNOT}} \hsextit{local} gates. The noise processes in \text{\sz{CNOT}} \hsextit{Noisy Intermediate-Scale Quantum} (\text{\sz{NISQ}} \normalsize \hsT) hardware do not exhibit such locality, resulting in \text{\sz{CNOT}} \hsextit{qubit crosstalk} \cite{crosst0,crosst1,crosst2,crosst3,crosst4,crosst5,crosst6,crosst7,crosst8,crosst9,crosst10,crosst11,crosst12,crosst13,crosst14,crosst15,crosst16,crosst17,crosst18,crosst19,crosst20,crosst21,crosst22,crosst23,crosst24}.
This non-locality suggests a global description of the average noise dynamics. The \text{\sz{CNOT}} \hsextit{global white-noise model} \cite{CLAWEPost0,CLAWEConference0,CLAWEPost1,CLAWEPresent1} presumes that the noise dynamics associated with \text{\sz{CNOT}} \hsextit{entangling operations} \cite{
transmEnt0,transmEnt1,transmEnt2,transmEnt3,transmEnt4,transmEnt5,transmEnt6,transmEnt7,transmEnt8,transmEnt9,transmEnt10,transmEnt11,transmEnt12,transmEnt13,transmEnt14,transmEnt15,transmEnt16,transmEnt17,transmEnt18,transmEnt19,transmEnt20,transmEnt21,transmEnt22,transmEnt23,transmEnt24,transmEnt25,transmEnt26,transmEnt27,transmEnt28,transmEnt29,transmEnt30,transmEnt31,transmEnt32,transmEnt33,transmEnt34,transmEnt35,transmEnt36} can be approximated by depolarizing events that span the entire Hilbert space (\autoref{fig:gwnm}). The global white-noise model is now derived from first principles using \text{\sz{CNOT}} \hsextit{quantum channel technology}.
\subsection{Introduction to Superoperators}\leftarrowbelel{ssc:supop}
Rigorously treating noise dynamics requires a density matrix representation \cite{densitymatI,densitymatII,densitymatIII}, because the evolution of open quantum systems generates \text{\sz{CNOT}} \hsextit{mixed quantum states}. Vector representations cannot describe such processes, as they only characterize \text{\sz{CNOT}} \hsextit{pure quantum states}: \text{\sz{CNOT}} \hsextsuperscriptz{$\Ket{\psi}$}.
Mixed quantum states have interacted with unknown degrees of freedom. They are composed of an ensemble of pure states \text{\sz{CNOT}} \hsextsuperscriptz{$\{\Ket{\psi_k}\}$}, with observational probabilities \text{\sz{CNOT}} \hsextsuperscriptz{$\{\alpha_k\}$}. The corresponding density matrix is the following:
\braegin{equation}
\rho_{\text{\sz{CNOT}} \hsext{\text{\sz{CNOT}} \hsextitny mixed}}=\sum_k \alpha_k \Ket{\psi_k}\hatsnh \bra{\psi_k}
\end{equation}
In the density matrix representation, \text{\sz{CNOT}} \hsextsuperscriptz{$d\hatsnh\text{\sz{CNOT}} \hsextitmes\hatsnh d$}-dimensional operators that act on wavefunctions, generalize to \text{\sz{CNOT}} \hsextsuperscriptz{$d^2\hatsnh\text{\sz{CNOT}} \hsextitmes \hatsnh d^2$}-dimensional \text{\sz{CNOT}} \hsextit{quantum channels} known as \text{\sz{CNOT}} \hsextit{superoperators}. Each superoperator can be represented by sets of \text{\sz{CNOT}} \hsextit{Kraus operators} \text{\sz{CNOT}} \hsextsuperscriptz{\{$M_k$\}} \cite{superOp}:
\braegin{equation}
\hat \mathcal{E} =\sum^{\mathcal{R}}_{k=1} M_k \otimes M_k^{\dotg}
\end{equation}
Meaningful density matrices are positive semi-definite, with \text{\sz{CNOT}} \hsextsuperscriptz{$\text{\sz{CNOT}} \hsext{Tr}(\rho)=1$}. To map such density matrices onto one another, superoperators must be \text{\sz{CNOT}} \hsextit{completely positive and trace-preserving} (\sz CPTP\nsz): \text{\sz{CNOT}} \hsextsuperscriptz{$\sum_k M_k M_k^{\dotg}=1$} \cite{densitymatIV}.
In this work, hat-notation is reserved for the action of superoperators in matrix representation:
\braegin{align}
\braegin{split}
&\text{\sz{CNOT}} \hsext{Matrix} \\[-2mm] &\text{\sz{CNOT}} \hsext{Representation:}
\end{split} \hatspace{5em} \hat \mathcal{E} \rho \\[2mm]
\braegin{split}
&\text{\sz{CNOT}} \hsext{Operator-Sum
} \\[-2mm] &\text{\sz{CNOT}} \hsext{Representation:}
\end{split} \ \ \hatspace{2em} \mathcal{E}(\rho)=\sum_k \hats M_k\hatsh \rho \hatsh M_k^{\dotg}
\end{align}
\braegin{figure}
\includegraphics[scale=0.048]{arxivfigs/ScalarDepthGWNMI.png}
\caption{Depolarizing channels follow CNOT gates.}
\leftarrowbelel{fig:gwnm}
\end{figure}
\subsection{The Depolarizing Channel}\leftarrowbelel{ssc:depolChan}
Depolarization results in the mixing of a quantum state with the infinite temperature Gibbs state, one for which all micro-states are equally likely \cite{gibbsstate}. Such processes are described by the \text{\sz{CNOT}} \hsextsuperscriptz{$n$}-qubit \text{\sz{CNOT}} \hsextit{depolarizing channel}:
\braegin{equation}
\hat \cdotm_{\epsilon,n} \hats \rho =(1-\epsilon)\hatsh \rho+\epsilon \hats \Ie_n
\end{equation}
where \text{\sz{CNOT}} \hsextsuperscriptz{$\Ie_n=\mathbbm{1}/2^n$} is the \text{\sz{CNOT}} \hsextit{infinite temperature state} (\Ie_nT) and \text{\sz{CNOT}} \hsextsuperscriptz{$\epsilon$} is the \text{\sz{CNOT}} \hsextit{noise strength}.
The repeated action of the depolarizing channel is the following:
\braegin{align}
\hat \cdotm^k_{\epsilon,n} \hatsh \rho &=(1-\epsilon)^k\hatsh \rho +f(\epsilon,k) \hatsh \Ie_n \\[0.3em]
f&(\epsilon,k)=\epsilon\sum_{n=0}^{k-1}(1-\epsilon)^n \leftarrowbelel{recursiveM}
\end{align}
The input state is suppressed exponentially, indicating a \text{\sz{CNOT}} \hsextit{signal-to-noise problem}. After its qubits are saturated by the \Ie_nT, a \text{\sz{CNOT}} \hsextit{\text{\sz{QPU}} \normalsize \hsFTO}(\text{\sz{QPU}} \normalsize \hsT) can no longer perform meaningful computation (\autoref{fig:nisqual}).
\subsection{Proving the Global White-Noise Model}
A \text{\sz{QPU}} \normalsize \hsTO is composed of qubits coupled to the \text{\sz{CNOT}} \hsextit{environment} and a \text{\sz{CNOT}} \hsextit{measurement apparatus}:
\braegin{equation}
\hatqpu=\hatenv\otimes\hatq\otimes \hatapp
\end{equation}
\noindent
In the \text{\sz{QPU}} \normalsize \hsT's expanded Hilbert space, noise dynamics map onto unitary time evolution \cite{qpuMOD1}.
Consider a \text{\sz{QPU}} \normalsize \hsTO that performs digital computations with \sz CNOT\normalsizeO gates. It is examined throughout a quantum computation obeying the \text{\sz{CNOT}} \hsextit{computational cycle}:
(I.) \underlines{\text{\sz{CNOT}} \hsextit{state preparation}}: The qubits are prepared in a pure initial state.
(II.) \underlines{\text{\sz{CNOT}} \hsextit{quantum computation}}: The \text{\sz{CNOT}} \hsextit{target computation} is performed by applying \sz CNOT\normalsizeO gates to the qubits.
\noindent
(III.) \underlines{\text{\sz{CNOT}} \hsextit{measurement}}: An observable on \text{\sz{CNOT}} \hsextsuperscriptz{$\hatq$} is measured.
h
The computational cycle is repeated \text{\sz{CNOT}} \hsextsuperscriptz{$N_m$} times. Within the \text{\sz{QPU}} \normalsize \hsT, the entire computation is described by unitary evolution for time \text{\sz{CNOT}} \hsextsuperscriptz{$\text{\sz{CNOT}} \hsexp={\text{\sz{CNOT}} \hsextitny{N_m}\hatsh t_{\text{\sz{CNOT}} \hsext{\text{\sz{CNOT}} \hsextitny cycle}}}$}:
\braegin{equation}
\rho_{\qs}pu^{(t)}=\hat U_{\text{\tiny \qpu}}^{(t)} \hatsh \rho_{\qs}pu^{(0)}
\end{equation}
A location metric is required to identify the occurrence of \sz CNOT\normalsizeO gates in a computation. In this work, the \text{\sz{CNOT}} \hsextit{scalar depth} (\text{\sz{CNOT}} \hsextsuperscriptz{$\rchi$}) is used: the number of entangling operations applied after state preparation.
The state of the \text{\sz{QPU}} \normalsize \hsTO \hatsnh during the computation can be parametrized by the scalar depth \text{\sz{CNOT}} \hsextsuperscriptz{$\rchi(t)$}:
\braegin{equation}
\rho_{\qs}pu^{(t)}\rightarrow \rho_{\qs}pu[\rchi(t)]
\end{equation}
The qubits will be acted on by the \text{\sz{CNOT}} \hsextsuperscriptz{$\rchi'^{\hatsh \text{\sz{CNOT}} \hsext{\text{\sz{CNOT}} \hsiny th}}$} \sz CNOT\normalsizeO gate at times \text{\sz{CNOT}} \hsextsuperscriptz{$\{t_{\sigma}\}$} satisfying \text{\sz{CNOT}} \hsextsuperscriptz{$\rchi(t_{\sigma})=\rchi'$}. The state of the \text{\sz{QPU}} \normalsize \hsTO at times \text{\sz{CNOT}} \hsextsuperscriptz{$\{t_{\sigma}\}$} defines a set of \text{\sz{CNOT}} \hsextit{encountering states}:
\braegin{equation}
\rho_{\qs}pu^{(t_k)}[\rchi']=\rho_{\qs}pu[\rchi'(t_k)]
\end{equation}
Encountering states at times \text{\sz{CNOT}} \hsextsuperscriptz{$t_l$} and \text{\sz{CNOT}} \hsextsuperscriptz{$t_k$} are related by unitary evolution on \text{\sz{CNOT}} \hsextsuperscriptz{$\hatqpu$}, represented by \text{\sz{CNOT}} \hsextit{encountering transformations}:
\braegin{align}
\hat U_{lk}&=\hat U_{\text{\tiny \qpu}}^{(t_l)} \hats \hat U_{\text{\tiny \qpu}}^{\dotg(t_k)} \\ \leftarrowbelel{encountT}
\rho_{\qs}pu^{(t_l)}[\rchi']&=\hat U_{lk}\hats \rho_{\qs}pu^{(t_k)}[\rchi']
\end{align}
The action of the \text{\sz{CNOT}} \hsextsuperscriptz{$\rchi'^{\text{\sz{CNOT}} \hsext{\text{\sz{CNOT}} \hsiny th}}$} \sz CNOT\normalsizeO gate on the encountering states is treated with quantum channel technology. The native \sz CNOT\normalsizeO gate coupling qubits \text{\sz{CNOT}} \hsextsuperscriptz{$\small{\{i,j}\}$} is the following:
\braegin{equation} \leftarrowbelel{navCNOT}
\h{\mathds{C}}^{ij}_{\rchi}p =\h \Em_{\rchi}p\hatsh \h C^{ij}_x
\end{equation}
\braegin{figure}
\includegraphics[scale=0.1005]{arxivfigs/DecoheringAnnealingL.png}
\caption{The time evolution of the Fermi-Hubbard Model is computed numerically (solid). Depolarizing noise dynamics (circles) cause saturation with the \text{\sz{CNOT}} \hsext{\footnotesize ITS\small} (grey).
}
\leftarrowbelel{fig:nisqual}
\end{figure}
\text{\sz{CNOT}} \hsextsuperscriptz{$\h \Em_{\rchi}p$} is a superoperator describing the noise dynamics of the native gate. \text{\sz{CNOT}} \hsextsuperscriptz{$\h C^{ij}_xO$} is the ideal \sz CNOT\normalsizeO gate.
To treat the noise dynamics in a unitary fashion, a \text{\sz{CNOT}} \hsextit{Stinespring dilation} \cite{stinespring} is performed:
\braegin{equation}
\hatq\rightarrow\hatqpu, \ \ \h \Em_{\rchi}p\rightarrow \vecNavp \hats \hat \xi
\end{equation}
\text{\sz{CNOT}} \hsextsuperscriptz{$\hat \xi$} is a \text{\sz{CNOT}} \hsextit{unital homomorphism} that takes \text{\sz{CNOT}} \hsextsuperscriptz{$\hatq\hatsnh \rightarrow \hatqpu$}. \text{\sz{CNOT}} \hsextsuperscriptz{$\vecNavp$} is a unitary transformation acting on \text{\sz{CNOT}} \hsextsuperscriptz{$\hatqpu$}.
The action of \hatsh \text{\sz{CNOT}} \hsextsuperscriptz{$\h{\mathds{C}}^{ij}_{\rchi}p$} on the \text{\sz{CNOT}} \hsextsuperscriptz{$\SRaise{3pt}{k^{\text{\sz{CNOT}} \hsext{th}}}$} encountering state is as follows:
\braegin{equation}
\rho_{\qs}pu^{(t_k)}[\rchi'\small{+}1]=\vecNavp \hatsh \hatsh\h C^{ij}_x \hats \rho_{\qs}pu^{(t_k)}[\rchi']
\end{equation}
The expectation value of \text{\sz{CNOT}} \hsextsuperscriptz{$O_{\text{\tiny q}}$} is obtained by averaging the contributions of the encountering states:
\braegin{equation}\leftarrowbelel{ohaarsum}
\braegin{split}
\brak{O_{\text{\tiny q}}}&=\frac{1}{N_m}\sum_{k=1}^{N_m}\text{\sz{CNOT}} \hsext{Tr}_{\text{\tiny \qpu}}\Big[\Big\{\vecNavp \hatsh \hatsh\h C^{ij}_x \hats \rho_{\qs}pu^{(t_k)}[\rchi']\Big\} \hats O_{\text{\tiny q}}\Big] \\
&=\frac{1}{N_m}\sum_{k=1}^{N_m}\text{\sz{CNOT}} \hsext{Tr}_{\text{\tiny \qpu}}\Big[\Big\{\vecNavp \hatsh \hatsh\h C^{ij}_x \hats \hat U_{k1}\hatsh \rho_{\qs}pu^{(t_1)}[\rchi'] \Big\}\hats O_{\text{\tiny q}}\Big]\rightarrowisetag{3\braaselineskip}
\end{split}
\end{equation}
\noindent
In the second line, \text{\sz{CNOT}} \hsextsuperscriptz{$\rho_{\qs}pu^{(t_k)}[\rchi']$} is expressed in terms of an encountering transformation on \text{\sz{CNOT}} \hsextsuperscriptz{$\rho_{\qs}pu^{(t_1)}[\rchi']$}.
In the ideal limit, the target computation is applied identically for all cycles. This implies the following:
\braegin{equation}
\big[O_{\text{\tiny q}},U^{\text{\tiny{ideal}}}_{lk}\big]= 0
\end{equation}
\text{\sz{CNOT}} \hsextsuperscriptz{$U_{_{k1}}U^{\text{\sz{CNOT}} \hsext{\text{\sz{CNOT}} \hsextitny$\dotg$}}_{k1}$} is now inserted into \autoref{ohaarsum}:
\braegin{equation}\leftarrowbelel{ambientP}
\braegin{split}
\brak{O_{\text{\tiny q}}}=\frac{1}{N_m}\sum_{k=1}^{N_m}\text{\sz{CNOT}} \hsext{Tr}_{\text{\tiny \qpu}}\Big[\hatsh U^{\dotg}_{k1}\Big\{ \vecNavp \hatsh \hatsh\h C^{ij}_x \hats \hat U_{k1}\hatsh \rho_{\qs}pu^{(t_1)}[\rchi']\Big\} \hatsh O_{\text{\tiny q}} \hatsh \SDrop{3pt}{U_{k1}}\Big]\\
\text{\tiny app}rox\frac{1}{N_m}\sum_{k=1}^{N_m}\text{\sz{CNOT}} \hsext{Tr}_{\text{\tiny \qpu}}\Big[\hatsh U^{\dotg}_{k1}\Big\{ \hatsh \vecNavp \hatsh \SDrop{3pt}{\hat U_{k1}} \hats \h C^{ij}_x\hatsh \rho_{\qs}pu^{(t_1)}[\rchi']\Big\} \hats \SDrop{3pt}{U_{k1}} \hats O_{\text{\tiny q}} \Big]
\end{split}
\end{equation}
This allows \autoref{ambientP} to be expressed as follows:
\braegin{equation}\leftarrowbelel{Haarave}
\braegin{split}
\brak{O_{\text{\tiny q}}}&\text{\tiny app}rox\frac{1}{N_m}\sum_{k=1}^{N_m}\text{\sz{CNOT}} \hsext{Tr}_{\text{\tiny \qpu}}\Big[\hatsh \Big\{ \hat U^{\dotg}_{k1} \hatsh \vecNavp \hatsh\hats \SDrop{3pt}{\hat U_{k1}} \ \hatsh \h C^{ij}_x \hats \rho_{\qs}pu^{(t_1)}[\rchi']\Big\} \hats O_{\text{\tiny q}} \Big]
\end{split}
\end{equation}
Note the following identity \cite{gwnm1}:
\braegin{equation}\leftarrowbelel{eqFullTwirl}
\braegin{split}
\mathcal{E}^{\text{\sz{CNOT}} \hsext{\text{\sz{CNOT}} \hsextitny ave}} \rho &=\int dU \hats \hat U^{\dotg} \hatsh \hat \mathcal{E} \hatsh \hat U \hats \rho \\
&=(1-\epsilon)\hatsh \rho+\epsilon\hatsh \Ie_n
\end{split}
\end{equation}
Applying this relation yields the following:
\braegin{align}
\brak{O_{\text{\tiny q}}}&\sim \int dU \hats \text{\sz{CNOT}} \hsext{Tr}_{\text{\tiny \qpu}}\Big[\Big\{\hats \hat U^{\dotg} \hats \vecNavp \hats \hat U \ \h C^{ij}_x \rho_{\qs}pu^{(t_1)}[\rchi']\Big\} \hats O_{\text{\tiny q}}\Big] \notag \\[0.4em]
&=\hats \text{\sz{CNOT}} \hsext{Tr}_{\text{\tiny q}} \Big[ \Big\{(1-\epsilon_g) \hats \h C^{ij}_x \rho_{\qs}[\rchi']+\epsilon_g \hats \Ie_n \Big\} \hats O_{\text{\tiny q}}\Big]
\end{align}
The averaged noise dynamics of the \sz CNOT\normalsizeO gate approximate a global depolarizing channel with \text{\sz{CNOT}} \hsextit{global noise strength} \text{\sz{CNOT}} \hsextsuperscriptz{$\epsilon_g$}.
The noise dynamics of the \sz CNOT\normalsizeO gate can be modified using \text{\sz{CNOT}} \hsextit{noise tailoring} (\nablaTt) algorithms (\text{\tiny app}ref{appendix:Atail}).
\section{CLAssical White-noise Extrapolation}\leftarrowbelel{sec:CLAWEdius}
The objective of \text{\sz{CLAWE}} \hsfTO (\text{\sz{CLAWE}} \hsT) \cite{CLAWEPresent1}, is the extraction of ideal observables from their noisy counterparts. This extraction requires the noise dynamics to obey the global white-noise model.
\subsection{Model-Based Extrapolation}\leftarrowbelel{subs:mbe}
\text{\sz{CLAWE}} \hsTO is a \text{\sz{CNOT}} \hsextit{model-based extrapolation} algorithm. Model-based extrapolation \cite{mbextrap0,mbextrap1,mbextrap2,mbextrap3} can be represented schematically in three stages:
\braegin{enumerate}[I.]
\item \underlines{Modeling}: Find a suitable model that describes a class of systems \text{\sz{CNOT}} \hsextsuperscriptz{$\{\mathcal{P}_{\sigma}\}$}, using parameters \text{\sz{CNOT}} \hsextsuperscriptz{$\{\leftarrowmbda_{\alpha}\}$}. The model must relate accessible observables to target observables: $\{\brak{O^{\text{\tiny acc}}_{\mu}}\}\rightarrow \{\brak{O_{\nu}^{\text{\sz{CNOT}} \hsarg}}\}$.
\item \underlines{Calibration}: Determine the model parameters \text{\sz{CNOT}} \hsextsuperscriptz{$\{\leftarrowmbda_{\alpha}^{\text{\tiny exp}}\}$} for a system \text{\sz{CNOT}} \hsextsuperscriptz{$\mathcal{P}_{\text{\sz{CNOT}} \hsext{phys}}$}, by measuring calibration observables \text{\sz{CNOT}} \hsextsuperscriptz{$\{\brak{ O_{\gamma}^{\text{\sz{CNOT}} \hsext{\text{\sz{CNOT}} \hsextitny cal}}}\}$}.
\item \underlines{Extrapolation}: Use the model to estimate target observables of \text{\sz{CNOT}} \hsextsuperscriptz{$\mathcal{P}_{\text{\sz{CNOT}} \hsext{phys}}$}.
\end{enumerate}
\subsubsection{Modeling}\leftarrowbelel{ssc:param}
\underlines{\text{\sz{CNOT}} \hsextit{Model Inversion}}: It is possible to exactly invert the global white-noise model due to the \text{\sz{CNOT}} \hsextit{unitary invariance} of the depolarizing channel:
\braegin{equation}
\hat \cdotm_{\epsilon,n}\hatsh \hat U \hats \rho \hats =\hats \hat U \hats\hat \cdotm_{\epsilon,n}\hats \rho
\end{equation}
Consider a target computation of scalar depth \text{\sz{CNOT}} \hsextsuperscriptz{$\rchi$}: \text{\sz{CNOT}} \hsextsuperscriptz{$U_{_{\rchi}}$}. There are \text{\sz{CNOT}} \hsextsuperscriptz{$\rchi$} global depolarizing channels dressing the ideal gates, which can be moved to the end of the computation, such that they act on the perfect output state:
\braegin{equation}
\rho_{_{\hatsnh n}}= (1-\epsilon_g)^{\rchi}\hats \hatsh \SDrop{3pt}{\h U_{\hsnhh \Scale[0.6]{\rchi}}} \hatsh \rho+f(\epsilon_g,\rchi)\hats \inftye_n.
\end{equation}
This relation can be used to express a noisy observable in terms of its \text{\sz{CNOT}} \hsextit{infinite temperature value} \text{\sz{CNOT}} \hsextsuperscriptz{$\Omega_{ITS}=\text{\sz{CNOT}} \hsext{\normalsize{Tr}}[\hatsh \inftye_n\hatsh O]$}:
\braegin{equation}
\braegin{split}
\brak{O_{_{\hatsnh n}}}&=(1-\epsilon_g)^{\rchi} \ \Scale[1.1]{\text{\sz{CNOT}} \hsext{Tr}}\big [\hatsh \SDrop{3pt}{\h U_{\hsnhh \Scale[0.6]{\rchi}}} \hatshh \rho\hatsh \hatshh O\hatshh \big] +f(\epsilon_g,\rchi)\hats \Scale[1.1]{\text{\sz{CNOT}} \hsext{Tr}} \big[\hatsh\inftye_n O\hatshh\big] \\
&=(1-\epsilon_g)^{\rchi} \ \Scale[1.1]{\text{\sz{CNOT}} \hsext{Tr}} \big [\hatsh \rho \hatsh \hatshh \SDrop{3pt}{\h U_{\hsnhh \Scale[0.6]{\rchi}}}^{\hatsn \hatshh\dotg} \hatsnhh O \hatshh\big] +f(\epsilon_g,\rchi)\hats \Scale[1.1]{\text{\sz{CNOT}} \hsext{Tr}} \big[\hatsh\inftye_n O\hatshh\big]\\[0.4em]
&= (1-\epsilon_g)^{\rchi} \BraK{ \SDrop{3pt}{\h U_{\hsnhh \Scale[0.6]{\rchi}}}^{\hatsn \hatshh \dotg} O}+f(\epsilon_g,\rchi) \hats \Omega_{ITS}\\[0.4em]
&=(1-\epsilon_g)^{\rchi}\brak{\hatshh O_{\hatsnhh u}\hatshh}+f(\epsilon_g,\rchi) \hats \Omega_{ITS}
\end{split}
\end{equation}
Apply the geometric sum formula to \text{\sz{CNOT}} \hsextsuperscriptz{$f(\epsilon_g,\rchi)$} (\autoref{recursiveM}), to isolate the ideal observable \text{\sz{CNOT}} \hsextsuperscriptz{$\brak{O_u}$}:
\braegin{equation}
\braegin{split}
\brak{O_{_{\hatsn n}}}=(1-\epsilon_g)^{\rchi}&\brak{\hatshh O_{\hatsnhh u}\hatshh}+\big[1-(1-\epsilon_g)^{\rchi}\hatshh\big]\hats \Omega_{ITS} \\[0.6em]
\brak{O_{_{\hatsn n}}}-\Omega_{ITS}&=(1-\epsilon_g)^{\rchi}\hatsh \big[\hatsnhh \brak{\hatshh O_{\hatsnhh u}\hatshh}-\Omega_{ITS}\hatshh \big]
\end{split}
\end{equation}
To obtain a simple relation, the \text{\sz{CNOT}} \hsextit{rescaled observable} is defined \text{\sz{CNOT}} \hsextsuperscriptz{$\Omega\equivuiv O- \Omega_{ITS}\hatsnh \text{\sz{CNOT}} \hsextitmes \hatsnh \inftye_n$}:
\braegin{equation}\leftarrowbelel{claweinvert}
\brak{\Omega_n}=\SRaise{5pt}{(1-\epsilon_g)^{\hatshh \rchi}} \brak{\Omega_u}
\end{equation}
\subsubsection{Calibration}
A \text{\sz{CNOT}} \hsextit{calibrating unitary} is a secondary computation that mimics the noise dynamics of the primary computation. It must have a \text{\sz{CNOT}} \hsextit{calibrating observable}: a quantity whose ideal observable \text{\sz{CNOT}} \hsextsuperscriptz{$\brak{O^c_u}$} is known for a \text{\sz{CNOT}} \hsextit{calibration state} \text{\sz{CNOT}} \hsextsuperscriptz{$\rho_{_{\hatsnh c}}$}.
To obtain \text{\sz{CNOT}} \hsextsuperscriptz{$\brak{O^c_n}$}, the calibrating observable is measured after applying the calibrating unitary to \text{\sz{CNOT}} \hsextsuperscriptz{$\rho_{_{\hatsnh c}}$}. Taking the ratio of the noisy observable to the ideal observable after rescaling, yields the \text{\sz{CNOT}} \hsextit{contamination} \text{\sz{CNOT}} \hsextsuperscriptz{$\mathcal{C}\text{\sz{CNOT}} \hsext{\footnotesize ($\rchi_c$)}$}:
\braegin{equation}\leftarrowbelel{contamination}
\mathcal{C}\text{\sz{CNOT}} \hsext{\footnotesize ($\rchi_c$)}=\frac{\brak{\SRaise{4pt}{\Omega_n^{c}}}}{\brak{\SRaise{4pt}{{\Omega_u^{c}}}}}
\end{equation}
The \text{\sz{CNOT}} \hsextit{secondary global noise strength} is given in terms of the contamination:
\braegin{equation}\leftarrowbelel{epdet}
\epsilon^s_g=1-\SRaise{5pt}{\mathcal{C}\text{\sz{CNOT}} \hsext{\footnotesize ($\rchi_c$)}^{1/\rchi_c}}
\end{equation}
\subsubsection{Extrapolation}
The \text{\sz{CNOT}} \hsextit{ideal map} is the estimate of the ideal observable obtained from \text{\sz{CLAWE}} \hsT:
\braegin{align}
\brak{\SRaise{5pt}{\Omega^{\hatshh \text{\tiny map}}_{u}}}&=(1-\epsilon^s_g\hatsh \SRaise{5pt}{)^{\hatsnhh-\rchi}} \brak{\Omega_n} \leftarrowbelel{idealmap} \\[0.4em]
\brak{\SRaise{5pt}{\Omega^{\hatshh \text{\tiny map}}_{u}}}&=(1-\epsilon^s_g\hatsh \SRaise{5pt}{)^{\hatsnhh-\rchi}}\hatsh \hatshh \SRaise{5pt}{(1-\epsilon_g)^{\rchi}} \brak{\Omega_u}
\end{align}
The viability of \text{\sz{CLAWE}} \hsTO is determined by the ratio of the ideal map to the ideal observable:
\braegin{equation}
\frac{\brak{\SRaise{5pt}{\Omega^{\hatshh \text{\tiny map}}_{u}}}}{\brak{\Omega_u}}=\Scale[0.9]{\Bigg(}\frac{1-\epsilon_g}{1-\epsilon_g^s}\Scale[0.9]{\Bigg)}^{\hatshh \rchi}
\end{equation}
The ratio scales \text{\sz{CNOT}} \hsextit{super-polynomially} as the scalar depth increases. The ideal map becomes unstable beyond the \text{\sz{CNOT}} \hsextit{gate cutoff}: \text{\sz{CNOT}} \hsextsuperscriptz{$\rchi_{\text{\sz{CNOT}} \hsext{g}} \hats \text{\sz{CNOT}} \hsext{$\scriptstyle{\sim}$}\hats \mathcal{O}(1/\epsilon_g)$}. This comes as a result of the depolarizing channel's signal-to-noise problem.
\subsection{Calibration Algorithms}\leftarrowbelel{subs:calib}
In the following algorithms, \text{\sz{CNOT}} \hsextit{motion-reversal} (\text{\sz{CNOT}} \hsextsuperscriptz{$\hat U^{\dotg} \hat U$}) of the target computation is used as the calibrating unitary \cite{CLAWEPost0}.
\subsubsection{Variant I}
An implicit assumption of \autoref{claweinvert} is that \text{\sz{CNOT}} \hsextsuperscriptz{$\epsilon_g$} is relatively constant during the course of the computation. The \sz Variant I\normalsizeO calibration algorithm is designed to extract this constant, by applying motion-reversal in powers of the target computation (\autoref{fig:calibI}):
\braegin{equation}
\big\{\hats \hat U_{\rchi}^{\dotg k}\hats \hatsh \hat U_{\rchi}^{k} \hats \hatsh \big| \scalebox{0.9}{\hats \hatsh for $\forall$ \hats $k$, from $1$ to $N_c$}\big\} \hatsnh \hatsN \hatsN\hatsN
\end{equation}
\braegin{figure}
\includegraphics[scale=0.058]{arxivfigs/CalibrationTopIF.png}
\caption{\text{\sz{CNOT}} \hsextit{Variant I}: A series of noise-tailored, motion-reversal experiments is performed. Measuring the contamination generates estimates of \text{\sz{CNOT}} \hsextsuperscriptz{$\epsilon_g$}.}
\leftarrowbelel{fig:calibI}
\includegraphics[scale=0.039]{arxivfigs/CalibrationIIFlipE.png}
\caption{\text{\sz{CNOT}} \hsextit{Variant II}: [Upper panel] A target computation is partitioned into unitary fragments. A memory window (dashed) is used to generate the memory state.
[Lower panel] Applying motion-reversal to the memory state with \fsi{$U_4$} generates estimates of \text{\sz{CNOT}} \hsextsuperscriptz{$\epsilon_{g_4}$}.}
\leftarrowbelel{fig:calibII}
\end{figure}
\subsubsection{Variant II}
The \sz Variant II\normalsizeO calibration algorithm partitions the target computation into \text{\sz{CNOT}} \hsextit{unitary fragments} of scalar depth \text{\sz{CNOT}} \hsextsuperscriptz{$\{\rchi_i\}$} \cite{CLAWEPost0}:
\braegin{equation}
U_{\rchi}\rightarrow U_{\rchi_{N_p}} \hatsnh \cdots \hats \hatsh U_{\rchi_2} \hats U_{\rchi_{1}}
\end{equation}
Throughout a computation, \text{\sz{CNOT}} \hsextsuperscriptz{$\epsilon_g$} will modulate across the unitary fragments. This allows \text{\sz{CNOT}} \hsextsuperscriptz{$\epsilon_g$} to be modeled as a \text{\sz{CNOT}} \hsextit{global noise vector} \text{\sz{CNOT}} \hsextsuperscriptz{$\vec \epsilon_g=\{\epsilon_{g_1}, \hatsh ... \hats, \epsilon_{g_{N_p}}\}$}.
\underlines{\text{\sz{CNOT}} \hsextit{Memory Window}}: Calibrating the unitary fragments in a vacuum will not capture the true noise dynamics of \text{\sz{CNOT}} \hsextsuperscriptz{$U_{\rchi}$}. The qubits retain memory of past interactions with the environment. The noise dynamics of a unitary fragment depend on those of its predecessors.
Due to \text{\sz{CNOT}} \hsextit{quantum memory loss}, this dependence can be mimicked by a \text{\sz{CNOT}} \hsextit{memory window}: a portion of the unitary fragment's predecessors. Applying the memory window to the calibration state will imprint noise dynamics onto a \text{\sz{CNOT}} \hsextit{memory state} (\autoref{fig:calibII}).
After constructing the memory state, motion-reversal is performed to generate \text{\sz{CNOT}} \hsextsuperscriptz{$\epsilon^s_{g_s}$}. Repeating this procedure for every unitary fragment yields \text{\sz{CNOT}} \hsextsuperscriptz{$\vec {\epsilon_g^s}$}.
The ideal map is the following:
\braegin{equation}\leftarrowbelel{piecewise}
\brak{\SRaise{5pt}{\Omega^{\hatshh \text{\tiny map}}_{u}}}= (1-\epsilon^s_{g_1})^{-\rchi_1} ...\hats\hatsh (1-\epsilon^s_{g_{N_p}})^{-\rchi_{N_p}}\hats \brak{\Omega_n}
\end{equation}
\section{Hardware Applications}\leftarrowbelel{sec:IBMQ}
\text{\sz{CLAWE}} \hsTO and \text{\sz{CNOT}} \hsextit{Zero-Noise Extrapolation} (\text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhT) \cite{zeronoiseIII,zeronoise} are applied to two computations that lie squarely within the \text{\sz{CNOT}} \hsextit{perturbative noise regime} (\text{\sz{PNR}}\normalsize) \cite{PNR0}:
\braegin{equation}
\rchi_{\text{\sz{CNOT}} \hsext{\text{\sz{CNOT}} \hsextitny PNR}} \hatsh \slashedim \hats \hatsh \frac{n}{2} \hatsh \rchi_g
\end{equation}
\subsection{Quantum Simulation}
A sensible choice for a benchmark computation is one that is expected to exhibit a \text{\sz{CNOT}} \hsextit{quantum speedup}. Rigorizing computing advantages is a key concern of \text{\sz{CNOT}} \hsextit{computational complexity theory}, which aims to classify computational problems by their difficulty \cite{complexi,complexii,complexAaron0,complexAaron1}.
Postulated by Alan Cobham \cite{cobham} and Jack Edmonds \cite{edmonds}, \text{\sz{CNOT}} \hsextit{Cobham's thesis} states that feasible computations have known \hats \text{\sz{CNOT}} \hsextit{polynomial-time algorithms} (\partialasT) \cite{complexOne}. \partialasTO are run on either classical \cite{cturing0,cturing1,cturing2} or quantum \cite{qturing0,qturing1,qturing2} \text{\sz{CNOT}} \hsextit{Turing machines}. This distinction is used to organize feasible computations in \text{\sz{CNOT}} \hsextit{complexity classes}.
Classically feasible computations are placed in the class \text{\sz{CNOT}} \hsextit{bounded-error probabilistic polynomial time} (\brappT) \cite{complexThree}. Quantumly feasible computations are placed in the class \text{\sz{CNOT}} \hsextit{bounded-error quantum polynomial time} (\braqpT) \cite{complexFour}. Computations that exhibit quantum speedups are those \text{\sz{CNOT}} \hsextsuperscriptz{$ \in$} \braqpTO and \hatsnh \text{\sz{CNOT}} \hsext{ $\notin$} \brappTO \cite{qspeedII}.
\text{\sz{CNOT}} \hsextit{Local quantum simulation} is a computation thought to be \text{\sz{CNOT}} \hsext{$\notin$} \brappTO \cite{feynmansupremacy,complexTwo,completeIII,completeIV,completeI,completeII}. Calculating the time evolution of an \text{\sz{CNOT}} \hsextsuperscriptz{$n$}-qubit system involves multiplying \text{\sz{CNOT}} \hsextsuperscriptz{$\SRaise{4pt}{2^n}\text{\sz{CNOT}} \hsextitmes \SRaise{4pt}{2^n}$} matrices. Because classical algorithms manipulate matrix elements, computing the dynamics will take exponential time:\footnote{Some theories possess a poly($n$) representation in the low-entanglement regime, enabling efficient computation \cite{MPSI,MPSII,MPSIII,MPSIV,MPSV,MPSVI,DMRGI,DMRGII,DMRGIII,DMRGIV}.\\[0.01em]}
\braegin{equation}
\text{\sz{CNOT}} \hsextit{time-complexity} \hatsh \sim \hatsh \mathcal{O}(\SRaise{4pt}{2^{2n}})\footnote{Time-complexity is the amount of computer time required to run an algorithm. It is usually approximated by counting the number of elementary operations.}
\end{equation}
Seth Lloyd proved that local quantum simulation is \text{\sz{CNOT}} \hsextsuperscriptz{$ \in$} \braqpTO by deriving the \text{\sz{CNOT}} \hsextit{\sz{P}\nsz roduct \sz{F}\nsz ormula \sz{A}lgorithm\nszO} (\text{\sz{PFA}} \normalsize \hsT) \cite{complexTwo}. It is tailored to \text{\sz{CNOT}} \hsextit{\text{\sz{CNOT}} \hsextsuperscriptz{$k$}-local theories} \cite{interI}, which have interactions coupling \text{\sz{CNOT}} \hsextsuperscriptz{$\leq k$} qubits:
\braegin{equation}
H=\sum_{\sigma=1}^{N_i} \hatsh H_{\sigma}
\end{equation}
The \text{\sz{PFA}} \normalsize \hsTO \hats applies a \text{\sz{CNOT}} \hsextit{Trotter-Suzuki expansion} \cite{trotterI,trotterII,trotterIII} to the evolution operator:
\braegin{equation}\leftarrowbelel{pfaE}
\Scale[1.3]{e}^{^{\hatsnh -\Scale[1]{i H t}}}\text{\tiny app}rox \Bigg(\hatsh \prod_{\sigma=1}^{N_i} \hats \Scale[1.3]{e}^{^{\hatsnh -\Scale[1.02]{i H_{\sigma} t/n_t}}} \hatsh \Bigg)^{\hatsnh \Scale[1.02]{n_t}}
\end{equation}
Approximating the dynamics to accuracy \text{\sz{CNOT}} \hsextsuperscriptz{$\epsilon$} will take the following time:
\braegin{equation}
\text{\sz{CNOT}} \hsextit{time-complexity} \hatsh \sim \hatsh N_i \hatsh \SRaise{4pt}{4^k} \hats \hatsh \SRaise{4pt}{t^2}\big{/}\epsilon
\end{equation}
This will scale polynomially, provided \text{\sz{CNOT}} \hsextsuperscriptz{$N_i\sim \text{\sz{CNOT}} \hsext{poly}(n)$} and \text{\sz{CNOT}} \hsextsuperscriptz{$k\sim \text{\sz{CNOT}} \hsext{polylog}(n)$}. For such theories, the \text{\sz{PFA}} \normalsize \hsTO generates an exponential quantum speedup over classical approaches.
\subsection{Simulating the Fermi-Hubbard Model \\on a Quantum Computer}\leftarrowbelel{ssc:fhm}
The benchmark computations involve digital quantum simulation using the \text{\sz{PFA}} \normalsize \hsT.
\subsubsection{Simulation Prescription}\leftarrowbelel{ssc:adiab}
The benchmark computations require time-dependent quantum simulation of the \sz{F}\nsz ermi-\sz{H}\nsz ubbard \sz{M}odel\nsz:
\braegin{equation}\leftarrowbelel{Hrun}
H_{f}(t)=-h(t)\hats \Big\{\sigma_x^1+\sigma_x^2\Big\}\hats +\hats \frac{u(t)}{2}\hats \sigma_z^1\otimes\sigma_z^2
\end{equation}
h
The Hamiltonian becomes dimensionless when rescaled with \text{\sz{CNOT}} \hsextsuperscriptz{$h(t)$}. The dimensionless interaction is \text{\sz{CNOT}} \hsextsuperscriptz{$\text{\sz{CNOT}} \hsextitlde u(t)=u(t)/h(t)$}:
\braegin{equation}\leftarrowbel{Fhresc}
\text{\sz{CNOT}} \hsextitlde H_{f}(t)=-\Big\{\sigma_x^1+\sigma_x^2\Big\}\hats +\hats \frac{\text{\sz{CNOT}} \hsextitlde u(t)}{2}\hats \sigma_z^1\otimes\sigma_z^2
\end{equation}
The initial state is prepared with a pair of Hadamard gates (\autoref{fig:FullCirc}):
\braegin{equation}\leftarrowbelel{fermtb}
\Ket{\psi_{_\text{\sz{CNOT}} \hsext{init.}}}=\Bigg\{\hatsh\frac{\Ket{0}+\Ket{1}}{\sqrt{2}}\hatsh \Bigg\}\otimes\Bigg\{\hatsh \frac{\Ket{0}+\Ket{1}}{\sqrt{2}} \hatsh \Bigg\}
\end{equation}
h
\braegin{figure*}
\includegraphics[scale=0.125]{arxivfigs/QCircuitDiagC}
\caption{[Upper Panel] The PFA is used to perform quantum simulation of the Fermi-Hubbard Model. [Lower Right Panel]
The R\'{e}nyi \hsT entropy is computed using the Bell-Basis Algorithm.}
\leftarrowbelel{fig:FullCirc}
\end{figure*}
\subsubsection{Computation Parameters}\leftarrowbelel{ssc:nisqComp}
\underlines{\text{\sz{CNOT}} \hsextit{Theoretical Result}}: To compute the theoretical result, quantum simulation is performed numerically.
The digitization error is estimated by permuting terms in the \text{\sz{PFA}} \normalsize \hsT. Each \text{\sz{PFA}} \normalsize \hsTO step contains \text{\sz{CNOT}} \hsextsuperscriptz{$3$} unitaries, of which two mutually commute (\autoref{fig:FullCirc}). As such, there are \text{\sz{CNOT}} \hsextsuperscriptz{$\SRaise{3pt}{4^k}$} total permutations for the \text{\sz{CNOT}} \hsextsuperscriptz{$k^{\text{\sz{CNOT}} \hsext{th}}$} \text{\sz{PFA}} \normalsize \hsTO step.
\subsubsection{Electronic Overlap Dynamics}\leftarrowbelel{ssc:rtnisqC}
The presence of electrons occupying shared lattice sites is indicated by the \text{\sz{CNOT}} \hsextit{electronic overlap}:
\braegin{equation}\leftarrowbelel{EsOp}
E_o=\Ket{00}\hatsn\bra{00}+\Ket{11}\hatsn\bra{11}
\end{equation}
The electronic overlap is measured during quantum simulation of the \sz{F}\nsz ermi-\sz{H}\nsz ubbard \sz{M}odel\nsz.
{\centering \paragraph{NISQ Computation} ~\\}
h
\underlines{\text{\sz{CNOT}} \hsextit{QPU Interfacing}}: The IBMQ$_{\text{\sz{CNOT}} \hsext{VIGO}}$\hsTO is accessed via \text{\sz{CNOT}} \hsextit{\sz Q\nsz is\sz K\nsz it\nsz}, which enables preparation of quantum circuits within an intuitive framework \cite{QisKit}. Quantum circuits are packaged into a \text{\sz{CNOT}} \hsextit{job object}, and sent to the \text{\sz{QPU}} \normalsize \hsT. Each job object can contain up to \text{\sz{CNOT}} \hsextsuperscriptz{$75$} individual circuits.
\underlines{\text{\sz{CNOT}} \hsextit{Data Acquisition}}: The benchmark computation requires \text{\sz{CNOT}} \hsextsuperscriptz{$10$} quantum circuits. The circuits are evaluated with a single call to the IBMQ$_{\text{\sz{CNOT}} \hsext{VIGO}}$\hsT. A \text{\sz{CNOT}} \hsextit{bootstrap algorithm} \cite{bootstrapI,bootstrapII,bootstrapIII} is run on the measurements to generate the electronic overlap and its uncertainty.
{\centering \paragraph{ZNE Noise Mitigation} ~\\}\leftarrowbelel{ssc:znedcond}
h
\text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhTO is used to establish a performance baseline for \text{\sz{CLAWE}} \hsT.
\text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhTO is performed with a polynomial fit and a \text{\sz{CNOT}} \hsextit{Richardson extrapolation}.
In both approaches, errors are modulated using the \text{\sz{CNOT}} \hsextit{quartic-cycle noise amplification} (\text{\sz{QCNA}}\normalsize) prescription. \text{\sz{QCNA}}\normalsizeO amplifies the noise dynamics by injecting pairs of \sz CNOT\normalsizeO gates in four rounds of computation (\autoref{fig:ZNEdCondCalib}). In this work, a (\text{\sz{CNOT}} \hsextsuperscriptz{$\text{\sz{CNOT}} \hsextitmes 7$})-\text{\sz{QCNA}}\normalsizeO is utilized: \text{\sz{CNOT}} \hsextsuperscriptz{$\rchi\rightarrow 7\hatsh \rchi$}.
h
\underlines{\text{\sz{CNOT}} \hsextit{ZNE Viability}}: \text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhTO is designed to treat computations that remain within the \text{\sz{PNR}}\normalsizeO after error amplification is performed. Applying (\text{\sz{CNOT}} \hsextsuperscriptz{$\text{\sz{CNOT}} \hsextitmes 7$})-\text{\sz{QCNA}}\normalsizeO to the \text{\sz{PFA}} \normalsize \hsT-expansion probes noise dynamics outside of the \text{\sz{PNR}}\normalsizeO (\text{\sz{CNOT}} \hsextsuperscriptz{$\rchi\hatsnh :20\rightarrow 140$}):
\braegin{equation}\leftarrowbelel{eq:vigopnr}
\text{\sz{CNOT}} \hsext{\small IBMQ-Vigo:} \ \rchi_{\text{\sz{CNOT}} \hsext{\text{\sz{CNOT}} \hsextitny PNR}} \text{\tiny app}rox 111
\end{equation}
\noindent
As such, \text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhTO should reliably correct \text{\sz{CNOT}} \hsextsuperscriptz{$7/10$} time-steps.
\underlines{\text{\sz{CNOT}} \hsextit{Polynomial Fit}}: Performing \text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhTO with a third-order polynomial fit demonstrates theoretical agreement for \text{\sz{CNOT}} \hsextsuperscriptz{$2/10$} points (\autoref{fig:ZNEdCondPoly}).
\underlines{\text{\sz{CNOT}} \hsextit{Richardson Extrapolation}}: Performing \text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhTO with a second-order Richardson extrapolation demonstrates theoretical agreement for \text{\sz{CNOT}} \hsextsuperscriptz{$6/10$} points (\autoref{fig:ZNEdCondRichard}).
{\centering \paragraph{CLAWE Noise Mitigation} ~\\}\leftarrowbelel{ssc:clawecond}
h
\sz Variant I\normalsizeO and \sz Variant II\normalsizeO are applied to the electronic overlap computation.
\underlines{\text{\sz{CNOT}} \hsextit{Variant I}}: Performing \sz Variant I\normalsizeO demonstrates theoretical agreement for \text{\sz{CNOT}} \hsextsuperscriptz{$8/10$} points (\autoref{fig:CLAWECondI}).
\underlines{\text{\sz{CNOT}} \hsextit{Variant II}}: Performing \sz Variant II\normalsizeO demonstrates theoretical agreement for \text{\sz{CNOT}} \hsextsuperscriptz{$8/10$} points (\autoref{fig:CLAWECondII}).
\underlines{\text{\sz{CNOT}} \hsextit{Variant I Calibration}}: The global noise strength is used to perform extrapolation (\autoref{fig:CLAWEIEPG}).
\underlines{\text{\sz{CNOT}} \hsextit{Variant II Calibration}}: The global noise vector is used to perform extrapolation (\autoref{fig:CLAWEIIEPG}).
\subsubsection{R\'{e}nyi \hsT Entropy Dynamics}\leftarrowbelel{subs:rtimerenyi}
The \text{\sz{CNOT}} \hsextit{R\'{e}nyi \hsT entropy} is measured during quantum simulation of the \sz{F}\nsz ermi-\sz{H}\nsz ubbard \sz{M}odel\nsz.
{\centering \paragraph{R\'{e}nyi \hsT Entropy} ~\\}\leftarrowbelel{ssc:renyiBBA}
h
The Hilbert space of the \sz{F}\nsz ermi-\sz{H}\nsz ubbard \sz{M}odel\nszO is bipartite in the electron spin:
\braegin{equation}
\mathcal{H}=\mathcal{H}_{\uparrow}\otimes \mathcal{H}_{\dota}
\end{equation}
For a state \text{\sz{CNOT}} \hsextsuperscriptz{$\rho$}, the \text{\sz{CNOT}} \hsextit{reduced density matrix} for each electron spin species is obtained by applying a \text{\sz{CNOT}} \hsextit{partial trace}:
\braegin{align}
\rho_{\uparrow}=\text{\sz{CNOT}} \hsext{Tr}_{\dota}\big[\hatsh \rho\hatsh \big] \\[0.4em]
\rho_{\dota}=\text{\sz{CNOT}} \hsext{Tr}_{\uparrow}\big[\hatsh \rho\hatsh \big]
\end{align}
The R\'{e}nyi \hsT entropy of \text{\sz{CNOT}} \hsextsuperscriptz{$\rho_{\uparrow}$} is the following:
\braegin{align}\leftarrowbelel{eq:reyniDef}
S\hatshh(\rho_{\uparrow}) &=-\frac{1}{2}\hatsh \leftarrowmbdag{\Big\{ \hatsh \text{\sz{CNOT}} \hsext{Tr} \big(\hatsh \rho_{\uparrow}^2 \hatsh \big) \hatsh \Big\}}
\end{align}
{\centering \paragraph{NISQ Computation} ~\\}\leftarrowbelel{ssc:nisqRenyi}
h
The R\'{e}nyi \hsT entropy can be computed using the \text{\sz{CNOT}} \hsextit{Bell-Basis Algorithm} (\braaraT) \cite{reyniXI}.
\underlines{\text{\sz{CNOT}} \hsextit{Bell-Basis Algorithm}}: Quantum simulation is applied to two copies of the initial state. The quantum stage of the \braaraTO is applied using a \sz CNOT\normalsizeO gate between the spin-up qubits (\autoref{fig:FullCirc}).
\underlines{\text{\sz{CNOT}} \hsextit{Data Acquisition}}: The R\'{e}nyi \hsT entropy computation requires \text{\sz{CNOT}} \hsextsuperscriptz{$10$} quantum circuits, which are evaluated with a single call to the \sz IBMQ-Santiago\normalsize. A bootstrap algorithm is run to generate the R\'{e}nyi \hsT entropy and its uncertainty.
{\centering \paragraph{ZNE Noise Mitigation} ~\\}\leftarrowbelel{ssc:znedRenyi}
h
\text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhTO is applied to the R\'{e}nyi \hsT entropy computation.
\underlines{\text{\sz{CNOT}} \hsextit{Polynomial Fit}}: Performing \text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhTO with a third-order polynomial fit demonstrates theoretical agreement for \text{\sz{CNOT}} \hsextsuperscriptz{$1/10$} points (\autoref{fig:ZNEdRenyiPoly}).
h
\underlines{\text{\sz{CNOT}} \hsextit{Richardson Extrapolation}}: Performing \text{\sz{CNOT}} \hsext{\sz{$\text{\sz{CNOT}} \hsext{ZNE}$}} \normalsize \hsnh \hsnhh \hsnhhTO with a second-order Richardson extrapolation demonstrates theoretical agreement for \text{\sz{CNOT}} \hsextsuperscriptz{$4/10$} points (\autoref{fig:ZNEdRenyiRichard}).
{\centering \paragraph{CLAWE Noise Mitigation} ~\\}\leftarrowbelel{ssc:claweRenyi}
h
\sz Variant I\normalsizeO and \sz Variant II\normalsizeO are applied to the R\'{e}nyi \hsT entropy computation.
\underlines{\text{\sz{CNOT}} \hsextit{Variant I}}: Performing \sz Variant I\normalsizeO demonstrates theoretical agreement for \text{\sz{CNOT}} \hsextsuperscriptz{$3/10$} points (\autoref{fig:CLAWERenyiI}).
\underlines{\text{\sz{CNOT}} \hsextit{Variant II}}: Performing \sz Variant II\normalsizeO demonstrates theoretical agreement for \text{\sz{CNOT}} \hsextsuperscriptz{$7/10$} points (\autoref{fig:CLAWERenyiII}).
\section*{Appendix}
\subsection{Noise Tailoring Algorithms}\leftarrowbelel{appendix:Atail}
\text{\sz{CNOT}} \hsextit{Coarse-grained decoupling} \cite{PAREC,randomization,randcomp,randcompII} can be used to alter noise dynamics using gate-level control. Oliver Kern, Gernot Alber, and Dima Shepelyansky first demonstrated this using \text{\sz{CNOT}} \hsextit{Pauli Random Error Correction} (\sz PAREC\nsz) \cite{PAREC}.
In \sz PAREC\nsz, the \text{\sz{CNOT}} \hsextit{computational frame} is toggled during a computation by inserting randomized pairs of Pauli operations. This leaves the computation logically equivalent. Toggling the computational frame generates a \text{\sz{CNOT}} \hsextit{dynamical decoupling}-like effect without the need for rapid time-modulation \cite{DDI}.
The \nablaTto algorithm used in this work is \text{\sz{CNOT}} \hsextit{Randomized Compiling} (\sz RCo\nsz) \cite{randcomp}. \sz RCo\nszO applies coarse-grained decoupling across a sequence of circuits.
\braegin{figure}
\includegraphics[scale=0.18]{arxivfigs/ZNEAmpBaseA}
\caption{Error-amplified dynamics (gray), are extrapolated to the zero-noise solution.}
\leftarrowbelel{fig:ZNEdCondCalib}
\includegraphics[scale=0.18]{arxivfigs/ElectronicOverlapPolynomialBaseB}
\caption{The ZNE polynomial fit (red) is compared with the theoretical result (indigo) for the electronic overlap.}
\leftarrowbelel{fig:ZNEdCondPoly}
\includegraphics[scale=0.18]{arxivfigs/ElectronicOverlapRichardsonBaseB}
\caption{The ZNE Richardson extrapolation (golden) is compared with the theoretical result (indigo) for the electronic overlap.}
\leftarrowbelel{fig:ZNEdCondRichard}
\end{figure}
\rhead{}
\braegin{figure}
\includegraphics[scale=0.18]{arxivfigs/ElectronicOverlapVariantIBaseB}
\caption{Variant I (red) is compared with the theoretical result (indigo) for the electronic overlap.}
\leftarrowbelel{fig:CLAWECondI}
\setcounter{figure}{10}
\includegraphics[scale=0.18]{arxivfigs/VariantIDiagBaseB}
\caption{The global noise strength (red) is shown alongside its mean value (blue).}
\leftarrowbelel{fig:CLAWEIEPG}
\setcounter{figure}{12}
\includegraphics[scale=0.08]{arxivfigs/RenyiPolynomialBaseB}
\caption{The ZNE polynomial fit (red) is compared with the theoretical result (blue) for the R\'{e}nyi \hsT entropy.}
\leftarrowbelel{fig:ZNEdRenyiPoly}
\setcounter{figure}{14}
\includegraphics[scale=0.08]{arxivfigs/RenyiVariantIBaseB}
\caption{Variant I (red) is compared with the theoretical result (blue) for the R\'{e}nyi \hsT entropy.}
\leftarrowbelel{fig:CLAWERenyiI}
\end{figure}
\braegin{figure}
\setcounter{figure}{9}
\includegraphics[scale=0.18]{arxivfigs/ElectronicOverlapVariantIIBaseB}
\caption{Variant II (golden) is compared with the theoretical result (indigo) for the electronic overlap.}
\leftarrowbelel{fig:CLAWECondII}
\setcounter{figure}{11}
\includegraphics[scale=0.18]{arxivfigs/VariantIIDiagBaseB}
\caption{The global noise vector (purple) is shown alongside its mean value (blue).}
\leftarrowbelel{fig:CLAWEIIEPG}
\setcounter{figure}{13}
\includegraphics[scale=0.08]{arxivfigs/RenyiRichardsonBaseB}
\caption{The ZNE Richardson extrapolation (golden) is compared with the theoretical result (blue) for the R\'{e}nyi \hsT entropy.}
\leftarrowbelel{fig:ZNEdRenyiRichard}
\setcounter{figure}{15}
\includegraphics[scale=0.08]{arxivfigs/RenyiVariantIIBaseB}
\caption{Variant II (golden) is compared with the theoretical result (blue) for the R\'{e}nyi \hsT entropy.}
\leftarrowbelel{fig:CLAWERenyiII}
\end{figure}
\end{appendices}
\rhead{}
\renewcommand*{\braibfont}{\scriptsize}
\braibliography{CLAWE}
\end{document}
|
math
|
After the successful auction I reported yesterday… Well, seems that Cashquests’ inspiring blog by Kumiko Suzuki is gone… I logged into see what was happening after her blog was sold, and to my horror I found this ugly domain place holder. All other posts are now redirecting to that domain parking mess. Ugly as sin… I’m sure she must be shocked, too.
We’ll be checking back in seven days to see what is happening. I don’t see how with a top 5000 ranking on Technorati, a PR of 5, and a high Alexa ranking that giving up this blog can be a good thing… What are your thoughts? I’m sure you’ll miss her blog as much as I do… I know I’ll miss the traffic from that link she sold me!
Woops it’s back! Sorry for the false alarm… But still the new blog owner hasn’t posted anything. Even older comments… are still sitting in the blog’s comment queue.
|
english
|
हैलोवीन कार्टून चरित्र पृष्ठभूमि हैलोवीन कार्टून चरित्र हैलोवीन चांदनी हैलोवीन, चांदनी, हैलोवीन, चुड़ैल मुफ्त डाउनलोड के लिए पृष्ठभूमि छवि
हैलोवीन कार्टून चरित्र पृष्ठभूमि हैलोवीन कार्टून चरित्र हैलोवीन चांदनी हैलोवीन
पंगत्री > पृष्ठभूमि > हैलोवीन कार्टून चरित्र पृष्ठभूमि हैलोवीन कार्टून चरित्र हैलोवीन चांदनी हैलोवीन
पिछली छविताजा चित्रित वसंत क्षेत्र पथ चित्रण पृष्ठभूमि डिजाइन
अगली छविवसंत वन पथ चित्रण पृष्ठभूमि डिजाइन
चांदनी हैलोवीन चुड़ैल कद्दू हैलोवीन कार्टून का पोस्टर हैलोवीन हैलोवीन कार्टून चरित्र पृष्ठभूमि आदमी बच्चे भूत चरित्र हैलोवीन पेड़
हेलोवीन पोस्टर में बिक्री के लिए हाथ निकालके शैली में भूत के साथ
हेलोवीन पोस्टर सामग्री
कुंडल छाप प्यारा पालतू श्रृंखला चाँदनी बिल्ली चित्रण पोस्टर
डिजाइन एक पोस्टर के साथ कार्टून अक्षर डोनट्स
सुंदर हेलोवीन ड्रेकुला चरित्र
प्यारी मम्मी हेलोवीन चरित्र
हेलोवीन पोस्टर में हाथ से तैयार की शैली के साथ नृत्य कंकाल में काले और सोने के रंग
|
hindi
|
سیٹھاہ اِمکان چھُ زِ جیری روزن چھُ کابارُک مٲلِکھ
|
kashmiri
|
<?php
header( 'Access-Control-Allow-Origin: *' );
header( "Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}" );
$get = filter_input( INPUT_GET , 'name', FILTER_SANITIZE_STRING );
$post = filter_input( INPUT_POST, 'name', FILTER_SANITIZE_STRING );
$name = 'World';
if ( isset( $get ) ) $name = $get ;
if ( isset( $post ) ) $name = $post;
$response = 'Hello, ' . $name . '!';
$callback = filter_input( INPUT_GET, 'callback', FILTER_SANITIZE_STRING );
if ( isset( $callback ) ) $response = $callback . '("' . $response . '");';
echo $response;
?>
|
code
|
Holdings: Cyder-maker's instructor, sweet-maker's assistant and victualler's and housekeeper's director.
Early American imprints. no. 9085.
|
english
|
Royal-Athena Galleries, Art of the Ancient World, vol. XIX (2008), p. 34, n°67. Pair of bronze busts, 12,5 cm high. Antinous, holding a scallop-shell tray and depicted with particularly abundant hair, probably adorned a lectica, a portable bed, popular mode of transportation for the well-to-do. Very rare as a pair. See also Hermitage, V.866-867.
St. Petersburg, Eremitage, Inv. N° V866 and 867. Two bronze weights.
Museo Archeologico Aquileia, First Floor-Room VI. After 130 A.D. The cult of Antinous is attested by two brick-tiles "plachette" with his portrait, probably ex-vota. The Greek legend says: "His homeland [worships] God Antinoos", clearly meaning Bytinion, now Bolu in Turkey, were he was born.
Private collection. Bronze, 10 cm high. Provenance unknown. Comparable to the two bronze weights of the Eremitage, here above.
Bronze statuette dated end of 17th century. Its head and its pose are loosely inspired by the Farnese Antinous, at that time kept in the Palazzo Farnese at Rome. Height: 19.6 cm. Berlin, Antikensammlung, Inv. N° Y.1459. Recently (2005) exhibited for the first time in the frame of the exhibition Antinoos, Geliebter und Gott, held at the Pergamon Museum, Berlin.
Bronze statuette dated end 1900, reproducing truthfully the Antinous Farnese. Height : 66 cm. Private collection. Recently (2005) exhibited in the frame of the exhibition Antinoos, Geliebter und Gott, held at the Pergamon Museum, Berlin.
Cambridge, Fitzwilliam Museum. A pair of statues representing Osiris-Antinous, probably Italian or French, ca. 1790-1820. Tin-glazed earthenware, 117.5 cm high. Bequeathed by J.W.L. Glaisher in 1928. Accession Number C.2388A-1928 and C.2388B-1928.
Berlin, Antikensammlung, Inv. 1988,4. Balsamarium Temporarily displayed in 2004 in the Altes Museum. Acquired in 1984 on the London art market. Original provenance unknown. Bronze, 20.3 cm high. During the last years of the reign of Hadrian, and probably for a certain time afterwards, a large number of such popular artefacts were produced throughout the empire, to meet an obvious demand. Nowadays, about 20 balsamariums portraying Antinous have already been discovered and are now preserved in Museums and collections all over Europe.
Belgrade City Museum, Balsamarium, Inv. N° AA/2498, no further information.
Denia (Spain), Museo archeológico. Balsamarium, considered to be a head of the god Mercury (because of the winglets), but also undeniably comparable to the "Antinous type". The balsamarium of Denia was created in Hadrians time. The slight inclination of the head and the melancholic look relate it to Antinous. It was found in a Roman house close to the port of Denia, the Roman Dianium.
Munich, Staatliche Antikensammlungen. Inv. N° SL.30, exhibited in Room IX, showcase 12. Balsamarium, formerly in the Loeb collection.
Varna (Bulgaria). Archaeological Museum. Balsamarium representing unequivocally Antinous.
Royal-Athena Galleries, Art of the Ancient World, vol. XIX (2008), p. 35, n°68. Balsamarium, 11,8 cm high. Balsamaria are numerous indeed and Antinous seems to have been often represented. The hair is particularly refined and, particular feature, the neck is scored to receive an inlaid necklace.
Private collection. Known as the "Marlborough Gem", after a previous owner, the House of Marlborough, who kept it from 1761 to 1875. The gem is mentioned for the first time in Venice in 1740, in the collection of A.M. Zanetti [1689-1767]. It can be traced as early as 1720, but it is not known in which hands it was at that time, or where it was found. «Le fameux amateur, et un peu marchand d’antiques à Venise, Antonio Maria Zanetti – je ne sçais s’il vit encore – fit une fois vingt-trois ans l’amour à un Antinoüs (une antique dont il fit l’acquisition), qu’il épousa enfin. Il auroit, disoit-il, vendu sa maison pour l’acheter, s’il eût été parfait.» (Pierre Clément, 1756). In 1761, it was bought from Zanetti by George Spencer, 4th Duke of Marlborough [1739-1817]. It was auctioned severaltimes since the end of the 19th century: in 1875, 1899, 1909, 1952, finally 1999, which brought it back to England. It is now in the possession of an anonymous collector. The first photo shows the antique piece, which was restored and supplemented in gold before 1740. The second photo shows a plaster cast of the intaglio. The third one is an impression of it, made by Story-Maskelyne when he catalogued the Marlborough collection. The gem has been copied frequently, most notably by the engraver Edward Burch (signed Burch F[ecit]), commissioned by the Duke of Marlborough himself and now also in a private collection (the fourth picture). Photos 1, 3 and 4 are under copyright of Dr. Claudia Wagner of the Beazley Archive, Oxford (http://www.beazley.ox.ac.uk/gems/marlborough/), who has kindly put them at our disposal to be published in our collection. «De tous les objets encore présents aujourd'hui à la surface de la terre, c'est le seul dont on puisse présumer avec quelque certitude qu'il a souvent été tenu entre les mains d'Hadrien» (Marguerite Yourcenar, 1951).
Florence, Museo Archeologico, Room B, Case n°7, n°256. Antique cameo of Antinous, set in a golden frame in modern times.
London, Sir John Soanes Museum, Inv. N° DS.213 (V.855). Antique cameo. Exhibited in the "Link Passage".
Paris, Bibliothèque Nationale, Cabinet des médailles. Sardony cameo, antique. Catalogue Babelon n° 238. Picture : Marie-Lan Nguyen (Jastrow).
London, British Museum, Room 47, Showcase 4. Large cameo inspired by the Antinous Braschi (Vatican). Bequeathed to the British Museum in 1978 by Professor John and Mrs Anne Hull Grundy. Engraved Girometti in bold capitals for Giuseppe Girometti (1779-1851) or Pietro Girometti (1811-1859).
JP Getty Foundation. 18th century intaglio, signed "Pichler", probably Giovanni (1734-1791). Bust of Antinous inspired by the most famous Albani relief, to satisfy the insatiable demand from Grand Tourists.
St Petersbourg, Eremitage, Inv. N° K.5093. Quite faithfull reproduction, as a cameo, of the celebrated intaglio named "Marlborough gem". Carved in Italy by an unknown engraver in the 2nd half of the 18th century. Acquired by the Eremitage at the end of the 18th century.
St Petersbourg, Eremitage, Inv. N° I.9666. Intaglio carved in Italy in the 2nd half of the 18th century by an unknown engraver. Acquired by the Eremitage at the end of the 18th century.
St Petersbourg, Eremitage, Inv. N° K.3425. Cameo carved in Italy in the 2nd half of the 18th century by an unknown engraver who rendered the features of Antinous rather freely, especially the hair. Acquired by the Eremitage at the beginning of the 19th century.
Vatican, Library of the Museo Profano. Cameo depicting the Antinous Braschi, signed Girometti. Acquired by Gregory XVI in 1845. This cameo, large in scale and in high relief, could be due to Pietro Girometti (1812-1859), son of Giuseppe Girometti (1779/80 1851).
Cameo dated ca. 1880, representing the Antinous Braschi. Approximate size: 44 x 39 mm. Private collection.
Large cameo, 66 x 55 mm, set in an ivory frame, dated ca. 1880 and depicting the Antinous Braschi. Private collection.
Private collection. Cameo mounted in a 40 x 32 cm brooch, dated ca. 1880, inspired by the Antinous Braschi, most popular subject for art collectors during the second half of the 19th century.
Large Italian cameo representing Antinous, set in an elaborate golden frame of overall dimensions 56 mm x 46mm. Dated ca. mid-1840, it is one of the first cameos to have been prompted by the Antinous Braschi. Private collection.
Cameo, 8.2 x 5.6 cm, probably 18th century. Former collection Roger Peyrefitte (1907-2000), Paris.
Private collection. Sardonix cameo depicting Antinous Braschi, dated mid 19th century, set in an exquisite gold frame. 1 7/8" by 1 5/8".
Private collection. Vitreous paste intaglio inserted in a gold setting, 25 x 35 mm. Free and accurate representation of Antinous. .
19th century intaglio, inspired by the Capitoline Antinous, subsequently set in a ring. Private collection. Approximate dimensions : 18 x 14 mm.
Cambridge, Fitzwilliam Museum. Medallion of Antinous, by Wedgwood & Bentley. Pale bluish-grey jasper with white relief, 5.5 cm x 4.5 cm, ca. 1775-1780. The 1779 Catalogue of cameos, etc., by Wedgwood & Bentley, already listed this type of cameo, inspired by the Marlborough gem. The particular cameo illustrated here was bequeathed to the Fitzwilliam Museum in 1960, by Clarke, Louis Colville Gray. Accession Number C.106-1961.
|
english
|
ऋषभ उवाच: || निरंकुशा: हि कवय: ||
कवियों की खीझ युगों पुरानी है.कवि जब अपने पाठक या श्रोता से असंतुष्ट होता है तो अपनी और कविता की स्वायत्तता के नारे लगाने लगता है..मुझे न मंच चाहिए, न प्रपंच , न सरपंच - इससे कवि के आत्म दर्प का पता चलता है. इसके बावजूद इस तथ्य को नहीं नकारा जा सकता कि कविता मूलतः संप्रेषण व्यापार तथा भाषिक कला है. संप्रेषण व्यापार के रूप में उसे गृहीता की आवश्यकता होती है तथा शाब्दिक कला के रूप में उसका लक्ष्य सौन्दर्य विधान है. इसलिए और कोई हो न हो ,पाठक कविता का सरपंच है.सहृदय के बिना साधारणीकरण की प्रक्रिया सम्भव नहीं और साधारणीकरण के बिना रस विमर्श अधूरा है.यों,पाठक रूपी सरपंच की उपेक्षा करके एकालाप तो किया जा सकता है, काव्य सृजन जैसी सामाजिक गतिविधि सम्भव नहीं. शायद इसीलिये कविगण समानधर्मा ,तत्वाभिनिवेशी और सहृदय पाठक के लिए युगों प्रतीक्षा करने को तैयार रहते हैं और अरसिक पाठक के समक्ष काव्य पाठ को नारकीय यातना मानते हैं........अरसिकेषु कवित्त निवेदनं ,शिरसि मा लिख मा लिख मा लिख!
स्मरणीय है कि भारतीय चिंतन वाक्- केंद्रित चिंतन है. शब्द को यहाँ ब्रह्म माना गया है और शब्द के अपव्यय को पाप. इसलिए यहाँ वाक्-संयम की बड़ी महिमा रही है.वाक्-संयम की दृष्टि से ही छंद विधान सामने आता है. अन्यथा यह किसी से छिपा नहीं है कि छंद न तो कविता का पर्याय है न प्राण.हाँ, पंख अवश्य है . और यह आवश्यक नहीं कि कविता पंख वाली ही हो. पर यह भी ध्यान रखना होगा कि भले ही वह उडे नहीं ,पर जड़ न हो. इसीलिये छंद न सही,गति, यति और प्रवाह तो हो. और निस्संदेह कविता की गति ,यति और प्रवाह के नियम ठीक ठीक वे नहीं हो सकते जो गद्य के होते हैं. इसलिए गद्यकविता भी अंततः कविता होती है गद्य नहीं. यदि रचनाकार अपनी रचना को गद्य से अलगा नहीं सकता, तो उसे कवि का विरुद धारण नहीं करना चाहिए.
गेयता या संगीत कविता की अतिरिक्त विशेषताएँ हैं, अनिवार्यता नहीं. बल्कि कवि की भाषिक कला की कसौटी यह है कि वह अपने अभिप्रेत विषय, विचार या भाव को किस प्रकार एक सौन्दर्यात्मक कृतित्व का रूप प्रदान करता है..सटीक और सोद्देश्य शब्द चयन तथा उसकी आकर्षक प्रस्तुति की प्रविधि की भिन्नता ही किसी कवि के वैशिष्ट्य की परिचायक होती है. यही कारण है कि भारतीय काव्य चिंतन के ६ में से ४ सम्प्रदाय भाषा पर अधिक बल देते हैं और ध्वनि काव्य को सर्व श्रेष्ठ काव्य माना जाता है. कवि शब्द शिल्पी है, इसलिए उसे जागरूकता पूर्वक कृति का शिल्पायन करना ही चाहिए. निस्संदेह इसके लिए अनुभव भी चाहिए और अध्ययन भी. दोनों ही जितने व्यापक होंगे, कविता भी उतनी ही व्यापक होगी. कवि को युग और क्षण को भी पकड़ना होता है और परम्परा को भी सहेज कर उसमें कुछ नया जोड़ना होता है. ऐसा करके ही वह ज्ञान के रिक्थ के प्रति अपना दायित्व निभा सकता है. परन्तु इसका यह अर्थ कदापि नहीं है कि कवित्व किसी प्रकार के गुरुडम का मोहताज है. कदापि नहीं. बल्कि सच तो यह है कि कवि निरंकुश होते हैं. गुरुडम के बल पर अखाडे चलाये जा सकते हैं,कविता नहीं की जा सकती .इसीलिये जिस युग या भाषा की कविता गुरुडम की शिकार हो जाती है, उसमें धीरेधीरे वैविध्य और जीवन्तता समाप्त हो जाती है तथा सारी कविता एक सांचे में ढली प्रतीत होने लगती है. दुहराव से ग्रस्त ऐसी कविता सौंदर्य खो देती है, क्योंकि सौंदर्य तो क्षण-क्षण नवीनता से ही उपजता है.
प्रस्तुतकर्ता ऋषभ देव शर्मा पर ११:०७:०० प्म
|
hindi
|
Faststone Capture crosshairs can be moved pixel by pixel using left, right, up, down arrows to start position of selection.
Enter then fixes the start followed by arrows to end of selection followed by Enter to complete selection.
Could this very easy accurate selection facility be added please.
What do people use pinta for?
I think this refers to being able to create selections using the keyboard.
|
english
|
نور خان چھِ اَکھ پاکِستٲنؠ اَداکارہ یۄس فِلمَن مَنٛز چھِ کٲم کَران۔
زٲتی زِندگی
فِلمی دور
== حَوالہٕ ==
|
kashmiri
|
St. Michael's Economics Professors Receive a "Manifesto"
...the same document was found published on multiple Web sites under thetitle of the True Cost Economics Manifesto, part of a campaign featuredon www.adbusters.org. The campaign, which began prior to 2005, invitesreaders to sign the manifesto and take part in True Cost Economics, aconcept aiming to create a “new economic paradigm,” according toadbusters.org.
Intriguing! Check out the article and read the letter. It sure does sound angry. And a bit deranged.
The Defender quotes department chair Reza Ramazani as being "100 percent sure" that this wasn't the work of a St. Michael's student. Though I haven't taken an economics course during my time at St. Mike's, based on what I've heard from those who have, it's a fairly progressive department with intelligent faculty. And other faculty members at the school have high praise for their economics colleagues, especially Ramazani. In short, our economics department are hardly the people responsible for a tanking world economy and environmental degradation.
Lastly, it sure does strike me as lazy activism to simply print out a fewcopies of a letter. Can't these leftist revolutionaries atleast come up with manifestos in their own words? Is that too much toask? This guy should've taken lessons from the Forest Crimes Unit overat UVM, and figured out innovative use of toilets or something. Nowthat's a protest.
Tyler Machado was the digital media manager at Seven Days. He mostly worked behind the scenes making sure the website, email newsletters and social media feeds stayed in tip-top shape.
|
english
|
ناوُت چُھ سُہ لفٕظ یُس زَن ناو چُھ کٲنسہِ شخصہٕ سُنٛد، جایِہ ہُنٛد، چیٖزُک یا کُنہِ
خوٗبی ہُنٛد۔
== حوالہٕ ==
|
kashmiri
|
بٔہ تہِ چھُسَن یہِ زنانہٕ وُچھِنۍ یژھان
|
kashmiri
|
\begin{document}
\begin{abstract}
Although the role of the electron paramagnetic resonance (EPR) g-tensor and
hyperfine coupling tensor in the EPR effective spin Hamiltonian is discussed
extensively in many textbooks, certain aspects of the theory are missing. In
this text we will cover those gaps and thus provide a comprehensive theory
about the existence of principal axes of the EPR tensors. However, an important
observation is that both g- and a-tensors have two sets of principal axes---one
in the real and one in the fictitious spin space---and, in fact, are not
tensors. Moreover, we present arguments based on the group theory why only
eigenvalues of the G-tensor, $\mb{G} = \mb{g}\mb{g}^{\!\mathsf{T}}$, and the
sign of the determinant of the g-tensor are observable quantities (an
analogical situation also holds for the hyperfine coupling tensor). We keep the
number of assumptions to a minimum and thus the theory is applicable in the
framework of the Dirac--Coulomb--Breit Hamiltonian and for any spatial symmetry
of the system.
\end{abstract}
\section{Notation}
\label{sec:notation}
In this work we employ the Hartree system of atomic units, so for example the
Bohr magneton has the value $\tfrac{1}{2c}$, where $c$ represents the speed of
light. Furthermore, we assume summation over repeated indices; however, this
rule may be broken in certain instances: for example, when writing the
eigenvalue equation $\mb{A}\mb{C}_k=e_k\mb{C}_k$, then $k$ is not a summation
index. Such cases can be recognized by the same index appearing on both side of
the equation. Nevertheless, in cases where the violation of the summation rule
is not obvious, we state explicitly which indices are not summed over. Also in
this work the symbols $\mc{R}$ and $\mc{I}$ represent the real and imaginary
part of a complex number, respectively. Finally, variables in bold font
represent either matrices or vectors whose dimension is apparent from the text.
\section{Introduction}
\label{sec:introduction}
The main aim of this work is to find the principal axis of the g-tensor with no
loose ends, {\it i.e.} all assumptions must be stated and all statements proven.
We will not specify the level of theory for the Hamiltonians and wavefunctions,
in order to make the discussion as general as possible. We make only these two
assumptions:
\begin{enumerate}
\item
The Hamiltonian is time-reversal symmetric in the absence of magnetic fields,
and the Hamiltonian responsible for the interaction with magnetic field is
time-reversal antisymmetric.
\item
The quantum-mechanical (qm) Hamiltonian, expressed in a subspace of
orthonormal wavefunctions (populated states), can be fully mapped to an
effective spin Hamiltonian of the form
\begin{equation}
\label{eq:eff:gt}
\mb{H}^\mr{qm} \overset{!}{=} \mb{H}^\mr{eff} = \frac{1}{2c} B_u g_{uv} \mb{S}_v.
\end{equation}
\end{enumerate}
The first of these assumptions holds, and makes the following discussion valid,
for the Dirac--Coulomb--Breit (DCB) Hamiltonian and any approximate theory that
can be derived from it. The discussion is thus appropriate for the vast
majority of {\it ab initio} quantum chemical methods in use at the present
time. The second assumption is warranted only for systems with negligible
zero-field splitting (ZFS), or for doublet systems where ZFS vanishes. In
addition, under assumption 1, the effective spin Hamiltonian in
eq~\eqref{eq:eff:gt} completely describes the field-dependent part of
$\mb{H}^\mr{qm}$ only up to triplet multiplicity. For systems with higher
multiplicities, eq~\eqref{eq:eff:gt} is valid only if higher than linear
spin--orbit effects are negligible (the so-called weak spin-orbit limit). It
is therefore only for systems with doublet multiplicity that point 2 holds for
{\it any} strength and order of relativistic effects. As a result of this, and
because every element of the SU$(2)$ group can be expressed using the
exponential parametrisation presented in eq~\eqref{eq:USn} with
$\vec{\mb{S}}=\tfrac{1}{2}\vec{\bs{\sigma}}$, the doublet case is fully
described by the theory discussed in this work. For a more detailed discussion
on the validity of eq~\eqref{eq:eff:gt} see ref~\citenum{Griffith:1960:spinH}.
Finally, note that because the operator associated with the magnetic moment of
the nucleus is time-reversal antisymmetric, the following discussion is also
valid for the hyperfine coupling tensor.
In the rest of this section we will focus on the theory behind the effective
spin Hamiltonian. In the general case, the system in the presence of the
magnetic field is fully described by the many-electron Hamiltonian and its
eigenspectrum ($k$ is not a summation index)
\begin{gather} \label{HPsiEPsi}
\left( H^0 + H^Z \right) \Psi_k = \mc{E}_k \Psi_k.
\end{gather}
Here $H^0$ is the perturbation-free Hamiltonian and $H^Z$ represents the
Hamiltonian responsible for the interaction of the system with the magnetic
field $\vec B$. In the following discussion we will assume that the solution
of the eigenproblem for the system in the absence of an external perturbation
is known ($k$ is not a summation index)
\begin{gather} \label{eigen:H0}
H^0 \Phi_k = E_k \Phi_k.
\end{gather}
The eigenfunctions $\Phi_k$ of the Hamiltonian $H^0$ form an orthonormal
complete basis in the corresponding Hilbert space, so it is convenient to
express the unknown wavefunctions $\Psi_k$ in the basis of those
eigenfunctions. Finding the approximate solution of the eigenproblem
\eqref{HPsiEPsi} then amounts to constructing the perturbation operator $H^Z$
in the truncated basis of perturbation-free wavefunctions $\Phi_k$ and solving
the following eigenproblem (see Appendix \ref{app:diag})
\begin{gather} \label{eigen:mat}
\left( \mb{E} + \mb{H}^Z \right) \mb{C} = \mb{C} \bs{\mc{E}},
\\
\label{eigen:mat2}
\left(H^Z\right)_{mn} = \big< \Phi_m \big| H^Z \big| \Phi_n \big>,
\qquad
\Psi_k = C_{nk} \Phi_n,
\\
\label{eigen:mat3}
E_{mn} = E_m \delta_{mn},
\qquad
\mc{E}_{mn} = \mc{E}_m \delta_{mn},
\end{gather}
where the summation convention is not applied in eq~\eqref{eigen:mat3}.
The basic idea of the effective spin Hamiltonian is to properly describe the
lowest energy levels of the system under study, $\mc{E}_m$, in
eq~\eqref{eigen:mat}. For this purpose one must find a suitable basis,
$\Phi_n$ in eq~\eqref{eigen:mat2}, onto which to project the many-electron qm
Hamiltonian $H^\mr{qm}$. Note that the basis may be formed by the
eigenfunctions $\Phi_n$, or any unitary linear combinations of them---in which
case the matrix $\mb{E}$ in eq~\eqref{eigen:mat} is not diagonal. The target
energy levels are then calculated as eigenvalues of the resulting matrix,
$\mb{H}^\mr{qm}=\mb{E} + \mb{H}^Z$. The role of the effective spin Hamiltonian
is then to parametrize that matrix:
\begin{gather}
\label{qm-to-eff}
\mb{H}^\mr{qm} \overset{!}{=} \mb{H}^\mr{eff},
\end{gather}
wherein the g-tensor---and possibly D-tensor and A-tensor---plays the role of
the expansion coefficients, and the matrices $\mb{S}_v$ that of the basis
elements. The energy levels that one needs to properly describe an EPR
experiment are usually determined by the population---{\it i.e.} the states
that are thermally populated in eq~\eqref{HPsiEPsi}---while the basis,
$\Phi_n$, in which the qm Hamiltonian may be expressed is determined by the
energy differences between the populated energy levels and the energies
$E_n$---thus one may discard basis functions $\Phi_n$ that have large energy
differences. In cases where the nonrelativistic ground-state multiplet is well
separated from the excited states---the usual case for transition metal
complexes---the number of basis functions and of populated states is the same.
On the other hand, if the energy spectrum of the studied systems does not have
a large gap between populated states and other excited states---which is often
the case in systems containing Lanthanides or Actinides---the number of basis
functions should be larger than the number of populated states.
Finally note that some of the theory presented in this work can be found in
refs~\citenum{Messiah-book, Abragam1970, Chibotaru:2013:spinH}.
\section{Construction of the projected Zeeman Hamiltonian}
\label{sec:gt:construct}
Although the theory discussed in this section is applicable for any
multiplicity of the fictitious spin---under the assumptions given in
section~\ref{sec:introduction}---we will demonstrate various aspects of the
theory using the doublet case as an example.
Equation~\eqref{eq:eff:gt} represents the mapping of the projected Zeeman
Hamiltonian $\mb{H}^\mr{qm}$ to a fictitious (effective) spin space, where the
matrices $\vec{\mb{S}}$ are fictitious spin operators $\vec{S}$ projected on
the fictitious spin basis $\left|S,M\right>$, with $S$ being the fictitious
spin and $M=-S, (-S+1), \dots, S$. Here we have repeated the word "fictitious"
a little too much, but we want to leave no doubt that when talking about the
spin in this work we refer to the fictitious (effective) spin and not to the
real spin of the system. In many cases the multiplicity of the effective spin
Hamiltonian, $m=2S+1$, corresponds to the spin multiplicity of the
nonrelativistic ground state of the studied system before it is split by the
spin-orbit interaction. However, in the general case, $m$ represents the
dimension of $\mb{H}^\mr{qm}$, {\it i.e.} the number of states that are
included in the effective spin Hamiltonian. One example where the dimension of
the matrices might not correspond to the multiplicity of the nonrelativistic
ground state is a system where the EPR effective spin Hamiltonian describes a
doubly-degenerate ground state and a doubly-degenerate excited state. This
scenario might arise as a zero-field-split nonrelativistic quartet ground state
or it might originate from a doublet ground state with a low-lying doublet
excited state. Anyhow, both scenarios are described by the fictitious spin
$S=\tfrac{3}{2}$. To avoid possible confusion, note that whenever we refer to
the multiplicity of a system ({\it e.g.} a doublet case or a triplet system),
we refer to the number of states that are described by the effective spin
Hamiltonian, rather than to the spin multiplicity of the nonrelativistic ground
state.
The integer fictitious spin---$\mb{H}^\mr{eff}$ with odd dimension, describing
an odd number of states---can only describe systems with an even number of
electrons, because systems with odd number of electrons have every energy level
even-times degenerate (see Appendix~\ref{app:odd-electrons}) in which case
$\mb{H}^\mr{eff}$ must have even dimension. On the other hand, half-integer
fictitious spin---$\mb{H}^\mr{eff}$ with even dimension, describing an even
number of states---can in principle be used to describe systems with either an
even or an odd number of electrons. However, a half-integer fictitious spin
describing a system with an even number of electrons is a rather unusual
scenario. Let us consider an example where the nonrelativistic triplet ground
state of a system with axial symmetry is split by strong SO interaction into
two degenerate states with lower energy (a new doubly-degenerate ground state)
and one non-degenerate state with higher energy (which, from the point of view
of qm theory, counts as a non-degenerate excited state). In such a case, if the
ZFS is large enough, it is sufficient for the effective spin Hamiltonian to
describe only the doubly-degenerate ground state. This ground state is formed
by a so-called non-Kramers pair (see Appendix~\ref{app:non-kramers-partner}),
and it has an EPR spectrum with unusual properties because the eigenfunctions
of a system with an even number of electrons are non-magnetic, see the
discussion in Appendices~\ref{app:non-magnetic1},~\ref{app:non-magnetic2},
and~\ref{app:nonKramers-off} and in ref~\citenum{Griffith:1963:non-KP}.
In this section we will construct the matrix $\mb{H}^\mr{qm}$, used in
eq~\eqref{eq:eff:gt}, as a projection of the Zeeman Hamiltonian onto the space
defined by a set of wavefunctions $\{\Phi_k\}_{k=1}^m$. In the previous
section the wavefunctions $\Phi_k$ denoted eigenfunctions of $H^0$, but in the
following we will also consider any unitary linear combinations of these
eigenfunctions. In other words, we will consider any other orthonormal set of
wavefunctions that defines the same space. From the point of view of
eq~\eqref{eq:eff:gt} this amounts to a choice of the basis for the projection
of the qm Zeeman operator, and thus it should not change any physical
properties. However, because $\mb{H}^\mr{eff}$ employs the spin operators
$\vec{\mb{S}}$, which in turn follow specific rules under time-reversal
symmetry, not every choice of basis is suitable for the projection. For
example, in a triplet system of C1 spatial symmetry every eigenfunction of
$H^0$ is non-degenerate and non-magnetic (up to a phase factor, see also the
discussion in Appendix~\ref{app:non-magnetic1}). However, if one wants to use
the expansion in eq~\eqref{eq:eff:gt}, the qm Hamiltonian must be expressed in
a basis where two wavefunctions form a non-Kramers pair and one wavefunction
has the property $\mc{K}\Psi=-\Psi$ under time-reversal symmetry. Here,
$\mc{K}$ represents the many-electron time-reversal operator, see
Appendix~\ref{app:K}. Note that, in this example, the wavefunctions are
eigenfunctions of $H^0$ only if the system has axial symmetry. To choose a
proper basis for the projection of the qm Hamiltonian one should consider the
behavior of the fictitious spin eigenfunctions under time-reversal symmetry.
For fictitious spin $S$ the eigenfunctions of the fictitious spin operators
$S^2$ and $S_z$ follow the relation\cite{Abragam1970}
\begin{gather}
\label{eq:TRrelations}
\mc{K}\left|S,M\right> = (-1)^{S-M} \left|S,-M\right>.
\end{gather}
For simplicity we have used the symbol $\mc{K}$ here, although we do not
specify the representation of eq~\eqref{eq:TRrelations}---{\it i.e.} we do not
specify the space in which the spin states $\left|S,M\right>$ are represented.
However, in every other instance in this text we use the symbol $\mc{K}$
strictly to mean the qm many-electron time-reversal operator that acts in the
$S^- H^{\otimes N_\mr{e}}$ Fock subspace for $N_\mr{e}$ fermions (see
Appendix~\ref{app:K}). This minor inconsistency in notation appears only once
in this work, in eq~\eqref{eq:TRrelations}. By imposing eq~\eqref{eq:eff:gt} we
assume a correspondence between the qm and the fictitious spin bases $\Phi_k
\leftrightarrow \left|S,M\right>$, so the qm basis $\{\Phi_k\}_{k=1}^m$ must
follow the relation in eq~\eqref{eq:TRrelations} as well. For a detailed
discussion and expressions on this topic see section III in
ref~\citenum{Chibotaru:2013:spinH}. One way to construct the basis
$\{\Phi_k\}_{k=1}^m$ that satisfies relation~\eqref{eq:TRrelations} is to
follow this procedure:
\begin{itemize}
\item
{\bf For an odd number of electrons:} a) fix the arbitrariness ({\it e.g.}
phase factors) in the eigenfunctions of $H^0$ such that each energy level is
represented only by Kramers pairs, see Appendix~\ref{app:odd-electrons}; b) fix
the phase factors of the selected Kramers partners such that they follow
eq~\eqref{eq:TRrelations}---note that the choice of which Kramers partner gets
the phase $-1$ is arbitrary.
\item
{\bf For an even number of electrons:} a) make the eigenfunctions of $H^0$
non-magnetic according to the procedure described in
Appendix~\ref{app:non-magnetic1}; b) arbitrarily choose one eigenfunction to
remain non-magnetic up to a phase factor dictated by eq~\eqref{eq:TRrelations};
c) from the rest of the non-magnetic wavefunctions, construct non-Kramers
partners as described in Appendix~\ref{app:non-kramers-partner} and fix their
phases according to eq~\eqref{eq:TRrelations}.
\end{itemize}
Finally, note that using this procedure for a system with an odd number of
electrons results in a basis that consists of eigenfunctions of $H^0$, but for
a system with an even number of electrons this is not the case, because the
procedure described in Appendix~\ref{app:non-kramers-partner}
[eq~\eqref{nonKP}] may mix eigenfunctions that belong to different energy
levels.
As an example we will examine a system with a doubly-degenerate ground state
and well-separated excited states. For such a doublet system the proper qm
basis contains one \mbox{(non-)Kramers pair}
\begin{gather}
\Phi \coloneqq \Phi_1,
\\
\widebar\Phi = \mc{K} \Phi \coloneqq \Phi_2.
\label{KramersPair2}
\end{gather}
The eigenproblem presented in eq~\eqref{eigen:mat} then reduces to the
following form
\begin{gather} \label{eigen:doublet}
\left(\begin{array}[c]{cc}
\big< \Phi \big| H^Z \big| \Phi \big> & \big< \Phi \big| H^Z \big| \widebar\Phi \big> \\
\big< \widebar\Phi \big| H^Z \big| \Phi \big> & \big< \widebar\Phi \big| H^Z \big| \widebar\Phi \big>
\end{array}\right)
\left(\begin{array}[c]{c}
C_{1k}
\\
C_{2k}
\end{array}\right)
=
e_k
\left(\begin{array}[c]{c}
C_{1k}
\\
C_{2k}
\end{array}\right).
\end{gather}
The eigenvalues $e_k$ represent the magnetically-induced splitting relative to
the ground-state energy in the absence of a magnetic field, $e_k = \mc{E}_k -
E$, $E \coloneqq E_1 = E_2$. In this example, we assume that the wavefunctions
of a non-Kramers pair would be eigenfunctions of $H^0$ with the same energy $E$
({\it e.g.} in a system with an axial symmetry). Equation
\eqref{eigen:doublet} can be further simplified when considering the
time-reversal and Hermitian symmetry of the Hamiltonian $H^Z$, see
Appendix~\ref{app:Kramers-spin}
\begin{gather} \label{eigen:2:mod}
\left(\begin{array}[c]{cr}
\big< \Phi \big| H^Z \big| \Phi \big> & \big< \Phi \big| H^Z \big| \widebar\Phi \big> \\
\big< \widebar\Phi \big| H^Z \big| \Phi \big> &-\big< \Phi \big| H^Z \big| \Phi \big>
\end{array}\right)
\left(\begin{array}[c]{c}
C_{1k}
\\
C_{2k}
\end{array}\right)
=
e_k
\left(\begin{array}[c]{c}
C_{1k}
\\
C_{2k}
\end{array}\right).
\end{gather}
Also note that the off-diagonal elements are zero in the case of an even number
of electrons---{\it i.e.} for a \mbox{non-Kramers} pair---see
Appendix~\ref{app:nonKramers-off}. As discussed in
section~\ref{sec:introduction} the $2 \times 2$ matrix in eq
\eqref{eigen:2:mod} can be parametrized by the g-tensor as follows
\begin{align}
\label{gt:def1}
\frac{1}{4c}
B_u g_{uv} \sigma_v
&\overset{!}{=}
\left(\begin{array}[c]{cr}
\big< \Phi \big| H^Z \big| \Phi \big> & \big< \Phi \big| H^Z \big| \widebar\Phi \big> \\
\big< \widebar\Phi \big| H^Z \big| \Phi \big> &-\big< \Phi \big| H^Z \big| \Phi \big>
\end{array}\right),
\end{align}
where $B_u$ are the components of the external magnetic field, and $\sigma_v$
is the Pauli matrix for direction $v$. The individual components of the
g-tensor can then be derived from the elements of the $2 \times 2$ matrix in eq
\eqref{gt:def1}
\begin{align} \label{gt:sol}
\begin{array}[c]{rr}
g_{u1} =& 4c\,\mc{R} \bappa{\Phi}{H^Z_u}{\widebar\Phi},
\\
g_{u2} =&-4c\,\mc{I} \bappa{\Phi}{H^Z_u}{\widebar\Phi},
\\
g_{u3} =& 4c\,\bappa{\Phi}{H^Z_u}{\Phi},
\end{array}
\end{align}
where $H^Z = B_u H^Z_u$ and
\begin{equation}
\label{eq:HZu}
H^Z_u \coloneqq \left.\frac{d H^Z} {d B_u} \right|_{\vec B = 0}.
\end{equation}
An interesting observation is that, on changing the phase of the wavefunction
$\Phi$, the g-tensor elements $g_{u1}$ and $g_{u2}$ change as well, see
Appendix~\ref{app:phase}. This somewhat surprising result leads to the
conclusion that the g-tensor is not an observable quantity in the fullest sense
of the term. Below we will discuss how the observable quantities derived from
the g-tensor are the eigenvalues of $\mb{G} = \mb{g}\mb{g}^\mathsf{T}$ and the
sign of the g-tensor determinant.
To obtain the g-tensor for higher multiplicities using the same procedure as
outlined for the doublet system, the system must satisfy the assumptions
discussed in section~\ref{sec:introduction}. To obtain the energy splittings
one must in addition assume that all energy levels are degenerate in the
absence of a magnetic field, see eqs~\eqref{eigen:mat}
and~\eqref{eigen:doublet} and the discussion under eq~\eqref{eigen:doublet}. In
other words, in this paragraph we also assume that ZFS effects are negligible
and that there are no other low-lying excited states that must be taken into
account. This is, however, fully warranted only in the doublet case if the
system has an odd number of electrons, where each energy level must be at least
doubly-degenerate even in the relativistic domain, see Appendix~\ref{app:KP}
and the discussion in section~\ref{sec:introduction}. Then, to find the
splitting of the energy levels induced by a magnetic field one needs to solve
the eigenvalue equation
\begin{equation} \label{eigen:S:mod}
\left( \frac{1}{2c} B_u g_{uv} \mb{S}_v \right) \mb{C}_k = e_k \mb{C}_k,
\end{equation}
which, for a doublet system, becomes eq~\eqref{eigen:2:mod} with
$\mb{H}^\mr{qm}$ parameterized according to eq~\eqref{gt:def1}. One can now
solve eq~\eqref{eigen:S:mod} (see Appendix~\ref{app:diag-GT}) to get the
expression for the eigenvalues $e_k$ in terms of the g-tensor parameters
\begin{gather} \label{eigen:bS:B}
e_k = M_k \big| \,\vec b\, \big|,
\quad
b_v = \frac{1}{2c} B_u g_{uv},
\quad
M_k \in \{-S, -(S-1), \dots, S\},
\quad
k = 1,\dots,2S+1.
\end{gather}
In contrast to Appendix~\ref{app:diag-GT} we have here reordered the
eigenvalues in ascending order. Eq~\eqref{eigen:bS:B} simplifies if the
magnetic field is chosen along the $u$th Cartesian coordinate axis as follows
\begin{align} \label{eigen:bS:u}
\vec{B}_u = B \vec{n}_u
\quad \rightarrow \quad
e_k\big(\vec{B}_u\big) = \frac{M_k B}{2c} \sqrt{ g_{u1}^2 + g_{u2}^2 + g_{u3}^2 },
\end{align}
with $B$ being the size of the magnetic field and $\vec{n}_u$ being the unit
vector in the $u$th direction. The eigenvalues $e_k$ are observable physical
quantities as they correspond to energy levels in the presence of the magnetic
field $\vec B$, but the form of eq~\eqref{eigen:bS:u} does not allow us to say
the same of the g-tensor parameters. In fact, as was noted above and as we will
see in the next section, the g-tensor is not actually an observable physical
quantity, and moreover is not even a proper tensor.
To conclude the doublet case discussed in this section, the effect of the
magnetic field on the system is fully described by eq~\eqref{eigen:2:mod}
provided only that these two conditions be met: a) $H^0$ is time-reversal
symmetric $H^0$; and b) $H^Z$ is time-reversal antisymmetric. Furthermore, the
g-tensor parameters fully describe the doublet system and are calculated as
presented in eq~\eqref{gt:sol}. Note that this discussion does not depend on
the level of theory used for calculation of the matrix elements $\big< \Phi
\big| H^Z \big| \Phi \big>$ and $\big< \Phi \big| H^Z \big| \widebar\Phi
\big>$, and is therefore valid in, for example, CAS or the DFT class of {\it ab
initio} theories.
\section{Principal axes of the g-tensor}
\label{sec:principal}
The only physical quantity in the definition of the g-tensor,
eq~\eqref{eq:eff:gt}, is an external magnetic field. The spin matrices,
$\vec{\mb{S}}$, are merely a basis used for the parametrization of the Zeeman
matrix, $\mb{H}^\mr{qm} = \mb{H}^Z$. Then, the rotation of the laboratory
frame changes only the orientation of the magnetic field, because elements of
$\mb{H}_u^Z$---constructed as the inner product of $H_u^Z$ in some basis, see
{\it e.g.} eq~\eqref{gt:sol}---are invariant with respect to this rotation.
Thus, as we will see later in the discussion, the task of looking for the
principal axes of the g-tensor merely by rotation of the laboratory frame---or,
equivalently, by rotation of the magnetic field---is in the general case
futile. This is also connected to the interesting observations that the
g-tensor is not a tensor, and moreover that it is not an observable quantity.
The easiest way to understand why the full g-tensor is not an observable
quantity is to see $\vec{\mb{S}}$ as a basis, and the g-tensor as the
associated set of expansion coefficients, with which to represent the Zeeman
matrix $\mb{H}_u^Z$. This matrix is the projection of the Zeeman operator for
the $u$th direction of the magnetic field onto a subspace in a Hilbert space of
$N_\mr{e}$ electrons. Its form of $\mb{H}_u^Z$, however, depends on the choice
of the basis for that subspace. Therefore, the g-tensor itself depends on the
choice of the basis, and a change in basis is obviously not connected to any
observable quantity. In the following, we show that changing this basis rotates
the fictitious spin, and that the g-tensor can be diagonalized when the
appropriate real and fictitious coordinate axis systems are chosen.
Let us first consider the transformation of the g-tensor caused by a change in
the magnetic field. Because the g-tensor does not depend on the strength of the
magnetic field, we consider only different orientations of magnetic fields of
the same strength, $\big|\vec B \big| = \Big| \vec{\widetilde{B}} \Big|$
\begin{equation}
\label{eq:BtB}
\vec{\widetilde{B}}
\quad\rightarrow\quad
\vec B = \mb{O} \vec{\widetilde{B}}.
\end{equation}
Here $\mb{O}$ is an arbitrary orthogonal transformation, $\mb{O}^\mathsf{T}
\mb{O} = \mb{O} \mb{O}^\mathsf{T} = \mb{1}$, in $\mathbb R^3$, {\it i.e.} $O
\in \mr{O}(3)$. Note that the transformation $\mb{O}$ represents both proper
and improper rotations. Proper rotations, $\mr{det}\,\mb{O} = 1$, have an
exponential form as described in eq~\eqref{rot:R3}, and they form the special
orthogonal group SO$(3)$. Improper rotations combine a proper rotation and a
reflection, and have $\mr{det} \, \mb{O} = -1$. The g-tensors derived from the
magnetic fields $\vec{\widetilde{B}}$ and $\vec B$ are then connected by the
orthogonal transformation as follows
\begin{gather}
\mb{H}^\mr{eff}
=
\frac{1}{2c} B_u g_{uv} \mb{S}_v
=
\frac{1}{2c} O_{uq} \widetilde{B}_q g_{uv} \mb{S}_v
=
\frac{1}{2c} \widetilde{B}_u \brr{O_{qu}g_{qv}} \mb{S}_v
=
\frac{1}{2c} \widetilde{B}_u \widetilde{g}_{uv} \mb{S}_v,
\\
\widetilde{\boldsymbol{g}} = \mb{O}^{\!\mathsf{T}} \!\boldsymbol{g},
\qquad
\boldsymbol{g} = \mb{O} \widetilde{\boldsymbol{g}},
\label{g:trans:B}
\end{gather}
where we have utilized eq~\eqref{eq:BtB} and the fact that $\mb{O}$ is an
orthogonal transformation.
As discussed above, the g-tensor also depends on the choice of the basis onto
which the Zeeman operator is projected. Here we are interested in those linear
transformations of basis functions $\{\Phi_n\}_{n=1}^m$ that preserve their
orthonormality
\begin{gather} \label{U:trans}
\widetilde\Phi_n = U_{mn} \Phi_m,
\\
\bapa{\Phi_m}{\Phi_n} = \delta_{mn}
\quad
\Rightarrow
\quad
\bapa{\widetilde\Phi_m}{\widetilde\Phi_n} = \delta_{mn}.
\end{gather}
Such matrices are called unitary transformations, $\mb{U}^\dagger \mb{U} =
\mb{U} \mb{U}^\dagger = \mb{1}$, and they act in $\mathbb{C}^m$, {\it i.e.} $U
\in \mr{U}(m)$. Using eq~\eqref{U:trans} one can write the relation between the
elements of the Zeeman Hamiltonian expressed in either of these bases as
\begin{gather}
\brr{H^Z}_{mn} = \bappa{\Phi_m}{H^Z}{\Phi_n},
\qquad
\brr{\widetilde{H}^Z}_{mn} = \bappa{\widetilde\Phi_m}{H^Z}{\widetilde\Phi_n},
\\
\bappa{\widetilde\Phi_m}{H^Z}{\widetilde\Phi_n}
=
\bappa{U_{km}\Phi_k}{H^Z}{U_{ln}\Phi_l}
=
U^\ast_{km} \bappa{\Phi_k}{H^Z}{\Phi_l} U_{ln},
\end{gather}
which can be written in matrix form as
\begin{gather}
\label{eq:HbarVHV}
\widetilde{\mb{H}}^Z = \mb{U}^\dagger \mb{H}^Z \mb{U}.
\end{gather}
Each of the Zeeman matrices can be parametrized by a different g-tensor as
follows
\begin{align}
\label{eq:tildeHZ}
\widetilde{\mb{H}}^Z
&\overset{!}{=}
\frac{1}{2c} B_u \widetilde{g}_{uv} \mb{S}_v,
\\
\label{eq:HZ}
\mb{H}^Z
&\overset{!}{=}
\frac{1}{2c} B_u g_{uv} \mb{S}_v.
\end{align}
Equation~\eqref{eq:HbarVHV} allows us to easily transform the effective spin
Hamiltonian between different choices of basis functions that represent the
studied multiplet. Then, by applying eqs~\eqref{eq:tildeHZ} and~\eqref{eq:HZ}
to eq~\eqref{eq:HbarVHV}, one gets
\begin{align}
\label{eq:tildeg:USU}
\frac{1}{2c} B_u \widetilde{g}_{uv} \mb{S}_v
&=
\frac{1}{2c} B_u g_{uv} \mb{U}^\dagger \mb{S}_v \mb{U}.
\end{align}
Because for every $U \in U(m)$ with $\mr{det}\,\mb{U} = \mr{exp}(i\alpha)$ and
$\alpha \in \mathbb{R}$ there exists $U^+ \in SU(m)$ with $\mr{det}\,\mb{U}^+
= 1$ such that
\begin{gather}
\label{eq:UpIm}
\mb{U} = \mb{U}^+ \mb{I}^-_\mr{e},
\\
\left(I^-_\mr{e}\right)_{kl} = \delta_{kl} \,e^{i\frac{\alpha}{m}},
\\
\mr{det}\,\mb{U}^+
= \mr{det}\brs{ \mb{U} \brr{\mb{I}^-_\mr{e}}^{-1} }
= \mr{det}\,\mb{U} \,\,\mr{det}\brr{e^{-i\frac{\alpha}{m}} \mb{1} }
= 1.
\end{gather}
One may transform the right-hand-side of eq~\eqref{eq:tildeg:USU} as
\begin{gather}
\label{eq:tildeg:UpSUp}
\frac{1}{2c} B_u \widetilde{g}_{uv} \mb{S}_v
=
\frac{1}{2c} B_u g_{uv} \brr{\mb{U}^+}^\dagger \mb{S}_v \mb{U}^+.
\end{gather}
This is possible because $\mb{I}^-_\mr{e}$ is the identity matrix multiplied by
a phase factor. For $m=2$ the procedure in
eqs~\eqref{U:trans}--\eqref{eq:tildeg:UpSUp} covers all possible $\mb{U}$ and
$\mb{U}^+$, and thus for the doublet case it covers all possible choices of the
orthonormal basis set $\{\Phi_n\}_{n=1}^2$. For $m>2$ this is not the case,
and therefore in the following we choose only such unitary transformations
$\mb{U}$ in eq~\eqref{U:trans} that lead to $\mb{U}^+$---according to
eq~\eqref{eq:UpIm}---which in turn can be written using the exponential form,
$\mb{U}^+ = \mr{exp}(-i\theta \vec{\mb{S}}\cdot \vec n)$. For more information
on the topic see also the discussion in Appendix~\ref{app:proper}. Finally,
one can employ identity~\eqref{SU:SO}---derived in Appendix~\ref{app:rot}---in
eq~\eqref{eq:tildeg:UpSUp}
\begin{gather}
\label{eq:tildeg:OpS}
\frac{1}{2c} B_u \widetilde{g}_{uv} \mb{S}_v
=
\frac{1}{2c} B_u g_{uv} \left( e^{-i\theta \vec{\mb{R}} \cdot \vec n} \right)_{vw} \mb{S}_w,
\\
\label{eq:tildeg:OpS1}
\bs{\widetilde{g}} = \bs{g} \mb{O}^+,
\quad
\mb{O}^+ = e^{-i\theta \vec{\mb{R}} \cdot \vec n}.
\end{gather}
Here the matrix $\mb{O}^+$ is a proper rotation, $\mr{det}\,\mb{O}^+ = 1$, that
is defined by an angle $\theta$ and a unit vector $\vec n$. The rotation
matrices $\vec R$ are defined in eqs~\eqref{R:def1} and~\eqref{R:def2}, and a
practical prescription for the proper rotation $\mb{O}^+$ is shown in
eq~\eqref{rot:R3}, also known as Rodrigues' formula. As discussed in
Appendix~\ref{app:eff:spin}, the transformation in eq~\eqref{U:trans} and the
matrix $\mb{O}^+$ in eq~\eqref{eq:tildeg:OpS1} correspond to rotation of the
spin in a fictitious spin space---below we use the notation $\mb{O}^+_\mr{f}$.
On the other hand, the transformation of the magnetic field in
eq~\eqref{eq:BtB} corresponds to rotation in a real space, and thus we denote
it $\mb{O}^+_\mr{r}$. Therefore, the transformations of the g-tensor,
eqs~\eqref{g:trans:B} and~\eqref{eq:tildeg:OpS1}, are independent and can be
combined as follows
\begin{equation}
\label{eq:trans:gt}
\bs{\widetilde{g}} = \mb{O}^{\!\mathsf{T}}_\mr{r} \,\bs{g}\, \mb{O}^+_\mr{f}.
\end{equation}
Note that because these transformations are independent, the choice of which
matrix is or is not transposed is arbitrary. The fact that the transformations
in eq~\eqref{eq:trans:gt} are independent allows us to diagonalize the
g-tensor. In the following, we show that, under the assumptions presented in
section~\ref{sec:introduction}, the g-tensor can be always brought to a
diagonal form.
Using only the transformation in real space $\mb{O}_\mr{r}$, it is not
possible, in the general case, to diagonalize the g-tensor. It is possible,
however, to diagonalize the $\mb{G}$ matrix instead
\begin{gather}
\label{G:trans1}
\mb{G} = \bs{g} \bs{g}^\mathsf{T},
\\
\label{G:trans2}
\mb{G}
=
\mb{O}_\mr{r} \, \widetilde{\bs{g}}
\left( \mb{O}_\mr{r} \, \widetilde{\bs{g}} \right)^{\!\mathsf{T}}
=
\mb{O}_\mr{r} \, \widetilde{\bs{g}}
\, \widetilde{\bs{g}}^\mathsf{T} \mb{O}^{\!\mathsf{T}}_\mr{r}
=
\mb{O}_\mr{r} \widetilde{\mb{G}} \mb{O}^{\!\mathsf{T}}_\mr{r}.
\end{gather}
Because $\widetilde{\mb{G}}$ is a real symmetric matrix
\begin{equation}
\widetilde{\mb{G}}^\mathsf{T}
=
(\widetilde{\bs{g}} \widetilde{\bs{g}}^\mathsf{T})^\mathsf{T}
=
\widetilde{\bs{g}} \widetilde{\bs{g}}^\mathsf{T}
=
\widetilde{\mb{G}},
\end{equation}
there exists an orthogonal transformation $\mb{O}_\mr{r}$ that diagonalizes it,
with the eigenvalues being real numbers. Let us assume that $\mb{O}_\mr{r}$ in
eq~\eqref{G:trans2} is such a transformation---it diagonalizes the
$\widetilde{\mb{G}}$ matrix, and thus $\mb{G}$ has a diagonal form.
$\mb{O}_\mr{r}$ can then be determined by solving the eigenvalue problem.
Following eqs~\eqref{G:trans1} and~\eqref{G:trans2} we can write ($v$ is not a
summation index)
\begin{gather}
\label{G:diag1}
\widetilde{G}_{uq} (O_\mr{r})^\mathsf{T}_{qv} = G_{v} (O_\mr{r})^\mathsf{T}_{uv},
\\
\label{G:diag2}
\mb{G}^\mr{diag} = \bs{g} \bs{g}^\mathsf{T},
\\
\label{G:diag3}
\delta_{uv} G_{v} = g_{uq} g_{vq},
\quad
G_v \coloneqq G_{vv}.
\end{gather}
Here eq~\eqref{G:diag1} represents the eigenvalue equation with eigenvectors
$\mb{O}^\mathsf{T}_\mr{r}$. The eigenvalues $G_v$ are positive real numbers,
because in eq~\eqref{G:diag3} they are expressed as a sum of the squares of
real numbers ($u$ is not a summation index)
\begin{gather}
\label{G:diag4}
G_{u} = g_{uq} g_{uq}.
\end{gather}
Note that $\mb{O}_\mr{r}$ in eq~\eqref{G:diag1} belongs to the group O$(3)$
represented in $\mathbb{R}^3$. However, if $\mr{det}\,\mb{O}_\mr{r} = -1$ one
can simply change the phase of one of the eigenvectors---multiplying the vector
by $-1$---to get the new transformation $\mb{O}^+_\mr{r}$ with $\mr{det}\,
\mb{O}^+_\mr{r} = 1$. Because changing this phase factor has no physical
consequences, {\it i.e.} one can still diagonalize any $\mb{G}$ matrix, we can
restrict the real transformation in eq~\eqref{eq:trans:gt} to proper rotations
\begin{equation}
\label{eq:trans:gt1}
\bs{\widetilde{g}} = (\mb{O}^+_\mr{r})^{\!\mathsf{T}} \,\bs{g}\, \mb{O}^+_\mr{f}.
\end{equation}
Equation \eqref{G:diag3} has two important consequences. First, the eigenvalues
$e_k$ in eq~\eqref{eigen:bS:u} can be expressed using the eigenvalues $G_u$
thanks to their dependence on the g-tensor parameters presented in eq
\eqref{G:diag4}
\begin{gather}
\label{eigen:G}
\vec{B}_u = B \vec{n}_u
\quad \rightarrow \quad
e_k\big(\vec{B}_u\big)
= \frac{M_k B}{2c} \sqrt{ g_{u1}^2 + g_{u2}^2 + g_{u3}^2 }
= \frac{M_k B}{2c} \sqrt{G_u}.
\end{gather}
Now, it is clear that the $\mb{G}$ matrix is an observable physical quantity
and that its eigenvalues govern the splitting induced by the magnetic field
applied along the principal axes of the $\mb{G}$ matrix [see also the
assumptions that led to eq~\eqref{eigen:bS:u} discussed in
section~\ref{sec:gt:construct}]. Moreover, the $\mb{G}$ matrix is a proper
tensor, because under the transformation of the magnetic field (or,
equivalently, the coordinate system) both of its indices are transformed by the
same orthogonal transformation, see eq~\eqref{G:trans2}. Thus, in the
following, we refer to the $\mb{G}$ matrix as the G-tensor. This is in
contrast to the g-tensor where only one index is transformed when rotating the
magnetic field, see eq~\eqref{g:trans:B}. However, one could force the
transformations in eq~\eqref{eq:trans:gt1} to be the same, {\it i.e.} when
rotating the real coordinate system by $\mb{O}^+_\mr{r}$ one could
simultaneously change the basis set $\{\Phi_n\}_{n=1}^m$ such that the
$\mb{O}^+_\mr{f} = \mb{O}^+_\mr{r}$. This procedure would make the g-tensor a
proper tensor. However, because the g-tensor is in the general case a
non-symmetric matrix, this choice would prohibit its diagonalization.
The second consequence of eq \eqref{G:diag3} is more subtle. The expression
states that if the G-tensor is diagonal, then the rows of the corresponding
g-tensor form an orthogonal set of vectors. This interesting fact can be
exploited in the diagonalization of the g-tensor itself. Let us normalize these
vectors---the rows of the g-tensor---to obtain the orthonormalized set of
vectors $\{\vec{w}_v\}_{v=1}^3$
\begin{align}
\left(w_v\right)_q = g_{vq} \, G^{-\frac{1}{2}}_v.
\label{eq:def:W1}
\end{align}
For simplicity let us assume for a while that all $G_v$ values are nonzero,
{\it i.e.} there are no zero rows of the g-tensor, see eq~\eqref{G:diag4}.
Every set of real orthonormal vectors forms an orthogonal transformation [an
element of the group $\mr{O}(m)$], if the number of the vectors equals the
dimension of the vector space---in this case $m$. This statement holds for any
finite-dimensional vector space with a scalar (inner) product. We work in
$\mathbb{R}^3$, but the proof can be easily extended to any complex (or
quaternion) vector space with a finite dimension, see Appendix \ref{app:U} for
more details. We can, therefore, write the following expressions for the set of
vectors $\{\vec{w}_v\}_{v=1}^3$
\begin{align}
\label{eq:def:W2}
W_{qv} \coloneqq \left(w_v\right)_q
\quad
\Rightarrow
\quad
\mb{W}^\mathsf{T} \mb{W} = \mb{W} \mb{W}^\mathsf{T} = \mb{1},
\quad
\mb{W} \in \mr{O}(3).
\end{align}
Now let us use the orthogonal transformation $\mb{W}$ in eq \eqref{G:diag2} as
follows
\begin{align}
\label{eq:gWWg}
\mr{diag}(\mb{G}) = \boldsymbol{g} \boldsymbol{g}^\mathsf{T}
=
\boldsymbol{g} \mb{W} \,\mb{W}^\mathsf{T} \!\boldsymbol{g}^\mathsf{T}
=
\widebar{\boldsymbol{g}} \widebar{\boldsymbol{g}}^\mathsf{T},
\qquad
\widebar{\boldsymbol{g}} = \boldsymbol{g} \mb{W}.
\end{align}
Because of the specific form of the transformation matrix $\mb{W}$,
eqs~\eqref{eq:def:W1} and~\eqref{eq:def:W2}, the $\widebar{g}$-tensor has a
diagonal form with positive diagonal values ($v$ is not a summation index)
\begin{align} \label{g:diag}
\widebar{g}_{uv} = g_{uq} W_{qv} = g_{uq} \left(w_v\right)_q
=
g_{uq} g_{vq} \, G^{-\frac{1}{2}}_v
=
\delta_{uv} G^{\frac{1}{2}}_v,
\end{align}
where we have utilized eq~\eqref{G:diag3}. Equations
\eqref{G:diag1}--\eqref{G:diag3} and \eqref{eq:def:W1}--\eqref{g:diag}
represent a recipe for diagonalizing any real non-symmetric square matrix with
two different orthogonal transformations where the final diagonal elements are
positive real numbers. The only assumption was that eigenvalues of the $\mb{G}$
matrix are nonzero. In the case of $G_v$ being zero the corresponding rows of
the g-tensor must be zero as well, see eq~\eqref{G:diag4}. However, the zero
vectors cannot be normalized, so in such a case the set $\{\vec{w}_v\}_{v=1}^3$
does not consist of orthonormal vectors. A way around this problem is to
replace the zero vectors with ones that will make the set
$\{\vec{w}_v\}_{v=1}^3$ orthonormal. This can be always done, although the
choice of such vectors is not, in the general case, unique. The $\mb{W}$ matrix
is then orthogonal, and when evaluating eq~\eqref{g:diag} one obtains the
expected zero elements---the square root of zero is zero---on the diagonal,
thanks to the corresponding zero rows of the g-tensor. Thus the procedure of
diagonalizing the $\widebar{\bs{g}}$ matrix in eq~\eqref{g:diag} can be
achieved even when some of the $G_v$ values are zero.
To transform the g-tensor, as requested by eq~\eqref{g:diag}, one can use a
rotation in the fictitious spin space, $\mb{O}^+_\mr{f}$, see
eq~\eqref{eq:trans:gt1} and the corresponding discussion. However, the
determinant of the transformation $\mb{W}$ can be either positive or negative,
while the transformation of the wavefunction basis $\{\Phi_n\}_{n=1}^m$ leads
only to proper rotations, {\it i.e.} $\mb{O}^+_\mr{f}$ with determinant equal
to one. In other words, not all required transformations $\mb{W}$ can be
obtained by mixing the basis set $\{\Phi_n\}_{n=1}^m$. In the problematic case
when $\mr{det} \,\mb{W} = -1$ one can define a new transformation of the
g-tensor as follows
\begin{gather}
\label{eq:gWI}
\widebar{\mb{g}} = \mb{g} \mb{W} \mb{I}^-,
\end{gather}
with the matrix $\mb{I}^-$ being any of these matrices
\begin{gather}
\label{eq:Ichoice}
\left(\begin{array}[c]{rrr}
-1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{array}\right),
\quad
\left(\begin{array}[c]{rrr}
1 & 0 & 0 \\
0 & -1 & 0 \\
0 & 0 & 1
\end{array}\right),
\quad
\left(\begin{array}[c]{rrr}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & -1
\end{array}\right),
\quad
\left(\begin{array}[c]{rrr}
-1 & 0 & 0 \\
0 & -1 & 0 \\
0 & 0 & -1
\end{array}\right).
\end{gather}
The transformation $\mb{W} \mb{I}^-$ is then a proper rotation and it still
diagonalizes the $\widebar{g}$-tensor
\begin{gather}
\brr{ \mb{W} \mb{I}^- }^\mathsf{T} \brr{ \mb{W} \mb{I}^- }
=
(\mb{I}^-)^\mathsf{T} \mb{W}^\mathsf{T} \mb{W} \mb{I}^-
=
(\mb{I}^-)^\mathsf{T} \mb{I}^-
=
\mb{1},
\\
\brr{ \mb{W} \mb{I}^- } \brr{ \mb{W} \mb{I}^- }^\mathsf{T}
=
\mb{W} \mb{I}^- (\mb{I}^-)^\mathsf{T} \mb{W}^\mathsf{T}
=
\mb{W} \mb{W}^\mathsf{T}
=
\mb{1},
\\
\mr{det}\brr{ \mb{W} \mb{I}^- }
=
\mr{det}\,\mb{W} \,\mr{det}\,\mb{I}^-
=
1,
\\
\label{eq:gbar:4}
\widebar{g}_{uv} = g_{uq} W_{qp} (I^-)_{pv} =
g_{uq} \left(w_p\right)_q (I^-)_{pv}
=
g_{uq} g_{pq} \, G^{-\frac{1}{2}}_p (I^-)_{pv}
=
G^{\frac{1}{2}}_u (I^-)_{uv}.
\end{gather}
One can easily show that both g-tensors, $\widebar{\bs{g}}$ and $\bs{g}$, have
the same G-tensor and thus lead to the same energy splittings,
eq~\eqref{eigen:G} ($v$ is not a summation index)
\begin{align}
\widebar{g}_{uq} \, \widebar{g}_{vq} = g_{uq} \, g_{vq} = \delta_{uv} G_v.
\end{align}
Note that the signs of the determinants of the matrices $\mb{W}$ and $\mb{g}$
are the same, because combining eqs~\eqref{eq:def:W1} and~\eqref{eq:def:W2}
results in
\begin{gather}
\mr{det}\,\mb{W} = \mr{det}\,\mb{W}^\mathsf{T}
= \mr{det}\brr{ \mb{G}^{-\frac{1}{2}} \mb{g} }
= \mr{det}\,\mb{G}^{-\frac{1}{2}} \,\,\mr{det}\,\mb{g},
\end{gather}
where the matrix $\mb{G}^{-\frac{1}{2}}$ is diagonal, with elements
$G_u^{-\frac{1}{2}}$, and its determinant is thus always positive. Therefore,
if the determinant of the g-tensor is negative, then in the process of its
diagonalization one may choose any matrix $\mb{I}^-$ from
eq~\eqref{eq:Ichoice}. This choice than means that the signs of the diagonal
elements of the $\widebar{g}$-tensor---also known as the principal elements or
g-values---may be chosen in four different ways while keeping the sign of the
determinant (the product of the g-values) unchanged, see eq~\eqref{eq:gbar:4}.
Therefore, the signs of the individual g-values are not observable quantities.
In the doublet case, there is no degree of freedom left in the transformation
of the basis, eq~\eqref{U:trans}, that could lead to transformations other than
$\mb{O}^+_\mr{f}$ (see also Appendix~\ref{app:proper}), and thus the only
observable quantity is the sign of the determinant of the g-tensor and the
eigenvalues of the G-tensor. In the case of higher multiplicities, the
additional degree of freedom in the change of the basis could in principle
prohibit even the measurement of the sign of the determinant of the
g-tensor---the theory presented here can neither confirm this nor rule it out.
However, it turns out that the sign of the g-tensor may be measured even for
higher multiplicies, see ref~\citenum{Pryce:1959:GT-sign}. Finally, note that
the g-tensor has two sets of principal axis systems, one in real space and one
in the fictitious spin space.
We may summarize the procedure above for diagonalizing the g-tensor as follows:
\begin{enumerate}
\item
Use independent rotations in real space and fictitious spin space, see
eq~\eqref{eq:trans:gt}.
\item
Diagonalize the $\widetilde{G}$-tensor, $\widetilde{\mb{G}} =
\widetilde{\bs{g}} \widetilde{\bs{g}}^\mathsf{T}$, according to
eq~\eqref{G:trans2}, using the transformation $\mb{O}_\mr{r}$ from
eq~\eqref{G:diag1}.
\item
Construct the g-tensor such that $\bs{g} = \mb{O}_\mr{r}\, \widetilde{\bs{g}}$.
\item
Construct the orthogonal matrix $\mb{W}$ combining eqs~\eqref{eq:def:W1}
and~\eqref{eq:def:W2} using the g-tensor
\begin{equation}
\mb{W} = \bs{g}^\mathsf{T} \mb{G}^{-\frac{1}{2}},
\end{equation}
where $\mb{G}^{-\frac{1}{2}}$ is a diagonal matrix with diagonal elements
$G_v^{-\frac{1}{2}}$ and $G_v$ represent eigenvalues of the
$\widetilde{G}$-tensor, {\it i.e.} diagonal elements of the matrix $\mb{G}$ in
eq~\eqref{G:trans2}.
\item
Construct the proper rotation in the fictitious spin space
\begin{align}
\label{eq:gmOf}
&\mr{det}\,\bs{g} > 0
\quad
\Rightarrow
\quad
\mb{O}^+_\mr{f} = \mb{W},
\\
\label{eq:gpOf}
&\mr{det}\,\bs{g} < 0
\quad
\Rightarrow
\quad
\mb{O}^+_\mr{f} = \mb{W} \mb{I}^-,
\end{align}
with $\mb{I}^-$ being one of the matrices in eq~\eqref{eq:Ichoice}. The
resulting diagonal $\widebar{g}$-tensor has the form
\begin{equation}
\widebar{\bs{g}} = \bs{g} \mb{O}^+_\mr{f},
\end{equation}
with the diagonal elements $G_v^{\frac{1}{2}}$, which in the case of
$\mr{det}\,\bs{g} < 0$ must incorporate a minus sign, according to which matrix
$\mb{I}^-$ was chosen. Finally, note that in the case of $\mr{det}\,\bs{g} >
0$, in principle one could modify the g-values in a similar way as for the case
of $\mr{det}\,\bs{g} < 0$, but with matrices that have two values $-1$ on
the diagonal. This is, however, not done in practice, and all g-values are
chosen to be positive.
\end{enumerate}
This procedure represents a proof of existence, and to a certain degree
uniqueness, of principal axes and principal values of the g-tensor. In
practice, however, the principal values are obtained simply by taking the
square roots of the eigenvalues of the G-tensor (step 2) and by modifying their
sign if the determinant of the g-tensor is negative [see eq~\eqref{eq:gbar:4}].
The two sets of principal axes---in the real space and the fictitious spin
space---are obtained in point 2 and point 5. However, when using {\it ab
initio} wavefunction methods one may be interested in the basis
[eqs~\eqref{U:trans}--\eqref{eq:HbarVHV}] in which the g-tensor is diagonal.
This is a more challenging task, because it requires extraction of $\theta$ and
$\vec n$ from eq~\eqref{eq:gmOf} or~\eqref{eq:gpOf} with $\mb{O}^+_\mr{f} =
\mr{exp}(-i\theta \vec{\mb{R}} \cdot \vec n)$ and then calculation of the
unitary transformation in eq~\eqref{U:trans} as $\mb{U} = \mr{exp}(-i\theta
\vec{\mb{S}}\cdot \vec n)$. There is, however, a better way of solving this
problem, which we will discuss in the next section.
\section{An alternative procedure for the diagonalization of the g-tensor}
\label{sec:alternative}
In this section we will discuss an alternative procedure to the diagonalization
of the g-tensor that will provide us with the basis set
$\{\Phi_n\}_{n=1}^m$---in which the g-tensor is diagonal---without the need for
extracting the parameters $\theta$ and $\vec n$ from the rotation in the
fictitious spin space $\mb{O}^+_\mr{f} = \mr{exp}(-i\theta \vec{\mb{R}} \cdot
\vec n)$, see also the last paragraph in the previous section. This procedure
is commonly used in quantum chemical calculations, see for example
refs~\citenum{Chibotaru:2013:spinH} and~\citenum{Bolvin:2016:EPR-review} and
works cited therein. Although this procedure is more practical then the one
presented in section~\ref{sec:principal}, it does not provide a stand-alone
proof that the g-tensor can be always brought to the diagonal form. On the
contrary, the procedure described here is applicable to an arbitrary system
only if a principal axis system exists for the g-tensor [and even then, only if
the transformation of the g-tensor can be written in the form given in
eq~\eqref{eq:trans:gt}]. However, a proof of the diagonalizability of the
g-tensor was presented in the previous section, and we will use some of the
results from that section here.
In the following we assume that the G-matrix is already diagonal, {\it i.e.} we
have already found the principal axis system in real space. Furthermore, let us
have a starting reference basis set $\{\Phi_n\}_{n=1}^m$ that satisfies the
same transformations under time-reversal symmetry as presented in
eq~\eqref{eq:TRrelations} [see also the corresponding discussion under that
equation]. The Zeeman matrix that corresponds to the $u$th component of the
magnetic field can then be parametrized using the g-tensor as follows
\begin{gather}
\label{eq:HuZ}
\mb{H}_u^Z
\overset{!}{=}
\frac{1}{2c} g_{uv} \mb{S}_v.
\end{gather}
Applying an arbitrary unitary transformation $\mb{U}$ to the basis set
$\{\Phi_n\}_{n=1}^m$, eq~\eqref{U:trans}, we get
\begin{gather}
\label{eq:HubarVHV}
\widetilde{\mb{H}}_u^Z = \mb{U}^\dagger \mb{H}_u^Z \mb{U}.
\end{gather}
This equation corresponds to eq~\eqref{eq:HbarVHV} for individual components of
the magnetic field. Our goal is to find a unitary transformation of the
reference basis set that diagonalizes the g-tensor in eq~\eqref{eq:HuZ}. In
other words, each of the three matrices, $\widetilde{\mb{H}}_u^Z$, should have
only one nonzero component in their expansion into the basis of spin matrices
$\vec{\mb{S}}$, {\it i.e.} ($u$ is not a summation index)
\begin{gather}
\label{eq:HuZ:zz}
\widetilde{\mb{H}}_u^Z
= \tfrac{1}{2c} \widetilde{g}_{uv} \mb{S}_v
= \tfrac{1}{2c} \widetilde{g}_{uu} \delta_{uv} \mb{S}_v
= \tfrac{1}{2c} \widetilde{g}_{uu} \mb{S}_u.
\end{gather}
Because the spin matrix $\mb{S}_3$ is diagonal, one can achieve this goal for
the $z$th Zeeman matrix by diagonalizing it
\begin{gather}
\label{eq:H3Z}
\mb{H}_3^Z \mb{C} = \mb{C} \mb{e},
\end{gather}
where the diagonal matrix $\mb{e}$ contains the eigenvalues and the matrix
$\mb{C}$ represents the corresponding eigenvectors. Because the coefficients
$\mb{C}$ form a unitary transformation, $\mb{C}^\dagger \mb{C} = \mb{C}
\,\mb{C}^\dagger = \mb{1}$ (see Appendix~\ref{app:U}), one can write
\begin{gather}
\label{eq:H3Z:UC}
\widetilde{\mb{H}}_3^Z = \mb{C}^\dagger \mb{H}_3^Z \mb{C} = \mb{e},
\quad
\mb{U} = \mb{C}.
\end{gather}
The $\widetilde{g}_{33}$ g-value can then be obtained by comparing
eqs~\eqref{eq:HuZ:zz} and~\eqref{eq:H3Z}
\begin{gather}
\label{eigen:g33:1}
e_k = \frac{1}{2c} \widetilde{g}_{33} M_k,
\\
\label{eigen:g33:2}
M_k \in \{-S, -(S-1), \dots, S\},
\quad
k = 1,\dots,2S+1.
\end{gather}
There are two problems with this result. First, one should determine the
g-value $\widetilde{g}_{33}$ from eq~\eqref{eigen:g33:1}, but the equation must
be satisfied for every index $k$, so the problem is over-parametrized. The
second problem is that we can only use one unitary transformation for all three
matrices $\widetilde{\mb{H}}_u^Z$. Both problems are a consequence of one more
fundamental issue: is there a unitary transformation that leads to
eq~\eqref{eq:HuZ:zz} for every system that satisfies the assumptions discussed
in section~\ref{sec:introduction}? The way out of this problem is to consider
section~\ref{sec:principal} as a proof that such a unitary matrix exists. Then,
because the eigenvalues in eq~\eqref{eq:H3Z} are unique, eq~\eqref{eigen:g33:1}
must have the same solution for every $k$. On the other hand, the eigenvectors
that diagonalize $\mb{H}_3^Z$ are not unique, because when changing the phase
factor of every eigenvector independently, eq~\eqref{eq:H3Z} remains satisfied.
As a result, even though we have carefully chosen the basis set
$\{\Phi_n\}_{n=1}^m$ such that it is possible to parametrize $\mb{H}_u^Z$ as
presented in eq~\eqref{eq:HuZ}, the matrices $\widetilde{\mb{H}}_x^Z$ and
$\widetilde{\mb{H}}_y^Z$ cannot be expressed the same way for every possible
unitary transformation $\mb{U}$, {\it i.e.} with every possible choice of the
phase factors. One can overcome this problem by just using a unitary
transformation of the form $\mb{U} = \mr{exp}(-i\theta \vec{\mb{S}}\cdot \vec
n)$ , because thanks to the identity in eq~\eqref{SU:SO} the vector
$\vec{\mb{S}}$ is simply rotated when such a transformation is employed [see
also eqs~\eqref{eq:tildeg:UpSUp} and~\eqref{eq:tildeg:OpS}]. Fortunately,
another consequence of the discussion in
sections~\ref{sec:introduction}--\ref{sec:principal} is that the g-tensor can
be diagonalized and that the unitary transformation $\mb{U}$ that is necessary
for the process [see eq~\eqref{U:trans} and related discussion] can be
parametrized using the exponential mapping
\begin{gather}
\label{eq:exp:U}
\mb{U} = e^{-i\theta \vec{\mb{S}}\cdot \vec n}.
\end{gather}
In other words, $\mb{U}$ is a member of the $m$-dimensional irreducible
representation of SU$(2)$ [which is a subgroup of SU$(m)$]. This is a helpful
statement, because it means that by proper choice of the phase factors for the
coefficients $\mb{C}$ in eq~\eqref{eq:H3Z}, the unitary transformation $\mb{U}$
in eq~\eqref{eq:H3Z:UC} can be made to satisfy eq~\eqref{eq:exp:U}. In the
following, we consider the doublet case, $m=2$, separately, because the
exponential form of $\mb{U}$ is easily guaranteed. Further on below we will
discuss the procedure for the general case of arbitrary $m$.
{\bf The doublet case:} As we stated above, the eigenvectors that diagonalize
$\mb{H}_3^Z$ are not unique, because one can change their phase factors freely
and eq~\eqref{eq:H3Z} will remain satisfied
\begin{gather}
\label{eq:Cpahse1}
p_{kl} = \delta_{kl} e^{i\alpha_k},
\quad
\alpha_k \in \mathbb{R},
\\
\label{eq:Cpahse2}
\mb{p}^\dagger \mb{p} = \mb{p} \,\mb{p}^\dagger = \mb{1},
\\
\label{eq:Cpahse3}
\widetilde{\mb{C}} = \mb{C} \mb{p},
\quad
\widetilde{\mb{e}} = \mb{p}^\dagger \mb{e} \mb{p} = \mb{e},
\\
\label{eq:Cpahse4}
\mb{H}_3^Z \widetilde{\mb{C}} = \widetilde{\mb{C}} \mb{e}.
\end{gather}
Because the matrix $\mb{C}$ forms a unitary transformation, its determinant is a
simple phase factor, $\mr{det}\,\mb{C} = \mr{exp}(i\gamma)$, $\gamma \in
\mathbb{R}$ [see eqs~\eqref{phase:U:1}--\eqref{phase:U:4}]. Therefore, one can
always choose the phase factors for the eigenvectors such that the determinant
of the new coefficient matrix $\widetilde{\mb{C}}$ is equal to one
\begin{gather}
\label{eq:alpah:p}
\mr{det}\,\mb{C} = e^{i\gamma},
\quad
\sum_{k=1}^m \alpha_k = -\gamma
\quad
\Rightarrow
\quad
\mr{det}\,\widetilde{\mb{C}} = \mr{det}\,\mb{C} \,\mr{det}\,\mb{p} = 1.
\end{gather}
As this procedure can be always performed, without loss of generality we can
assume that the matrix $\mb{C}$ in eq~\eqref{eq:H3Z} already has a determinant
equal to one, and can write
\begin{gather}
\label{eq:H3Z:SU}
\mb{U} \in \mr{SU}(2),
\quad
\mr{det}\,\mb{U} = 1.
\end{gather}
When representing elements of the group $\mr{SU}(2)$ in the two dimensional
complex space $\mathbb{C}^2$, every group element can be written in the
exponential form as presented in eq~\eqref{eq:exp:U} with $\vec{\mb{S}} =
\tfrac{1}{2}\vec{\sigma}$. The transformation in eq~\eqref{eq:HubarVHV} then
leads to matrices $\widetilde{\mb{H}}_u^Z$ that can be again parametrized using
only spin matrices with expansion coefficients $\widetilde{\mb{g}}$ [see also
eqs~\eqref{eq:tildeg:OpS} and~\eqref{eq:tildeg:OpS1}]
\begin{gather}
\label{eq:tildeHgS}
\widetilde{\mb{H}}_u^Z
=
\frac{1}{2c} \widetilde{g}_{uv} \mb{S}_v.
\end{gather}
Therefore one can write
\begin{gather}
\label{eq:gtogtilde}
\mb{G}
= \bs{g} \bs{g}^\mathsf{T}
= \widetilde{\bs{g}} (\mb{O}^+)^\mathsf{T}
[ \widetilde{\bs{g}} (\mb{O}^+)^\mathsf{T} ]^\mathsf{T}
= \widetilde{\bs{g}} \widetilde{\bs{g}}^\mathsf{T}
= \widetilde{\mb{G}},
\end{gather}
with $\mb{O}^+$ connected to the unitary transformation according to
eq~\eqref{SU:SO:2}. Furthermore, because we have assumed that the G-tensor is
diagonal, according to eq~\eqref{eq:gtogtilde} the $\widetilde{\mr{G}}$-tensor
is diagonal as well. Diagonalizing the matrix $\mb{H}_3^Z$ then satisfies
eq~\eqref{eq:HuZ:zz} for $u=3$, so two elements of the $\widetilde{g}$-tensor
are zero
\begin{gather}
\label{eq:g-zero}
\widetilde{g}_{31} = \widetilde{g}_{32} = 0.
\end{gather}
In addition, because $\widetilde{\mr{G}}$-tensor is diagonal, the rows of the
$\widetilde{g}$-tensor form an orthogonal set of vectors,
$\{\vec{v}_u\}_{u=1}^3$, see also eq~\eqref{eq:def:W1} and related discussion
\begin{gather}
(v_u)_v = \widetilde{g}_{uv},
\\
\vec{v}_u \cdot \vec{v}_v = 0,
\quad
u\ne v.
\end{gather}
Note that $\vec{v}_3$ has the first two components zero, see
eq~\eqref{eq:g-zero}. Thus, if we further assume that $\widetilde{g}_{33} \ne
0$ then
\begin{gather}
\label{eq:v3v1}
\vec{v}_3 \cdot \vec{v}_1 = \widetilde{g}_{33} \,\widetilde{g}_{13} = 0
\quad
\Rightarrow
\quad
\widetilde{g}_{13} = 0,
\\
\label{eq:v3v2}
\vec{v}_3 \cdot \vec{v}_2 = \widetilde{g}_{33} \,\widetilde{g}_{23} = 0
\quad
\Rightarrow
\quad
\widetilde{g}_{23} = 0.
\\
\label{eq:v1v2}
\Rightarrow
\quad
\vec{v}_1 \cdot \vec{v}_2 = \widetilde{g}_{11} \,\widetilde{g}_{21}
+ \widetilde{g}_{12} \,\widetilde{g}_{22} = 0.
\end{gather}
Combining eqs~\eqref{eq:g-zero}, \eqref{eq:v3v1} and~\eqref{eq:v3v2} one gets
\begin{gather}
\label{eq:gtilde:almost}
\widetilde{\bs{g}} =
\left(\begin{array}[c]{rrr}
\widetilde{g}_{11} & \widetilde{g}_{12} & 0 \\
\widetilde{g}_{21} & \widetilde{g}_{22} & 0 \\
0 & 0 & \widetilde{g}_{33}
\end{array}\right).
\end{gather}
As discussed above, diagonalization of $\mb{H}_3^Z$ is (in the general case)
not sufficient to diagonalize the g-tensor. However, one may take advantage of
the remaining degree of freedom in the coefficients in eq~\eqref{eq:H3Z} and
change their phase factors such that the determinant of the matrix $\mb{C}$ is
preserved [see also eqs~\eqref{eq:Cpahse1}--\eqref{eq:Cpahse4}]
\begin{gather}
\label{eq:pahse:0}
\mr{det}\,\mb{C} = 1,
\quad
p_{kl} = \delta_{kl} e^{i\alpha_k},
\quad
\sum_{k=1}^m \alpha_k = 0
\quad
\Rightarrow
\quad
\mr{det}\,\widetilde{\mb{C}} = \mr{det}\,\mb{C} \,\mr{det}\,\mb{p} = 1.
\end{gather}
In the doublet case, because eq~\eqref{eq:pahse:0} leads only to matrices
$\mb{p}$ that belong to SU$(2)$, the matrix $\widetilde{\mb{C}} = \mb{C}
\mb{p}$ belongs to SU$(2)$ as well and thus can be written in exponential form.
Although this procedure works for the doublet case only, we formulate the
following equations for any multiplicity, to show that one can choose the form
of the matrix $\mb{p}$ such that it belongs to the $m$-dimensional irreducible
representation (irrep) of SU$(2)$. If $\mb{C}$ then belongs to this irrep,
$\widetilde{\mb{C}}$ will belong to the same group as well, {\it i.e.} one can
write it in an exponential form, eq~\eqref{eq:exp:U}. However, as discussed
above, $\mb{C}$ might not belong to this irreducible representation, and thus
one needs to apply a different procedure to diagonalize the g-tensor for higher
than doublet multiplicities. In the doublet case, eq~\eqref{eq:pahse:0} leads
to the matrix $\mb{p}$ in the following expression without any restrictions,
while for higher multiplicities one must additionally restrict the choice of
the phase factors
\begin{gather}
\label{eq:pS3}
\{\alpha_k\}_{k=1}^m = \{ - \eta S, - \eta (S-1), \dots, \eta S \},
\quad
m = 2S + 1,
\quad
\eta \in \mathbb{R}
\\
\label{eq:pS3-1}
\Rightarrow
\quad
\mb{p}
=
\left(\begin{array}[c]{cccc}
e^{-i\eta S} & 0 & \dots & 0 \\
0 & e^{-i\eta (S-1)} & \dots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & 0 & \dots & e^{i\eta S}
\end{array}\right)
=
e^{-i\eta \mb{S}_3}.
\end{gather}
Using this form of the matrix $\mb{p}$ we can then transform
eq~\eqref{eq:tildeHgS} as
\begin{align}
\mb{p}^\dagger \widetilde{\mb{H}}_u^Z \mb{p}
&=
\frac{1}{2c} \widetilde{g}_{uv} e^{i\eta \mb{S}_3} \mb{S}_v e^{-i\eta \mb{S}_3},
\\
\label{eq:pHpS:3}
\mb{p}^\dagger \widetilde{\mb{H}}_u^Z \mb{p}
&=
\frac{1}{2c} \widetilde{g}_{uv} \brr{e^{-i\eta \mb{R}_3}}_{vw} \mb{S}_w,
\\
\label{eq:pHpS:4}
\mb{p}^\dagger \widetilde{\mb{H}}_u^Z \mb{p}
&=
\frac{1}{2c} \widebar{g}_{uv} \mb{S}_v,
\quad
\widebar{\bs{g}} = \widetilde{\bs{g}} e^{-i\eta \mb{R}_3},
\end{align}
where we have used identity~\eqref{SU:SO} derived in Appendix~\ref{app:rot}.
Because of the form of the matrix $\mb{R}_3$, eq~\eqref{R:def2}, the
exponential factor in eq~\eqref{eq:pHpS:4} can be written as follows
\begin{gather}
\label{eq:Rtoeta}
e^{-i\eta \mb{R}_3}
=
\left(
\begin{array}{cc|c}
& & 0 \\
\multicolumn{2}{c|}{\smash{\raisebox{.5\normalbaselineskip}{$e^{-i\eta\sigma_2}$}}}
& 0 \\
\hline \\[-\normalbaselineskip]
0 & 0 & 1
\end{array}
\right)
=
\left(
\begin{array}{cc|c}
& & 0 \\
\multicolumn{2}{c|}{\smash{\raisebox{.5\normalbaselineskip}
{$\mr{cos}\,\eta-i\sigma_2\,\mr{sin}\,\eta$}}}
& 0 \\
\hline \\[-\normalbaselineskip]
0 & 0 & 1
\end{array}
\right)
=
\left(
\begin{array}{ccc}
\mr{cos}\,\eta & -\mr{sin}\,\eta & 0 \\
\mr{sin}\,\eta & \mr{cos}\,\eta & 0 \\
0 & 0 & 1
\end{array}
\right).
\end{gather}
Combining eqs~\eqref{eq:gtilde:almost}, \eqref{eq:pHpS:4} and~\eqref{eq:Rtoeta}
one gets
\begin{gather}
\widebar{\bs{g}}
=
\left(\begin{array}[c]{rrr}
\widetilde{g}_{11} & \widetilde{g}_{12} & 0 \\
\widetilde{g}_{21} & \widetilde{g}_{22} & 0 \\
0 & 0 & \widetilde{g}_{33}
\end{array}\right)
\left(
\begin{array}{ccc}
\mr{cos}\,\eta & -\mr{sin}\,\eta & 0 \\
\mr{sin}\,\eta & \mr{cos}\,\eta & 0 \\
0 & 0 & 1
\end{array}
\right).
\end{gather}
Our goal is to diagonalize the matrix $\widebar{\bs{g}}$, a task which amounts
to solving the following two equations with unknown parameter $\eta$
\begin{align}
\label{eq:v1rot}
-\widetilde{g}_{11} \,\mr{sin}\,\eta + \widetilde{g}_{12} \,\mr{cos}\,\eta &= 0,
\\
\label{eq:v2rot}
\widetilde{g}_{21} \,\mr{cos}\,\eta + \widetilde{g}_{22} \,\mr{sin}\,\eta &=0.
\end{align}
Because the rows of the $\widetilde{g}$-tensor are orthogonal vectors, see
eq~\eqref{eq:v1v2}, and the matrix $\mr{exp}(-i\eta \sigma_2)$ represents a
rotation in the two-dimensional real vector space, it is always possible to
find such a rotation if the vectors are nonzero. Indeed, the solution of
eqs~\eqref{eq:v1rot} and~\eqref{eq:v2rot} reads
\begin{gather}
\label{eq:eta}
\eta
= \mr{tan}^{-1}\brr{\frac{\widetilde{g}_{12}}{\widetilde{g}_{11}}}
= \mr{tan}^{-1}\brr{-\frac{\widetilde{g}_{21}}{\widetilde{g}_{22}}},
\end{gather}
where we have utilized eq~\eqref{eq:v1v2}. The parameter $\eta$ in
eq~\eqref{eq:eta} defines the matrix $\mb{p}$ in eqs~\eqref{eq:pahse:0}
and~\eqref{eq:pS3} that diagonalizes the $\widebar{g}$-tensor according to
eq~\eqref{eq:pHpS:4}.
The only loose end is the assumption that the rows of the
$\widetilde{g}$-tensor are nonzero. In the case of one or more zero rows, one
may fix the above procedure using a solution to analogous problem discussed in
section~\ref{sec:principal}.
{\bf The case of an arbitrary multiplicity:} In the procedure for the doublet
case we took advantage of the fact that, by fixing the determinant of the
matrix $\mb{C}$ to one, it will automatically belong to the $2$-dimensional
irreducible representation of SU$(2)$---{\it i.e.} the natural
representation---and can thus be expressed using the exponential mapping, see
eq~\eqref{eq:exp:U}. For the case of higher than doublet multiplicity, fixing
the determinant of $\mb{C}$ to one will make it a member of the group SU$(m)$,
but not necessarily a member of the $m$-dimensional irreducible representation
of SU$(2)$. However, as discussed earlier, there exists a choice of phase
factors $\mb{p}$ such that the matrix $\mb{C}\mb{p}$ is a member of the irrep
and thus can be parametrized according to eq~\eqref{eq:exp:U}. In addition, a
proper choice of $\mb{p}$ would lead to a diagonal g-tensor, {\it i.e.}
eq~\eqref{eq:HuZ:zz} would be satisfied ($u$ is not a summation index)
\begin{gather}
\label{eq:HuZ:zz-1}
\mb{p}^\dagger \widetilde{\mb{H}}_u^Z \mb{p}
= \tfrac{1}{2c} \widetilde{g}_{uu} \mb{S}_u.
\end{gather}
Because there exist $\mb{p}$ for which this equation holds, the equation has
the following form for $u=1$
\begin{gather}
\left(\begin{array}[c]{cccc}
e^{-i\alpha_1} & 0 & \dots & 0 \\
0 & e^{-i\alpha_2} & \dots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & 0 & \dots & e^{-i\alpha_m}
\end{array}\right)
\left(\begin{array}[c]{ccccc}
0 & r_1 e^{i\beta_1} & \dots & 0 & 0 \\
r_1 e^{-i\beta_1} & 0 & \dots & 0 & 0 \\
\vdots & \vdots & \ddots & \vdots & \vdots \\
0 & 0 & \dots & 0 & r_{m-1}e^{i\beta_{m-1}} \\
0 & 0 & \dots & r_{m-1}e^{-i\beta_{m-1}} & 0 \\
\end{array}\right)
\times
\\
\times
\left(\begin{array}[c]{cccc}
e^{i\alpha_1} & 0 & \dots & 0 \\
0 & e^{i\alpha_2} & \dots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & 0 & \dots & e^{i\alpha_m}
\end{array}\right)
= \tfrac{1}{2c} \widetilde{g}_{11}
\left(\begin{array}[c]{ccccc}
0 & r_1 & \dots & 0 & 0 \\
r_1 & 0 & \dots & 0 & 0 \\
\vdots & \vdots & \ddots & \vdots & \vdots \\
0 & 0 & \dots & 0 & r_{m-1} \\
0 & 0 & \dots & r_{m-1} & 0 \\
\end{array}\right).
\end{gather}
Here only the upper- and lower-diagonal of the matrix $\widetilde{\mb{H}}_1^Z$
are nonzero. In addition, they are composed of complex numbers with arbitrary
phases and moduli equal to the off-diagonal elements of the matrix $\mb{S}_1$.
Because the beta parameters are known, one can write set of linear equations
for the unknown alpha parameters as
\begin{gather}
\label{eq:get-pahses}
\left(\begin{array}[c]{rrrrrr}
1 & -1 & 0 & \dots & 0 & 0 \\
0 & 1 & -1 & \dots & 0 & 0 \\
\vdots \mkern 1.5mu & \vdots \mkern 1.5mu & \vdots \mkern 1.5mu & \ddots\, & \vdots \mkern 1.5mu & \vdots \mkern 1.5mu \\
0 & 0 & 0 & \dots & 1 & -1 \\
1 & 1 & 1 & \dots & 1 & 1 \\
\end{array}\right)
\left(\begin{array}[c]{c}
\alpha_1 \\
\alpha_2 \\
\vdots \\
\alpha_{m-1} \\
\alpha_m \\
\end{array}\right)
=
\left(\begin{array}[c]{c}
\beta_1 \\
\beta_2 \\
\vdots \\
\beta_{m-1} \\
-\gamma \\
\end{array}\right).
\end{gather}
In eq~\eqref{eq:get-pahses} the last equation represents the fact that the new
coefficients $\widetilde{\mb{C}} = \mb{C} \mb{p}$ should belong to the
$m$-dimensional irreducible representation of SU$(m)$ with
$\mr{det}\,\widetilde{\mb{C}} = 1$. However, the untransformed matrix $\mb{C}$
has a determinant with an arbitrary phase, $\mr{det}\,\mb{C} =
\mr{exp}(i\gamma)$, see also eqs~\eqref{eq:Cpahse1}--\eqref{eq:alpah:p}. The
determinant of the matrix in eq~\eqref{eq:get-pahses} is nonzero, and therefore
the equation has a unique solution which defines the transformation matrix
$\mb{p}$, which in turn diagonalizes the g-tensor according to
eq~\eqref{eq:HuZ:zz-1}. Note that this procedure also works for the doublet
case.
The procedure for the diagonalization of the g-tensor under the assumptions
discussed in section~\ref{sec:introduction} can be summarized as follows:
\begin{enumerate}
\item
Choose the reference basis set $\{\Phi_n\}_{n=1}^m$ such that it satisfies the
same transformations under time-reversal symmetry as presented in
eq~\eqref{eq:TRrelations}, see section~\ref{sec:gt:construct}.
\item
Construct matrices $\mb{H}_u^Z$ and calculate the g-tensor, see
eq~\eqref{eq:HuZ}.
\item
Find the principal axes in real space, {\it i.e.} diagonalize the G-tensor, see
also eqs~\eqref{G:trans2} and~\eqref{G:diag1}.
\item
Diagonalize the matrix $\mb{H}_3^Z$ and determine the $\widetilde{g}_{33}$
g-value, see eqs~\eqref{eq:H3Z}--\eqref{eigen:g33:2}.
\item
Calculate $\widetilde{\mb{H}}_1^Z$ and determine the phase factors (alpha
parameters) by solving the linear set of equation in eq~\eqref{eq:get-pahses}.
\item
Construct the matrix $\mb{p}$, $p_{kl} = \delta_{kl}\,\mr{exp}(i\alpha_k)$, and
diagonalize the g-tensor according to eq~\eqref{eq:HuZ:zz-1}.
\end{enumerate}
\begin{appendices}
\section{}
\label{app:diag}
If one has access to the solutions of the perturbation-free eigenproblem,
eq~\eqref{eigen:H0}, it is convenient to express the wavefunctions $\Psi_k$ in
the truncated orthonormal basis of $\Phi_n$
\begin{gather}
\Psi_k = C_{nk} \Phi_n.
\end{gather}
By projecting eq~\eqref{HPsiEPsi} onto the space defined by the orthonormal
wavefunctions $\Phi_n$, we then obtain the following eigenvalue matrix equation
\begin{gather}
\big< \Phi_m \big| H^0 + H^Z \big| \Phi_n \big> \, C_{nk}
=
\mc{E}_k \, C_{mk},
\\
\left[ E_m \delta_{mn} + \big< \Phi_m \big| H^Z \big| \Phi_n \big> \right] \, C_{nk}
=
\mc{E}_k \, C_{mk}.
\end{gather}
Here we have used the eigenvalue expression in eq~\eqref{eigen:H0}, the
Kronecker delta function $\delta_{mn}$, and the fact that the set of basis
functions $\{\Phi_n\}$ is orthonormal, $\big< \Phi_m \big| \Phi_n \big> =
\delta_{mn}$.
\section{}
\label{app:odd-electrons}
{\bf Theorem:} For a system with an odd number of electrons described by a
time-reversal-symmetric Hamiltonian, every energy level is even-times
degenerate and the eigenfunctions can be chosen to form Kramers partners
\begin{gather}
\label{eq:Nodd:KP}
N_\mr{e} \text{ is odd},
\quad [H,\mc{K}]=0,
\quad H\Psi_i = E\Psi_i
\\
\Rightarrow
\quad
i=1 \dots 2N^E,
\quad \{\Psi_i,\widebar{\Psi}_i\} \in \{\Psi_i\}_{i=1}^{2N^E}.
\end{gather}
In addition, $\{\Psi_i\}_{i=1}^{2N^E}$ forms an orthonormal set of wavefunctions.
\noindent{\bf Proof:} In Appendices~\ref{app:KP} and~\ref{app:kramers-partner}
it is shown that, for an odd number of electrons, Kramers partners are
orthonormal---{\it i.e.} they form two distinct wavefunctions---and that Kramers
partners are eigenfunctions belonging to the same energy level. Therefore, one
can simply choose any eigenfunction $\Psi_1$, $H\Psi_1 = E\Psi_1$, and then by
forming its Kramers partner, $\widebar{\Psi}_1 = \mc{K}\Psi_1$, one gets another
eigenfunction with the same energy, $H\widebar{\Psi}_1 = E\widebar{\Psi}_1$.
Without loss of generality, we can then assume that a set of $2n$
eigenfunctions of $H$ are already orthonormal and form Kramers partners,
$\{\Psi_i,\widebar{\Psi}_i\}_{i=1}^{n}$. When starting the procedure outlined
below, simply set $n=1$. If the energy level is more than $2n$-times degenerate
one needs to construct a wavefunction $\Psi_{2n+1}$ that is orthonormal
to the set $\{\Psi_i,\widebar{\Psi}_i\}_{i=1}^{n}$ and that is an eigenfunction of
$H$ with the energy $E$. One way to create $\Psi_{2n+1}$ is by the
following projection technique
\begin{gather}
\label{eq:KP:tilde1}
\Psi_{2n+1}
=
\brr{ 1 - \sum_{i=1}^{n}\left| \Psi_i \right> \left< \Psi_i \right|
- \sum_{i=1}^{n}\left| \widebar{\Psi}_i \right> \left< \widebar{\Psi}_i \right|} \Psi_j^\mr{orig}
,
\\
\label{eq:KP:tilde2}
k = 1 \dots n
\quad
\Rightarrow
\\
\label{eq:KP:tilde3}
\bapa{\Psi_k}{\Psi_{2n+1}}
=
\bapa{\Psi_k}{\Psi_j^\mr{orig}}
-
\sum_{i=1}^n \bapa{\Psi_k}{\Psi_i} \bapa{\Psi_i}{\Psi_j^\mr{orig}}
-
\sum_{i=1}^n \bapa{\Psi_k}{\widebar{\Psi}_i} \bapa{\widebar{\Psi}_i}{\Psi_j^\mr{orig}}
= 0
,
\\
\label{eq:KP:tilde4}
\bapa{\widebar{\Psi}_k}{\Psi_{2n+1}}
=
\bapa{\widebar{\Psi}_k}{\Psi_j^\mr{orig}}
-
\sum_{i=1}^n \bapa{\widebar{\Psi}_k}{\Psi_i} \bapa{\Psi_i}{\Psi_j^\mr{orig}}
-
\sum_{i=1}^n \bapa{\widebar{\Psi}_k}{\widebar{\Psi}_i} \bapa{\widebar{\Psi}_i}{\Psi_j^\mr{orig}}
= 0
.
\end{gather}
where we have utilized the fact that $\bapa{\Psi_k}{\Psi_i}
=\bapa{\widebar{\Psi}_k}{\widebar{\Psi}_i} = \delta_{ki}$ and
$\bapa{\Psi_k}{\widebar{\Psi}_i} = \bapa{\widebar{\Psi}_k}{\Psi_i} = 0$. The
wavefunction $\Psi_j^\mr{orig}$ is from the initial set of eigenfunctions of
the Hamiltonian---{\it i.e.} a set that does not necessarily consist of sets of
Kramers partners. If $\Psi_j^\mr{orig}$ belongs to the subspace formed by
$\{\Psi_i,\widebar{\Psi}_i\}_{i=1}^{n}$ then $\Psi_{2n+1}$ is zero, in which
case one needs to repeat the procedure with a different $\Psi^\mr{orig}$ until
a nonzero wavefunction is obtained. When successful one can then normalize
the wavefunction $\Psi_{2n+1}$. Because $\Psi_{2n+1}$ is a linear combination
of eigenfunctions of the same energy level, it is also an eigenfunction with
that same energy as well.
According to Appendix~\ref{app:KP} the wavefunction $\widebar{\Psi}_{2n+1}$ is
orthogonal to $\Psi_{2n+1}$, and because $\Psi_{2n+1}$ is orthonormal to the
set $\{\Psi_i,\widebar{\Psi}_i\}_{i=1}^{n}$,
eqs~\eqref{eq:KP:tilde2}--\eqref{eq:KP:tilde4}, $\widebar{\Psi}_{2n+1}$ is
orthonormal to this set as well ($k = 1 \dots n$)
\begin{gather}
\bapa{\widebar{\Psi}_{2n+1}}{\Psi_k}
= \bapa{\mc{K}\Psi_{2n+1}}{\Psi_k}
= \bapa{\Psi_{2n+1}}{\mc{K}^\dagger\Psi_k}^\ast
= -\bapa{\Psi_{2n+1}}{\widebar{\Psi}_k}^\ast
= 0,
\\
\bapa{\widebar{\Psi}_{2n+1}}{\widebar{\Psi}_k}
= \bapa{\mc{K}\Psi_{2n+1}}{\widebar{\Psi}_k}
= \bapa{\Psi_{2n+1}}{\mc{K}^\dagger\mc{K}\Psi_k}^\ast
= \bapa{\Psi_{2n+1}}{\Psi_k}^\ast
= 0,
\end{gather}
where we have utilized the fact that for an odd number of electrons the
following holds [see also eq~\eqref{eq:KK}]
\begin{align}
\mc{K}\mc{K} &= -1,
\\
\mc{K}^\dagger\mc{K}\mc{K} &= -\mc{K}^\dagger,
\\
\mc{K}^\dagger &= -\mc{K},
\end{align}
and that $\mc{K}$ is a unitary operator, $\mc{K}^\dagger\mc{K}=1$. In
addition, note that Kramers partners have the same norm, see
Appendix~\eqref{app:kramers-partner}, and thus if $\Psi_{2n+1}$ is normalized
to one then $\widebar{\Psi}_{2n+1}$ is normalized to one as well. If $2n+2 <
2N^E$ then one should repeat the described procedure with $n=n+1$. Finally, it
is now clear that every energy level must be even-times degenerate, because
when using the procedure described above one adds eigenfunctions in pairs. QED.
\section{}
\label{app:non-kramers-partner}
{\bf Theorem:} The non-Kramers partners\cite{Griffith:1963:non-KP} can be
constructed from the non-magnetic wavefunctions as follows
\begin{gather}
\label{nonKP}
\begin{array}[c]{cc}
\mathcal{K}\Psi_1 = \Psi_1 \\
\mathcal{K}\Psi_2 = \Psi_2
\end{array}
\quad
\Rightarrow
\quad
\begin{array}[c]{cc}
\Phi = \tfrac{1}{\sqrt{2}} \brr{ \Psi_1 + i \Psi_2 } \\
\widebar\Phi = \tfrac{1}{\sqrt{2}} \brr{ \Psi_1 - i \Psi_2 } \\
\end{array}
,
\\
\bapa{\Psi_i}{\Psi_j} = \delta_{ij},
\quad i,j = 1,2
\quad
\Rightarrow
\quad
\bapa{\Phi}{\Phi} = \bapa{\widebar\Phi}{\widebar\Phi} = 1.
\end{gather}
\noindent{\bf Proof:} Using the fact that $\mc{K}$ is an antilinear operator
[see eq~\eqref{antilinear2}], it holds that
\begin{gather}
\widebar{\Phi} = \mc{K}\Phi = \tfrac{1}{\sqrt{2}} \mc{K}\brr{ \Psi_1 + i \Psi_2 }
= \tfrac{1}{\sqrt{2}} \brr{ \mc{K}\Psi_1 - i \mc{K}\Psi_2 }
= \tfrac{1}{\sqrt{2}} \brr{ \Psi_1 - i \Psi_2 }
\\
\bapa{\Phi}{\Phi}
= \tfrac{1}{2}\bapa{\Psi_1 + i \Psi_2}{\Psi_1 + i \Psi_2}
\\
= \tfrac{1}{2}\brs{ \bapa{\Psi_1}{\Psi_1}
+\bapa{\Psi_2}{\Psi_2}
+2\mc{R}\brr{ i\bapa{\Psi_1}{\Psi_2} } }
= 1.
\end{gather}
And according to Appendix~\ref{app:kramers-partner} (non-)Kramers partners have
the same norm. QED.
\section{}
\label{app:non-magnetic1}
{\bf Theorem:} Eigenfunctions of the time-reversal symmetric Hamiltonian for a
system with an even number of electrons can be chosen such that they are invariant
under time-reversal, {\it i.e.} they are non-magnetic (see
Appendix~\ref{app:non-magnetic2})
\begin{equation}
\label{eq:Neven:non-magnetic}
N_\mr{e} \text{ is even},
\quad H\Psi = E\Psi,
\quad [H,\mc{K}]=0
\quad
\Rightarrow
\quad
\mathcal{K}\Psi = \Psi,
\end{equation}
and form an orthonormal set of wavefunctions.
\noindent{\bf Proof:} To prove the above theorem it is sufficient to show that
eq~\eqref{eq:Neven:non-magnetic} holds for an energy level of arbitrary
degeneracy, $i=1 \dots N^E$
\begin{equation}
\label{eq:Neven:non-magnetic-1}
N_\mr{e} \text{ is even},
\quad H\Psi_i = E\Psi_i,
\quad [H,\mc{K}]=0
\quad
\Rightarrow
\quad
\mathcal{K}\Psi_i = \Psi_i.
\end{equation}
Without loss of generality, let us assume that a set of $n-1$ eigenfunctions of
$H$ are already orthonormal and non-magnetic, $\mathcal{K}\Psi_i^\mr{nm} =
\Psi_i^\mr{nm}$ for $i=1 \dots n-1$, and that the $n$th eigenfunction
$\Psi_{n}$ is orthogonal to this set and normalized to one. When starting the
procedure outlined below simply set $n=1$. The Kramers partner
$\widebar{\Psi}_n \coloneqq \mc{K}\Psi_n$ is the eigenfunction of $H$ with the
energy $E$ and has the same norm as $\Psi_n$, see
Appendix~\ref{app:kramers-partner}. The non-magnetic eigenfunction of $H$ with
energy $E$ can be constructed as
\begin{gather}
\label{eq:nm-construction}
\Psi_n^\mr{nm} = c_n\Psi_n + c_n^\ast\widebar{\Psi}_n,
\end{gather}
where $c_n=r_ne^{i\alpha_n}$ is a complex number chosen such that
$\Psi_n^\mr{nm}$ is normalized to one
\begin{gather}
\bapa{\Psi_n^\mr{nm}}{\Psi_n^\mr{nm}}
=
|c_n|^2 \bapa{\Psi_n}{\Psi_n} +
|c_n|^2 \bapa{\widebar{\Psi}_n}{\widebar{\Psi}_n} +
c_n^2 \bapa{\widebar{\Psi}_n}{\Psi_n} +
(c_n^2)^\ast \bapa{\Psi_n}{\widebar{\Psi}_n}
\\
=
2|c_n|^2 + 2 \mc{R} \brr{c_n^2 \bapa{\widebar{\Psi}_n}{\Psi_n}} =
2 r_n^2 \brs{1 + \mc{R} \brr{e^{i2\alpha_n} \bapa{\widebar{\Psi}_n}{\Psi_n}} }
\overset{!}{=} 1.
\end{gather}
One solution for the parameters $r_n$ and $\alpha_n$ can be expressed as
\begin{gather}
\label{eq:c:aa0}
\bapa{\widebar{\Psi}_n}{\Psi_n} = 0
\quad
\Rightarrow
\quad
r_n = \tfrac{1}{\sqrt{2}}, \quad \forall \alpha_n \in \mathbb{R},
\\
\label{eq:c:aa1}
\bapa{\widebar{\Psi}_n}{\Psi_n} \ne 0
\quad
\Rightarrow
\quad
r_n = \brs{ 2 \brr{1 + \brp{\bapa{\widebar{\Psi}_n}{\Psi_n}}}}^{-\tfrac{1}{2}} , \quad
\alpha_n = - \tfrac{1}{2}\,\mr{arccos}
\brr{ \frac{\mc{R}\bapa{\widebar{\Psi}_n}{\Psi_n}}{\brp{\bapa{\widebar{\Psi}_n}{\Psi_n}}} }.
\end{gather}
The wavefunction $\Psi_n^\mr{nm}$ is non-magnetic
\begin{gather}
\label{eq:nm-proof}
\mc{K}\Psi_n^\mr{nm} = \mc{K}c_n\Psi_n + \mc{K}c_n^\ast\widebar{\Psi}_n
= c_n^\ast\mc{K}\Psi_n + c_n\mc{K}\widebar{\Psi}_n
= c_n^\ast\widebar{\Psi}_n + c_n\Psi_n = \Psi_n^\mr{nm}.
\end{gather}
Furthermore, $\Psi_n^\mr{nm}$ is an eigenfunction of $H$ with eigenvalue $E$,
because it is composed of two wavefunctions $\Psi_n$ and $\widebar{\Psi}_n$
which are also eigenfunctions of $H$ with eigenvalue $E$ [see also
~\eqref{eq:psibar4}]. In eq~\eqref{eq:nm-proof} we have utilized the relation
$\mc{K}^2=1$, which holds for systems with even numbers of electrons, see
eq~\eqref{eq:KK}. Finally, because $\Psi_n$ is orthogonal to the set of
wavefunctions $\{\Psi_i^\mr{nm}\}_{i=1}^{n-1}$,
$\bapa{\Psi_i^\mr{nm}}{\Psi_n}=0$, the non-magnetic eigenfunction
$\Psi^\mr{nm}_n$ is orthogonal to this set as well
\begin{gather}
\bapa{\Psi_i^\mr{nm}}{\Psi_n^\mr{nm}} = c_n \bapa{\Psi_i^\mr{nm}}{\Psi_n}
+ c_n^\ast \bapa{\Psi_i^\mr{nm}}{\widebar{\Psi}_n}
= c_n^\ast \bapa{\Psi_i^\mr{nm}}{\mc{K}^\dagger\mc{K}\widebar{\Psi}_n}
\\
= c_n^\ast \bapa{\mc{K} \Psi_i^\mr{nm}}{\mc{K}\mc{K}\Psi_n}^\ast
= c_n^\ast \bapa{\Psi_i^\mr{nm}}{\Psi_n}^\ast = 0.
\end{gather}
To repeat the procedure outlined above, one first needs to construct the
wavefunction $\Psi_{n+1}$ that is orthonormal to our given set of non-magnetic
orthonormal eigenfunctions $\{\Psi_i^\mr{nm}\}_{i=1}^{n}$ and that is the
eigenfunction of $H$ with the energy $E$. One way to construct such
wavefunction is to project out every wavefunction
$\{\Psi_i^\mr{nm}\}_{i=1}^{n}$ from the eigenfunction $\Psi_j^\mr{orig}$
\begin{gather}
\label{eq:psi:tilde1}
\Psi_{n+1}
=
\brr{ 1 - \sum_{i=1}^n\left| \Psi_i^\mr{nm} \right> \left< \Psi_i^\mr{nm} \right|} \Psi_j^\mr{orig}
,
\\
\label{eq:psi:tilde2}
k = 1 \dots n
\quad
\Rightarrow
\quad
\bapa{\Psi_k^\mr{nm}}{\Psi_{n+1}}
=
\bapa{\Psi_k^\mr{nm}}{\Psi_j^\mr{orig}}
-
\sum_{i=1}^n \bapa{\Psi_k^\mr{nm}}{\Psi_i^\mr{nm}} \bapa{\Psi_i^\mr{nm}}{\Psi_j^\mr{orig}}
= 0
.
\end{gather}
where $\bapa{\Psi_k^\mr{nm}}{\Psi_i^\mr{nm}} = \delta_{ki}$ and
$\Psi_j^\mr{orig}$ is an eigenfunction from the starting set of wavefunctions
in eq~\eqref{eq:Neven:non-magnetic-1}. However, if $\Psi_j^\mr{orig}$ belongs
to the subspace represented by the wavefunctions
$\{\Psi_i^\mr{nm}\}_{i=1}^{n}$, eq~\eqref{eq:psi:tilde1} gives a zero
wavefunction. In this case one just needs to chose a different $\Psi^\mr{orig}$
and repeat until a nonzero wavefunction is obtained. Finally, normalize
the nonzero $\Psi_{n+1}$ and start the process from the beginning with $n=n+1$.
QED.
\section{}
\label{app:non-magnetic2}
{\bf Theorem:} For operators that are time-reversal-antisymmetric and
Hermitian, the non-magnetic states have vanishing expectation values
\begin{equation}
\label{eq:non-magnetic}
O^\dagger = O,
\quad
\mc{K} O \mc{K}^\dagger = -O,
\quad
\mc{K}\Psi = \Psi
\quad
\Rightarrow
\quad
\bappa{\Psi}{O}{\Psi} = 0.
\end{equation}
\noindent{\bf Proof:} Utilizing the fact that the time-reversal operator is
unitary, eq~\eqref{antilinear1}, a proper definition of the adjoint of the
antilinear operator, eq~\eqref{antilinear3}, and the fact that the expectation
values of a Hermitian operator are real, eq~\eqref{eq:hermitian}, one can show
\begin{gather}
\bappa{\Psi}{O}{\Psi}
= \bappa{\Psi}{\mc{K}^\dagger\mc{K}O\mc{K}^\dagger\mc{K}}{\Psi}
= - \bappa{\Psi}{\mc{K}^\dagger O\mc{K}}{\Psi}
= - \bappa{\mc{K}\Psi}{O}{\mc{K}\Psi}^\ast
\\
= - \bappa{\Psi}{O}{\Psi}^\ast
= - \bappa{\Psi}{O}{\Psi}.
\end{gather}
The only number that can be positive and negative at the same time is zero.
QED. Note that the reason that the wavefunctions for which $\widebar\Psi =
\Psi$ are called "non-magnetic" is that all operators which represent magnetic
interactions are time-reversal-antisymmetric and Hermitian; and thus these
wavefunctions have zero expectation values with magnetic operators according
to theorem~\eqref{eq:non-magnetic}.
\section{}
\label{app:nonKramers-off}
\noindent{\bf Theorem}: For non-Kramers partners the off-diagonal elements of
the time-reversal-anti\-symmetric and Hermitian operator $O$ are zero
\begin{equation}
O^\dagger = O,
\quad
O\mc{K} = -\mc{K}O,
\quad
\widebar\Psi = \mc{K} \Psi,
\quad
\mc{K}^2 = 1
\quad
\Rightarrow
\quad
\bappa{\Psi}{O}{\widebar\Psi} = 0
\end{equation}
\noindent{\bf Proof}: Non-Kramers pairs (see
Appendix~\ref{app:non-kramers-partner}) may arise only in the case of a system
with an even number of electrons, because they are constructed from non-magnetic
wavefunctions, $\widebar\psi = \psi$, which cannot occur for odd $N_\mr{e}$,
where $\bapa{\psi}{\widebar\psi}=0$ (see Appendix~\ref{app:KP}). For the case
of a system with an even number of electrons it holds that $\mc{K}^2 = 1$ [see
eq~\eqref{eq:KK}], and we can write
\begin{align}
\bappa{\Psi}{O}{\widebar\Psi}
&= \bappa{\Psi}{O\mc{K}}{\Psi}
= - \bappa{\Psi}{\mc{K} O}{\Psi}
= - \bappa{\mc{K}^\dagger\Psi}{O}{\Psi}^\ast
= - \bappa{\mc{K}\Psi}{O}{\Psi}^\ast
\\
&= - \bappa{\widebar\Psi}{O}{\Psi}^\ast
= - \bapa{O\Psi}{\widebar\Psi}
= - \bappa{\Psi}{O^\dagger}{\widebar\Psi}
= - \bappa{\Psi}{O}{\widebar\Psi}.
\end{align}
Here we are employing an identity valid for even $N_\mr{e}$
\begin{align}
\mc{K}^2 &= 1,
\\
\mc{K}^2\mc{K}^\dagger &= \mc{K}^\dagger,
\\
\mc{K} &= \mc{K}^\dagger,
\end{align}
as well as using the properties of the time-reversal operator in
eqs~\eqref{antilinear1} and~\eqref{antilinear3}, the definition of a Hermitian
operator, $O^\dagger = O$, and the definition of the adjoint of a linear
operator in eq~\eqref{eq:linear-adjoint}. Finally, one must note that zero is
the only number that can be simultaneously both positive and negative. QED.
\section{}
\label{app:K}
In the four-component framework the many-electron time-reversal operator, for
the system with $N_\mr{e}$ electrons, has the form
\begin{gather} \label{def:K}
\mc{K} = \prod_{i=1}^{N_\mr{e}} K_i,
\qquad
K_i = -i \Sigma_{y,i} K_{0,i},
\qquad
\Sigma_{y,i} =
\left(
\begin{matrix}
\sigma_{y,i} & 0 \\
0 & \sigma_{y,i}
\end{matrix}
\right),
\end{gather}
where $K_i$ is the one-electron time-reversal operator, $K_{0,i}$ represents
the complex conjugation operator, $K_{0,i}\,\phi(\vec{r}_i) =
\phi^\ast(\vec{r}_i)$, $\sigma_{y,i}$ is the $y$th Pauli matrix, and index $i$
indicates on which electron the operators are acting. Because $\mc{K}$ and
$K_i$ are antilinear unitary operators it holds that
\begin{gather}
\mc{K}^\dagger \mc{K} = \mc{K} \mc{K}^\dagger = 1,
\label{antilinear1}
\\
\mc{K} \left( a\Psi + b\Phi \right) = a^\ast \mc{K}\Psi + b^\ast \mc{K}\Phi,
\label{antilinear2}
\\
\big< \Psi \big| \mc{K}\Phi \big> = \big< \mc{K}^\dagger \Psi \big| \Phi \big>^\ast,
\label{antilinear3}
\\
\nonumber
\\
K_i^\dagger K_i = K_i K_i^\dagger = 1,
\label{antilinear4}
\\
K_i \left( a\psi + b\phi \right) = a^\ast K_i\psi + b^\ast K_i\phi,
\label{antilinear5}
\\
\big< \psi \big| K_i\phi \big> = \big< K_i^\dagger \psi \big| \phi \big>^\ast,
\label{antilinear6}
\end{gather}
where $a,b \in \mathbb C$; $\psi, \phi \in [L^2(\mathbb R^3)]^4$ are
four-spinors (complex vector-valued square-integrable functions from
$\mathbb{R}^3$ to $\mathbb{C}^4$); and $\Psi,\Phi \in V^{N_\mr{e}}$, with
$V^{N_\mr{e}} = S^- H^{\otimes N_\mr{e}}$ and $H=[L^2(\mathbb R^3)]^4$, are
many-electron wavefunctions that belong to the Fock subspace for $N_\mr{e}$
fermions. Because the Fock subspace $V^{N_\mr{e}}$ is equipped with the inner
product
\begin{equation}
\label{eq:ip-prop-0}
\big<.\big|.\big> : \quad V^{N_\mr{e}} \times V^{N_\mr{e}} \rightarrow \mathbb{C},
\end{equation}
defined by the properties
\begin{gather}
\label{eq:ip-prop-1}
\bapa{\Psi}{\Phi}^\ast = \bapa{\Phi}{\Psi},
\\
\label{eq:ip-prop-2}
\bapa{a\Psi_1 + b\Psi_2}{\Phi} = a \bapa{\Psi_1}{\Phi} + b \bapa{\Psi_2}{\Phi},
\quad
a,b \in \mathbb{C},
\\
\label{eq:ip-prop-3}
\Psi \ne 0
\quad
\Rightarrow
\quad
\bapa{\Psi}{\Psi} > 0,
\end{gather}
it forms a Hilbert space. Finally, note that the definition of the adjoint of
the linear operator $O$---in contrast to the antilinear operator above---is
written as
\begin{gather}
\label{eq:linear-adjoint}
\bapa{\Psi}{O\Phi} = \bapa{O^\dagger\Psi}{\Phi}.
\end{gather}
For a more detailed description of antilinear operators, we refer the
interested reader to the excellent book by Messiah.\cite{Messiah-book} Note
especially the definition of the adjoint of the antilinear operator, see
eq~\eqref{antilinear3} and related discussion in Chapter XV in
ref~\citenum{Messiah-book}.
\section{}
\label{app:Kramers-spin}
\noindent{\bf Theorem}:
For a time-reversal-antisymmetric and Hermitian operator $O$ the expectation
values of (non-)Kramers partners have opposite sign
\begin{equation}
O^\dagger = O,
\quad
\mc{K}^\dagger O\mc{K} = -O,
\quad
\widebar\Psi = \mc{K} \Psi
\quad
\Rightarrow
\quad
\bappa{\widebar\Psi}{O}{\widebar\Psi} = -\bappa{\Psi}{O}{\Psi}.
\end{equation}
\noindent{\bf Proof}:
Because $O$ is a Hermitian operator, $O^\dagger = O$, the expectation values
of any wavefunction are real
\begin{equation}
\label{eq:hermitian}
\bappa{\Psi}{O}{\Psi}^\ast
= \bapa{O\Psi}{\Psi}
= \bappa{\Psi}{O^\dagger}{\Psi}
= \bappa{\Psi}{O}{\Psi}.
\end{equation}
Considering eq~\eqref{eq:hermitian}, the properties of the time-reversal
operator $\mc{K}$, eqs~\eqref{antilinear1}--\eqref{antilinear3}, and the fact
that $O$ is time-reversal-antisymmetric, $\mc{K}^\dagger O \mc{K} = - O$, one
can write
\begin{align}
\big< \widebar\Psi \big| O \big| \widebar\Psi \big>
&=
\big< \mc{K} \Psi \big| O \big| \mc{K} \Psi \big>
=
\big< \Psi \big| \mc{K}^\dagger O \mc{K} \big| \Psi \big>^\ast
\\
&=
- \big< \Psi \big| O \big| \Psi \big>^\ast
=
- \big< \Psi \big| O \big| \Psi \big>.
\end{align}
QED.
\section{}
\label{app:phase}
\noindent{\bf Theorem}: For the doublet case, if one changes the phase of the
Kramers pair $\{\Psi, \widebar\Psi\}$ associated with the $g$-tensor
\begin{align}
\label{gt:2-psi}
\begin{array}[c]{rr}
g_{u1} =& 4c\,\mc{R} \bappa{\Psi}{H^Z_u}{\widebar\Psi},
\\
g_{u2} =&-4c\,\mc{I} \bappa{\Psi}{H^Z_u}{\widebar\Psi},
\\
g_{u3} =& 4c\,\bappa{\Psi}{H^Z_u}{\Psi},
\end{array}
\end{align}
the new $\widetilde{g}$-tensor of the phase-shifted Kramers pair
$\{\widetilde{\Psi}, \widebar{\widetilde{\Psi}}\}$
\begin{align}
\label{gt:2-phi}
\begin{array}[c]{rr}
\widetilde{g}_{u1} =& 4c\,\mc{R} \bappa{\widetilde{\Psi}}{H^Z_u}{\widebar{\widetilde{\Psi}}},
\\
\widetilde{g}_{u2} =&-4c\,\mc{I} \bappa{\widetilde{\Psi}}{H^Z_u}{\widebar{\widetilde{\Psi}}},
\\
\widetilde{g}_{u3} =& 4c\,\bappa{\widetilde{\Psi}}{H^Z_u}{\widetilde{\Psi}},
\end{array}
\end{align}
can be written in the form
\begin{gather}
\widetilde{\Psi} = e^{i\alpha} \Psi,
\quad
\alpha \in \mathbb{R}
\\
\label{eq:gtogbyphase}
\Rightarrow
\quad
\left(\begin{array}[c]{rrr}
\widetilde{g}_{11} & \widetilde{g}_{12} & \widetilde{g}_{13} \\
\widetilde{g}_{21} & \widetilde{g}_{22} & \widetilde{g}_{23} \\
\widetilde{g}_{31} & \widetilde{g}_{32} & \widetilde{g}_{33}
\end{array}\right)
=
\left(\begin{array}[c]{rrr}
g_{11} & g_{12} & g_{13} \\
g_{21} & g_{22} & g_{23} \\
g_{31} & g_{32} & g_{33}
\end{array}\right)
\left(
\begin{array}{ccc}
\mr{cos}\brr{2\alpha} & \mr{sin}\brr{2\alpha} & 0 \\
-\mr{sin}\brr{2\alpha} & \mr{cos}\brr{2\alpha} & 0 \\
0 & 0 & 1
\end{array}
\right).
\end{gather}
\noindent{\bf Proof}: Because the time-reversal operator is antilinear, see
eq~\eqref{antilinear2}, the Kramers partner of $\widetilde{\Psi}$ transforms as
follows
\begin{equation}
\label{eq:change-phase}
\widetilde{\Psi} = e^{i\alpha} \Psi
\quad
\Rightarrow
\quad
\widebar{\widetilde{\Psi}} = e^{-i\alpha} \widebar\Psi.
\end{equation}
Inserting the relations between $\{\widetilde{\Psi}, \widebar{\widetilde{\Psi}}\}$
and $\{\Psi, \widebar\Psi\}$ into eqs~\eqref{gt:2-phi}, employing the identity
\begin{equation}
e^{i\alpha} = \mr{cos}\,\alpha + i\,\mr{sin}\,\alpha,
\end{equation}
and using the relations for the $g$-tensor in eq~\eqref{gt:2-psi}, one can expand
the components of the $\widetilde{g}$-tensor in terms of the elements of the g-tensor
\begin{gather}
\label{eq:phase-gtilde-x}
\begin{array}[c]{c}
\widetilde{g}_{u1}
= 4c\,\mc{R} \bappa{e^{i\alpha} \Psi}{H^Z_u}{e^{-i\alpha} \widebar\Psi}
= 4c\,\mc{R} \brc{ e^{-i2\alpha} \bappa{\Psi}{H^Z_u}{\widebar\Psi} }
\\
= 4c\,\mc{R} \brc{ \big[ \mr{cos}\brr{2\alpha} - i\,\mr{sin}\brr{2\alpha} \big]
\brs{ \mc{R}\bappa{\Psi}{H^Z_u}{\widebar\Psi}
+ i \, \mc{I}\bappa{\Psi}{H^Z_u}{\widebar\Psi} }
}
\\
= 4c \: \mr{cos}\brr{2\alpha} \mc{R}\bappa{\Psi}{H^Z_u}{\widebar\Psi}
+ 4c \: \mr{sin}\brr{2\alpha} \mc{I}\bappa{\Psi}{H^Z_u}{\widebar\Psi}
\\
= \mr{cos}\brr{2\alpha} g_{u1} - \mr{sin}\brr{2\alpha} g_{u2},
\end{array}
\\
\label{eq:phase-gtilde-y}
\begin{array}[c]{c}
\widetilde{g}_{u2}
= - 4c\,\mc{I} \bappa{e^{i\alpha} \Psi}{H^Z_u}{e^{-i\alpha} \widebar\Psi}
= - 4c\,\mc{I} \brc{ e^{-i2\alpha} \bappa{\Psi}{H^Z_u}{\widebar\Psi} }
\\
= - 4c\,\mc{I} \brc{ \big[ \mr{cos}\brr{2\alpha} - i\,\mr{sin}\brr{2\alpha} \big]
\brs{ \mc{R}\bappa{\Psi}{H^Z_u}{\widebar\Psi}
+ i \, \mc{I}\bappa{\Psi}{H^Z_u}{\widebar\Psi} }
}
\\
= - 4c \: \mr{cos}\brr{2\alpha} \mc{I}\bappa{\Psi}{H^Z_u}{\widebar\Psi}
+ 4c \: \mr{sin}\brr{2\alpha} \mc{R}\bappa{\Psi}{H^Z_u}{\widebar\Psi}
\\
= \mr{cos}\brr{2\alpha} g_{u2} + \mr{sin}\brr{2\alpha} g_{u1},
\end{array}
\\
\label{eq:phase-gtilde-z}
\widetilde{g}_{u3}
= 4c \bappa{e^{i\alpha} \Psi}{H^Z_u}{e^{i\alpha} \Psi}
= 4c \bappa{\Psi}{H^Z_u}{\Psi}
= g_{u3}.
\end{gather}
Eqs~\eqref{eq:phase-gtilde-x}--\eqref{eq:phase-gtilde-z} can be written in the
matrix form presented in eq~\eqref{eq:gtogbyphase}. QED.
Note that this theorem is a special case of the transformation of the g-tensor
presented in eqs~\eqref{eq:tildeg:UpSUp}--\eqref{eq:tildeg:OpS1}, where the key
identity, eq~\eqref{SU:SO}, has---from the point of view of this appendix---the
form
\begin{align}
e^{-i\alpha \bs{\sigma}_z} \, \bs{\sigma}_u \, e^{i\alpha \bs{\sigma}_z}
=
\left( e^{i 2 \alpha \mb{R}_z} \right)_{uv} \bs{\sigma}_v,
\end{align}
with $\theta = -2\alpha$ and $\vec{n} = (0,0,1)$. The transformation of the basis
wavefunctions can be written in the matrix form
\begin{equation}
e^{i\alpha \bs{\sigma}_z}
=
\left(\begin{array}[c]{cc}
e^{i\alpha} & 0 \\
0 & e^{-i\alpha}
\end{array}\right),
\end{equation}
which corresponds to a change of the phase in eq~\eqref{eq:change-phase},
and according to eq~\eqref{eq:Rtoeta} the three-dimensional rotation
$\mr{exp}\,(i2\alpha\mb{R}_z)$ has the form of the transformation matrix in
eq~\eqref{eq:gtogbyphase}.
\section{}
\label{app:KP}
{\bf Theorem:} For a system with an odd number of electrons described by the
time-reversal-symmetric Hamiltonian, every energy level is at least twofold
degenerate and is formed by Kramers partners.
\noindent{\bf Proof:} First, let us apply the time-reversal operator
$\mc{K}$ on the eigenvalue equation \eqref{eigen:H0}
\begin{gather}
H^0 \Phi_k = E_k \Phi_k,
\\
\mc{K} H^0 \mc{K}^\dagger \mc{K} \Phi_k = E_k \mc{K} \Phi_k.
\end{gather}
Because the Hamiltonian $H^0$ is time-reversal-symmetric, $\mc{K} H^0
\mc{K}^\dagger = H^0$, we can write
\begin{gather}
H^0 \Phi_k = E_k \Phi_k,
\label{KP1}
\\
H^0 \widebar\Phi_k = E_k \widebar\Phi_k,
\label{KP2}
\end{gather}
where we have utilized the definition of the Kramers partner, $\widebar\Phi_k =
\mc{K} \Phi_k$. From expressions \eqref{KP1} and \eqref{KP2} it follows that
wavefunctions $\Phi_k$ and $\widebar\Phi_k$ share the same energy. To prove
that the energy level $E_k$ is at least doubly-degenerate we need to show that
the wavefunctions are different. To do so we will show that they are
orthogonal. Note that two wavefunctions are the same, up to a phase factor, if
their inner product is a phase factor. For the inner product of the above
Kramers pair one can write
\begin{align}
\big< \Phi_k \big| \widebar\Phi_k \big>
&=
\big< \mc{K}^\dagger \mc{K} \Phi_k \big| \mc{K}\Phi_k \big>
=
\big< \mc{K} \Phi_k \big| \mc{K} \mc{K}\Phi_k \big>^\ast
\nonumber
\\
&=
\big< \mc{K} \mc{K} \Phi_k \big| \widebar\Phi_k \big>
=
\left( -1 \right)^{N_\mr{e}}
\big< \Phi_k \big| \widebar\Phi_k \big>.
\label{orthogonal}
\end{align}
Here we have utilized the fact that $\mc{K}$ is the antilinear unitary operator,
\eqref{antilinear1} and \eqref{antilinear3}, and the following identity for the
square of the many-electron time-reversal operator
\begin{gather}
\label{eq:KK}
\mc{K} \mc{K}
=
\left( \prod_i^{N_\mr{e}} K_i \right) \left( \prod_j^{N_\mr{e}} K_j \right)
=
\prod_i^{N_\mr{e}} K_i K_i
=
\prod_i^{N_\mr{e}} \left(-1\right)
=
\left(-1\right)^{N_\mr{e}},
\end{gather}
where $(K_i)^2=-1$ follows directly from the definition of $K_i$
in eq~\eqref{def:K}.
From eq~\eqref{orthogonal} it follows that for an odd number of electrons the
Kramers partners are orthogonal, $\big< \Phi_k \big| \widebar\Phi_k \big> = 0$,
because the only complex number that is equal to its negative value is zero.
QED.
\section{}
\label{app:diag-GT}
\noindent{\bf Theorem}: The real linear combination of spin matrices have the
following eigenvalues and eigenvectors
\begin{gather} \label{eq:eigen:S}
\left[ \mb{S}_u, \mb{S}_v \right] = i \epsilon_{uvw} \mb{S}_w,
\quad
\left( b_u \mb{S}_u \right) \mb{C} = \mb{C} \mb{e},
\quad
\vec b \in \mathbb{R}^3
\\
\label{eq:eigen:S:1}
\Rightarrow
\quad
e_k = M_k \big| \,\vec b\, \big|,
\quad
M_k \in \{S, S-1, \dots, -S\},
\quad
k = 1,\dots,2S+1,
\\
\label{eq:eigen:S:2}
\mb{C} = e^{-i\theta \vec{\mb{S}} \cdot \vec n},
\quad
\theta = \mr{cos}^{-1}\left(\frac{b_z}{\big| \,\vec b\, \big|}\right),
\quad
\vec n = \left(\big| \,\vec b\, \big|^2 - b_z^2 \right)^{-\frac{1}{2}}
\left( \vec b \times \vec z\right),
\quad
\big| \,\vec{b}\,\big| \ne 0,
\end{gather}
where $\epsilon_{uvw}$ is the Levi--Civita symbol, $S$ is a (half-)integer
number, $\vec z$ represents the unit vector in the z direction, $\mb{C}$ are
eigenvectors in columns, and $\mb{e}$ is a diagonal matrix with the diagonal
elements $e_k$. Note that for $\big| \,\vec{b}\, \big|=0$,
eq~\eqref{eq:eigen:S} has a trivial solution.
\noindent{\bf Proof}:
First we transform the eigenvalue equation~\eqref{eq:eigen:S} by employing the
unitary transformation from SU$(m)$ (with $m=2S+1$)
\begin{gather}
e^{i\theta \vec{\mb{S}} \cdot \vec n}
\left( b_u \mb{S}_u \right)
e^{-i\theta \vec{\mb{S}} \cdot \vec n}
e^{i\theta \vec{\mb{S}} \cdot \vec n}
\mb{C}
=
e^{i\theta \vec{\mb{S}} \cdot \vec n}
\mb{C}\mb{e}.
\end{gather}
Note that only for $m=2$ do these unitary transformations represent all
elements of SU$(m)$, although for higher $m$ they form the $m$-dimensional
irreducible representation of SU$(2)$ [which is a subgroup of SU$(m)$]. Then,
because the spin matrices satisfy the commutation relation in
eq~\eqref{eq:eigen:S}, we can utilize the result of Appendix~\ref{app:rot}
[eq~\eqref{eq:eXeRX} or~\eqref{SU:SO}]
\begin{gather}
\left[ b_u \left( e^{-i\theta \vec{\mb{R}} \cdot \vec n} \right)_{uv} \mb{S}_v \right]
e^{i\theta \vec{\mb{S}} \cdot \vec n}
\mb{C}
=
e^{i\theta \vec{\mb{S}} \cdot \vec n}
\mb{C}\mb{e}
\\
\label{eq:tilde-ev}
\left( \tilde{b}_u \mb{S}_u \right)
\mb{\tilde{C}}
=
\mb{\tilde{C}}\mb{e},
\\
\label{eq:tilde-ev-1}
\mb{\tilde{C}}
=
e^{i\theta \vec{\mb{S}} \cdot \vec n}
\mb{C},
\\
\tilde{b}_u = \left( e^{-i\theta \vec{\mb{R}} \cdot \vec n} \right)_{vu} b_v
= \left( e^{i\theta \vec{\mb{R}} \cdot \vec n} \right)_{uv} b_v.
\end{gather}
Because the matrices $\mr{exp}(i\theta \vec{\mb{R}} \cdot \vec n)$ represent all
proper rotations---all elements of SO$(3)$---the length of $\vec{b}$ and
$\vec{\tilde{b}}$ is the same, $\big| \,\vec{\tilde{b}}\, \big| = \big| \,\vec
b\, \big|$. Moreover, it is always possible to find a proper rotation of
$\vec{b}$ such that $\vec{\tilde{b}}$ will face in the z direction
\begin{equation}
\label{eq:tildeb}
\vec{\tilde{b}}
\overset{!}{=}
\left(\begin{array}[c]{c}
0 \\
0 \\
\big| \,\vec b\, \big| \\
\end{array}\right),
\end{equation}
providing the length of $\vec{b}$ is nonzero. To find the proper
rotation---defined by $\vec n$ and $\theta$---which leads to
eq~\eqref{eq:tildeb}, one must realize that $\vec n$ is a unit vector
orthogonal to both vectors $\vec{b}$ and $\vec{\tilde{b}}$, and that $\theta$
is an angle between these two vectors. Thus by using standard vector algebra we
get two equations
\begin{gather}
\vec b \cdot \vec{\tilde{b}} = \big| \,\vec b\, \big|^2 \mr{cos}\theta,
\\
\vec n = \left( \big| \,\vec b\, \big|^2 \mr{sin}\theta \right)^{-1}
\left( \vec b \times \vec{\tilde{b}} \right),
\end{gather}
whose solution leads to $\vec n$ and $\theta$ in eq~\eqref{eq:eigen:S:2}.
Finally, if eq~\eqref{eq:tildeb} is satisfied, then eq~\eqref{eq:tilde-ev}
becomes
\begin{gather}
\left( \big| \,\vec b\, \big| \mb{S}_z \right)
\mb{\tilde{C}}
=
\mb{\tilde{C}}\mb{e},
\end{gather}
and because the spin matrix $\mb{S}_z$ is diagonal with the diagonal elements
\begin{gather}
S_{kk} \in \{S, S-1, \dots, -S\},
\quad k = 1,\dots,2S+1,
\end{gather}
the eigenvectors $\mb{\tilde{C}}$ have a simple form, $\tilde{C}_{lk} =
\delta_{lk}$. One thus obtains the eigenvalues $e_k$ from
eq~\eqref{eq:eigen:S:1}, and to get the eigenvectors $\mb{C}$ one uses
eq~\eqref{eq:tilde-ev-1}
\begin{equation}
C_{lk}
=
\left( e^{-i\theta \vec{\mb{S}} \cdot \vec n} \right)_{lp}
\tilde{C}_{pk}
=
\left( e^{-i\theta \vec{\mb{S}} \cdot \vec n} \right)_{lk}.
\end{equation}
QED.
\section{}
\label{app:proper}
Because the spin operators $\mb{S}_u$ that act in $m$-dimensional complex
space $\mathbb{C}^m$ satisfy the commutation relation in eq~\eqref{XY-YX}
\begin{equation}
\left[ \mb{S}_u, \mb{S}_v \right] = i \epsilon_{uvw} \mb{S}_w,
\end{equation}
the expression in eq~\eqref{eq:eXeRX} becomes
\begin{align}
\label{SU:SO}
e^{i\theta \vec{\mb{S}} \cdot \vec n} \, \mb{S}_u \, e^{-i\theta \vec{\mb{S}} \cdot \vec n}
=
\left( e^{-i\theta \vec{\mb{R}} \cdot \vec n} \right)_{uv} \mb{S}_v.
\end{align}
To simplify the notation in this appendix we write eq~\eqref{SU:SO} in the form
\begin{align}
\label{SU:SO:2}
\mb{U}^+ \,\mb{S}_u \brr{\mb{U}^+}^\dagger
=
\brr{O^+}_{uv} \mb{S}_v,
\end{align}
with the matrices $\mb{O}^+$ and $\mb{U}^+$ being
\begin{align}
\label{eq:ORn}
\mb{O}^+ &= e^{-i\theta \vec{\mb{R}}\cdot \vec n},
\\
\label{eq:USn}
\mb{U}^+ &= e^{i\theta \vec{\mb{S}}\cdot \vec n}.
\end{align}
The operator $\mb{O}^+$ is a proper rotation in a real three-dimensional vector
space---{\it i.e.} it is a member of the special orthogonal group
SO$(3)$---while the operator $\mb{U}^+$ is a unitary transformation in a
complex $m$-dimensional vector space---{\it i.e.} it is a member of the special
unitary group SU$(m)$. Thus both matrices, $\mb{O}^+$ and $\mb{U}^+$, have a
determinant equal to $1$. Importantly, the expression $\mr{exp}(-i\theta
\vec{\mb{R}}\cdot \vec n)$ represents all group elements of $\mr{SO}(3)$,
while, on the other hand, the expression $\mr{exp}(i\theta \vec{\mb{S}}\cdot
\vec n)$ represents all group elements of SU$(m)$ only in the two-dimensional
case, $m=2$. Note, however, that $\mb{U}^+$ represents all elements of the
$m$-dimensional irreducible representation of SU$(2)$---the subgroup of
SU$(m)$. In the physics literature, this represenation is labeled using $S$
rather than $m$, with $m=2S+1$.
In the rest of this appendix we will discuss the case $m=2$, for which
eq~\eqref{SU:SO} holds for all elements of the groups SU$(2)$ and SO$(3)$. The
role of the unitary transformation in eq~\eqref{SU:SO}---in the context of this
work---stems from the choice of the orthonormal basis in which the qm operators
are represented [see the discussion in the main text, {\it e.g.}
eq~\eqref{eq:HbarVHV}]. Therefore, in the general case, one must deal with the
expression $\mb{U} \,\mb{S}_u \brr{\mb{U}}^\dagger$ with $\mb{U} \in
\mr{U}(2)$, rather than $\mb{U}^+ \,\mb{S}_u \brr{\mb{U}^+}^\dagger$ with
$\mb{U}^+ \in \mr{SU}(2)$. Note that $\mr{SU}(2)$ is a subgroup of
$\mr{U}(2)$. However, as we show in the following theorem, the additional
flexibility in $\mb{U}$, as compared to $\mb{U}^+$, is redundant in the
context of eq~\eqref{SU:SO}.
\noindent{\bf Theorem}: For every $\mb{U} \in \mr{U}(2)$ there exist $\mb{U}^+
\in \mr{SU}(2)$ and $\mb{O}^+ \in \mr{SO}(3)$ such that
\begin{gather}
\label{SU:SO:3}
\mb{U} \,\mb{S}_u \brr{\mb{U}}^\dagger
=
\brr{O^+}_{uv} \mb{S}_v,
\\
\label{SU:SO:4}
\mb{U}^+ \,\mb{S}_u \brr{\mb{U}^+}^\dagger
=
\brr{O^+}_{uv} \mb{S}_v,
\\
\label{SU:SO:5}
\mb{U} = e^{i\frac{\alpha}{2}}\mb{U}^+,
\quad
\mr{det}\,\mb{U} = e^{i\alpha},
\quad
\alpha \in \mathbb{R},
\end{gather}
with $\mb{O}^+$ and $\mb{U}^+$ as defined in eqs~\eqref{eq:ORn}
and~\eqref{eq:USn}.
\noindent{\bf Proof}: Because $\mb{U}^\dagger\mb{U}=\mb{1}$, the determinant of
$\mb{U}$ is a phase factor
\begin{gather}
\label{phase:U:1}
\mr{det}(\mb{U}^\dagger\mb{U}) = \mr{det}(\mb{1}),
\\
\label{phase:U:2}
(\mr{det}\,\mb{U})^\ast \,\,\mr{det}\,\mb{U} = 1,
\\
\label{phase:U:3}
\brp{\mr{det}\,\mb{U}}^2 = 1,
\\
\label{phase:U:4}
\Rightarrow
\quad
\mr{det}\,\mb{U} = e^{i\alpha}, \quad \alpha \in \mathbb{R}.
\end{gather}
Then for every $\mb{U}$ there exists $\mb{U}^+$ such that
\begin{gather}
\label{decompose:U}
\mb{U} = \mb{U}^+ \mb{I}^-,
\\
\left(I^-\right)_{kl} = \delta_{kl} \,e^{i\frac{\alpha}{2}}.
\end{gather}
One may readily verify that the determinant of such a $\mb{U}^+$ is one.
Because $\mb{I}^-$ is the identity matrix multiplied by a phase factor, one can
easily modify eq~\eqref{SU:SO:3} to give
\begin{gather}
\brr{\mb{U}^+\mb{I}^-} \mb{S}_u \brr{\mb{U}^+\mb{I}^-}^\dagger
=
\left( O^+ \right)_{uv} \mb{S}_v,
\\
\mb{U}^+ e^{i\frac{\alpha}{2}} \mb{S}_u e^{-i\frac{\alpha}{2}} \brr{\mb{U}^+}^\dagger
=
\left( O^+ \right)_{uv} \mb{S}_v,
\end{gather}
thus obtaining expression~\eqref{SU:SO:4}. QED.
As a direct consequence of the above theorem, there does not exist a unitary
transformation $\mb{U} \in \mr{U}(2)$ that gives an improper rotation,
$\mb{O}^-$ (a member of O$(3)$ with the determinant equal to minus one), {\it
i.e.}
\begin{align}
\label{improper:R}
\mb{U} \mb{S}_u \brr{\mb{U}}^\dagger
\ne
\left( O^- \right)_{uv} \mb{S}_v.
\end{align}
The consequence of this statement is that it is impossible to measure the sign
of the individual g-tensor eigenvalues, and only the sign of the g-tensor
determinant is an observable quantity (see the main text for a more detailed
discussion of this fact).
Note that the theorem presented in this appendix is valid only for $m=2$
because $\mb{U}^+$ represents all elements of SU$(2)$ and thus every $\mb{U}
\in \mr{U}(2)$ can be decomposed as presented in eq~\eqref{decompose:U}. For
$m>2$ one may still decompose every $\mb{U} \in \mr{U}(m)$ in a similar way,
except for the fact that the resulting $\mb{U}^+$ , with $\mr{det}\,\mb{U}^+ =
1$, does not necessarily satisfy the relation in eq~\eqref{eq:USn}, and thus
not every such $\mb{U}^+$ satisfies eq~\eqref{SU:SO:4}.
\section{}
\label{app:rot}
Let us consider three operators $X_u$ on a vector space V which satisfy the
following commutation relation
\begin{gather}
\left[ \tilde{X}_u, \tilde{X}_v \right] = \epsilon_{uvw} \tilde{X}_w,
\end{gather}
where $\epsilon_{uvw}$ is the Levi--Civita symbol. The three operators
$\tilde{X}_u$ are basis elements of the Lie algebra $\mathfrak{so}(3)$
represented on a vector space V. To remain consistent with the definition of
momentum operators in quantum theory, we define a new set of operators
$X_u=i\tilde{X}_u$ which then satisfy the commutation relation
\begin{equation} \label{XY-YX}
\left[ X_u, X_v \right] = i \epsilon_{uvw} X_w.
\end{equation}
\noindent{\bf Theorem}: For the operators $X_u$ that satisfy the commutation
relation~\eqref{XY-YX} the following relations hold
\begin{align} \label{rotX}
e^{i\theta \vec X \cdot \vec n} \, \vec X \, e^{-i\theta \vec X \cdot \vec n}
&=
\vec X \mr{cos}\,\theta + \left( \vec n \times \vec X \right) \mr{sin}\,\theta
+ \left( 1 - \mr{cos}\,\theta \right) \vec n \left( \vec X \cdot \vec n \right),
\\
\label{eq:eXeRX}
e^{i\theta \vec X \cdot \vec n} \, X_u \, e^{-i\theta \vec X \cdot \vec n}
&=
\left( e^{-i\theta \vec R \cdot \vec n} \right)_{uv} X_v,
\end{align}
where $u, v, w$ are Cartesian indices, $\theta \in \mathbb{R}$, $\vec n$ is a
unit vector in $\mathbb{R}^3$, and $-i\vec R$ are basis elements of the Lie
algebra $\mathfrak{so}(3)$ represented on vector space $\mathbb{R}^3$
\begin{gather}
(R_u)_{vw} = -i\epsilon_{uvw},
\label{R:def1}
\\
R_1 =
\left(\begin{array}[c]{ccc}
0 & 0 & 0 \\
0 & 0 &-i \\
0 & i & 0 \\
\end{array}\right),
\quad
R_2 =
\left(\begin{array}[c]{ccc}
0 & 0 & i \\
0 & 0 & 0 \\
-i & 0 & 0 \\
\end{array}\right),
\quad
R_3 =
\left(\begin{array}[c]{ccc}
0 &-i & 0 \\
i & 0 & 0 \\
0 & 0 & 0 \\
\end{array}\right).
\label{R:def2}
\end{gather}
\noindent{\bf Proof}: To prove expression \eqref{rotX} we employ the
Baker–Campbell–Hausdorff formula
\begin{align}
e^{i\theta \vec X \cdot \vec n} \vec X e^{-i\theta \vec X \cdot \vec n}
&=
\vec X +
\left( i\theta \right) \left[ \vec X \cdot \vec n, \vec X \right] +
\frac{1}{2!} \left( i\theta \right)^2
\left[ \vec X \cdot \vec n, \left[ \vec X \cdot \vec n, \vec X \right] \right]
\nonumber
\\
&+
\frac{1}{3!} \left( i\theta \right)^3
\left[
\vec X \cdot \vec n,
\left[ \vec X \cdot \vec n, \left[ \vec X \cdot \vec n, \vec X \right] \right]
\right]
+ \dots.
\label{transX}
\end{align}
Taking advantage of the commutation relation \eqref{XY-YX} we can write
\begin{gather}
\left[ \vec X \cdot \vec n, \vec X \right] = - i \left( \vec n \times \vec X \right),
\label{commut1}
\\
\left[ \vec X \cdot \vec n, \left[ \vec X \cdot \vec n, \vec X \right] \right]
=
\vec X - \left( \vec X \cdot \vec n \right) \vec n,
\\
\left[
\vec X \cdot \vec n,
\left[ \vec X \cdot \vec n, \left[ \vec X \cdot \vec n, \vec X \right] \right]
\right]
=
- i \left( \vec n \times \vec X \right).
\label{commut3}
\end{gather}
Because the commutator expressions, eqs \eqref{commut1} and \eqref{commut3},
are equal, the equation \eqref{transX} simplifies significantly
\begin{align}
e^{i\theta \vec X \cdot \vec n} \vec X e^{-i\theta \vec X \cdot \vec n}
&=
\vec X
-i
\sum_{n=0}^{\infty}
\frac{\left( i\theta \right)^{2n+1}}{\left(2n+1\right)!}
\left( \vec n \times \vec X \right)
+
\sum_{n=1}^{\infty}
\frac{\left( i\theta \right)^{2n}}{\left(2n\right)!}
\left( \vec X - \left( \vec X \cdot \vec n \right) \vec n \right)
\\
&=
\sum_{n=0}^{\infty}
\frac{\left(i\theta\right)^{2n}}{\left(2n\right)!}
\,\vec X
+
\sum_{n=0}^{\infty}
\frac{\left(-1\right)^{n} \theta^{2n+1}}{\left(2n+1\right)!}
\left( \vec n \times \vec X \right)
-
\sum_{n=1}^{\infty}
\frac{\left( i\theta \right)^{2n}}{\left(2n\right)!}
\left( \vec X \cdot \vec n \right) \vec n.
\end{align}
Recognizing the Taylor series of trigonometric functions $\mr{sin}\,\theta$
and $\mr{cos}\,\theta$ one arrives at the expression \eqref{rotX}.
The right-hand-side of the eq~\eqref{rotX} is Rodrigues' well-known rotation
formula. Rodrigues' rotation formula provides an algorithm to compute the
exponential map from the Lie algebra $\mathfrak{so}(3)$ to the Lie group of all
proper rotations, SO$(3)$. If we consider the representation of the Lie algebra
and Lie group on the three-dimensional real vector space $\mathbb{R}^3$, the
Rodrigues' formula then rotates an element of this vector space, $\vec v \in
\mathbb{R}^3$, by given axis $\vec n$ and angle $\theta$
\begin{align} \label{rot:R3}
e^{-i\theta \vec R \cdot \vec n} \,\vec v =
\vec v \, \mr{cos}\,\theta + \left( \vec n \times \vec v \right) \mr{sin}\,\theta
+ \left( 1 - \mr{cos}\,\theta \right) \vec n \left( \vec v \cdot \vec n \right).
\end{align}
Expression~\eqref{rotX} then connects the unitary transformation of the
operators $X_u$ with a proper rotation in $\mathbb{R}^3$ as
\begin{align}
\label{eq:eXeRX-1}
e^{i\theta \vec X \cdot \vec n} \vec X e^{-i\theta \vec X \cdot \vec n}
=
e^{-i\theta \vec R \cdot \vec n} \,\vec X,
\end{align}
which equals to eq~\eqref{eq:eXeRX}. QED.
In eq~\eqref{eq:eXeRX-1} the operator $O(\theta, \vec n) = exp(-i\theta \vec R
\cdot \vec n)$ represents all proper rotations in $\mathbb{R}^3$, {\it i.e.}
all rotations with $\mr{det}(O) = 1$. Note that operators $X_u$ can have
different forms depending on what vector space is chosen for the representation
of the lie algebra $\mathfrak{so}(3)$. This includes, but is not limited to,
the operators
\begin{gather}
(R_u)_{vw} = -i\epsilon_{uvw},
\\
\vec L = -i \left( \vec r \times \vec\nabla \right),
\\
\vec S = \frac{1}{2} \vec\sigma,
\\
\vec J = \vec L + \vec S,
\end{gather}
with $\vec\sigma$ representing a vector composed of Pauli matrices.
\section{}
\label{app:eff:spin}
In this appendix we discuss the definition of the fictitious spin space and its
consequences. We will demonstrate the ideas using the case of the doublet
system, but the theory can easily be extended to any arbitrary multiplicity.
The basic idea of the fictitious spin space is to represent wavefunctions in
the complex vector space in a way that preserves their properties.
Many-electron wavefunctions belong to the Fock subspace, which is equipped with
the inner product $\bapa{\Phi_1}{\Phi_2} \rightarrow \mathbb{C}$, see also
Appendix~\ref{app:K}. These wavefunctions are then associated with vectors in
the complex vector space $\mathbb{C}^m$---also known as spin vectors---equipped
with the dot product $\vec{v} \cdot \vec{w} = \mb{v}^\dagger \mb{w} \rightarrow
\mathbb{C}$. To associate a wavefunction with a vector from the fictitious spin
space, one first selects a reference basis set $\{\Phi_n\}_{n=1}^m$ and expands
the wavefunction in it, $\Psi = C_n \Phi_n$. The wavefunction is then
represented by the expansion coefficients used to construct the vector in
$\mathbb{C}^m$, $v_n \coloneqq C_n$. In the doublet case, $m=2$, the reference
basis set itself--- the Kramers pair $\{\Phi,\widebar\Phi\}$---is thus
associated with the two-dimensional spin vectors in the following manner
\begin{align}
\label{eq:psi-v-equiv}
\Phi
\rightarrow
\mb{v}
=
\left(\begin{array}[c]{c}
1 \\
0
\end{array}\right),
\qquad
\widebar\Phi
\rightarrow
\widebar{\mb{v}}
=
\left(\begin{array}[c]{c}
0 \\
1
\end{array}\right).
\end{align}
As discussed in section~\ref{sec:introduction}, the purpose of the EPR
effective spin Hamiltonian is to describe projection of the qm Hamiltonian onto
a space defined by a set of wavefunctions $\{\Phi_n\}_{n=1}^m$, {\it i.e.}
$\mb{H}^\mr{eff} \overset{!}{=} \mb{H}^\mr{qm}$. For the doublet case this
equivalence is presented in eq~\eqref{gt:def1}. The mapping in
eq~\eqref{eq:psi-v-equiv} then leads to the same expectation value---either of
the wavefunction with the Zeeman Hamiltonian or of the spin vector with the
effective spin Hamiltonian---regardless of the type of space it is calculated
in. Thus for example for the basis wavefunction $\Phi$ it holds that
\begin{align}
\label{eq:psi-v-H}
\bappa{\Phi}{H^Z}{\Phi}
\quad
\rightarrow
\quad
\Big( \:1 \quad 0 \:\Big)^\ast
&\left(
\begin{array}{cc}
& \\
\multicolumn{2}{c}{\smash{\raisebox{.5\normalbaselineskip}{$\frac{1}{2c} B_u g_{uv} \mb{S}_v$}}}
\\
\end{array}
\right)
\left(\begin{array}[c]{c}
1 \\
0
\end{array}\right)
\\
=
\Big( \:1 \quad 0 \:\Big)^\ast
&\left(\begin{array}[c]{cr}
\big< \Phi \big| H^Z \big| \Phi \big> & \big< \Phi \big| H^Z \big| \widebar\Phi \big> \\
\big< \widebar\Phi \big| H^Z \big| \Phi \big> &-\big< \Phi \big| H^Z \big| \Phi \big>
\end{array}\right)
\left(\begin{array}[c]{c}
1 \\
0
\end{array}\right),
\end{align}
with $\vec{\mb{S}} = \tfrac{1}{2}\bs{\sigma}$. Eq~\eqref{eq:psi-v-H}
represents an expectation value for one basis function; the expression for all
combinations of basis functions can be written as follows
\begin{align}
\label{eq:psi-v-H-gen}
\bappa{\Phi_m}{H^Z}{\Phi_n}
\quad
\rightarrow
\quad
\mb{v}_m^\dagger
\left( \frac{1}{2c} B_u g_{uv} \mb{S}_v \right)
\mb{v}_n,
\end{align}
with $\{\Phi_1,\Phi_2\} = \{\Phi,\widebar\Phi\}$ and $\{\mb{v}_1,\mb{v}_2\} =
\{\mb{v},\widebar{\mb{v}}\}$. Choosing a different orthonormal Kramers pair as
a basis set for representation of the Zeeman Hamiltonian corresponds to the
unitary transformation $\widetilde\Phi_m = U_{nm} \Phi_n$. In the main text we
have discussed the usefulness of the unitary transformations that belong to the
$m$-dimensional irreducible representations of the SU$(2)$ group [in the case
of $m=2$ this is the natural representation of SU$(2)$ in $\mathbb{C}^2$]
\begin{gather}
\label{eq:U-phi-trans-1}
\widetilde{\Phi}_m
=
\left( e^{-i \theta \vec{\mb{S}} \cdot \vec n } \right)_{nm} \Phi_n.
\end{gather}
One of the advantages of such transformations is that if the set
$\{\Phi_n\}_{n=1}^m$ satifies relations in eq~\eqref{eq:TRrelations}, then the
set $\{\widetilde{\Phi}_n\}_{n=1}^m$ fulfills these relations as well [see also
the corresponding discussion under eq~\eqref{eq:TRrelations}]. Therefore, for
$m=2$, the basis set on the left-hand-side of eq~\eqref{eq:U-phi-trans-1} forms
a Kramers pair as well. According to eq~\eqref{eq:U-phi-trans-1} the spin
vectors $\widetilde{\mb{v}}_m$ associated with the basis functions
$\widetilde{\Phi}_m$ can be written as $(\widetilde{v}_m)_n = [\mr{exp}(-i
\theta \vec{\mb{S}} \cdot \vec n)]_{nm}$, or equivalently
\begin{align}
\label{eq:psi-v-equiv1}
\widetilde{\Phi}
\rightarrow
\widetilde{\mb{v}} =
\left(
\begin{array}{cc}
& \\
\multicolumn{2}{c}{\smash{\raisebox{.5\normalbaselineskip}{$e^{-i \theta \vec {\mb{S}} \cdot \vec n }$}}}
\\
\end{array}
\right)
\left(\begin{array}[c]{c}
1 \\
0
\end{array}\right),
\qquad
\widetilde{\widebar\Phi}
\rightarrow
\widebar{\widetilde{\mb{v}}} =
\left(
\begin{array}{cc}
& \\
\multicolumn{2}{c}{\smash{\raisebox{.5\normalbaselineskip}{$e^{-i \theta \vec {\mb{S}} \cdot \vec n }$}}}
\\
\end{array}
\right)
\left(\begin{array}[c]{c}
0 \\
1
\end{array}\right),
\end{align}
where $\{\widetilde{\Phi}_1, \widetilde{\Phi}_2\} = \{\widetilde{\Phi},
\widebar{\widetilde{\Phi}}\}$ and
$\{\widetilde{\mb{v}}_1,\widetilde{\mb{v}}_2\} =
\{\widetilde{\mb{v}},\widebar{\widetilde{\mb{v}}}\}$. Employing
eqs~\eqref{eq:U-phi-trans-1} and~\eqref{SU:SO} one may calculate the
expectation values of the set $\{\widetilde{\Phi},
\widetilde{\widebar{\Phi}}\}$ with the Zeeman operator in both the real and
fictitious spin spaces as
\begin{gather}
\label{eq:psi-v-H-new}
\bappa{\widetilde{\Phi}_m}{H^Z}{\widetilde{\Phi}_n}
=
\brr{e^{i \theta \vec {\mb{S}} \cdot \vec n }}_{\!mk}
\bappa{\Phi_k}{H^Z}{\Phi_l}
\brr{e^{-i \theta \vec {\mb{S}} \cdot \vec n }}_{\!ln}
\\
\rightarrow
\\
\label{eq:tilde-eff-1}
\widetilde{\mb{v}}^\dagger_m
\brr{ \frac{1}{2c} B_u g_{uv} \mb{S}_v }
\widetilde{\mb{v}}_n
\\
\label{eq:tilde-eff-2}
=
\brr{e^{i \theta \vec {\mb{S}} \cdot \vec n}}_{\!mk}
\brr{ \frac{1}{2c} B_u g_{uv} \mb{S}_v }_{\!kl}
\brr{e^{-i \theta \vec {\mb{S}} \cdot \vec n}}_{\!ln}
\\
\label{eq:tilde-eff-3}
=
\left(
\frac{1}{2c} B_u g_{uv}\,
e^{i \theta \vec {\mb{S}} \cdot \vec n }
\mb{S}_v
e^{-i \theta \vec {\mb{S}} \cdot \vec n }
\right)_{\!mn}
\\
\label{eq:tilde-eff-4}
=
\mb{v}_m^\dagger
\left(
\frac{1}{2c} B_u g_{uv}\,
\widetilde{\mb{S}}_v
\right)
\mb{v}_n
\\
\label{eq:tilde-eff-5}
=
\mb{v}_m^\dagger
\left[
\frac{1}{2c} B_u g_{uv}
\left( e^{-i \theta \vec{\mb{R}} \cdot \vec n } \right)_{uw} \mb{S}_w
\right]
\mb{v}_n
\\
\label{eq:tilde-eff-6}
=
\mb{v}_m^\dagger \left( \frac{1}{2c} B_u \widetilde{g}_{uv} \mb{S}_v \right) \mb{v}_n.
\end{gather}
Finally, one may calculate the orientation of the fictitious spin of
wavefunctions $\Phi$ and $\widetilde\Phi$ as follows
\begin{align}
\label{eq:rot-spin-1}
\vec{s} &= \mb{v}^\dagger \vec{\mb{S}} \,\mb{v},
\\
\label{eq:rot-spin-2}
\vec{\tilde{s}}
&= \widetilde{\mb{v}}^\dagger \vec{\mb{S}} \,\widetilde{\mb{v}}
\\
\label{eq:rot-spin-3}
&=
\widetilde{\mb{v}}^\dagger
e^{i \theta \vec {\mb{S}} \cdot \vec n }
\,\vec{\mb{S}}
\,e^{-i \theta \vec {\mb{S}} \cdot \vec n }
\,\widetilde{\mb{v}},
\\
\label{eq:rot-spin-4}
&=
\widetilde{\mb{v}}^\dagger
e^{-i \theta \vec{\mb{R}} \cdot \vec n }
\,\vec{\mb{S}}
\,\widetilde{\mb{v}},
\\
\label{eq:rot-spin-5}
&=
e^{-i \theta \vec{\mb{R}} \cdot \vec n }
\vec{s}.
\end{align}
One may deduce a few facts from the discussion in this appendix:
\begin{enumerate}
\item
The first important observation is that the orientation of the fictitious spin
of the reference basis wavefunctions in the fictitious spin space, see
eqs~\eqref{eq:psi-v-equiv} and~\eqref{eq:rot-spin-1}, is always along the
z-axis.
\item
From point 1 one infers that by choosing the reference basis set one also
chooses the axis system in the fictitious spin space.
\item
Again from point 1, one may see that the orientation of the real and fictitious
spin are not related unless additional assumptions are imposed.
\item
From eqs~\eqref{eq:psi-v-H-gen},~\eqref{eq:tilde-eff-1},
and~\eqref{eq:rot-spin-5} one concludes that choosing a different basis set of
orthonormal wavefunctions is equivalent to rotation of the fictitious spin of
those wavefunctions.
\item
Eqs~\eqref{eq:tilde-eff-1} and~\eqref{eq:tilde-eff-4} correspond to active
and passive rotation, respectively, where the active transformation rotatates
spin vectors in a fixed coordinate axis system and the passive transformation
rotates the axis system---thus changing the spin operators---while the spin
vectors remain fixed.
\item
Finally, eqs~\eqref{eq:tilde-eff-5} and~\eqref{eq:tilde-eff-6} correspond to
rotation of the g-tensor while leaving the spin vectors and axis system
unchanged.
\end{enumerate}
\section{}
\label{app:U}
\noindent{\bf Theorem}:
Let us consider an $m$-dimensional vector space $V$ over a field $F$ of either
real $\mathbb{R}$ or complex $\mathbb{C}$ numbers, with a defined dot product
of two vectors $\vec{v}, \vec{w} \in V$ such that $\vec{v} \cdot \vec{w}
\rightarrow F$. The generalization of the dot product to abstract vector
spaces is called the inner product, see also
eqs~\eqref{eq:ip-prop-0}--\eqref{eq:ip-prop-3}. Then, for every set of the
orthonormal vectors $\{\vec{w}_v\}_{v=1}^m$ from the vector space $V$, it holds
that
\begin{gather}
\label{eq:wdotwuv}
\vec{w}_u \cdot \vec{w}_v = \delta_{uv}
\quad
\Rightarrow
\quad
\mb{W}^\mathsf{T} \mb{W} = \mb{W} \mb{W}^\mathsf{T} = \mb{1},
\end{gather}
where the matrix $\mb{W}$ is composed of the coordinates of the vectors
$\vec{w}_v$ in columns
\begin{gather}
(w_v)_u \coloneqq W_{uv},
\end{gather}
with $(w_v)_u$ being defined using the orthonormal basis set
$\{\vec{n}_u\}_{u=1}^m$ such that
\begin{gather}
\label{eq:wdotn}
\vec{w}_v \cdot \vec{n}_u = (w_v)_u,
\\
\label{eq:ndotn}
\vec{n}_u \cdot \vec{n}_v = \delta_{uv}.
\end{gather}
Eq~\eqref{eq:wdotn} represents a projection of the vector $\vec{w}_v$ onto the
direction defined by the vector $\vec{n}_u$. Note that the transpose sign
$\mathsf{T}$ in eq~\eqref{eq:wdotwuv} indicates that we have chosen the field
of real numbers; the theorem and the proof is, however, easily applicable to
the field of complex numbers as well.
\noindent{\bf Proof}: Any vector can be viewed as a linear combination of the
basis vectors with its coordinates being the expansion coefficients
\begin{gather}
\label{eq:wexpansion}
\vec{w}_v = (w_v)_k \,\vec{n}_k.
\end{gather}
Eq~\eqref{eq:wdotn} may then be readily verified
\begin{gather}
\vec{w}_v \cdot \vec{n}_u
= \brs{ (w_v)_k \,\vec{n}_k } \cdot \vec{n}_u
= (w_v)_k \brs{ \vec{n}_k \cdot \vec{n}_u }
= (w_v)_k \,\delta_{ku}
= (w_v)_u,
\end{gather}
where we have employed the orthonormalization condition for the basis set,
eq~\eqref{eq:ndotn}. Using the definition of a vector through expansion in
eq~\eqref{eq:wexpansion} and the orthonormalization condition in
eq~\eqref{eq:wdotwuv} one can easily prove the first identity
\begin{gather}
\vec{w}_u \cdot \vec{w}_v = \delta_{uv},
\\
\brs{ (w_u)_k \,\vec{n}_k } \cdot \brs{ (w_v)_l \,\vec{n}_l } = \delta_{uv},
\\
(w_u)_k \, \delta_{kl} \, (w_v)_l = \delta_{uv},
\\
(w_u)_k \, (w_v)_k = \delta_{uv},
\\
W_{ku} \, W_{kv} = \delta_{uv},
\\
\mb{W}^\mathsf{T} \mb{W} = \mb{1}.
\end{gather}
To prove the second identity one can simply reverse the role of the two vector
sets, $\{\vec{w}_v\}_{v=1}^m$ and $\{\vec{n}_v\}_{v=1}^m$, where now one
expands the vectors $\vec{n}_v$ in the orthonormal basis set
$\{\vec{w}_v\}_{v=1}^m$ instead
\begin{gather}
\vec{n}_u \cdot \vec{n}_v = \delta_{uv},
\\
\brs{ (n_u)_k \,\vec{w}_k } \cdot \brs{ (n_v)_l \,\vec{w}_l } = \delta_{uv},
\\
(n_u)_k \, \delta_{kl} \, (n_v)_l = \delta_{uv},
\\
(n_u)_k \, (n_v)_k = \delta_{uv},
\\
\label{eq:nnreverse}
\brs{ \vec{n}_u \cdot \vec{w}_k } \, \brs{ \vec{n}_v \cdot \vec{w}_k } = \delta_{uv},
\\
(w_k)_u \, (w_k)_v = \delta_{uv},
\\
W_{uk} \, W_{vk} = \delta_{uv},
\\
\mb{W} \mb{W}^\mathsf{T} = \mb{1}.
\end{gather}
To obtain eq~\eqref{eq:nnreverse} we have used eq~\eqref{eq:wdotn} with the
roles of the vectors $\vec{n}_u$ and $\vec{w}_u$, ({\it i.e.} which one is used
as a basis and which is the vector being expanded) reversed. In other words,
$(n_u)_k$ may be calculated as the projection of the vector $\vec{n}_u$ onto
the direction defined by the vector $\vec{w}_k$. QED.
\section{}
\label{app:kramers-partner}
{\bf Theorem:} If $\Psi$ is an eigenfunction of the time-reversal symmetric
Hamiltonian $H$, then its (non-)Kramers partner, $\widebar{\Psi} \coloneqq
\mc{K}\Psi$, is an eigenfunction of $H$ with the same eigenvalue and the same
norm
\begin{equation}
\label{eq:KP1}
H\Psi = E\Psi,
\quad
[H,\mc{K}]=0
\quad
\Rightarrow
\quad
H \widebar\Psi = E \widebar\Psi,
\quad
\bapa{\Psi}{\Psi} = \bapa{\widebar\Psi}{\widebar\Psi}.
\end{equation}
\noindent{\bf Proof:} Utilizing the time-reversal symmetry of the Hamiltonian
$H$, the fact that the time-reversal operator is unitary,
eq~\eqref{antilinear1}, a proper definition of the adjoint of the antilinear
operator, eq~\eqref{antilinear3}, and the conjugate symmetry,
eq~\eqref{eq:ip-prop-1}, one can easily show that
\begin{gather}
H\Psi = E\Psi,
\\
\mc{K}H\Psi = \mc{K}E\Psi,
\\
H\mc{K}\Psi = E\mc{K}\Psi,
\\
\label{eq:psibar4}
H\widebar{\Psi} = E\widebar{\Psi},
\end{gather}
and
\begin{gather}
\bapa{\Psi}{\Psi} = \bapa{\Psi}{\mc{K}^\dagger\mc{K}\Psi}
= \bapa{\mc{K}\Psi}{\mc{K}\Psi}^\ast
= \bapa{\widebar\Psi}{\widebar\Psi}.
\end{gather}
QED. Note that $\Psi$ and $\widebar{\Psi}$ are not necessarily different
wavefunctions, see the case of an even number of electrons discussed in
Appendix~\ref{app:non-magnetic1}.
\end{appendices}
\providecommand{\latin}[1]{#1}
\makeatletter
\providecommand{\doi}
{\begingroup\let\do\@makeother\dospecials
\catcode`\{=1 \catcode`\}=2 \doi@aux}
\providecommand{\doi@aux}[1]{\endgroup\texttt{#1}}
\makeatother
\providecommand*\mcitethebibliography{\thebibliography}
\csname @ifundefined\endcsname{endmcitethebibliography}
{\let\endmcitethebibliography\endthebibliography}{}
\begin{mcitethebibliography}{8}
\providecommand*\natexlab[1]{#1}
\providecommand*\mciteSetBstSublistMode[1]{}
\providecommand*\mciteSetBstMaxWidthForm[2]{}
\providecommand*\mciteBstWouldAddEndPuncttrue
{\def\EndOfBibitem{\unskip.}}
\providecommand*\mciteBstWouldAddEndPunctfalse
{\let\EndOfBibitem\relax}
\providecommand*\mciteSetBstMidEndSepPunct[3]{}
\providecommand*\mciteSetBstSublistLabelBeginEnd[3]{}
\providecommand*\EndOfBibitem{}
\mciteSetBstSublistMode{f}
\mciteSetBstMaxWidthForm{subitem}{(\alph{mcitesubitemcount})}
\mciteSetBstSublistLabelBeginEnd
{\mcitemaxwidthsubitemform\space}
{\relax}
{\relax}
\bibitem[Griffith(1960)]{Griffith:1960:spinH}
Griffith,~J.~S. Some investigations in the theory of open-shell ions.
\emph{Mol.~Phys.} \textbf{1960}, \emph{3}, 79--89\relax
\mciteBstWouldAddEndPuncttrue
\mciteSetBstMidEndSepPunct{\mcitedefaultmidpunct}
{\mcitedefaultendpunct}{\mcitedefaultseppunct}\relax
\EndOfBibitem
\bibitem[Messiah({1961--1962})]{Messiah-book}
Messiah,~A. \emph{{Q}uantum mechanics}; North-Holland Pub. Co.: Amsterdam,
{1961--1962}; pp 1--1136\relax
\mciteBstWouldAddEndPuncttrue
\mciteSetBstMidEndSepPunct{\mcitedefaultmidpunct}
{\mcitedefaultendpunct}{\mcitedefaultseppunct}\relax
\EndOfBibitem
\bibitem[Abragam and Bleaney({1970})Abragam, and Bleaney]{Abragam1970}
Abragam,~A.; Bleaney,~B. \emph{{E}lectron {P}aramagnetic {R}esonance of
{T}ransition {I}ons}; Oxford University Press: Oxford, {1970}; pp
1--911\relax
\mciteBstWouldAddEndPuncttrue
\mciteSetBstMidEndSepPunct{\mcitedefaultmidpunct}
{\mcitedefaultendpunct}{\mcitedefaultseppunct}\relax
\EndOfBibitem
\bibitem[Chibotaru(2013)]{Chibotaru:2013:spinH}
Chibotaru,~L.~F. \emph{Advances in Chemical Physics}; John Wiley {\&} Sons,
Inc., 2013; pp 397--519\relax
\mciteBstWouldAddEndPuncttrue
\mciteSetBstMidEndSepPunct{\mcitedefaultmidpunct}
{\mcitedefaultendpunct}{\mcitedefaultseppunct}\relax
\EndOfBibitem
\bibitem[Griffith(1963)]{Griffith:1963:non-KP}
Griffith,~J.~S. Spin Hamiltonian for Even-Electron Systems Having Even
Multiplicity. \emph{Phys.~Rev.} \textbf{1963}, \emph{132}, 316--319\relax
\mciteBstWouldAddEndPuncttrue
\mciteSetBstMidEndSepPunct{\mcitedefaultmidpunct}
{\mcitedefaultendpunct}{\mcitedefaultseppunct}\relax
\EndOfBibitem
\bibitem[Pryce(1959)]{Pryce:1959:GT-sign}
Pryce,~M.~H.~L. {S}ign of g in Magnetic Resonance, and the Sign of the
Quadrupole Moment of {N}p$^{237}$. \emph{Phys.~Rev.~Lett.} \textbf{1959},
\emph{3}, 375--375\relax
\mciteBstWouldAddEndPuncttrue
\mciteSetBstMidEndSepPunct{\mcitedefaultmidpunct}
{\mcitedefaultendpunct}{\mcitedefaultseppunct}\relax
\EndOfBibitem
\bibitem[Bolvin and Autschbach(2016)Bolvin, and
Autschbach]{Bolvin:2016:EPR-review}
Bolvin,~H.; Autschbach,~J. \emph{Relativistic methods for calculating electron
paramagnetic resonance ({EPR}) parameters}; Springer Berlin Heidelberg, 2016;
pp 725--763\relax
\mciteBstWouldAddEndPuncttrue
\mciteSetBstMidEndSepPunct{\mcitedefaultmidpunct}
{\mcitedefaultendpunct}{\mcitedefaultseppunct}\relax
\EndOfBibitem
\end{mcitethebibliography}
\end{document}
|
math
|
No church is immune to generational disconnectedness. We want to introduce you to the Pray for Me Campaign!
The Pray for Me Campaign is committed to helping churches and ministries bridge the gap between generations through prayer.
In recent years we have become increasingly affected by the rise in students leaving the church. Sticky Faith’s research found this unsettling national statistic: 40-50% of students from good youth groups and families will drift from God and the church after high school.
|
english
|
You are here: Home / Dearborn Michigan Pediatrician / Healthy Families / We Have A Better Rainbow For You To Taste!
We Have A Better Rainbow For You To Taste!
I know you may have heard that expression before on some candy commercial, but really? Their rainbow is chock full of sugar and artificial colors & ingredients.
The rainbow I am talking about is one that not only gets its color from Mother Nature, but is so wonderfully tasty and good for your insides and out. It’s natural, nutritious and ever so sweet!
Apple’s antioxidant properties prevent cell and tissue damage. Studies by nutritionists have shown that apples contain abundant amounts of elastin and collagen that help keep the skin young. Applying a mixture of mashed apple, honey, rose water and oatmeal can act as a great exfoliating mask on your skin.
Carrots are brimming with tiny orange pigments called beta-carotene. When you eat foods with those pigments, you are not only giving your insides a healthy boost, but your skin a healthy glow. And what’s more, research shows that this can actually help prevent premature aging from sun damage.
Recent studies have shown that people with higher intakes of monounsaturated fats, the essential fats that make up more than 50% of the calories in an avocado, have fewer wrinkles. Avocados are also rich in B vitamins, which help to keep your skin looking vibrant and smooth. Other monounsaturated-fat foods: olive oil, almonds, and peanut butter.
Besides providing protection from heart attack and stroke, antioxidants called polyphenols found in grapes can also help keep middle-aged skin from sagging. That’s because polyphenols improve skin’s elasticity by strengthening collagen, the primary protein in skin’s innermost layer. Blueberries are another great choice!
Or legumes, to be exact. These include black beans, chickpeas, lentils, soybeans, and peanuts. And how do these puny pods protect your face? By smoothing out wrinkles. Australian researchers analyzed the diets of more than 400 elderly men and women and found that high intakes of legumes—alongside vegetables and healthy fats—resulted in 20% fewer wrinkles over time. The effect is likely a result of isoflavones—potent antioxidants—concentrated in the beans.
Lycopene, the phytochemical that makes tomatoes red, helps eliminate skin-aging free radicals caused by ultraviolet rays. Cooking tomatoes helps concentrate its lycopene levels, so tomato sauce, tomato paste, and even ketchup pack on the protection. So does a hunk of lycopene-rich watermelon, which gives you hydrating benefits as well.
We suggest you skip the candy rainbow, even if the commercials are funny, and instead opt for the healthy one. Not only will you look better, but you’ll feel a whole lot better overall, too. So, what’s your favorite food color?
P.S. My favorite of the above group is watermelon! I’ve been eating it, but also cutting a hole in a seedless melon (the hole should be big enough for a blender attachment) and whipping it right in the melon. It makes the best, freshest watermelon juice ever!
Written by: Roberta Perry, President of Scrubz Body Scrub, Inc.
After years of being totally selfless and taking care of everyone else’s needs, Roberta’s skin was peeling, dry, itchy and irritated. In 2005, she decided to create her own skin care product and headed for the kitchen. She played the “mad chemist” role, mixing different combinations of botanical oils and came up with a formula she loved. However, it was not until she did extensive research, that she realized how lucky she was with the recipe she had created. Natures oils are incredible for skin. She brought in her sister and together they started Scrubz™ in 2006. She has been published and quoted in blogs, beauty magazines and articles. She is a proud member of Indie Beauty/Indie Business, American Made Matters, Independent We Stand, Bethpage Chamber of Commerce, and the Bethpage Kiwanis Club.
|
english
|
frameworken
===========
my first ToDo App with Symfony
|
code
|
HairMax’s Lasercombs are clinically studied and FDA approved for both men and women. The company even claims that over 90% of their customers encounter “noticeable benefits” with continuous use.
This Pininfarina-designed device features 82 medical grade lasers that deliver maximum light to your follicles, together with a patented hair parting teeth system that aids to achieve the best results. In fact, with LaserBand 82, HairMax asserts your treatments can last a minimum 90 seconds, three times weekly.
The newest version in HairMax’s lineup, the LaserBand 41 was created for speed, since it can be used in as little as three minutes, three times weekly.
As its name suggests, LaserBand 41 boasts 41 medical-grade lasers (no LEDs) to stimulate hair follicles at the cellular level, to promote hair growth, and reverse hair thinning. And with its Flex-fit head band design, it should be comfortable for almost all head sizes and shapes.
Features 9 medical grade laser modules. When used three times weekly for 11 minutes each session, HairMax claims Ultima 9 can stimulate new hair growth, greater density, and healthier, fuller, more attractive-looking results–in only a few weeks!
The HairMax Laser Combs are made for people going through androgenetic alopecia. This is a fancy word for genetic hair loss. Treatment is done by yourself. The laser comb is combed through the hair 3 times weekly for about 15 minutes. Another benefit: your biceps will grow bigger after 45 minutes of weekly brushing. Pass the comb over the entire scalp area that is going through the miniaturization process. Usually, this counteracts the miniaturization process. Rather than hair appearing thinner and ultimately falling out completely, they will begin to get thicker. This will offer you more scalp coverage and a healthier looking head of hair.
If you want to talk about the technical language, this biological process is known as PhotoBioStimulation. This raises adenosine three phosphate (ATP) and keratin production. Enhancing cellular activity and metabolism, both of these coenzymes are responsible for intracellular energy transfer in addition to being known for revitalizing living cells such as the hair follicle cells.
The other function that these low-level laser treatments are responsible for is increased blood flow. Hair follicles require numerous nutrients to grow healthy and strong. Dihydrotestosterone (DHT) gets in the way of the delivery system. The laser comb assists in making sure nutrients are delivered more efficiently to hair follicles and further removes said DHT from the scalp.
The Food and Drug Administration (FDA) is a regulatory body whose major job is to protect consumers from advertising gimmicks and harmful products. They handle matters such as food safety laws and dietary supplements. They’ve a meticulous and comprehensive application and testing process that businesses must submit to that in part, if they pass, can validate their products allegations.
As we said, the HairMax Laser Comb is the only hair loss treatment machine approved by the FDA. It’s one of the three hair loss treatment items granted FDA approval as clinically proven hair loss treatment methods. The other two treatments granted approval are a topical product by the name of Minoxidil (Rogaine) and an orally administered product called Propecia.
We will discuss a little history on how HairMax’s submission to the FDA was approved. Lexington International LLC conducted a study in the United States of America. This clinical study was done in 4 different areas. In the end, this research study found that 93% of participants using the HairMax Laser Comb had a decrease in the amount of terminal hairs. That means those participants who were aged 30 to 60 increased the number of dense hairs. This increase was an average of about 19 hairs/cm over a 6 month period. So for every square centimeter of scalp, there was an additional 19 hairs in participants who used the laser comb.
For Lasercombs, Hairmax gives a 3 Pay installment plan to help defray the costs. If you purchased a HairMax laser comb using the 3 monthly payments choice, you are on a multi-pay billing program. Multi-pay is only accessible to customers ordering directly from Lexington International using a credit card, and discount codes along with other promotional offers may not be applied to these orders. A 10 percent fee is added to the then given purchase price when using the multi-pay choice to purchase a laser device.
Payments immediately post to the credit card used on the order approximately every 30 days, with the first payment posting on the day of the order. You don’t need to contact Lexington International or manually send payments. Funds should be available on the credit card for each month.
Orders are processed within 1-2 business days of order placement and are delivered with FedEx, UPS, or USPS, FedEx, USPS, or UPS. Overnight orders shipped to a Post Office Box may take up to 2 business days to be delivered. International orders ship via FedEx International Economy service or UPS Worldwide Expedited. For orders carrying HairMax devices, tracking numbers are given via email after shipment.
Orders shipped internationally may have duties or extra fees to be paid in your country for importation. Please note that these charges are evaluated as part of the import process and therefore are not expenses from Lexington International.
When putting an order for delivery outside the USA, please note that the international shipping charge that is shown on your Order Summary DOES NOT include Local Taxes, VAT and/or Duty that is assessed from the country the order will be delivered to. Such Regional Taxes, VAT and/or Duty should be paid AT THE TIME OF DELIVERY.
HairMax wants the users to be completely happy with the HairMax laser device, so the company provides a money back guarantee for orders placed directly with Lexington International: HairMax laser devices can be returned within 5 months to get a refund, less a 20% restocking fee on the total purchase price. (Please be aware that, if you’re purchasing a HairMax laser device utilizing a payment plan, the 20% restocking fee will be based on the complete purchase price value of the laser device, rather than on any individual payment which you may have made prior to returning the HairMax laser device with our money back guarantee.) This money back guarantee is effective from the date of delivery. You’ll be demanded to obtain a Return Merchandise Authorization and pay the return shipping costs and the appropriate restocking fee (previously mentioned). Please note that only orders placed directly through Lexington International are qualified for the money back guarantee. Nonetheless, more than 90% of HairMax’s customers do see notable benefits with continuous HairMax use, therefore, you won’t really be making use of this.
All HairMax laser devices acquired through Lexington International or by a licensed distributor includes a 2-year factory warranty against defects in materials or workmanship from Lexington International, LLC. Lexington may lengthen this warranty period under particular conditions. For further warranty information, please refer to the user manual (included in the packaging materials of your laser device).
To receive warranty service, you must deliver the product freight paid, in either its original packaging or packaging giving an equal degree of protection, along with your name and address.
Cost effective: Cost effectiveness is one of the added advantages with laser combs, compared surgical routes. With hair transplant surgery, you might need a number of sessions with the surgeon that will cost a lot of money. To the contrary, a laser comb is a one-time investment which could be utilized only when it must be used.
Easy use: The laser combs are as simple as combing your hair. You have to simply switch it on and brush it right through your hair.
Method: It is very important to use laser combs as advised in order to attain desired outcomes from it. If you aren’t using it properly, you might not see any results.
|
english
|
बीटीसी २०१३ एवम २०१४ चतुर्थ सेमेस्टर ( अवशेष/अनुत्तीर्ण ) की परीक्षा वर्ष २०१८ के आंतरिक मूल्यांकन के अंक ऑनलाइन पूरित कर प्रिंट आउट प्रेषण के सम्बंध में आदेश - शिक्षा विभाग की हलचल (शिक्षा विभाग की हलचल)
शिक्षा विभाग की हलचल (शिक्षा विभाग की हलचल) बत्क न्यूज बी टी सी २०१४ बीटीसी २०१३ शासनादेश संग्रह बीटीसी २०१३ एवम २०१४ चतुर्थ सेमेस्टर ( अवशेष/अनुत्तीर्ण ) की परीक्षा वर्ष २०१८ के आंतरिक मूल्यांकन के अंक ऑनलाइन पूरित कर प्रिंट आउट प्रेषण के सम्बंध में आदेश
बीटीसी २०१३ एवम २०१४ चतुर्थ सेमेस्टर ( अवशेष/अनुत्तीर्ण ) की परीक्षा वर्ष २०१८ के आंतरिक मूल्यांकन के अंक ऑनलाइन पूरित कर प्रिंट आउट प्रेषण के सम्बंध में आदेश
सौरभ त्रिवेदी जान्वरी २५, २०१८ बत्क न्यूज बी टी सी २०१४ बीटीसी २०१३ शासनादेश संग्रह
|
hindi
|
A road in Welling is currently closed in both directions due to a burst water main.
Lodge Hill from Denton Road to Langley Road is currently completely blocked off as engineers try and fix the problem.
The issue started on Saturday (March 16) and is very close to Plumstead Cemetery.
Bus route B11 is currently on diversion and you are advised to make extra time when travelling today.
|
english
|
/**********************
Arduino-like project with setup() & loop(). Read number
as string via UART from PC terminal and echo value back.
Functionality:
- configure UART1 for PC in-/output
- use UART1 send for putchar() output
- use UART1 receive for gets() input
- read string from PC, convert to number and send value to PC
**********************/
/*----------------------------------------------------------
INCLUDE FILES
----------------------------------------------------------*/
#include "main_general.h" // board-independent main
#include "uart1.h" // UART1 communication
#include "putchar.h" // for printf()
#include "getchar.h" // for gets()
/*----------------------------------------------------------
FUNCTIONS
----------------------------------------------------------*/
//////////
// user setup, called once after reset
//////////
void setup() {
// init UART1 to 115.2kBaud, 8N1, full duplex
UART1_begin(115200);
// use UART1 for printf() output
putcharAttach(UART1_write);
// use UART1 blocking read for gets() input
getcharAttach(UART1_read);
// wait a it for console to launch
sw_delay(1000);
} // setup
//////////
// user loop, called continuously
//////////
void loop() {
char str[20];
int num;
// read a string via UART1
printf("Enter a number: ");
gets(str);
// convert to integer [-2^16; 2^16-1]
num = atoi(str);
// print result via UART1
printf("value: %d\n\n", num);
} // loop
/*-----------------------------------------------------------------------------
END OF MODULE
-----------------------------------------------------------------------------*/
|
code
|
अंतर्राष्ट्रीय व्यापार चिह्न वीट ("विट") पर८० साल तक वह अवसाद के लिए साधनों की रेटिंग में अग्रणी रहे हैं। कंपनी "रेकिट बेन्कीसर" अपने उत्पादों को सुधारने के लिए अपनी सुरक्षा और दक्षता सुनिश्चित करने में लगातार सुधार करती है। "विट" के साथ हर कोई अवसाद का एक आरामदायक तरीका चुन सकता है। बालों को हटाने मोम उन लोगों के लिए उपयुक्त है जो उच्च दर्द थ्रेसहोल्ड हैं, डिबेट्री क्रीम उपभोक्ताओं के साथ अधिक संवेदनशील त्वचा का उपयोग करती है।
प्रतिक्रिया संतुष्ट ग्राहक कहते हैं किबालों को हटाने मोम की विधि - सबसे सरल और तेजी से। यदि यह अक्सर प्रयोग किया जाता है, बाल पतले हो जाते हैं, वे छोटे हो जाते हैं। वैक्स स्ट्रिप्स तुरंत उपयोग के लिए तैयार हैं। वे आवेदन (पैर, चेहरा, बिकनी क्षेत्र, अंडरार्म) और त्वचा के प्रकार के विषय क्षेत्रों चुन सकते हैं। पैर मोम स्ट्रिप्स "बुद्धि" है, जो की समीक्षा ४ हफ्तों के लिए वास्तव में चिकनी त्वचा की बात करते हैं, त्वचा के प्रकार के आधार पर कई प्रकार में विभाजित पर बाल हटाने के लिए बनाया गया है। एलोवेरा और संवेदनशील के लिए दूध कमल - - विटामिन ई और बादाम का तेल सामान्य त्वचा के लिए स्ट्रिप्स शीया मक्खन और जामुन, सूखे के अर्क होता है। प्रौद्योगिकी "बुद्धि" सुप्रेम'एसेन्स की नई श्रृंखला के साथ, जिनमें से एक हिस्सा आवश्यक तेलों और सामग्री मोइस्त्राइज़ करने के लिए कर रहे हैं और त्वचा को पोषण देने के लिए, यह उत्कृष्ट परिणाम प्राप्त, २ मिमी जितना संक्षिप्त बाल निकालना और त्वचा रेशमी और चिकनी बनाने के लिए संभव है।
वीट बिकिनी जोन के लिए मोम धारियां
बगल और बिकनी क्षेत्र विशेष रूप से संवेदनशील है औरडेनिलेशन प्रक्रिया में विशेष ध्यान देने की आवश्यकता है "विट" इन नाजुक स्थानों में बालों को हटाने के लिए विशेष उपकरण तैयार करता है, जो त्वचा को एक साथ देते हैं और देखभाल करते हैं। यदि आप एक रेजर का उपयोग करते हैं, तो इनग्राउन बालों की एक उच्च संभावना है। मोम स्ट्रिप्स "विट", जिसकी समीक्षा इस की पुष्टि करती है, बालों के तेज सुझावों को नहीं छोड़ें, जब शेविंग इस तरह से बालों को निकालने से इनक्राफ्ट के साथ जुड़ा असुविधा का खतरा कम होता है। स्ट्रिप्स का सुविधाजनक आकार त्वचा को चिकना बनाने में आसान और त्वरित बनाता है।
वीट वैक्स स्ट्रिप्स
यह उपकरण विशेष रूप से हटाने के लिए बनाया गया हैचेहरे पर बाल। इसकी मदद से, आप त्वचा के छोटे क्षेत्रों पर डिबियाशन कर सकते हैं। अच्छे परिणाम प्राप्त करने के लिए, बाल ५ मिमी से अधिक नहीं होना चाहिए, और त्वचा सूजन नहीं होनी चाहिए। प्रत्येक उपयोग से पहले, इलाज के लिए सतह की संवेदनशीलता के लिए एक परीक्षण करें। दो बार एक सत्र के लिए एक ही साइट पर पट्टी का प्रयोग न करें और बाद में डिप्ती के बाद तुरंत बाहर न जाएं। यह त्वचा को घायल कर सकता है और उस पर जलन दिखाई देगी। विट स्ट्रेट्स "विट", जिनके बारे में समीक्षा, यदि सही तरीके से लागू किया गया है, सकारात्मक हैं, लंबे समय से आपको अपने चेहरे पर अनचाहे बालों से बचाएगा।
मॉइस्चराइजिंग नैपकिन के साथ आता है,जो प्रक्रिया पूरी करते हैं मोम के तैयार किए गए स्ट्रिप्स का प्रयोग बहुत सुविधाजनक है, क्योंकि त्वचा की तैयारी करने के लिए समय बर्बाद करने की कोई आवश्यकता नहीं है। उनका नियमित उपयोग इस तथ्य को आगे बढ़ाता है कि एपिलेशन बाल कम से कम होते हैं और वैक्सिंग स्थानों पर पतले होते हैं, जिसका मतलब है कि त्वचा चिकनी हो जाएगी और यहां तक कि लंबे समय तक भी।
नाक के लिए सफाई स्ट्रिप्स: तेज और
एक नया बाल हटानेवाला। बालों को रोको
कैसे एक मोम एपिलेटर, सबसे अच्छा की समीक्षा का चयन करने के लिए
गर्भावस्था टेस्ट पर स्ट्रिप्स
"मैं पैदा हुआ था" - गर्भावस्था परीक्षण: समीक्षा
मोम मोमबत्तियां अपने हाथों से कैसे करें
|
hindi
|
Two golf courses, a Nature Center, an eatery, recreation center with a pool, an amphitheater, a 3600 foot aerial tramway, and 20 different hiking trails are just some of the amenities found at this popular park. Healthy dogs are allowed in camp areas for no charge and the cabins/cottages for a $50 refundable deposit, plus $40 for the first night and $5 for each additional night per pet. A credit card must be on file, and there is a pet agreement to sign at check in. Pets may not be left unattended outside, they must be securely crated when left alone in the cabins or cottages, they are not allowed to be tied/chained on the porch or yard, and their food may not be kept outside. Dogs must have certified proof of inoculations from a veterinarian, be on no more than a 10 foot leash, and picked up after. Dogs are allowed on the aerial tram.
|
english
|
#ifndef __TEXTREADER_H__
#define __TEXTREADER_H__
#include <cstdio>
#include <string>
#include "Reader.h"
namespace cigma
{
class TextReader;
};
class cigma::TextReader : public Reader
{
public:
TextReader();
~TextReader();
public:
ReaderType getType() { return TXT_READER; }
public:
int open(std::string filename);
void close();
public:
void get_dataset(const char *loc, double **data, int *num, int *dim);
void get_coordinates(const char *loc, double **coordinates, int *nno, int *nsd);
void get_connectivity(const char *loc, int **connectivity, int *nel, int *ndofs);
public:
FILE *fp; // default file pointer
};
// ---------------------------------------------------------------------------
#endif
|
code
|
START TRANSACTION;
alter table ModuleScript
drop constraint FK54AE36777BF02576;
drop table ModuleScript cascade;
create table ModuleScript (
id int8 not null,
description varchar(255),
name varchar(255),
unix bool not null,
moduleVersion_id int8,
primary key (id)
);
alter table ModuleScript
add constraint FK54AE36777BF02576
foreign key (moduleVersion_id)
references ModuleVersion;
COMMIT;
|
code
|
A triptych is a work of art that is divided into three sections or panels; the term was originally applied to paintings and sculptures, and then later to sets of three (usually-related) photographs. Technically speaking, this isn't really a triptych, as it's a single photograph. Still, the three distinct elements -- the dead leaves trapped between the two contrasting tree trunks -- immediately brought the term to mind. Even better, each of the three is a different kind of tree: a maple log below, beech leaves, and of course, the distinctive white of birch at the top.
|
english
|
چشمن منز گِندٕنووُم تاپھ
|
kashmiri
|
کہنِہ
|
kashmiri
|
Try an adaptable table, editable, a console, but you also need a kitchen table or a table top?
Convivium is a timeless table and so adaptable that it is like buying 4 / 5 tables in one. convivium as Cattelan Italy It may in fact be a console or coffee table, or you can use a dining room or kitchen table. It can also be a desk.
|
english
|
(function() {
/**
* almond 0.2.6 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
//Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed.
/*jslint sloppy: true */
/*global setTimeout: false */
var requirejs, require, define;
(function (undef) {
var main, req, makeMap, handlers,
defined = {},
waiting = {},
config = {},
defining = {},
hasOwn = Object.prototype.hasOwnProperty,
aps = [].slice;
function hasProp(obj, prop) {
return hasOwn.call(obj, prop);
}
/**
* Given a relative module name, like ./something, normalize it to
* a real name that can be mapped to a path.
* @param {String} name the relative name
* @param {String} baseName a real name that the name arg is relative
* to.
* @returns {String} normalized name
*/
function normalize(name, baseName) {
var nameParts, nameSegment, mapValue, foundMap,
foundI, foundStarMap, starI, i, j, part,
baseParts = baseName && baseName.split("/"),
map = config.map,
starMap = (map && map['*']) || {};
//Adjust any relative paths.
if (name && name.charAt(0) === ".") {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
//Convert baseName to array, and lop off the last part,
//so that . matches that "directory" and not name of the baseName's
//module. For instance, baseName of "one/two/three", maps to
//"one/two/three.js", but we want the directory, "one/two" for
//this normalization.
baseParts = baseParts.slice(0, baseParts.length - 1);
name = baseParts.concat(name.split("/"));
//start trimDots
for (i = 0; i < name.length; i += 1) {
part = name[i];
if (part === ".") {
name.splice(i, 1);
i -= 1;
} else if (part === "..") {
if (i === 1 && (name[2] === '..' || name[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
name.splice(i - 1, 2);
i -= 2;
}
}
}
//end trimDots
name = name.join("/");
} else if (name.indexOf('./') === 0) {
// No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot.
name = name.substring(2);
}
}
//Apply map config if available.
if ((baseParts || starMap) && map) {
nameParts = name.split('/');
for (i = nameParts.length; i > 0; i -= 1) {
nameSegment = nameParts.slice(0, i).join("/");
if (baseParts) {
//Find the longest baseName segment match in the config.
//So, do joins on the biggest to smallest lengths of baseParts.
for (j = baseParts.length; j > 0; j -= 1) {
mapValue = map[baseParts.slice(0, j).join('/')];
//baseName segment has config, find if it has one for
//this name.
if (mapValue) {
mapValue = mapValue[nameSegment];
if (mapValue) {
//Match, update name to the new value.
foundMap = mapValue;
foundI = i;
break;
}
}
}
}
if (foundMap) {
break;
}
//Check for a star map match, but just hold on to it,
//if there is a shorter segment match later in a matching
//config, then favor over this star map.
if (!foundStarMap && starMap && starMap[nameSegment]) {
foundStarMap = starMap[nameSegment];
starI = i;
}
}
if (!foundMap && foundStarMap) {
foundMap = foundStarMap;
foundI = starI;
}
if (foundMap) {
nameParts.splice(0, foundI, foundMap);
name = nameParts.join('/');
}
}
return name;
}
function makeRequire(relName, forceSync) {
return function () {
//A version of a require function that passes a moduleName
//value for items that may need to
//look up paths relative to the moduleName
return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
};
}
function makeNormalize(relName) {
return function (name) {
return normalize(name, relName);
};
}
function makeLoad(depName) {
return function (value) {
defined[depName] = value;
};
}
function callDep(name) {
if (hasProp(waiting, name)) {
var args = waiting[name];
delete waiting[name];
defining[name] = true;
main.apply(undef, args);
}
if (!hasProp(defined, name) && !hasProp(defining, name)) {
throw new Error('No ' + name);
}
return defined[name];
}
//Turns a plugin!resource to [plugin, resource]
//with the plugin being undefined if the name
//did not have a plugin prefix.
function splitPrefix(name) {
var prefix,
index = name ? name.indexOf('!') : -1;
if (index > -1) {
prefix = name.substring(0, index);
name = name.substring(index + 1, name.length);
}
return [prefix, name];
}
function onResourceLoad(name, defined, deps){
if(requirejs.onResourceLoad && name){
requirejs.onResourceLoad({defined:defined}, {id:name}, deps);
}
}
/**
* Makes a name map, normalizing the name, and using a plugin
* for normalization if necessary. Grabs a ref to plugin
* too, as an optimization.
*/
makeMap = function (name, relName) {
var plugin,
parts = splitPrefix(name),
prefix = parts[0];
name = parts[1];
if (prefix) {
prefix = normalize(prefix, relName);
plugin = callDep(prefix);
}
//Normalize according
if (prefix) {
if (plugin && plugin.normalize) {
name = plugin.normalize(name, makeNormalize(relName));
} else {
name = normalize(name, relName);
}
} else {
name = normalize(name, relName);
parts = splitPrefix(name);
prefix = parts[0];
name = parts[1];
if (prefix) {
plugin = callDep(prefix);
}
}
//Using ridiculous property names for space reasons
return {
f: prefix ? prefix + '!' + name : name, //fullName
n: name,
pr: prefix,
p: plugin
};
};
function makeConfig(name) {
return function () {
return (config && config.config && config.config[name]) || {};
};
}
handlers = {
require: function (name) {
return makeRequire(name);
},
exports: function (name) {
var e = defined[name];
if (typeof e !== 'undefined') {
return e;
} else {
return (defined[name] = {});
}
},
module: function (name) {
return {
id: name,
uri: '',
exports: defined[name],
config: makeConfig(name)
};
}
};
main = function (name, deps, callback, relName) {
var cjsModule, depName, ret, map, i,
args = [],
usingExports;
//Use name if no relName
relName = relName || name;
//Call the callback to define the module, if necessary.
if (typeof callback === 'function') {
//Pull out the defined dependencies and pass the ordered
//values to the callback.
//Default to [require, exports, module] if no deps
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
for (i = 0; i < deps.length; i += 1) {
map = makeMap(deps[i], relName);
depName = map.f;
//Fast path CommonJS standard dependencies.
if (depName === "require") {
args[i] = handlers.require(name);
} else if (depName === "exports") {
//CommonJS module spec 1.1
args[i] = handlers.exports(name);
usingExports = true;
} else if (depName === "module") {
//CommonJS module spec 1.1
cjsModule = args[i] = handlers.module(name);
} else if (hasProp(defined, depName) ||
hasProp(waiting, depName) ||
hasProp(defining, depName)) {
args[i] = callDep(depName);
} else if (map.p) {
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
args[i] = defined[depName];
} else {
throw new Error(name + ' missing ' + depName);
}
}
ret = callback.apply(defined[name], args);
if (name) {
//If setting exports via "module" is in play,
//favor that over return value and exports. After that,
//favor a non-undefined return value over exports use.
if (cjsModule && cjsModule.exports !== undef &&
cjsModule.exports !== defined[name]) {
defined[name] = cjsModule.exports;
} else if (ret !== undef || !usingExports) {
//Use the return value from the function.
defined[name] = ret;
}
}
} else if (name) {
//May just be an object definition for the module. Only
//worry about defining if have a module name.
defined[name] = callback;
}
onResourceLoad(name, defined, args);
};
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
if (typeof deps === "string") {
if (handlers[deps]) {
//callback in this case is really relName
return handlers[deps](callback);
}
//Just return the module wanted. In this scenario, the
//deps arg is the module name, and second arg (if passed)
//is just the relName.
//Normalize module name, if it contains . or ..
return callDep(makeMap(deps, callback).f);
} else if (!deps.splice) {
//deps is a config object, not an array.
config = deps;
if (callback.splice) {
//callback is an array, which means it is a dependency list.
//Adjust args if there are dependencies
deps = callback;
callback = relName;
relName = null;
} else {
deps = undef;
}
}
//Support require(['a'])
callback = callback || function () {};
//If relName is a function, it is an errback handler,
//so remove it.
if (typeof relName === 'function') {
relName = forceSync;
forceSync = alt;
}
//Simulate async callback;
if (forceSync) {
main(undef, deps, callback, relName);
} else {
//Using a non-zero value because of concern for what old browsers
//do, and latest browsers "upgrade" to 4 if lower value is used:
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
//If want a value immediately, use require('id') instead -- something
//that works in almond on the global level, but not guaranteed and
//unlikely to work in other AMD implementations.
setTimeout(function () {
main(undef, deps, callback, relName);
}, 4);
}
return req;
};
/**
* Just drops the config on the floor, but returns req in case
* the config return value is used.
*/
req.config = function (cfg) {
config = cfg;
if (config.deps) {
req(config.deps, config.callback);
}
return req;
};
/**
* Expose module registry for debugging and tooling
*/
requirejs._defined = defined;
define = function (name, deps, callback) {
//This module may not have dependencies
if (!deps.splice) {
//deps is not an array, so probably means
//an object literal or factory function for
//the value. Adjust args.
callback = deps;
deps = [];
}
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
waiting[name] = [name, deps, callback];
}
};
define.amd = {
jQuery: true
};
}());/*!
* jQuery JavaScript Library v1.9.1
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-2-4
*/
(function( window, undefined ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//
var
// The deferred used on DOM ready
readyList,
// A central reference to the root jQuery(document)
rootjQuery,
// Support: IE<9
// For `typeof node.method` instead of `node.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
location = window.location,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// [[Class]] -> type pairs
class2type = {},
// List of deleted data cache ids, so we can reuse them
core_deletedIds = [],
core_version = "1.9.1",
// Save a reference to some core methods
core_concat = core_deletedIds.concat,
core_push = core_deletedIds.push,
core_slice = core_deletedIds.slice,
core_indexOf = core_deletedIds.indexOf,
core_toString = class2type.toString,
core_hasOwn = class2type.hasOwnProperty,
core_trim = core_version.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
// Used for splitting on whitespace
core_rnotwhite = /\S+/g,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
},
// The ready event handler
completed = function( event ) {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
detach();
jQuery.ready();
}
},
// Clean-up method for dom ready events
detach = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: core_version,
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
// scripts is true for back-compat
jQuery.merge( this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: core_push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var src, copyIsArray, copy, name, options, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
if ( obj == null ) {
return String( obj );
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ core_toString.call(obj) ] || "object" :
typeof obj;
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts );
if ( scripts ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
},
parseJSON: function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
if ( data === null ) {
return data;
}
if ( typeof data === "string" ) {
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
if ( data ) {
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
}
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && jQuery.trim( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArraylike( Object(arr) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
core_push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value,
i = 0,
length = elems.length,
isArray = isArraylike( elems ),
ret = [];
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return core_concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var args, proxy, tmp;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < length; i++ ) {
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
function isArraylike( obj ) {
var length = obj.length,
type = jQuery.type( obj );
if ( jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// First callback to fire (used internally by add and fireWith)
firingStart,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( list && ( !fired || stack ) ) {
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
}
});
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ]
deferred[ tuple[0] ] = function() {
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function() {
var support, all, a,
input, select, fragment,
opt, eventName, isSupported, i,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Support tests won't run in some limited or non-browser environments
all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ];
if ( !all || !a || !all.length ) {
return {};
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
support = {
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: div.firstChild.nodeType === 3,
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: a.getAttribute("href") === "/a",
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.5/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
checkOn: !!input.value,
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: document.compatMode === "CSS1Compat",
// Will be defined later
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
boxSizingReliable: true,
pixelPosition: false
};
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Support: IE<9
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
// Check if we can trust getAttribute("value")
input = document.createElement("input");
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "checked", "t" );
input.setAttribute( "name", "t" );
fragment = document.createDocumentFragment();
fragment.appendChild( input );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9
// Opera does not clone events (and typeof div.attachEvent === undefined).
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
if ( div.attachEvent ) {
div.attachEvent( "onclick", function() {
support.noCloneEvent = false;
});
div.cloneNode( true ).click();
}
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
for ( i in { submit: true, change: true, focusin: true }) {
div.setAttribute( eventName = "on" + i, "t" );
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
}
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Run tests that need a body at doc ready
jQuery(function() {
var container, marginDiv, tds,
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
body.appendChild( container ).appendChild( div );
// Support: IE8
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Support: IE8
// Check if empty table cells still have offsetWidth/Height
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior
div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
support.boxSizing = ( div.offsetWidth === 4 );
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
// Use window.getComputedStyle because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. (#3333)
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = div.appendChild( document.createElement("div") );
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== core_strundefined ) {
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Support: IE6
// Check if elements with layout shrink-wrap their children
div.style.display = "block";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
if ( support.inlineBlockNeedsLayout ) {
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
body.style.zoom = 1;
}
}
body.removeChild( container );
// Null elements to avoid leaks in IE
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
all = select = fragment = opt = a = input = null;
return support;
})();
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
}
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var i, l, thisCache,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
}
jQuery.extend({
cache: {},
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data ) {
return internalData( elem, name, data );
},
removeData: function( elem, name ) {
return internalRemoveData( elem, name );
},
// For internal use only.
_data: function( elem, name, data ) {
return internalData( elem, name, data, true );
},
_removeData: function( elem, name ) {
return internalRemoveData( elem, name, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
// Do not set data on non-element because it will not be cleared (#8335).
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
return false;
}
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var attrs, name,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attrs = elem.attributes;
for ( ; i < attrs.length; i++ ) {
name = attrs[i].name;
if ( !name.indexOf( "data-" ) ) {
name = jQuery.camelCase( name.slice(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
// Try to fetch any internally stored data first
return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
}
this.each(function() {
jQuery.data( this, key, value );
});
}, null, value, arguments.length > 1, null, true );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
hooks.cur = fn;
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key );
})
});
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook,
rclass = /[\t\r\n]/g,
rreturn = /\r/g,
rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i,
rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
getSetInput = jQuery.support.input;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
// The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
" "
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
elem.className = jQuery.trim( cur );
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
""
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
elem.className = value ? jQuery.trim( cur ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
// Toggle whole class name
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var ret, hooks, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var val,
self = jQuery(this);
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attr: function( elem, name, value ) {
var hooks, notxml, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === core_strundefined ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
} else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
// In IE9+, Flash objects don't have .getAttribute (#12945)
// Support: IE9+
if ( typeof elem.getAttribute !== core_strundefined ) {
ret = elem.getAttribute( name );
}
// Non-existent attributes return null, we normalize to undefined
return ret == null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var name, propName,
i = 0,
attrNames = value && value.match( core_rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( (name = attrNames[i++]) ) {
propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( rboolean.test( name ) ) {
// Set corresponding property to false for boolean attributes
// Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
if ( !getSetAttribute && ruseDefault.test( name ) ) {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
} else {
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to default in case type is set after value during creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
var
// Use .prop to determine if this attribute is understood as boolean
prop = jQuery.prop( elem, name ),
// Fetch it accordingly
attr = typeof prop === "boolean" && elem.getAttribute( name ),
detail = typeof prop === "boolean" ?
getSetInput && getSetAttribute ?
attr != null :
// oldIE fabricates an empty string for missing boolean attributes
// and conflates checked/selected into attroperties
ruseDefault.test( name ) ?
elem[ jQuery.camelCase( "default-" + name ) ] :
!!attr :
// fetch an attribute node for properties not recognized as boolean
elem.getAttributeNode( name );
return detail && detail.value !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
// Use defaultChecked and defaultSelected for oldIE
} else {
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
return name;
}
};
// fix oldIE value attroperty
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return jQuery.nodeName( elem, "input" ) ?
// Ignore the value *property* by using defaultValue
elem.defaultValue :
ret && ret.specified ? ret.value : undefined;
},
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
}
};
}
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
ret.value :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
(ret = elem.ownerDocument.createAttribute( name ))
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
return name === "value" || value === elem.getAttribute( name ) ?
value :
undefined;
}
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
}
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret == null ? undefined : ret;
}
});
});
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each([ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case senstitivity in URL's, like in "background"
return elem.style.cssText || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj,
handlers, type, namespaces, origType,
elemData = jQuery._data( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if ( !(events = elemData.events) ) {
events = elemData.events = {};
}
if ( !(eventHandle = elemData.handle) ) {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !(handlers = events[ type ]) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[ type ] || [];
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery._removeData( elem, "events" );
}
},
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = core_hasOwn.call( event, "type" ) ? event.type : event,
namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf(".") >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
event.isTrigger = true;
event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === (elem.ownerDocument || document) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event );
var i, ret, handleObj, matched, j,
handlerQueue = [],
args = core_slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
if ( (event.result = ret) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var sel, handleObj, matches, i,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
for ( ; cur != this; cur = cur.parentNode || this ) {
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matches[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, handlers: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) {
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
}
return handlerQueue;
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: IE<9
// Fix target property (#1925)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Support: Chrome 23+, Safari?
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
// Includes some event props shared by KeyEvent and MouseEvent
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var body, eventDoc, doc,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
this.click();
return false;
}
}
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== document.activeElement && this.focus ) {
try {
this.focus();
return false;
} catch ( e ) {
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
}
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === document.activeElement && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
beforeunload: {
postDispatch: function( event ) {
// Even when returnValue equals to undefined Firefox will still show alert
if ( event.result !== undefined ) {
event.originalEvent.returnValue = event.result;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === core_strundefined ) {
elem[ name ] = null;
}
elem.detachEvent( name, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( !e ) {
return;
}
// If preventDefault exists, run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// Support: IE
// Otherwise set the returnValue property of the original event to false
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( !e ) {
return;
}
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// Support: IE
// Set the cancelBubble property of the original event to true
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
}
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "submitBubbles" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "submitBubbles", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "changeBubbles", true );
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var type, origFn;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
var elem = this[0];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
(function( window, undefined ) {
var i,
cachedruns,
Expr,
getText,
isXML,
compile,
hasDuplicate,
outermostContext,
// Local document vars
setDocument,
document,
docElem,
documentIsXML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
sortOrder,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
support = {},
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Array methods
arr = [],
pop = arr.pop,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
operators = "([*^$|!~]?=)",
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments quoted,
// then not containing pseudos/brackets,
// then attribute selectors/non-parenthetical expressions,
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rsibling = /[\x20\t\r\n\f]*[+~]/,
rnative = /^[^{]+\{\s*\[native code/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rescape = /'|\\/g,
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
funescape = function( _, escaped ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
return high !== high ?
escaped :
// BMP codepoint
high < 0 ?
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Use a stripped-down slice if we can't use a native one
try {
slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
} catch ( e ) {
slice = function( i ) {
var elem,
results = [];
while ( (elem = this[i++]) ) {
results.push( elem );
}
return results;
};
}
/**
* For feature detection
* @param {Function} fn The function to test for native support
*/
function isNative( fn ) {
return rnative.test( fn + "" );
}
/**
* Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var cache,
keys = [];
return (cache = function( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key += " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key ] = value);
});
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createElement("div");
try {
return fn( div );
} catch (e) {
return false;
} finally {
// release memory in IE
div = null;
}
}
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
results = results || [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
return [];
}
if ( !documentIsXML && !seed ) {
// Shortcuts
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
return results;
}
}
// QSA path
if ( support.qsa && !rbuggyQSA.test(selector) ) {
old = true;
nid = expando;
newContext = context;
newSelector = nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + toSelector( groups[i] );
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results, slice.call( newContext.querySelectorAll(
newSelector
), 0 ) );
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Detect xml
* @param {Element|Object} elem An element or a document
*/
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var doc = node ? node.ownerDocument || node : preferredDoc;
// If no document and documentElement is available, return
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Set our document
document = doc;
docElem = doc.documentElement;
// Support tests
documentIsXML = isXML( doc );
// Check if getElementsByTagName("*") returns only elements
support.tagNameNoComments = assert(function( div ) {
div.appendChild( doc.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Check if attributes should be retrieved by attribute nodes
support.attributes = assert(function( div ) {
div.innerHTML = "<select></select>";
var type = typeof div.lastChild.getAttribute("multiple");
// IE8 returns a string for some attributes even when not present
return type !== "boolean" && type !== "string";
});
// Check if getElementsByClassName can be trusted
support.getByClassName = assert(function( div ) {
// Opera can't find a second classname (in 9.6)
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
return false;
}
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className = "e";
return div.getElementsByClassName("e").length === 2;
});
// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
support.getByName = assert(function( div ) {
// Inject content
div.id = expando + 0;
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
docElem.insertBefore( div, docElem.firstChild );
// Test
var pass = doc.getElementsByName &&
// buggy browsers will return fewer than the correct 2
doc.getElementsByName( expando ).length === 2 +
// buggy browsers will return more than the correct 0
doc.getElementsByName( expando + 0 ).length;
support.getIdNotName = !doc.getElementById( expando );
// Cleanup
docElem.removeChild( div );
return pass;
});
// IE6/7 return modified attributes
Expr.attrHandle = assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
div.firstChild.getAttribute("href") === "#";
}) ?
{} :
{
"href": function( elem ) {
return elem.getAttribute( "href", 2 );
},
"type": function( elem ) {
return elem.getAttribute("type");
}
};
// ID find and filter
if ( support.getIdNotName ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
} else {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
var m = context.getElementById( id );
return m ?
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
[m] :
undefined :
[];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.tagNameNoComments ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Name
Expr.find["NAME"] = support.getByName && function( tag, context ) {
if ( typeof context.getElementsByName !== strundefined ) {
return context.getElementsByName( name );
}
};
// Class
Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
return context.getElementsByClassName( className );
}
};
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21),
// no need to also add to buggyMatches since matches checks buggyQSA
// A support test would require too much code (would include document ready)
rbuggyQSA = [ ":focus" ];
if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explictly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// IE8 - Some boolean attributes are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Opera 10-12/IE8 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<input type='hidden' i=''/>";
if ( div.querySelectorAll("[i^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
docElem.mozMatchesSelector ||
docElem.webkitMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
// Document order sorting
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
var compare;
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
if ( a === doc || contains( preferredDoc, a ) ) {
return -1;
}
if ( b === doc || contains( preferredDoc, b ) ) {
return 1;
}
return 0;
}
return compare & 4 ? -1 : 1;
}
return a.compareDocumentPosition ? -1 : 1;
} :
function( a, b ) {
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
// Parentless nodes are either documents or disconnected
} else if ( !aup || !bup ) {
return a === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
hasDuplicate = false;
[0, 0].sort( sortOrder );
support.detectDuplicates = hasDuplicate;
return document;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
// rbuggyQSA always contains :focus, so no need for an existence check
if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, document, null, [elem] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
var val;
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
if ( !documentIsXML ) {
name = name.toLowerCase();
}
if ( (val = Expr.attrHandle[ name ]) ) {
return val( elem );
}
if ( documentIsXML || support.attributes ) {
return elem.getAttribute( name );
}
return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
name :
val && val.specified ? val.value : null;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
// Document sorting and removing duplicates
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
i = 1,
j = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( ; (elem = results[i]); i++ ) {
if ( elem === results[ i - 1 ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
// Returns a function to use in pseudos for input types
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
// Returns a function to use in pseudos for buttons
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
// Returns a function to use in pseudos for positionals
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[5] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[4] ) {
match[2] = match[4];
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeName ) {
if ( nodeName === "*" ) {
return function() { return true; };
}
nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, outerCache, node, diff, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || (parent[ expando ] = {});
cache = outerCache[ type ] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && cache[2];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
// Use previously-cached element index if available
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifider
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsXML ?
elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
elem.lang) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push( {
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
} );
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push( {
value: matched,
type: type,
matches: match
} );
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var data, cache, outerCache,
dirkey = dirruns + " " + doneName;
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
if ( (data = cache[1]) === true || data === cachedruns ) {
return data === true;
}
} else {
cache = outerCache[ dir ] = [ dirkey ];
cache[1] = matcher( elem, context, xml ) || cachedruns;
if ( cache[1] === true ) {
return true;
}
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// A counter to specify which element is currently being matched
var matcherCachedRuns = 0,
bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = matcherCachedRuns;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++matcherCachedRuns;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
context.nodeType === 9 && !documentIsXML &&
Expr.relative[ tokens[1].type ] ) {
context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, slice.call( seed, 0 ) );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
documentIsXML,
results,
rsibling.test( selector )
);
return results;
}
// Deprecated
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Easy API for creating new setFilters
function setFilters() {}
Expr.filters = setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
// Initialize with the default document
setDocument();
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
var runtil = /Until$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
isSimple = /^.[^:#\[\.,]*$/,
rneedsContext = jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var i, ret, self,
len = this.length;
if ( typeof selector !== "string" ) {
self = this;
return this.pushStack( jQuery( selector ).filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
}) );
}
ret = [];
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, this[ i ], ret );
}
// Needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false) );
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true) );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
rneedsContext.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
cur = this[i];
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
}
cur = cur.parentNode;
}
}
return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( jQuery.unique(all) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
jQuery.fn.andSelf = jQuery.fn.addBack;
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( this.length > 1 && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
// We have to close these tags to support XHTML (#13200)
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
return this.domManip( arguments, false, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
});
},
after: function() {
return this.domManip( arguments, false, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
});
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
if ( elem.parentNode ) {
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
setGlobalEval( getAll( elem, "script" ) );
}
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
// If this is a select, ensure that it displays empty (#12336)
// Support: IE<9
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
elem.options.length = 0;
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function( value ) {
var isFunc = jQuery.isFunction( value );
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( !isFunc && typeof value !== "string" ) {
value = jQuery( value ).not( this ).detach();
}
return this.domManip( [ value ], true, function( elem ) {
var next = this.nextSibling,
parent = this.parentNode;
if ( parent ) {
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
});
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
// Flatten any nested arrays
args = core_concat.apply( [], args );
var first, node, hasScripts,
scripts, doc, fragment,
i = 0,
l = this.length,
set = this,
iNoClone = l - 1,
value = args[0],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
return this.each(function( index ) {
var self = set.eq( index );
if ( isFunction ) {
args[0] = value.call( this, index, table ? self.html() : undefined );
}
self.domManip( args, table, callback );
});
}
if ( l ) {
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call(
table && jQuery.nodeName( this[i], "table" ) ?
findOrAppend( this[i], "tbody" ) :
this[i],
node,
i
);
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Hope ajax is available...
jQuery.ajax({
url: node.src,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
} else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return this;
}
});
function findOrAppend( elem, tag ) {
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
var attr = elem.getAttributeNode("type");
elem.type = ( attr && attr.specified ) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
}
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
});
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
// Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( manipulation_rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
// Fix all IE cloning issues
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
fixCloneNodeIssues( node, destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
cloneCopyEvent( node, destElements[i] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
destElements = srcElements = node = null;
// Return the cloned set
return clone;
},
buildFragment: function( elems, context, scripts, selection ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.createElement("div") );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup
tmp = safe.lastChild;
}
}
}
// Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( (elem = nodes[ i++ ]) ) {
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( (elem = tmp[ j++ ]) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
},
cleanData: function( elems, /* internal */ acceptData ) {
var elem, type, id, data,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( typeof elem.removeAttribute !== core_strundefined ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
core_deletedIds.push( id );
}
}
}
}
}
});
var iframe, getStyles, curCSS,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity\s*=\s*([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rmargin = /^margin/,
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
elemdisplay = { BODY: "block" },
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: 0,
fontWeight: 400
},
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
}
function isHidden( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
if ( !values[ index ] ) {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
}
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
jQuery.fn.extend({
css: function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
var len, styles,
map = {},
i = 0;
if ( jQuery.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
for ( ; i < len; i++ ) {
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
}
return map;
}
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
},
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
var bool = typeof state === "boolean";
return this.each(function() {
if ( bool ? state : isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
});
}
});
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"columnCount": true,
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra, styles ) {
var num, val, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
//convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
}
return val;
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
// NOTE: we've included the "window" in window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
return window.getComputedStyle( elem, null );
};
curCSS = function( elem, name, _computed ) {
var width, minWidth, maxWidth,
computed = _computed || getStyles( elem ),
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
style = elem.style;
if ( computed ) {
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret;
};
} else if ( document.documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, _computed ) {
var left, rs, rsLeft,
computed = _computed || getStyles( elem ),
ret = computed ? computed[ name ] : undefined,
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
rs.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe ||
jQuery("<iframe frameborder='0' width='0' height='0'/>")
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
doc.write("<!doctype html><html><body>");
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
}
// Called ONLY from within css_defaultDisplay
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[0], "display" );
elem.remove();
return display;
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
}) :
getWidthOrHeight( elem, name, extra );
}
},
set: function( elem, value, extra ) {
var styles = extra && getStyles( elem );
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
// if value === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there is no filter style applied in a css rule or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
jQuery(function() {
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
if ( computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" },
curCSS, [ elem, "marginRight" ] );
}
}
};
}
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = {
get: function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
computed;
}
}
};
});
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
(!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i = 0,
expanded = {},
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
jQuery.fn.extend({
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
})
.filter(function(){
var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !manipulation_rcheckableType.test( type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
});
jQuery.fn.hover = function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
};
var
// Document location
ajaxLocParts,
ajaxLocation,
ajax_nonce = jQuery.now(),
ajax_rquery = /\?/,
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType[0] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var deep, key,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, response, type,
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
}).complete( callback && function( jqXHR, status ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
});
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
jQuery.fn[ type ] = function( fn ){
return this.on( type, fn );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: ajaxLocation,
type: "GET",
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param
cacheURL,
// Response headers as string
responseHeadersString,
// timeout handle
timeoutTimer,
// To know if global events are to be dispatched
fireGlobals,
transport,
// Response headers
responseHeaders,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while ( (match = rheaders.exec( responseHeadersString )) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
var lname = name.toLowerCase();
if ( !state ) {
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR ).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
// A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( state === 2 ) {
return jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger("ajaxStart");
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
cacheURL = s.url;
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if ( s.cache === false ) {
s.url = rts.test( cacheURL ) ?
// If there is already a '_' parameter, set its value
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
// Otherwise add one to the end
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
}
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout(function() {
jqXHR.abort("timeout");
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch ( e ) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 ) {
isSuccess = true;
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
isSuccess = true;
statusText = "notmodified";
// If we have data, let's convert it
} else {
isSuccess = ajaxConvert( s, response );
statusText = isSuccess.state;
success = isSuccess.data;
error = isSuccess.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger("ajaxStop");
}
}
}
return jqXHR;
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
var conv2, current, conv, tmp,
converters = {},
i = 0,
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice(),
prev = dataTypes[ 0 ];
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
// Convert to each sequential dataType, tolerating list modification
for ( ; (current = dataTypes[++i]); ) {
// There's only work to do if current dataType is non-auto
if ( current !== "*" ) {
// Convert response if prev dataType is non-auto and differs from current
if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split(" ");
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.splice( i--, 0, current );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s["throws"] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
// Update prev for next iteration
prev = current;
}
}
return { state: "success", data: response };
}
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || jQuery("head")[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement("script");
script.async = true;
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( undefined, true );
}
}
};
}
});
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function() {
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
var xhrCallbacks, xhrSupported,
xhrId = 0,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject && function() {
// Abort all pending requests
var key;
for ( key in xhrCallbacks ) {
xhrCallbacks[ key ]( undefined, true );
}
};
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
xhrSupported = jQuery.ajaxSettings.xhr();
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = jQuery.support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var handle, i,
xhr = s.xhr();
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers["X-Requested-With"] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( err ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status, responseHeaders, statusText, responses;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
responses = {};
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
if ( typeof xhr.responseText === "string" ) {
responses.text = xhr.responseText;
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
if ( !s.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( callback );
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback( undefined, true );
}
}
};
}
});
}
var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
"*": [function( prop, value ) {
var end, unit,
tween = this.createTween( prop, value ),
parts = rfxnum.exec( value ),
target = tween.cur(),
start = +target || 0,
scale = 1,
maxIterations = 20;
if ( parts ) {
end = +parts[2];
unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" && start ) {
// Iteratively approximate from a nonzero starting point
// Prefer the current property, because this process will be trivial if it uses the same units
// Fallback to end or a simple constant
start = jQuery.css( tween.elem, prop, true ) || end || 1;
do {
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
start = start / scale;
jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
}
tween.unit = unit;
tween.start = start;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
}
function createTweens( animation, props ) {
jQuery.each( props, function( prop, value ) {
var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( collection[ index ].call( animation, prop, value ) ) {
// we're done with this property
return;
}
}
});
}
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
createTweens( animation, props );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
function propFilter( props, specialEasing ) {
var value, name, index, easing, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
jQuery.Animation = jQuery.extend( Animation, {
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
tweeners[ prop ] = tweeners[ prop ] || [];
tweeners[ prop ].unshift( callback );
}
},
prefilter: function( callback, prepend ) {
if ( prepend ) {
animationPrefilters.unshift( callback );
} else {
animationPrefilters.push( callback );
}
}
});
function defaultPrefilter( elem, props, opts ) {
/*jshint validthis:true */
var prop, index, length,
value, dataShow, toggle,
tween, hooks, oldfire,
anim = this,
style = elem.style,
orig = {},
handled = [],
hidden = elem.nodeType && isHidden( elem );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
}
// show/hide pass
for ( index in props ) {
value = props[ index ];
if ( rfxtypes.exec( value ) ) {
delete props[ index ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
handled.push( index );
}
}
length = handled.length;
if ( length ) {
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( index = 0 ; index < length ; index++ ) {
prop = handled[ index ];
tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
}
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || "swing";
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
if ( tween.elem[ tween.prop ] != null &&
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
return tween.elem[ tween.prop ];
}
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Remove in 2.0 - this supports IE8's panic based approach
// to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
});
jQuery.fn.extend({
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate({ opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
doAnimation.finish = function() {
anim.stop( true );
};
// Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each(function() {
var index,
data = jQuery._data( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// enable finishing flag on private data
data.finish = true;
// empty the queue first
jQuery.queue( this, type, [] );
if ( hooks && hooks.cur && hooks.cur.finish ) {
hooks.cur.finish.call( this );
}
// look for any active animations, and finish them
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true );
timers.splice( index, 1 );
}
}
// look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this );
}
}
// turn off finishing flag
delete data.finish;
});
}
});
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p*Math.PI ) / 2;
}
};
jQuery.timers = [];
jQuery.fx = Tween.prototype.init;
jQuery.fx.tick = function() {
var timer,
timers = jQuery.timers,
i = 0;
fxNow = jQuery.now();
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
if ( timer() && jQuery.timers.push( timer ) ) {
jQuery.fx.start();
}
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.stop = function() {
clearInterval( timerId );
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Back Compat <1.8 extension point
jQuery.fx.step = {};
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, win,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
};
};
jQuery.offset = {
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[ 0 ] ) {
return;
}
var offsetParent, offset,
parentOffset = { top: 0, left: 0 },
elem = this[ 0 ];
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.documentElement;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || document.documentElement;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
});
});
// Limit scope pollution from any deprecated API
// (function() {
// })();
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window );
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* The system module encapsulates the most basic features used by other modules.
* @module system
* @requires require
* @requires jquery
*/
define('durandal/system',['require', 'jquery'], function(require, $) {
var isDebugging = false,
nativeKeys = Object.keys,
hasOwnProperty = Object.prototype.hasOwnProperty,
toString = Object.prototype.toString,
system,
treatAsIE8 = false,
nativeIsArray = Array.isArray,
slice = Array.prototype.slice;
//see http://patik.com/blog/complete-cross-browser-console-log/
// Tell IE9 to use its built-in console
if (Function.prototype.bind && (typeof console === 'object' || typeof console === 'function') && typeof console.log == 'object') {
try {
['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd']
.forEach(function(method) {
console[method] = this.call(console[method], console);
}, Function.prototype.bind);
} catch (ex) {
treatAsIE8 = true;
}
}
// callback for dojo's loader
// note: if you wish to use Durandal with dojo's AMD loader,
// currently you must fork the dojo source with the following
// dojo/dojo.js, line 1187, the last line of the finishExec() function:
// (add) signal("moduleLoaded", [module.result, module.mid]);
// an enhancement request has been submitted to dojo to make this
// a permanent change. To view the status of this request, visit:
// http://bugs.dojotoolkit.org/ticket/16727
if (require.on) {
require.on("moduleLoaded", function(module, mid) {
system.setModuleId(module, mid);
});
}
// callback for require.js loader
if (typeof requirejs !== 'undefined') {
requirejs.onResourceLoad = function(context, map, depArray) {
system.setModuleId(context.defined[map.id], map.id);
};
}
var noop = function() { };
var log = function() {
try {
// Modern browsers
if (typeof console != 'undefined' && typeof console.log == 'function') {
// Opera 11
if (window.opera) {
var i = 0;
while (i < arguments.length) {
console.log('Item ' + (i + 1) + ': ' + arguments[i]);
i++;
}
}
// All other modern browsers
else if ((slice.call(arguments)).length == 1 && typeof slice.call(arguments)[0] == 'string') {
console.log((slice.call(arguments)).toString());
} else {
console.log.apply(console, slice.call(arguments));
}
}
// IE8
else if ((!Function.prototype.bind || treatAsIE8) && typeof console != 'undefined' && typeof console.log == 'object') {
Function.prototype.call.call(console.log, console, slice.call(arguments));
}
// IE7 and lower, and other old browsers
} catch (ignore) { }
};
var logError = function(error) {
if(error instanceof Error){
throw error;
}
throw new Error(error);
};
/**
* @class SystemModule
* @static
*/
system = {
/**
* Durandal's version.
* @property {string} version
*/
version: "2.0.1",
/**
* A noop function.
* @method noop
*/
noop: noop,
/**
* Gets the module id for the specified object.
* @method getModuleId
* @param {object} obj The object whose module id you wish to determine.
* @return {string} The module id.
*/
getModuleId: function(obj) {
if (!obj) {
return null;
}
if (typeof obj == 'function') {
return obj.prototype.__moduleId__;
}
if (typeof obj == 'string') {
return null;
}
return obj.__moduleId__;
},
/**
* Sets the module id for the specified object.
* @method setModuleId
* @param {object} obj The object whose module id you wish to set.
* @param {string} id The id to set for the specified object.
*/
setModuleId: function(obj, id) {
if (!obj) {
return;
}
if (typeof obj == 'function') {
obj.prototype.__moduleId__ = id;
return;
}
if (typeof obj == 'string') {
return;
}
obj.__moduleId__ = id;
},
/**
* Resolves the default object instance for a module. If the module is an object, the module is returned. If the module is a function, that function is called with `new` and it's result is returned.
* @method resolveObject
* @param {object} module The module to use to get/create the default object for.
* @return {object} The default object for the module.
*/
resolveObject: function(module) {
if (system.isFunction(module)) {
return new module();
} else {
return module;
}
},
/**
* Gets/Sets whether or not Durandal is in debug mode.
* @method debug
* @param {boolean} [enable] Turns on/off debugging.
* @return {boolean} Whether or not Durandal is current debugging.
*/
debug: function(enable) {
if (arguments.length == 1) {
isDebugging = enable;
if (isDebugging) {
this.log = log;
this.error = logError;
this.log('Debug:Enabled');
} else {
this.log('Debug:Disabled');
this.log = noop;
this.error = noop;
}
}
return isDebugging;
},
/**
* Logs data to the console. Pass any number of parameters to be logged. Log output is not processed if the framework is not running in debug mode.
* @method log
* @param {object} info* The objects to log.
*/
log: noop,
/**
* Logs an error.
* @method error
* @param {string|Error} obj The error to report.
*/
error: noop,
/**
* Asserts a condition by throwing an error if the condition fails.
* @method assert
* @param {boolean} condition The condition to check.
* @param {string} message The message to report in the error if the condition check fails.
*/
assert: function (condition, message) {
if (!condition) {
system.error(new Error(message || 'Assert:Failed'));
}
},
/**
* Creates a deferred object which can be used to create a promise. Optionally pass a function action to perform which will be passed an object used in resolving the promise.
* @method defer
* @param {function} [action] The action to defer. You will be passed the deferred object as a paramter.
* @return {Deferred} The deferred object.
*/
defer: function(action) {
return $.Deferred(action);
},
/**
* Creates a simple V4 UUID. This should not be used as a PK in your database. It can be used to generate internal, unique ids. For a more robust solution see [node-uuid](https://github.com/broofa/node-uuid).
* @method guid
* @return {string} The guid.
*/
guid: function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
},
/**
* Uses require.js to obtain a module. This function returns a promise which resolves with the module instance. You can pass more than one module id to this function or an array of ids. If more than one or an array is passed, then the promise will resolve with an array of module instances.
* @method acquire
* @param {string|string[]} moduleId The id(s) of the modules to load.
* @return {Promise} A promise for the loaded module(s).
*/
acquire: function() {
var modules,
first = arguments[0],
arrayRequest = false;
if(system.isArray(first)){
modules = first;
arrayRequest = true;
}else{
modules = slice.call(arguments, 0);
}
return this.defer(function(dfd) {
require(modules, function() {
var args = arguments;
setTimeout(function() {
if(args.length > 1 || arrayRequest){
dfd.resolve(slice.call(args, 0));
}else{
dfd.resolve(args[0]);
}
}, 1);
}, function(err){
dfd.reject(err);
});
}).promise();
},
/**
* Extends the first object with the properties of the following objects.
* @method extend
* @param {object} obj The target object to extend.
* @param {object} extension* Uses to extend the target object.
*/
extend: function(obj) {
var rest = slice.call(arguments, 1);
for (var i = 0; i < rest.length; i++) {
var source = rest[i];
if (source) {
for (var prop in source) {
obj[prop] = source[prop];
}
}
}
return obj;
},
/**
* Uses a setTimeout to wait the specified milliseconds.
* @method wait
* @param {number} milliseconds The number of milliseconds to wait.
* @return {Promise}
*/
wait: function(milliseconds) {
return system.defer(function(dfd) {
setTimeout(dfd.resolve, milliseconds);
}).promise();
}
};
/**
* Gets all the owned keys of the specified object.
* @method keys
* @param {object} object The object whose owned keys should be returned.
* @return {string[]} The keys.
*/
system.keys = nativeKeys || function(obj) {
if (obj !== Object(obj)) {
throw new TypeError('Invalid object');
}
var keys = [];
for (var key in obj) {
if (hasOwnProperty.call(obj, key)) {
keys[keys.length] = key;
}
}
return keys;
};
/**
* Determines if the specified object is an html element.
* @method isElement
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
system.isElement = function(obj) {
return !!(obj && obj.nodeType === 1);
};
/**
* Determines if the specified object is an array.
* @method isArray
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
system.isArray = nativeIsArray || function(obj) {
return toString.call(obj) == '[object Array]';
};
/**
* Determines if the specified object is...an object. ie. Not an array, string, etc.
* @method isObject
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
system.isObject = function(obj) {
return obj === Object(obj);
};
/**
* Determines if the specified object is a boolean.
* @method isBoolean
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
system.isBoolean = function(obj) {
return typeof(obj) === "boolean";
};
/**
* Determines if the specified object is a promise.
* @method isPromise
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
system.isPromise = function(obj) {
return obj && system.isFunction(obj.then);
};
/**
* Determines if the specified object is a function arguments object.
* @method isArguments
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
/**
* Determines if the specified object is a function.
* @method isFunction
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
/**
* Determines if the specified object is a string.
* @method isString
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
/**
* Determines if the specified object is a number.
* @method isNumber
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
/**
* Determines if the specified object is a date.
* @method isDate
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
/**
* Determines if the specified object is a boolean.
* @method isBoolean
* @param {object} object The object to check.
* @return {boolean} True if matches the type, false otherwise.
*/
//isArguments, isFunction, isString, isNumber, isDate, isRegExp.
var isChecks = ['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'];
function makeIsFunction(name) {
var value = '[object ' + name + ']';
system['is' + name] = function(obj) {
return toString.call(obj) == value;
};
}
for (var i = 0; i < isChecks.length; i++) {
makeIsFunction(isChecks[i]);
}
return system;
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* The viewEngine module provides information to the viewLocator module which is used to locate the view's source file. The viewEngine also transforms a view id into a view instance.
* @module viewEngine
* @requires system
* @requires jquery
*/
define('durandal/viewEngine',['durandal/system', 'jquery'], function (system, $) {
var parseMarkup;
if ($.parseHTML) {
parseMarkup = function (html) {
return $.parseHTML(html);
};
} else {
parseMarkup = function (html) {
return $(html).get();
};
}
/**
* @class ViewEngineModule
* @static
*/
return {
/**
* The file extension that view source files are expected to have.
* @property {string} viewExtension
* @default .html
*/
viewExtension: '.html',
/**
* The name of the RequireJS loader plugin used by the viewLocator to obtain the view source. (Use requirejs to map the plugin's full path).
* @property {string} viewPlugin
* @default text
*/
viewPlugin: 'text',
/**
* Determines if the url is a url for a view, according to the view engine.
* @method isViewUrl
* @param {string} url The potential view url.
* @return {boolean} True if the url is a view url, false otherwise.
*/
isViewUrl: function (url) {
return url.indexOf(this.viewExtension, url.length - this.viewExtension.length) !== -1;
},
/**
* Converts a view url into a view id.
* @method convertViewUrlToViewId
* @param {string} url The url to convert.
* @return {string} The view id.
*/
convertViewUrlToViewId: function (url) {
return url.substring(0, url.length - this.viewExtension.length);
},
/**
* Converts a view id into a full RequireJS path.
* @method convertViewIdToRequirePath
* @param {string} viewId The view id to convert.
* @return {string} The require path.
*/
convertViewIdToRequirePath: function (viewId) {
return this.viewPlugin + '!' + viewId + this.viewExtension;
},
/**
* Parses the view engine recognized markup and returns DOM elements.
* @method parseMarkup
* @param {string} markup The markup to parse.
* @return {DOMElement[]} The elements.
*/
parseMarkup: parseMarkup,
/**
* Calls `parseMarkup` and then pipes the results through `ensureSingleElement`.
* @method processMarkup
* @param {string} markup The markup to process.
* @return {DOMElement} The view.
*/
processMarkup: function (markup) {
var allElements = this.parseMarkup(markup);
return this.ensureSingleElement(allElements);
},
/**
* Converts an array of elements into a single element. White space and comments are removed. If a single element does not remain, then the elements are wrapped.
* @method ensureSingleElement
* @param {DOMElement[]} allElements The elements.
* @return {DOMElement} A single element.
*/
ensureSingleElement:function(allElements){
if (allElements.length == 1) {
return allElements[0];
}
var withoutCommentsOrEmptyText = [];
for (var i = 0; i < allElements.length; i++) {
var current = allElements[i];
if (current.nodeType != 8) {
if (current.nodeType == 3) {
var result = /\S/.test(current.nodeValue);
if (!result) {
continue;
}
}
withoutCommentsOrEmptyText.push(current);
}
}
if (withoutCommentsOrEmptyText.length > 1) {
return $(withoutCommentsOrEmptyText).wrapAll('<div class="durandal-wrapper"></div>').parent().get(0);
}
return withoutCommentsOrEmptyText[0];
},
/**
* Creates the view associated with the view id.
* @method createView
* @param {string} viewId The view id whose view should be created.
* @return {Promise} A promise of the view.
*/
createView: function(viewId) {
var that = this;
var requirePath = this.convertViewIdToRequirePath(viewId);
return system.defer(function(dfd) {
system.acquire(requirePath).then(function(markup) {
var element = that.processMarkup(markup);
element.setAttribute('data-view', viewId);
dfd.resolve(element);
}).fail(function(err){
that.createFallbackView(viewId, requirePath, err).then(function(element){
element.setAttribute('data-view', viewId);
dfd.resolve(element);
});
});
}).promise();
},
/**
* Called when a view cannot be found to provide the opportunity to locate or generate a fallback view. Mainly used to ease development.
* @method createFallbackView
* @param {string} viewId The view id whose view should be created.
* @param {string} requirePath The require path that was attempted.
* @param {Error} requirePath The error that was returned from the attempt to locate the default view.
* @return {Promise} A promise for the fallback view.
*/
createFallbackView: function (viewId, requirePath, err) {
var that = this,
message = 'View Not Found. Searched for "' + viewId + '" via path "' + requirePath + '".';
return system.defer(function(dfd) {
dfd.resolve(that.processMarkup('<div class="durandal-view-404">' + message + '</div>'));
}).promise();
}
};
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* The viewLocator module collaborates with the viewEngine module to provide views (literally dom sub-trees) to other parts of the framework as needed. The primary consumer of the viewLocator is the composition module.
* @module viewLocator
* @requires system
* @requires viewEngine
*/
define('durandal/viewLocator',['durandal/system', 'durandal/viewEngine'], function (system, viewEngine) {
function findInElements(nodes, url) {
for (var i = 0; i < nodes.length; i++) {
var current = nodes[i];
var existingUrl = current.getAttribute('data-view');
if (existingUrl == url) {
return current;
}
}
}
function escape(str) {
return (str + '').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
}
/**
* @class ViewLocatorModule
* @static
*/
return {
/**
* Allows you to set up a convention for mapping module folders to view folders. It is a convenience method that customizes `convertModuleIdToViewId` and `translateViewIdToArea` under the covers.
* @method useConvention
* @param {string} [modulesPath] A string to match in the path and replace with the viewsPath. If not specified, the match is 'viewmodels'.
* @param {string} [viewsPath] The replacement for the modulesPath. If not specified, the replacement is 'views'.
* @param {string} [areasPath] Partial views are mapped to the "views" folder if not specified. Use this parameter to change their location.
*/
useConvention: function(modulesPath, viewsPath, areasPath) {
modulesPath = modulesPath || 'viewmodels';
viewsPath = viewsPath || 'views';
areasPath = areasPath || viewsPath;
var reg = new RegExp(escape(modulesPath), 'gi');
this.convertModuleIdToViewId = function (moduleId) {
return moduleId.replace(reg, viewsPath);
};
this.translateViewIdToArea = function (viewId, area) {
if (!area || area == 'partial') {
return areasPath + '/' + viewId;
}
return areasPath + '/' + area + '/' + viewId;
};
},
/**
* Maps an object instance to a view instance.
* @method locateViewForObject
* @param {object} obj The object to locate the view for.
* @param {string} [area] The area to translate the view to.
* @param {DOMElement[]} [elementsToSearch] An existing set of elements to search first.
* @return {Promise} A promise of the view.
*/
locateViewForObject: function(obj, area, elementsToSearch) {
var view;
if (obj.getView) {
view = obj.getView();
if (view) {
return this.locateView(view, area, elementsToSearch);
}
}
if (obj.viewUrl) {
return this.locateView(obj.viewUrl, area, elementsToSearch);
}
var id = system.getModuleId(obj);
if (id) {
return this.locateView(this.convertModuleIdToViewId(id), area, elementsToSearch);
}
return this.locateView(this.determineFallbackViewId(obj), area, elementsToSearch);
},
/**
* Converts a module id into a view id. By default the ids are the same.
* @method convertModuleIdToViewId
* @param {string} moduleId The module id.
* @return {string} The view id.
*/
convertModuleIdToViewId: function(moduleId) {
return moduleId;
},
/**
* If no view id can be determined, this function is called to genreate one. By default it attempts to determine the object's type and use that.
* @method determineFallbackViewId
* @param {object} obj The object to determine the fallback id for.
* @return {string} The view id.
*/
determineFallbackViewId: function (obj) {
var funcNameRegex = /function (.{1,})\(/;
var results = (funcNameRegex).exec((obj).constructor.toString());
var typeName = (results && results.length > 1) ? results[1] : "";
return 'views/' + typeName;
},
/**
* Takes a view id and translates it into a particular area. By default, no translation occurs.
* @method translateViewIdToArea
* @param {string} viewId The view id.
* @param {string} area The area to translate the view to.
* @return {string} The translated view id.
*/
translateViewIdToArea: function (viewId, area) {
return viewId;
},
/**
* Locates the specified view.
* @method locateView
* @param {string|DOMElement} viewOrUrlOrId A view, view url or view id to locate.
* @param {string} [area] The area to translate the view to.
* @param {DOMElement[]} [elementsToSearch] An existing set of elements to search first.
* @return {Promise} A promise of the view.
*/
locateView: function(viewOrUrlOrId, area, elementsToSearch) {
if (typeof viewOrUrlOrId === 'string') {
var viewId;
if (viewEngine.isViewUrl(viewOrUrlOrId)) {
viewId = viewEngine.convertViewUrlToViewId(viewOrUrlOrId);
} else {
viewId = viewOrUrlOrId;
}
if (area) {
viewId = this.translateViewIdToArea(viewId, area);
}
if (elementsToSearch) {
var existing = findInElements(elementsToSearch, viewId);
if (existing) {
return system.defer(function(dfd) {
dfd.resolve(existing);
}).promise();
}
}
return viewEngine.createView(viewId);
}
return system.defer(function(dfd) {
dfd.resolve(viewOrUrlOrId);
}).promise();
}
};
});
// Knockout JavaScript library v2.3.0
// (c) Steven Sanderson - http://knockoutjs.com/
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
(function() {function F(q){return function(){return q}};(function(q){var w=this||(0,eval)("this"),s=w.document,H=w.navigator,t=w.jQuery,y=w.JSON;(function(q){"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?q(module.exports||exports):"function"===typeof define&&define.amd?define('knockout',["exports"],q):q(w.ko={})})(function(C){function G(b,c,d,f){a.d[b]={init:function(b){a.a.f.set(b,I,{});return{controlsDescendantBindings:!0}},update:function(b,e,m,h,k){m=a.a.f.get(b,I);e=a.a.c(e());h=!d!==!e;var l=!m.fb;if(l||c||h!==m.vb)l&&(m.fb=
a.a.Oa(a.e.childNodes(b),!0)),h?(l||a.e.P(b,a.a.Oa(m.fb)),a.Ja(f?f(k,e):k,b)):a.e.ba(b),m.vb=h}};a.g.S[b]=!1;a.e.L[b]=!0}function J(b,c,d){d&&c!==a.h.n(b)&&a.h.W(b,c);c!==a.h.n(b)&&a.q.I(a.a.Ga,null,[b,"change"])}var a="undefined"!==typeof C?C:{};a.b=function(b,c){for(var d=b.split("."),f=a,g=0;g<d.length-1;g++)f=f[d[g]];f[d[d.length-1]]=c};a.r=function(a,c,d){a[c]=d};a.version="2.3.0";a.b("version",a.version);a.a=function(){function b(a,b){for(var e in a)a.hasOwnProperty(e)&&b(e,a[e])}function c(b,
e){if("input"!==a.a.u(b)||!b.type||"click"!=e.toLowerCase())return!1;var k=b.type;return"checkbox"==k||"radio"==k}var d={},f={};d[H&&/Firefox\/2/i.test(H.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];d.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");b(d,function(a,b){if(b.length)for(var e=0,c=b.length;e<c;e++)f[b[e]]=a});var g={propertychange:!0},e=s&&function(){for(var a=3,b=s.createElement("div"),e=b.getElementsByTagName("i");b.innerHTML=
"\x3c!--[if gt IE "+ ++a+"]><i></i><![endif]--\x3e",e[0];);return 4<a?a:q}();return{Ta:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],p:function(a,b){for(var e=0,c=a.length;e<c;e++)b(a[e])},k:function(a,b){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var e=0,c=a.length;e<c;e++)if(a[e]===b)return e;return-1},La:function(a,b,e){for(var c=0,d=a.length;c<d;c++)if(b.call(e,a[c]))return a[c];return null},ka:function(b,e){var c=a.a.k(b,e);0<=c&&
b.splice(c,1)},Ma:function(b){b=b||[];for(var e=[],c=0,d=b.length;c<d;c++)0>a.a.k(e,b[c])&&e.push(b[c]);return e},Z:function(a,b){a=a||[];for(var e=[],c=0,d=a.length;c<d;c++)e.push(b(a[c]));return e},Y:function(a,b){a=a||[];for(var e=[],c=0,d=a.length;c<d;c++)b(a[c])&&e.push(a[c]);return e},R:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var e=0,c=b.length;e<c;e++)a.push(b[e]);return a},ja:function(b,e,c){var d=b.indexOf?b.indexOf(e):a.a.k(b,e);0>d?c&&b.push(e):c||b.splice(d,1)},
extend:function(a,b){if(b)for(var e in b)b.hasOwnProperty(e)&&(a[e]=b[e]);return a},w:b,oa:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},Mb:function(b){b=a.a.N(b);for(var e=s.createElement("div"),c=0,d=b.length;c<d;c++)e.appendChild(a.H(b[c]));return e},Oa:function(b,e){for(var c=0,d=b.length,g=[];c<d;c++){var f=b[c].cloneNode(!0);g.push(e?a.H(f):f)}return g},P:function(b,e){a.a.oa(b);if(e)for(var c=0,d=e.length;c<d;c++)b.appendChild(e[c])},eb:function(b,e){var c=b.nodeType?[b]:b;if(0<
c.length){for(var d=c[0],g=d.parentNode,f=0,r=e.length;f<r;f++)g.insertBefore(e[f],d);f=0;for(r=c.length;f<r;f++)a.removeNode(c[f])}},hb:function(a,b){7>e?a.setAttribute("selected",b):a.selected=b},F:function(a){return null===a||a===q?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Wb:function(b,e){for(var c=[],d=(b||"").split(e),g=0,f=d.length;g<f;g++){var r=a.a.F(d[g]);""!==r&&c.push(r)}return c},Tb:function(a,b){a=a||"";return b.length>a.length?!1:a.substring(0,b.length)===
b},yb:function(a,b){if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;null!=a;){if(a==b)return!0;a=a.parentNode}return!1},aa:function(b){return a.a.yb(b,b.ownerDocument)},pb:function(b){return!!a.a.La(b,a.a.aa)},u:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},o:function(b,d,k){var f=e&&g[d];if(f||"undefined"==typeof t)if(f||"function"!=typeof b.addEventListener)if("undefined"!=typeof b.attachEvent){var n=function(a){k.call(b,a)},p="on"+d;b.attachEvent(p,n);
a.a.C.ia(b,function(){b.detachEvent(p,n)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else b.addEventListener(d,k,!1);else{if(c(b,d)){var r=k;k=function(a,b){var e=this.checked;b&&(this.checked=!0!==b.sb);r.call(this,a);this.checked=e}}t(b).bind(d,k)}},Ga:function(a,b){if(!a||!a.nodeType)throw Error("element must be a DOM node when calling triggerEvent");if("undefined"!=typeof t){var e=[];c(a,b)&&e.push({sb:a.checked});t(a).trigger(b,e)}else if("function"==typeof s.createEvent)if("function"==
typeof a.dispatchEvent)e=s.createEvent(f[b]||"HTMLEvents"),e.initEvent(b,!0,!0,w,0,0,0,0,0,!1,!1,!1,!1,0,a),a.dispatchEvent(e);else throw Error("The supplied element doesn't support dispatchEvent");else if("undefined"!=typeof a.fireEvent)c(a,b)&&(a.checked=!0!==a.checked),a.fireEvent("on"+b);else throw Error("Browser doesn't support triggering events");},c:function(b){return a.T(b)?b():b},ya:function(b){return a.T(b)?b.t():b},ga:function(b,e,c){if(e){var d=/\S+/g,g=b.className.match(d)||[];a.a.p(e.match(d),
function(b){a.a.ja(g,b,c)});b.className=g.join(" ")}},ib:function(b,e){var c=a.a.c(e);if(null===c||c===q)c="";var d=a.e.firstChild(b);!d||3!=d.nodeType||a.e.nextSibling(d)?a.e.P(b,[s.createTextNode(c)]):d.data=c;a.a.Bb(b)},gb:function(a,b){a.name=b;if(7>=e)try{a.mergeAttributes(s.createElement("<input name='"+a.name+"'/>"),!1)}catch(c){}},Bb:function(a){9<=e&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},zb:function(a){if(e){var b=a.style.width;a.style.width=0;a.style.width=
b}},Qb:function(b,e){b=a.a.c(b);e=a.a.c(e);for(var c=[],d=b;d<=e;d++)c.push(d);return c},N:function(a){for(var b=[],e=0,c=a.length;e<c;e++)b.push(a[e]);return b},Ub:6===e,Vb:7===e,ca:e,Ua:function(b,e){for(var c=a.a.N(b.getElementsByTagName("input")).concat(a.a.N(b.getElementsByTagName("textarea"))),d="string"==typeof e?function(a){return a.name===e}:function(a){return e.test(a.name)},g=[],f=c.length-1;0<=f;f--)d(c[f])&&g.push(c[f]);return g},Nb:function(b){return"string"==typeof b&&(b=a.a.F(b))?
y&&y.parse?y.parse(b):(new Function("return "+b))():null},Ca:function(b,e,c){if(!y||!y.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return y.stringify(a.a.c(b),e,c)},Ob:function(e,c,d){d=d||{};var g=d.params||{},f=d.includeFields||this.Ta,p=e;if("object"==typeof e&&"form"===a.a.u(e))for(var p=e.action,r=f.length-1;0<=r;r--)for(var z=
a.a.Ua(e,f[r]),D=z.length-1;0<=D;D--)g[z[D].name]=z[D].value;c=a.a.c(c);var q=s.createElement("form");q.style.display="none";q.action=p;q.method="post";for(var v in c)e=s.createElement("input"),e.name=v,e.value=a.a.Ca(a.a.c(c[v])),q.appendChild(e);b(g,function(a,b){var e=s.createElement("input");e.name=a;e.value=b;q.appendChild(e)});s.body.appendChild(q);d.submitter?d.submitter(q):q.submit();setTimeout(function(){q.parentNode.removeChild(q)},0)}}}();a.b("utils",a.a);a.b("utils.arrayForEach",a.a.p);
a.b("utils.arrayFirst",a.a.La);a.b("utils.arrayFilter",a.a.Y);a.b("utils.arrayGetDistinctValues",a.a.Ma);a.b("utils.arrayIndexOf",a.a.k);a.b("utils.arrayMap",a.a.Z);a.b("utils.arrayPushAll",a.a.R);a.b("utils.arrayRemoveItem",a.a.ka);a.b("utils.extend",a.a.extend);a.b("utils.fieldsIncludedWithJsonPost",a.a.Ta);a.b("utils.getFormFields",a.a.Ua);a.b("utils.peekObservable",a.a.ya);a.b("utils.postJson",a.a.Ob);a.b("utils.parseJson",a.a.Nb);a.b("utils.registerEventHandler",a.a.o);a.b("utils.stringifyJson",
a.a.Ca);a.b("utils.range",a.a.Qb);a.b("utils.toggleDomNodeCssClass",a.a.ga);a.b("utils.triggerEvent",a.a.Ga);a.b("utils.unwrapObservable",a.a.c);a.b("utils.objectForEach",a.a.w);a.b("utils.addOrRemoveItem",a.a.ja);a.b("unwrap",a.a.c);Function.prototype.bind||(Function.prototype.bind=function(a){var c=this,d=Array.prototype.slice.call(arguments);a=d.shift();return function(){return c.apply(a,d.concat(Array.prototype.slice.call(arguments)))}});a.a.f=new function(){var b=0,c="__ko__"+(new Date).getTime(),
d={};return{get:function(b,c){var e=a.a.f.pa(b,!1);return e===q?q:e[c]},set:function(b,c,e){if(e!==q||a.a.f.pa(b,!1)!==q)a.a.f.pa(b,!0)[c]=e},pa:function(a,g){var e=a[c];if(!e||"null"===e||!d[e]){if(!g)return q;e=a[c]="ko"+b++;d[e]={}}return d[e]},clear:function(a){var b=a[c];return b?(delete d[b],a[c]=null,!0):!1}}};a.b("utils.domData",a.a.f);a.b("utils.domData.clear",a.a.f.clear);a.a.C=new function(){function b(b,c){var g=a.a.f.get(b,d);g===q&&c&&(g=[],a.a.f.set(b,d,g));return g}function c(e){var d=
b(e,!1);if(d)for(var d=d.slice(0),f=0;f<d.length;f++)d[f](e);a.a.f.clear(e);"function"==typeof t&&"function"==typeof t.cleanData&&t.cleanData([e]);if(g[e.nodeType])for(d=e.firstChild;e=d;)d=e.nextSibling,8===e.nodeType&&c(e)}var d="__ko_domNodeDisposal__"+(new Date).getTime(),f={1:!0,8:!0,9:!0},g={1:!0,9:!0};return{ia:function(a,c){if("function"!=typeof c)throw Error("Callback must be a function");b(a,!0).push(c)},cb:function(e,c){var g=b(e,!1);g&&(a.a.ka(g,c),0==g.length&&a.a.f.set(e,d,q))},H:function(b){if(f[b.nodeType]&&
(c(b),g[b.nodeType])){var d=[];a.a.R(d,b.getElementsByTagName("*"));for(var h=0,k=d.length;h<k;h++)c(d[h])}return b},removeNode:function(b){a.H(b);b.parentNode&&b.parentNode.removeChild(b)}}};a.H=a.a.C.H;a.removeNode=a.a.C.removeNode;a.b("cleanNode",a.H);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.C);a.b("utils.domNodeDisposal.addDisposeCallback",a.a.C.ia);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.C.cb);(function(){a.a.xa=function(b){var c;if("undefined"!=typeof t)if(t.parseHTML)c=
t.parseHTML(b)||[];else{if((c=t.clean([b]))&&c[0]){for(b=c[0];b.parentNode&&11!==b.parentNode.nodeType;)b=b.parentNode;b.parentNode&&b.parentNode.removeChild(b)}}else{var d=a.a.F(b).toLowerCase();c=s.createElement("div");d=d.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!d.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!d.indexOf("<td")||!d.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];b="ignored<div>"+d[1]+b+d[2]+"</div>";for("function"==typeof w.innerShiv?
c.appendChild(w.innerShiv(b)):c.innerHTML=b;d[0]--;)c=c.lastChild;c=a.a.N(c.lastChild.childNodes)}return c};a.a.fa=function(b,c){a.a.oa(b);c=a.a.c(c);if(null!==c&&c!==q)if("string"!=typeof c&&(c=c.toString()),"undefined"!=typeof t)t(b).html(c);else for(var d=a.a.xa(c),f=0;f<d.length;f++)b.appendChild(d[f])}})();a.b("utils.parseHtmlFragment",a.a.xa);a.b("utils.setHtml",a.a.fa);a.s=function(){function b(c,f){if(c)if(8==c.nodeType){var g=a.s.$a(c.nodeValue);null!=g&&f.push({xb:c,Kb:g})}else if(1==c.nodeType)for(var g=
0,e=c.childNodes,m=e.length;g<m;g++)b(e[g],f)}var c={};return{va:function(a){if("function"!=typeof a)throw Error("You can only pass a function to ko.memoization.memoize()");var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);c[b]=a;return"\x3c!--[ko_memo:"+b+"]--\x3e"},mb:function(a,b){var g=c[a];if(g===q)throw Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized.");try{return g.apply(null,b||[]),
!0}finally{delete c[a]}},nb:function(c,f){var g=[];b(c,g);for(var e=0,m=g.length;e<m;e++){var h=g[e].xb,k=[h];f&&a.a.R(k,f);a.s.mb(g[e].Kb,k);h.nodeValue="";h.parentNode&&h.parentNode.removeChild(h)}},$a:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:null}}}();a.b("memoization",a.s);a.b("memoization.memoize",a.s.va);a.b("memoization.unmemoize",a.s.mb);a.b("memoization.parseMemoText",a.s.$a);a.b("memoization.unmemoizeDomNodeAndDescendants",a.s.nb);a.Sa={throttle:function(b,c){b.throttleEvaluation=
c;var d=null;return a.j({read:b,write:function(a){clearTimeout(d);d=setTimeout(function(){b(a)},c)}})},notify:function(b,c){b.equalityComparer="always"==c?F(!1):a.m.fn.equalityComparer;return b}};a.b("extenders",a.Sa);a.kb=function(b,c,d){this.target=b;this.la=c;this.wb=d;a.r(this,"dispose",this.B)};a.kb.prototype.B=function(){this.Hb=!0;this.wb()};a.V=function(){this.G={};a.a.extend(this,a.V.fn);a.r(this,"subscribe",this.Da);a.r(this,"extend",this.extend);a.r(this,"getSubscriptionsCount",this.Db)};
a.V.fn={Da:function(b,c,d){d=d||"change";var f=new a.kb(this,c?b.bind(c):b,function(){a.a.ka(this.G[d],f)}.bind(this));this.G[d]||(this.G[d]=[]);this.G[d].push(f);return f},notifySubscribers:function(b,c){c=c||"change";this.G[c]&&a.q.I(function(){a.a.p(this.G[c].slice(0),function(a){a&&!0!==a.Hb&&a.la(b)})},this)},Db:function(){var b=0;a.a.w(this.G,function(a,d){b+=d.length});return b},extend:function(b){var c=this;b&&a.a.w(b,function(b,f){var g=a.Sa[b];"function"==typeof g&&(c=g(c,f))});return c}};
a.Wa=function(a){return null!=a&&"function"==typeof a.Da&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.V);a.b("isSubscribable",a.Wa);a.q=function(){var b=[];return{rb:function(a){b.push({la:a,Ra:[]})},end:function(){b.pop()},bb:function(c){if(!a.Wa(c))throw Error("Only subscribable things can act as dependencies");if(0<b.length){var d=b[b.length-1];!d||0<=a.a.k(d.Ra,c)||(d.Ra.push(c),d.la(c))}},I:function(a,d,f){try{return b.push(null),a.apply(d,f||[])}finally{b.pop()}}}}();var L=
{undefined:!0,"boolean":!0,number:!0,string:!0};a.m=function(b){function c(){if(0<arguments.length)return c.equalityComparer&&c.equalityComparer(d,arguments[0])||(c.K(),d=arguments[0],c.J()),this;a.q.bb(c);return d}var d=b;a.V.call(c);c.t=function(){return d};c.J=function(){c.notifySubscribers(d)};c.K=function(){c.notifySubscribers(d,"beforeChange")};a.a.extend(c,a.m.fn);a.r(c,"peek",c.t);a.r(c,"valueHasMutated",c.J);a.r(c,"valueWillMutate",c.K);return c};a.m.fn={equalityComparer:function(a,c){return null===
a||typeof a in L?a===c:!1}};var A=a.m.Pb="__ko_proto__";a.m.fn[A]=a.m;a.qa=function(b,c){return null===b||b===q||b[A]===q?!1:b[A]===c?!0:a.qa(b[A],c)};a.T=function(b){return a.qa(b,a.m)};a.Xa=function(b){return"function"==typeof b&&b[A]===a.m||"function"==typeof b&&b[A]===a.j&&b.Eb?!0:!1};a.b("observable",a.m);a.b("isObservable",a.T);a.b("isWriteableObservable",a.Xa);a.U=function(b){b=b||[];if("object"!=typeof b||!("length"in b))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
b=a.m(b);a.a.extend(b,a.U.fn);return b};a.U.fn={remove:function(a){for(var c=this.t(),d=[],f="function"==typeof a?a:function(e){return e===a},g=0;g<c.length;g++){var e=c[g];f(e)&&(0===d.length&&this.K(),d.push(e),c.splice(g,1),g--)}d.length&&this.J();return d},removeAll:function(b){if(b===q){var c=this.t(),d=c.slice(0);this.K();c.splice(0,c.length);this.J();return d}return b?this.remove(function(c){return 0<=a.a.k(b,c)}):[]},destroy:function(a){var c=this.t(),d="function"==typeof a?a:function(c){return c===
a};this.K();for(var f=c.length-1;0<=f;f--)d(c[f])&&(c[f]._destroy=!0);this.J()},destroyAll:function(b){return b===q?this.destroy(F(!0)):b?this.destroy(function(c){return 0<=a.a.k(b,c)}):[]},indexOf:function(b){var c=this();return a.a.k(c,b)},replace:function(a,c){var d=this.indexOf(a);0<=d&&(this.K(),this.t()[d]=c,this.J())}};a.a.p("pop push reverse shift sort splice unshift".split(" "),function(b){a.U.fn[b]=function(){var a=this.t();this.K();a=a[b].apply(a,arguments);this.J();return a}});a.a.p(["slice"],
function(b){a.U.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.b("observableArray",a.U);a.j=function(b,c,d){function f(){a.a.p(v,function(a){a.B()});v=[]}function g(){var a=m.throttleEvaluation;a&&0<=a?(clearTimeout(t),t=setTimeout(e,a)):e()}function e(){if(!n)if(l&&D())x();else{n=!0;try{var b=a.a.Z(v,function(a){return a.target});a.q.rb(function(e){var c;0<=(c=a.a.k(b,e))?b[c]=q:v.push(e.Da(g))});for(var e=p.call(c),d=b.length-1;0<=d;d--)b[d]&&v.splice(d,1)[0].B();l=!0;m.notifySubscribers(k,
"beforeChange");k=e;m.notifySubscribers(k)}finally{a.q.end(),n=!1}v.length||x()}}function m(){if(0<arguments.length){if("function"===typeof r)r.apply(c,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}l||e();a.q.bb(m);return k}function h(){return!l||0<v.length}var k,l=!1,n=!1,p=b;p&&"object"==typeof p?(d=p,p=d.read):(d=d||{},p||(p=d.read));if("function"!=typeof p)throw Error("Pass a function that returns the value of the ko.computed");
var r=d.write,z=d.disposeWhenNodeIsRemoved||d.$||null,D=d.disposeWhen||d.Qa||F(!1),x=f,v=[],t=null;c||(c=d.owner);m.t=function(){l||e();return k};m.Cb=function(){return v.length};m.Eb="function"===typeof d.write;m.B=function(){x()};m.ta=h;a.V.call(m);a.a.extend(m,a.j.fn);a.r(m,"peek",m.t);a.r(m,"dispose",m.B);a.r(m,"isActive",m.ta);a.r(m,"getDependenciesCount",m.Cb);!0!==d.deferEvaluation&&e();if(z&&h()){x=function(){a.a.C.cb(z,x);f()};a.a.C.ia(z,x);var s=D,D=function(){return!a.a.aa(z)||s()}}return m};
a.Gb=function(b){return a.qa(b,a.j)};C=a.m.Pb;a.j[C]=a.m;a.j.fn={};a.j.fn[C]=a.j;a.b("dependentObservable",a.j);a.b("computed",a.j);a.b("isComputed",a.Gb);(function(){function b(a,g,e){e=e||new d;a=g(a);if("object"!=typeof a||null===a||a===q||a instanceof Date||a instanceof String||a instanceof Number||a instanceof Boolean)return a;var m=a instanceof Array?[]:{};e.save(a,m);c(a,function(c){var d=g(a[c]);switch(typeof d){case "boolean":case "number":case "string":case "function":m[c]=d;break;case "object":case "undefined":var l=
e.get(d);m[c]=l!==q?l:b(d,g,e)}});return m}function c(a,b){if(a instanceof Array){for(var e=0;e<a.length;e++)b(e);"function"==typeof a.toJSON&&b("toJSON")}else for(e in a)b(e)}function d(){this.keys=[];this.Ha=[]}a.lb=function(c){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return b(c,function(b){for(var e=0;a.T(b)&&10>e;e++)b=b();return b})};a.toJSON=function(b,c,e){b=a.lb(b);return a.a.Ca(b,c,e)};d.prototype={save:function(b,c){var e=a.a.k(this.keys,
b);0<=e?this.Ha[e]=c:(this.keys.push(b),this.Ha.push(c))},get:function(b){b=a.a.k(this.keys,b);return 0<=b?this.Ha[b]:q}}})();a.b("toJS",a.lb);a.b("toJSON",a.toJSON);(function(){a.h={n:function(b){switch(a.a.u(b)){case "option":return!0===b.__ko__hasDomDataOptionValue__?a.a.f.get(b,a.d.options.wa):7>=a.a.ca?b.getAttributeNode("value")&&b.getAttributeNode("value").specified?b.value:b.text:b.value;case "select":return 0<=b.selectedIndex?a.h.n(b.options[b.selectedIndex]):q;default:return b.value}},W:function(b,
c){switch(a.a.u(b)){case "option":switch(typeof c){case "string":a.a.f.set(b,a.d.options.wa,q);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.f.set(b,a.d.options.wa,c),b.__ko__hasDomDataOptionValue__=!0,b.value="number"===typeof c?c:""}break;case "select":""===c&&(c=q);if(null===c||c===q)b.selectedIndex=-1;for(var d=b.options.length-1;0<=d;d--)if(a.h.n(b.options[d])==c){b.selectedIndex=d;break}1<b.size||-1!==b.selectedIndex||(b.selectedIndex=
0);break;default:if(null===c||c===q)c="";b.value=c}}}})();a.b("selectExtensions",a.h);a.b("selectExtensions.readValue",a.h.n);a.b("selectExtensions.writeValue",a.h.W);a.g=function(){function b(a,b){for(var d=null;a!=d;)d=a,a=a.replace(c,function(a,c){return b[c]});return a}var c=/\@ko_token_(\d+)\@/g,d=["true","false","null","undefined"],f=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i;return{S:[],da:function(c){var e=a.a.F(c);if(3>e.length)return[];"{"===e.charAt(0)&&(e=e.substring(1,e.length-
1));c=[];for(var d=null,f,k=0;k<e.length;k++){var l=e.charAt(k);if(null===d)switch(l){case '"':case "'":case "/":d=k,f=l}else if(l==f&&"\\"!==e.charAt(k-1)){l=e.substring(d,k+1);c.push(l);var n="@ko_token_"+(c.length-1)+"@",e=e.substring(0,d)+n+e.substring(k+1),k=k-(l.length-n.length),d=null}}f=d=null;for(var p=0,r=null,k=0;k<e.length;k++){l=e.charAt(k);if(null===d)switch(l){case "{":d=k;r=l;f="}";break;case "(":d=k;r=l;f=")";break;case "[":d=k,r=l,f="]"}l===r?p++:l===f&&(p--,0===p&&(l=e.substring(d,
k+1),c.push(l),n="@ko_token_"+(c.length-1)+"@",e=e.substring(0,d)+n+e.substring(k+1),k-=l.length-n.length,d=null))}f=[];e=e.split(",");d=0;for(k=e.length;d<k;d++)p=e[d],r=p.indexOf(":"),0<r&&r<p.length-1?(l=p.substring(r+1),f.push({key:b(p.substring(0,r),c),value:b(l,c)})):f.push({unknown:b(p,c)});return f},ea:function(b){var e="string"===typeof b?a.g.da(b):b,c=[];b=[];for(var h,k=0;h=e[k];k++)if(0<c.length&&c.push(","),h.key){var l;a:{l=h.key;var n=a.a.F(l);switch(n.length&&n.charAt(0)){case "'":case '"':break a;
default:l="'"+n+"'"}}h=h.value;c.push(l);c.push(":");c.push(h);h=a.a.F(h);0<=a.a.k(d,a.a.F(h).toLowerCase())?h=!1:(n=h.match(f),h=null===n?!1:n[1]?"Object("+n[1]+")"+n[2]:h);h&&(0<b.length&&b.push(", "),b.push(l+" : function(__ko_value) { "+h+" = __ko_value; }"))}else h.unknown&&c.push(h.unknown);e=c.join("");0<b.length&&(e=e+", '_ko_property_writers' : { "+b.join("")+" } ");return e},Jb:function(b,c){for(var d=0;d<b.length;d++)if(a.a.F(b[d].key)==c)return!0;return!1},ha:function(b,c,d,f,k){if(b&&
a.T(b))!a.Xa(b)||k&&b.t()===f||b(f);else if((b=c()._ko_property_writers)&&b[d])b[d](f)}}}();a.b("expressionRewriting",a.g);a.b("expressionRewriting.bindingRewriteValidators",a.g.S);a.b("expressionRewriting.parseObjectLiteral",a.g.da);a.b("expressionRewriting.preProcessBindings",a.g.ea);a.b("jsonExpressionRewriting",a.g);a.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",a.g.ea);(function(){function b(a){return 8==a.nodeType&&(g?a.text:a.nodeValue).match(e)}function c(a){return 8==a.nodeType&&
(g?a.text:a.nodeValue).match(m)}function d(a,e){for(var d=a,g=1,f=[];d=d.nextSibling;){if(c(d)&&(g--,0===g))return f;f.push(d);b(d)&&g++}if(!e)throw Error("Cannot find closing comment tag to match: "+a.nodeValue);return null}function f(a,b){var c=d(a,b);return c?0<c.length?c[c.length-1].nextSibling:a.nextSibling:null}var g=s&&"\x3c!--test--\x3e"===s.createComment("test").text,e=g?/^\x3c!--\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*--\x3e$/:/^\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*$/,m=g?/^\x3c!--\s*\/ko\s*--\x3e$/:
/^\s*\/ko\s*$/,h={ul:!0,ol:!0};a.e={L:{},childNodes:function(a){return b(a)?d(a):a.childNodes},ba:function(c){if(b(c)){c=a.e.childNodes(c);for(var e=0,d=c.length;e<d;e++)a.removeNode(c[e])}else a.a.oa(c)},P:function(c,e){if(b(c)){a.e.ba(c);for(var d=c.nextSibling,g=0,f=e.length;g<f;g++)d.parentNode.insertBefore(e[g],d)}else a.a.P(c,e)},ab:function(a,c){b(a)?a.parentNode.insertBefore(c,a.nextSibling):a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)},Va:function(c,e,d){d?b(c)?c.parentNode.insertBefore(e,
d.nextSibling):d.nextSibling?c.insertBefore(e,d.nextSibling):c.appendChild(e):a.e.ab(c,e)},firstChild:function(a){return b(a)?!a.nextSibling||c(a.nextSibling)?null:a.nextSibling:a.firstChild},nextSibling:function(a){b(a)&&(a=f(a));return a.nextSibling&&c(a.nextSibling)?null:a.nextSibling},ob:function(a){return(a=b(a))?a[1]:null},Za:function(e){if(h[a.a.u(e)]){var d=e.firstChild;if(d){do if(1===d.nodeType){var g;g=d.firstChild;var m=null;if(g){do if(m)m.push(g);else if(b(g)){var r=f(g,!0);r?g=r:m=
[g]}else c(g)&&(m=[g]);while(g=g.nextSibling)}if(g=m)for(m=d.nextSibling,r=0;r<g.length;r++)m?e.insertBefore(g[r],m):e.appendChild(g[r])}while(d=d.nextSibling)}}}}})();a.b("virtualElements",a.e);a.b("virtualElements.allowedBindings",a.e.L);a.b("virtualElements.emptyNode",a.e.ba);a.b("virtualElements.insertAfter",a.e.Va);a.b("virtualElements.prepend",a.e.ab);a.b("virtualElements.setDomNodeChildren",a.e.P);(function(){a.M=function(){this.Na={}};a.a.extend(a.M.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return null!=
b.getAttribute("data-bind");case 8:return null!=a.e.ob(b);default:return!1}},getBindings:function(a,c){var d=this.getBindingsString(a,c);return d?this.parseBindingsString(d,c,a):null},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind");case 8:return a.e.ob(b);default:return null}},parseBindingsString:function(b,c,d){try{var f;if(!(f=this.Na[b])){var g=this.Na,e,m="with($context){with($data||{}){return{"+a.g.ea(b)+"}}}";e=new Function("$context","$element",m);
f=g[b]=e}return f(c,d)}catch(h){throw h.message="Unable to parse bindings.\nBindings value: "+b+"\nMessage: "+h.message,h;}}});a.M.instance=new a.M})();a.b("bindingProvider",a.M);(function(){function b(b,e,d){for(var f=a.e.firstChild(e);e=f;)f=a.e.nextSibling(e),c(b,e,d)}function c(c,e,f){var h=!0,k=1===e.nodeType;k&&a.e.Za(e);if(k&&f||a.M.instance.nodeHasBindings(e))h=d(e,null,c,f).Sb;h&&b(c,e,!k)}function d(b,c,d,h){function k(a){return function(){return p[a]}}function l(){return p}var n=0,p,r,
z=a.a.f.get(b,f);if(!c){if(z)throw Error("You cannot apply bindings multiple times to the same element.");a.a.f.set(b,f,!0)}a.j(function(){var f=d&&d instanceof a.A?d:new a.A(a.a.c(d)),x=f.$data;!z&&h&&a.jb(b,f);if(p=("function"==typeof c?c(f,b):c)||a.M.instance.getBindings(b,f))0===n&&(n=1,a.a.w(p,function(c){var e=a.d[c];if(e&&8===b.nodeType&&!a.e.L[c])throw Error("The binding '"+c+"' cannot be used with virtual elements");if(e&&"function"==typeof e.init&&(e=(0,e.init)(b,k(c),l,x,f))&&e.controlsDescendantBindings){if(r!==
q)throw Error("Multiple bindings ("+r+" and "+c+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");r=c}}),n=2),2===n&&a.a.w(p,function(c){var e=a.d[c];e&&"function"==typeof e.update&&(0,e.update)(b,k(c),l,x,f)})},null,{$:b});return{Sb:r===q}}a.d={};a.A=function(b,c,d){c?(a.a.extend(this,c),this.$parentContext=c,this.$parent=c.$data,this.$parents=(c.$parents||[]).slice(0),this.$parents.unshift(this.$parent)):(this.$parents=
[],this.$root=b,this.ko=a);this.$data=b;d&&(this[d]=b)};a.A.prototype.createChildContext=function(b,c){return new a.A(b,this,c)};a.A.prototype.extend=function(b){var c=a.a.extend(new a.A,this);return a.a.extend(c,b)};var f="__ko_boundElement";a.jb=function(b,c){if(2==arguments.length)a.a.f.set(b,"__ko_bindingContext__",c);else return a.a.f.get(b,"__ko_bindingContext__")};a.Ka=function(b,c,f){1===b.nodeType&&a.e.Za(b);return d(b,c,f,!0)};a.Ja=function(a,c){1!==c.nodeType&&8!==c.nodeType||b(a,c,!0)};
a.Ia=function(a,b){if(b&&1!==b.nodeType&&8!==b.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");b=b||w.document.body;c(a,b,!0)};a.na=function(b){switch(b.nodeType){case 1:case 8:var c=a.jb(b);if(c)return c;if(b.parentNode)return a.na(b.parentNode)}return q};a.ub=function(b){return(b=a.na(b))?b.$data:q};a.b("bindingHandlers",a.d);a.b("applyBindings",a.Ia);a.b("applyBindingsToDescendants",a.Ja);a.b("applyBindingsToNode",a.Ka);
a.b("contextFor",a.na);a.b("dataFor",a.ub)})();var K={"class":"className","for":"htmlFor"};a.d.attr={update:function(b,c){var d=a.a.c(c())||{};a.a.w(d,function(c,d){d=a.a.c(d);var e=!1===d||null===d||d===q;e&&b.removeAttribute(c);8>=a.a.ca&&c in K?(c=K[c],e?b.removeAttribute(c):b[c]=d):e||b.setAttribute(c,d.toString());"name"===c&&a.a.gb(b,e?"":d.toString())})}};a.d.checked={init:function(b,c,d){a.a.o(b,"click",function(){var f;if("checkbox"==b.type)f=b.checked;else if("radio"==b.type&&b.checked)f=
b.value;else return;var g=c(),e=a.a.c(g);"checkbox"==b.type&&e instanceof Array?a.a.ja(g,b.value,b.checked):a.g.ha(g,d,"checked",f,!0)});"radio"!=b.type||b.name||a.d.uniqueName.init(b,F(!0))},update:function(b,c){var d=a.a.c(c());"checkbox"==b.type?b.checked=d instanceof Array?0<=a.a.k(d,b.value):d:"radio"==b.type&&(b.checked=b.value==d)}};a.d.css={update:function(b,c){var d=a.a.c(c());"object"==typeof d?a.a.w(d,function(c,d){d=a.a.c(d);a.a.ga(b,c,d)}):(d=String(d||""),a.a.ga(b,b.__ko__cssValue,!1),
b.__ko__cssValue=d,a.a.ga(b,d,!0))}};a.d.enable={update:function(b,c){var d=a.a.c(c());d&&b.disabled?b.removeAttribute("disabled"):d||b.disabled||(b.disabled=!0)}};a.d.disable={update:function(b,c){a.d.enable.update(b,function(){return!a.a.c(c())})}};a.d.event={init:function(b,c,d,f){var g=c()||{};a.a.w(g,function(e){"string"==typeof e&&a.a.o(b,e,function(b){var g,k=c()[e];if(k){var l=d();try{var n=a.a.N(arguments);n.unshift(f);g=k.apply(f,n)}finally{!0!==g&&(b.preventDefault?b.preventDefault():b.returnValue=
!1)}!1===l[e+"Bubble"]&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation())}})})}};a.d.foreach={Ya:function(b){return function(){var c=b(),d=a.a.ya(c);if(!d||"number"==typeof d.length)return{foreach:c,templateEngine:a.D.sa};a.a.c(c);return{foreach:d.data,as:d.as,includeDestroyed:d.includeDestroyed,afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.D.sa}}},init:function(b,c){return a.d.template.init(b,a.d.foreach.Ya(c))},
update:function(b,c,d,f,g){return a.d.template.update(b,a.d.foreach.Ya(c),d,f,g)}};a.g.S.foreach=!1;a.e.L.foreach=!0;a.d.hasfocus={init:function(b,c,d){function f(e){b.__ko_hasfocusUpdating=!0;var f=b.ownerDocument;if("activeElement"in f){var g;try{g=f.activeElement}catch(l){g=f.body}e=g===b}f=c();a.g.ha(f,d,"hasfocus",e,!0);b.__ko_hasfocusLastValue=e;b.__ko_hasfocusUpdating=!1}var g=f.bind(null,!0),e=f.bind(null,!1);a.a.o(b,"focus",g);a.a.o(b,"focusin",g);a.a.o(b,"blur",e);a.a.o(b,"focusout",e)},
update:function(b,c){var d=!!a.a.c(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===d||(d?b.focus():b.blur(),a.q.I(a.a.Ga,null,[b,d?"focusin":"focusout"]))}};a.d.hasFocus=a.d.hasfocus;a.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.fa(b,c())}};var I="__ko_withIfBindingData";G("if");G("ifnot",!1,!0);G("with",!0,!1,function(a,c){return a.createChildContext(c)});a.d.options={init:function(b){if("select"!==a.a.u(b))throw Error("options binding applies only to SELECT elements");
for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:function(b,c,d){function f(a,b,c){var d=typeof b;return"function"==d?b(a):"string"==d?a[b]:c}function g(b,c){if(p){var d=0<=a.a.k(p,a.h.n(c[0]));a.a.hb(c[0],d)}}var e=0==b.length,m=!e&&b.multiple?b.scrollTop:null;c=a.a.c(c());var h=d(),k=h.optionsIncludeDestroyed,l={},n,p;b.multiple?p=a.a.Z(b.selectedOptions||a.a.Y(b.childNodes,function(b){return b.tagName&&"option"===a.a.u(b)&&b.selected}),function(b){return a.h.n(b)}):0<=
b.selectedIndex&&(p=[a.h.n(b.options[b.selectedIndex])]);if(c){"undefined"==typeof c.length&&(c=[c]);var r=a.a.Y(c,function(b){return k||b===q||null===b||!a.a.c(b._destroy)});"optionsCaption"in h&&(n=a.a.c(h.optionsCaption),null!==n&&n!==q&&r.unshift(l))}else c=[];d=g;h.optionsAfterRender&&(d=function(b,c){g(0,c);a.q.I(h.optionsAfterRender,null,[c[0],b!==l?b:q])});a.a.Aa(b,r,function(b,c,d){d.length&&(p=d[0].selected&&[a.h.n(d[0])]);c=s.createElement("option");b===l?(a.a.fa(c,n),a.h.W(c,q)):(d=f(b,
h.optionsValue,b),a.h.W(c,a.a.c(d)),b=f(b,h.optionsText,d),a.a.ib(c,b));return[c]},null,d);p=null;e&&"value"in h&&J(b,a.a.ya(h.value),!0);a.a.zb(b);m&&20<Math.abs(m-b.scrollTop)&&(b.scrollTop=m)}};a.d.options.wa="__ko.optionValueDomData__";a.d.selectedOptions={init:function(b,c,d){a.a.o(b,"change",function(){var f=c(),g=[];a.a.p(b.getElementsByTagName("option"),function(b){b.selected&&g.push(a.h.n(b))});a.g.ha(f,d,"selectedOptions",g)})},update:function(b,c){if("select"!=a.a.u(b))throw Error("values binding applies only to SELECT elements");
var d=a.a.c(c());d&&"number"==typeof d.length&&a.a.p(b.getElementsByTagName("option"),function(b){var c=0<=a.a.k(d,a.h.n(b));a.a.hb(b,c)})}};a.d.style={update:function(b,c){var d=a.a.c(c()||{});a.a.w(d,function(c,d){d=a.a.c(d);b.style[c]=d||""})}};a.d.submit={init:function(b,c,d,f){if("function"!=typeof c())throw Error("The value for a submit binding must be a function");a.a.o(b,"submit",function(a){var d,m=c();try{d=m.call(f,b)}finally{!0!==d&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}})}};
a.d.text={update:function(b,c){a.a.ib(b,c())}};a.e.L.text=!0;a.d.uniqueName={init:function(b,c){if(c()){var d="ko_unique_"+ ++a.d.uniqueName.tb;a.a.gb(b,d)}}};a.d.uniqueName.tb=0;a.d.value={init:function(b,c,d){function f(){m=!1;var e=c(),f=a.h.n(b);a.g.ha(e,d,"value",f)}var g=["change"],e=d().valueUpdate,m=!1;e&&("string"==typeof e&&(e=[e]),a.a.R(g,e),g=a.a.Ma(g));!a.a.ca||("input"!=b.tagName.toLowerCase()||"text"!=b.type||"off"==b.autocomplete||b.form&&"off"==b.form.autocomplete)||-1!=a.a.k(g,"propertychange")||
(a.a.o(b,"propertychange",function(){m=!0}),a.a.o(b,"blur",function(){m&&f()}));a.a.p(g,function(c){var d=f;a.a.Tb(c,"after")&&(d=function(){setTimeout(f,0)},c=c.substring(5));a.a.o(b,c,d)})},update:function(b,c){var d="select"===a.a.u(b),f=a.a.c(c()),g=a.h.n(b);f!==g&&(g=function(){a.h.W(b,f)},g(),d&&setTimeout(g,0));d&&0<b.length&&J(b,f,!1)}};a.d.visible={update:function(b,c){var d=a.a.c(c()),f="none"!=b.style.display;d&&!f?b.style.display="":!d&&f&&(b.style.display="none")}};(function(b){a.d[b]=
{init:function(c,d,f,g){return a.d.event.init.call(this,c,function(){var a={};a[b]=d();return a},f,g)}}})("click");a.v=function(){};a.v.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource");};a.v.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock");};a.v.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){c=c||s;var d=c.getElementById(b);if(!d)throw Error("Cannot find template with ID "+b);return new a.l.i(d)}if(1==
b.nodeType||8==b.nodeType)return new a.l.Q(b);throw Error("Unknown template type: "+b);};a.v.prototype.renderTemplate=function(a,c,d,f){a=this.makeTemplateSource(a,f);return this.renderTemplateSource(a,c,d)};a.v.prototype.isTemplateRewritten=function(a,c){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,c).data("isRewritten")};a.v.prototype.rewriteTemplate=function(a,c,d){a=this.makeTemplateSource(a,d);c=c(a.text());a.text(c);a.data("isRewritten",!0)};a.b("templateEngine",a.v);
a.Ea=function(){function b(b,c,d,m){b=a.g.da(b);for(var h=a.g.S,k=0;k<b.length;k++){var l=b[k].key;if(h.hasOwnProperty(l)){var n=h[l];if("function"===typeof n){if(l=n(b[k].value))throw Error(l);}else if(!n)throw Error("This template engine does not support the '"+l+"' binding within its templates");}}d="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+a.g.ea(b)+" } })()},'"+d.toLowerCase()+"')";return m.createJavaScriptEvaluatorBlock(d)+c}var c=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,
d=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{Ab:function(b,c,d){c.isTemplateRewritten(b,d)||c.rewriteTemplate(b,function(b){return a.Ea.Lb(b,c)},d)},Lb:function(a,g){return a.replace(c,function(a,c,d,f,l){return b(l,c,d,g)}).replace(d,function(a,c){return b(c,"\x3c!-- ko --\x3e","#comment",g)})},qb:function(b,c){return a.s.va(function(d,m){var h=d.nextSibling;h&&h.nodeName.toLowerCase()===c&&a.Ka(h,b,m)})}}}();a.b("__tr_ambtns",a.Ea.qb);(function(){a.l={};a.l.i=function(a){this.i=a};a.l.i.prototype.text=
function(){var b=a.a.u(this.i),b="script"===b?"text":"textarea"===b?"value":"innerHTML";if(0==arguments.length)return this.i[b];var c=arguments[0];"innerHTML"===b?a.a.fa(this.i,c):this.i[b]=c};a.l.i.prototype.data=function(b){if(1===arguments.length)return a.a.f.get(this.i,"templateSourceData_"+b);a.a.f.set(this.i,"templateSourceData_"+b,arguments[1])};a.l.Q=function(a){this.i=a};a.l.Q.prototype=new a.l.i;a.l.Q.prototype.text=function(){if(0==arguments.length){var b=a.a.f.get(this.i,"__ko_anon_template__")||
{};b.Fa===q&&b.ma&&(b.Fa=b.ma.innerHTML);return b.Fa}a.a.f.set(this.i,"__ko_anon_template__",{Fa:arguments[0]})};a.l.i.prototype.nodes=function(){if(0==arguments.length)return(a.a.f.get(this.i,"__ko_anon_template__")||{}).ma;a.a.f.set(this.i,"__ko_anon_template__",{ma:arguments[0]})};a.b("templateSources",a.l);a.b("templateSources.domElement",a.l.i);a.b("templateSources.anonymousTemplate",a.l.Q)})();(function(){function b(b,c,d){var f;for(c=a.e.nextSibling(c);b&&(f=b)!==c;)b=a.e.nextSibling(f),1!==
f.nodeType&&8!==f.nodeType||d(f)}function c(c,d){if(c.length){var f=c[0],g=c[c.length-1];b(f,g,function(b){a.Ia(d,b)});b(f,g,function(b){a.s.nb(b,[d])})}}function d(a){return a.nodeType?a:0<a.length?a[0]:null}function f(b,f,h,k,l){l=l||{};var n=b&&d(b),n=n&&n.ownerDocument,p=l.templateEngine||g;a.Ea.Ab(h,p,n);h=p.renderTemplate(h,k,l,n);if("number"!=typeof h.length||0<h.length&&"number"!=typeof h[0].nodeType)throw Error("Template engine must return an array of DOM nodes");n=!1;switch(f){case "replaceChildren":a.e.P(b,
h);n=!0;break;case "replaceNode":a.a.eb(b,h);n=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+f);}n&&(c(h,k),l.afterRender&&a.q.I(l.afterRender,null,[h,k.$data]));return h}var g;a.Ba=function(b){if(b!=q&&!(b instanceof a.v))throw Error("templateEngine must inherit from ko.templateEngine");g=b};a.za=function(b,c,h,k,l){h=h||{};if((h.templateEngine||g)==q)throw Error("Set a template engine before calling renderTemplate");l=l||"replaceChildren";if(k){var n=d(k);return a.j(function(){var g=
c&&c instanceof a.A?c:new a.A(a.a.c(c)),r="function"==typeof b?b(g.$data,g):b,g=f(k,l,r,g,h);"replaceNode"==l&&(k=g,n=d(k))},null,{Qa:function(){return!n||!a.a.aa(n)},$:n&&"replaceNode"==l?n.parentNode:n})}return a.s.va(function(d){a.za(b,c,h,d,"replaceNode")})};a.Rb=function(b,d,g,k,l){function n(a,b){c(b,r);g.afterRender&&g.afterRender(b,a)}function p(c,d){r=l.createChildContext(a.a.c(c),g.as);r.$index=d;var k="function"==typeof b?b(c,r):b;return f(null,"ignoreTargetNode",k,r,g)}var r;return a.j(function(){var b=
a.a.c(d)||[];"undefined"==typeof b.length&&(b=[b]);b=a.a.Y(b,function(b){return g.includeDestroyed||b===q||null===b||!a.a.c(b._destroy)});a.q.I(a.a.Aa,null,[k,b,p,g,n])},null,{$:k})};a.d.template={init:function(b,c){var d=a.a.c(c());"string"==typeof d||(d.name||1!=b.nodeType&&8!=b.nodeType)||(d=1==b.nodeType?b.childNodes:a.e.childNodes(b),d=a.a.Mb(d),(new a.l.Q(b)).nodes(d));return{controlsDescendantBindings:!0}},update:function(b,c,d,f,g){c=a.a.c(c());d={};f=!0;var n,p=null;"string"!=typeof c&&(d=
c,c=a.a.c(d.name),"if"in d&&(f=a.a.c(d["if"])),f&&"ifnot"in d&&(f=!a.a.c(d.ifnot)),n=a.a.c(d.data));"foreach"in d?p=a.Rb(c||b,f&&d.foreach||[],d,b,g):f?(g="data"in d?g.createChildContext(n,d.as):g,p=a.za(c||b,g,d,b)):a.e.ba(b);g=p;(n=a.a.f.get(b,"__ko__templateComputedDomDataKey__"))&&"function"==typeof n.B&&n.B();a.a.f.set(b,"__ko__templateComputedDomDataKey__",g&&g.ta()?g:q)}};a.g.S.template=function(b){b=a.g.da(b);return 1==b.length&&b[0].unknown||a.g.Jb(b,"name")?null:"This template engine does not support anonymous templates nested within its templates"};
a.e.L.template=!0})();a.b("setTemplateEngine",a.Ba);a.b("renderTemplate",a.za);a.a.Pa=function(){function a(b,d,f,g,e){var m=Math.min,h=Math.max,k=[],l,n=b.length,p,r=d.length,q=r-n||1,t=n+r+1,s,v,w;for(l=0;l<=n;l++)for(v=s,k.push(s=[]),w=m(r,l+q),p=h(0,l-1);p<=w;p++)s[p]=p?l?b[l-1]===d[p-1]?v[p-1]:m(v[p]||t,s[p-1]||t)+1:p+1:l+1;m=[];h=[];q=[];l=n;for(p=r;l||p;)r=k[l][p]-1,p&&r===k[l][p-1]?h.push(m[m.length]={status:f,value:d[--p],index:p}):l&&r===k[l-1][p]?q.push(m[m.length]={status:g,value:b[--l],
index:l}):(m.push({status:"retained",value:d[--p]}),--l);if(h.length&&q.length){b=10*n;var E;for(d=f=0;(e||d<b)&&(E=h[f]);f++){for(g=0;k=q[g];g++)if(E.value===k.value){E.moved=k.index;k.moved=E.index;q.splice(g,1);d=g=0;break}d+=g}}return m.reverse()}return function(c,d,f){c=c||[];d=d||[];return c.length<=d.length?a(c,d,"added","deleted",f):a(d,c,"deleted","added",f)}}();a.b("utils.compareArrays",a.a.Pa);(function(){function b(b){for(;b.length&&!a.a.aa(b[0]);)b.splice(0,1);if(1<b.length){for(var c=
b[0],g=b[b.length-1],e=[c];c!==g;){c=c.nextSibling;if(!c)return;e.push(c)}Array.prototype.splice.apply(b,[0,b.length].concat(e))}return b}function c(c,f,g,e,m){var h=[];c=a.j(function(){var c=f(g,m,b(h))||[];0<h.length&&(a.a.eb(h,c),e&&a.q.I(e,null,[g,c,m]));h.splice(0,h.length);a.a.R(h,c)},null,{$:c,Qa:function(){return!a.a.pb(h)}});return{O:h,j:c.ta()?c:q}}a.a.Aa=function(d,f,g,e,m){function h(a,c){u=n[c];x!==c&&(E[a]=u);u.ra(x++);b(u.O);t.push(u);w.push(u)}function k(b,c){if(b)for(var d=0,e=c.length;d<
e;d++)c[d]&&a.a.p(c[d].O,function(a){b(a,d,c[d].X)})}f=f||[];e=e||{};var l=a.a.f.get(d,"setDomNodeChildrenFromArrayMapping_lastMappingResult")===q,n=a.a.f.get(d,"setDomNodeChildrenFromArrayMapping_lastMappingResult")||[],p=a.a.Z(n,function(a){return a.X}),r=a.a.Pa(p,f,e.dontLimitMoves),t=[],s=0,x=0,v=[],w=[];f=[];for(var E=[],p=[],u,B=0,y,A;y=r[B];B++)switch(A=y.moved,y.status){case "deleted":A===q&&(u=n[s],u.j&&u.j.B(),v.push.apply(v,b(u.O)),e.beforeRemove&&(f[B]=u,w.push(u)));s++;break;case "retained":h(B,
s++);break;case "added":A!==q?h(B,A):(u={X:y.value,ra:a.m(x++)},t.push(u),w.push(u),l||(p[B]=u))}k(e.beforeMove,E);a.a.p(v,e.beforeRemove?a.H:a.removeNode);for(var B=0,l=a.e.firstChild(d),C;u=w[B];B++){u.O||a.a.extend(u,c(d,g,u.X,m,u.ra));for(s=0;r=u.O[s];l=r.nextSibling,C=r,s++)r!==l&&a.e.Va(d,r,C);!u.Fb&&m&&(m(u.X,u.O,u.ra),u.Fb=!0)}k(e.beforeRemove,f);k(e.afterMove,E);k(e.afterAdd,p);a.a.f.set(d,"setDomNodeChildrenFromArrayMapping_lastMappingResult",t)}})();a.b("utils.setDomNodeChildrenFromArrayMapping",
a.a.Aa);a.D=function(){this.allowTemplateRewriting=!1};a.D.prototype=new a.v;a.D.prototype.renderTemplateSource=function(b){var c=(9>a.a.ca?0:b.nodes)?b.nodes():null;if(c)return a.a.N(c.cloneNode(!0).childNodes);b=b.text();return a.a.xa(b)};a.D.sa=new a.D;a.Ba(a.D.sa);a.b("nativeTemplateEngine",a.D);(function(){a.ua=function(){var a=this.Ib=function(){if("undefined"==typeof t||!t.tmpl)return 0;try{if(0<=t.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();this.renderTemplateSource=
function(b,f,g){g=g||{};if(2>a)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var e=b.data("precompiled");e||(e=b.text()||"",e=t.template(null,"{{ko_with $item.koBindingContext}}"+e+"{{/ko_with}}"),b.data("precompiled",e));b=[f.$data];f=t.extend({koBindingContext:f},g.templateOptions);f=t.tmpl(e,b,f);f.appendTo(s.createElement("div"));t.fragments={};return f};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+
a+" })()) }}"};this.addTemplate=function(a,b){s.write("<script type='text/html' id='"+a+"'>"+b+"\x3c/script>")};0<a&&(t.tmpl.tag.ko_code={open:"__.push($1 || '');"},t.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};a.ua.prototype=new a.v;var b=new a.ua;0<b.Ib&&a.Ba(b);a.b("jqueryTmplTemplateEngine",a.ua)})()})})();
})();
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* The binder joins an object instance and a DOM element tree by applying databinding and/or invoking binding lifecycle callbacks (binding and bindingComplete).
* @module binder
* @requires system
* @requires knockout
*/
define('durandal/binder',['durandal/system', 'knockout'], function (system, ko) {
var binder,
insufficientInfoMessage = 'Insufficient Information to Bind',
unexpectedViewMessage = 'Unexpected View Type',
bindingInstructionKey = 'durandal-binding-instruction',
koBindingContextKey = '__ko_bindingContext__';
function normalizeBindingInstruction(result){
if(result === undefined){
return { applyBindings: true };
}
if(system.isBoolean(result)){
return { applyBindings:result };
}
if(result.applyBindings === undefined){
result.applyBindings = true;
}
return result;
}
function doBind(obj, view, bindingTarget, data){
if (!view || !bindingTarget) {
if (binder.throwOnErrors) {
system.error(insufficientInfoMessage);
} else {
system.log(insufficientInfoMessage, view, data);
}
return;
}
if (!view.getAttribute) {
if (binder.throwOnErrors) {
system.error(unexpectedViewMessage);
} else {
system.log(unexpectedViewMessage, view, data);
}
return;
}
var viewName = view.getAttribute('data-view');
try {
var instruction;
if (obj && obj.binding) {
instruction = obj.binding(view);
}
instruction = normalizeBindingInstruction(instruction);
binder.binding(data, view, instruction);
if(instruction.applyBindings){
system.log('Binding', viewName, data);
ko.applyBindings(bindingTarget, view);
}else if(obj){
ko.utils.domData.set(view, koBindingContextKey, { $data:obj });
}
binder.bindingComplete(data, view, instruction);
if (obj && obj.bindingComplete) {
obj.bindingComplete(view);
}
ko.utils.domData.set(view, bindingInstructionKey, instruction);
return instruction;
} catch (e) {
e.message = e.message + ';\nView: ' + viewName + ";\nModuleId: " + system.getModuleId(data);
if (binder.throwOnErrors) {
system.error(e);
} else {
system.log(e.message);
}
}
}
/**
* @class BinderModule
* @static
*/
return binder = {
/**
* Called before every binding operation. Does nothing by default.
* @method binding
* @param {object} data The data that is about to be bound.
* @param {DOMElement} view The view that is about to be bound.
* @param {object} instruction The object that carries the binding instructions.
*/
binding: system.noop,
/**
* Called after every binding operation. Does nothing by default.
* @method bindingComplete
* @param {object} data The data that has just been bound.
* @param {DOMElement} view The view that has just been bound.
* @param {object} instruction The object that carries the binding instructions.
*/
bindingComplete: system.noop,
/**
* Indicates whether or not the binding system should throw errors or not.
* @property {boolean} throwOnErrors
* @default false The binding system will not throw errors by default. Instead it will log them.
*/
throwOnErrors: false,
/**
* Gets the binding instruction that was associated with a view when it was bound.
* @method getBindingInstruction
* @param {DOMElement} view The view that was previously bound.
* @return {object} The object that carries the binding instructions.
*/
getBindingInstruction:function(view){
return ko.utils.domData.get(view, bindingInstructionKey);
},
/**
* Binds the view, preserving the existing binding context. Optionally, a new context can be created, parented to the previous context.
* @method bindContext
* @param {KnockoutBindingContext} bindingContext The current binding context.
* @param {DOMElement} view The view to bind.
* @param {object} [obj] The data to bind to, causing the creation of a child binding context if present.
*/
bindContext: function(bindingContext, view, obj) {
if (obj && bindingContext) {
bindingContext = bindingContext.createChildContext(obj);
}
return doBind(obj, view, bindingContext, obj || (bindingContext ? bindingContext.$data : null));
},
/**
* Binds the view, preserving the existing binding context. Optionally, a new context can be created, parented to the previous context.
* @method bind
* @param {object} obj The data to bind to.
* @param {DOMElement} view The view to bind.
*/
bind: function(obj, view) {
return doBind(obj, view, obj, obj);
}
};
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* The activator module encapsulates all logic related to screen/component activation.
* An activator is essentially an asynchronous state machine that understands a particular state transition protocol.
* The protocol ensures that the following series of events always occur: `canDeactivate` (previous state), `canActivate` (new state), `deactivate` (previous state), `activate` (new state).
* Each of the _can_ callbacks may return a boolean, affirmative value or promise for one of those. If either of the _can_ functions yields a false result, then activation halts.
* @module activator
* @requires system
* @requires knockout
*/
define('durandal/activator',['durandal/system', 'knockout'], function (system, ko) {
var activator;
function ensureSettings(settings) {
if (settings == undefined) {
settings = {};
}
if (!settings.closeOnDeactivate) {
settings.closeOnDeactivate = activator.defaults.closeOnDeactivate;
}
if (!settings.beforeActivate) {
settings.beforeActivate = activator.defaults.beforeActivate;
}
if (!settings.afterDeactivate) {
settings.afterDeactivate = activator.defaults.afterDeactivate;
}
if(!settings.affirmations){
settings.affirmations = activator.defaults.affirmations;
}
if (!settings.interpretResponse) {
settings.interpretResponse = activator.defaults.interpretResponse;
}
if (!settings.areSameItem) {
settings.areSameItem = activator.defaults.areSameItem;
}
return settings;
}
function invoke(target, method, data) {
if (system.isArray(data)) {
return target[method].apply(target, data);
}
return target[method](data);
}
function deactivate(item, close, settings, dfd, setter) {
if (item && item.deactivate) {
system.log('Deactivating', item);
var result;
try {
result = item.deactivate(close);
} catch(error) {
system.error(error);
dfd.resolve(false);
return;
}
if (result && result.then) {
result.then(function() {
settings.afterDeactivate(item, close, setter);
dfd.resolve(true);
}, function(reason) {
system.log(reason);
dfd.resolve(false);
});
} else {
settings.afterDeactivate(item, close, setter);
dfd.resolve(true);
}
} else {
if (item) {
settings.afterDeactivate(item, close, setter);
}
dfd.resolve(true);
}
}
function activate(newItem, activeItem, callback, activationData) {
if (newItem) {
if (newItem.activate) {
system.log('Activating', newItem);
var result;
try {
result = invoke(newItem, 'activate', activationData);
} catch (error) {
system.error(error);
callback(false);
return;
}
if (result && result.then) {
result.then(function() {
activeItem(newItem);
callback(true);
}, function(reason) {
system.log(reason);
callback(false);
});
} else {
activeItem(newItem);
callback(true);
}
} else {
activeItem(newItem);
callback(true);
}
} else {
callback(true);
}
}
function canDeactivateItem(item, close, settings) {
settings.lifecycleData = null;
return system.defer(function (dfd) {
if (item && item.canDeactivate) {
var resultOrPromise;
try {
resultOrPromise = item.canDeactivate(close);
} catch(error) {
system.error(error);
dfd.resolve(false);
return;
}
if (resultOrPromise.then) {
resultOrPromise.then(function(result) {
settings.lifecycleData = result;
dfd.resolve(settings.interpretResponse(result));
}, function(reason) {
system.error(reason);
dfd.resolve(false);
});
} else {
settings.lifecycleData = resultOrPromise;
dfd.resolve(settings.interpretResponse(resultOrPromise));
}
} else {
dfd.resolve(true);
}
}).promise();
};
function canActivateItem(newItem, activeItem, settings, activationData) {
settings.lifecycleData = null;
return system.defer(function (dfd) {
if (newItem == activeItem()) {
dfd.resolve(true);
return;
}
if (newItem && newItem.canActivate) {
var resultOrPromise;
try {
resultOrPromise = invoke(newItem, 'canActivate', activationData);
} catch (error) {
system.error(error);
dfd.resolve(false);
return;
}
if (resultOrPromise.then) {
resultOrPromise.then(function(result) {
settings.lifecycleData = result;
dfd.resolve(settings.interpretResponse(result));
}, function(reason) {
system.error(reason);
dfd.resolve(false);
});
} else {
settings.lifecycleData = resultOrPromise;
dfd.resolve(settings.interpretResponse(resultOrPromise));
}
} else {
dfd.resolve(true);
}
}).promise();
};
/**
* An activator is a read/write computed observable that enforces the activation lifecycle whenever changing values.
* @class Activator
*/
function createActivator(initialActiveItem, settings) {
var activeItem = ko.observable(null);
var activeData;
settings = ensureSettings(settings);
var computed = ko.computed({
read: function () {
return activeItem();
},
write: function (newValue) {
computed.viaSetter = true;
computed.activateItem(newValue);
}
});
computed.__activator__ = true;
/**
* The settings for this activator.
* @property {ActivatorSettings} settings
*/
computed.settings = settings;
settings.activator = computed;
/**
* An observable which indicates whether or not the activator is currently in the process of activating an instance.
* @method isActivating
* @return {boolean}
*/
computed.isActivating = ko.observable(false);
/**
* Determines whether or not the specified item can be deactivated.
* @method canDeactivateItem
* @param {object} item The item to check.
* @param {boolean} close Whether or not to check if close is possible.
* @return {promise}
*/
computed.canDeactivateItem = function (item, close) {
return canDeactivateItem(item, close, settings);
};
/**
* Deactivates the specified item.
* @method deactivateItem
* @param {object} item The item to deactivate.
* @param {boolean} close Whether or not to close the item.
* @return {promise}
*/
computed.deactivateItem = function (item, close) {
return system.defer(function(dfd) {
computed.canDeactivateItem(item, close).then(function(canDeactivate) {
if (canDeactivate) {
deactivate(item, close, settings, dfd, activeItem);
} else {
computed.notifySubscribers();
dfd.resolve(false);
}
});
}).promise();
};
/**
* Determines whether or not the specified item can be activated.
* @method canActivateItem
* @param {object} item The item to check.
* @param {object} activationData Data associated with the activation.
* @return {promise}
*/
computed.canActivateItem = function (newItem, activationData) {
return canActivateItem(newItem, activeItem, settings, activationData);
};
/**
* Activates the specified item.
* @method activateItem
* @param {object} newItem The item to activate.
* @param {object} newActivationData Data associated with the activation.
* @return {promise}
*/
computed.activateItem = function (newItem, newActivationData) {
var viaSetter = computed.viaSetter;
computed.viaSetter = false;
return system.defer(function (dfd) {
if (computed.isActivating()) {
dfd.resolve(false);
return;
}
computed.isActivating(true);
var currentItem = activeItem();
if (settings.areSameItem(currentItem, newItem, activeData, newActivationData)) {
computed.isActivating(false);
dfd.resolve(true);
return;
}
computed.canDeactivateItem(currentItem, settings.closeOnDeactivate).then(function (canDeactivate) {
if (canDeactivate) {
computed.canActivateItem(newItem, newActivationData).then(function (canActivate) {
if (canActivate) {
system.defer(function (dfd2) {
deactivate(currentItem, settings.closeOnDeactivate, settings, dfd2);
}).promise().then(function () {
newItem = settings.beforeActivate(newItem, newActivationData);
activate(newItem, activeItem, function (result) {
activeData = newActivationData;
computed.isActivating(false);
dfd.resolve(result);
}, newActivationData);
});
} else {
if (viaSetter) {
computed.notifySubscribers();
}
computed.isActivating(false);
dfd.resolve(false);
}
});
} else {
if (viaSetter) {
computed.notifySubscribers();
}
computed.isActivating(false);
dfd.resolve(false);
}
});
}).promise();
};
/**
* Determines whether or not the activator, in its current state, can be activated.
* @method canActivate
* @return {promise}
*/
computed.canActivate = function () {
var toCheck;
if (initialActiveItem) {
toCheck = initialActiveItem;
initialActiveItem = false;
} else {
toCheck = computed();
}
return computed.canActivateItem(toCheck);
};
/**
* Activates the activator, in its current state.
* @method activate
* @return {promise}
*/
computed.activate = function () {
var toActivate;
if (initialActiveItem) {
toActivate = initialActiveItem;
initialActiveItem = false;
} else {
toActivate = computed();
}
return computed.activateItem(toActivate);
};
/**
* Determines whether or not the activator, in its current state, can be deactivated.
* @method canDeactivate
* @return {promise}
*/
computed.canDeactivate = function (close) {
return computed.canDeactivateItem(computed(), close);
};
/**
* Deactivates the activator, in its current state.
* @method deactivate
* @return {promise}
*/
computed.deactivate = function (close) {
return computed.deactivateItem(computed(), close);
};
computed.includeIn = function (includeIn) {
includeIn.canActivate = function () {
return computed.canActivate();
};
includeIn.activate = function () {
return computed.activate();
};
includeIn.canDeactivate = function (close) {
return computed.canDeactivate(close);
};
includeIn.deactivate = function (close) {
return computed.deactivate(close);
};
};
if (settings.includeIn) {
computed.includeIn(settings.includeIn);
} else if (initialActiveItem) {
computed.activate();
}
computed.forItems = function (items) {
settings.closeOnDeactivate = false;
settings.determineNextItemToActivate = function (list, lastIndex) {
var toRemoveAt = lastIndex - 1;
if (toRemoveAt == -1 && list.length > 1) {
return list[1];
}
if (toRemoveAt > -1 && toRemoveAt < list.length - 1) {
return list[toRemoveAt];
}
return null;
};
settings.beforeActivate = function (newItem) {
var currentItem = computed();
if (!newItem) {
newItem = settings.determineNextItemToActivate(items, currentItem ? items.indexOf(currentItem) : 0);
} else {
var index = items.indexOf(newItem);
if (index == -1) {
items.push(newItem);
} else {
newItem = items()[index];
}
}
return newItem;
};
settings.afterDeactivate = function (oldItem, close) {
if (close) {
items.remove(oldItem);
}
};
var originalCanDeactivate = computed.canDeactivate;
computed.canDeactivate = function (close) {
if (close) {
return system.defer(function (dfd) {
var list = items();
var results = [];
function finish() {
for (var j = 0; j < results.length; j++) {
if (!results[j]) {
dfd.resolve(false);
return;
}
}
dfd.resolve(true);
}
for (var i = 0; i < list.length; i++) {
computed.canDeactivateItem(list[i], close).then(function (result) {
results.push(result);
if (results.length == list.length) {
finish();
}
});
}
}).promise();
} else {
return originalCanDeactivate();
}
};
var originalDeactivate = computed.deactivate;
computed.deactivate = function (close) {
if (close) {
return system.defer(function (dfd) {
var list = items();
var results = 0;
var listLength = list.length;
function doDeactivate(item) {
computed.deactivateItem(item, close).then(function () {
results++;
items.remove(item);
if (results == listLength) {
dfd.resolve();
}
});
}
for (var i = 0; i < listLength; i++) {
doDeactivate(list[i]);
}
}).promise();
} else {
return originalDeactivate();
}
};
return computed;
};
return computed;
}
/**
* @class ActivatorSettings
* @static
*/
var activatorSettings = {
/**
* The default value passed to an object's deactivate function as its close parameter.
* @property {boolean} closeOnDeactivate
* @default true
*/
closeOnDeactivate: true,
/**
* Lower-cased words which represent a truthy value.
* @property {string[]} affirmations
* @default ['yes', 'ok', 'true']
*/
affirmations: ['yes', 'ok', 'true'],
/**
* Interprets the response of a `canActivate` or `canDeactivate` call using the known affirmative values in the `affirmations` array.
* @method interpretResponse
* @param {object} value
* @return {boolean}
*/
interpretResponse: function(value) {
if(system.isObject(value)) {
value = value.can || false;
}
if(system.isString(value)) {
return ko.utils.arrayIndexOf(this.affirmations, value.toLowerCase()) !== -1;
}
return value;
},
/**
* Determines whether or not the current item and the new item are the same.
* @method areSameItem
* @param {object} currentItem
* @param {object} newItem
* @param {object} currentActivationData
* @param {object} newActivationData
* @return {boolean}
*/
areSameItem: function(currentItem, newItem, currentActivationData, newActivationData) {
return currentItem == newItem;
},
/**
* Called immediately before the new item is activated.
* @method beforeActivate
* @param {object} newItem
*/
beforeActivate: function(newItem) {
return newItem;
},
/**
* Called immediately after the old item is deactivated.
* @method afterDeactivate
* @param {object} oldItem The previous item.
* @param {boolean} close Whether or not the previous item was closed.
* @param {function} setter The activate item setter function.
*/
afterDeactivate: function(oldItem, close, setter) {
if(close && setter) {
setter(null);
}
}
};
/**
* @class ActivatorModule
* @static
*/
activator = {
/**
* The default settings used by activators.
* @property {ActivatorSettings} defaults
*/
defaults: activatorSettings,
/**
* Creates a new activator.
* @method create
* @param {object} [initialActiveItem] The item which should be immediately activated upon creation of the ativator.
* @param {ActivatorSettings} [settings] Per activator overrides of the default activator settings.
* @return {Activator} The created activator.
*/
create: createActivator,
/**
* Determines whether or not the provided object is an activator or not.
* @method isActivator
* @param {object} object Any object you wish to verify as an activator or not.
* @return {boolean} True if the object is an activator; false otherwise.
*/
isActivator:function(object){
return object && object.__activator__;
}
};
return activator;
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* The composition module encapsulates all functionality related to visual composition.
* @module composition
* @requires system
* @requires viewLocator
* @requires binder
* @requires viewEngine
* @requires activator
* @requires jquery
* @requires knockout
*/
define('durandal/composition',['durandal/system', 'durandal/viewLocator', 'durandal/binder', 'durandal/viewEngine', 'durandal/activator', 'jquery', 'knockout'], function (system, viewLocator, binder, viewEngine, activator, $, ko) {
var dummyModel = {},
activeViewAttributeName = 'data-active-view',
composition,
compositionCompleteCallbacks = [],
compositionCount = 0,
compositionDataKey = 'durandal-composition-data',
partAttributeName = 'data-part',
bindableSettings = ['model', 'view', 'transition', 'area', 'strategy', 'activationData'],
visibilityKey = "durandal-visibility-data",
composeBindings = ['compose:'];
function getHostState(parent) {
var elements = [];
var state = {
childElements: elements,
activeView: null
};
var child = ko.virtualElements.firstChild(parent);
while (child) {
if (child.nodeType == 1) {
elements.push(child);
if (child.getAttribute(activeViewAttributeName)) {
state.activeView = child;
}
}
child = ko.virtualElements.nextSibling(child);
}
if(!state.activeView){
state.activeView = elements[0];
}
return state;
}
function endComposition() {
compositionCount--;
if (compositionCount === 0) {
setTimeout(function(){
var i = compositionCompleteCallbacks.length;
while(i--) {
try{
compositionCompleteCallbacks[i]();
}catch(e){
system.error(e);
}
}
compositionCompleteCallbacks = [];
}, 1);
}
}
function cleanUp(context){
delete context.activeView;
delete context.viewElements;
}
function tryActivate(context, successCallback, skipActivation) {
if(skipActivation){
successCallback();
} else if (context.activate && context.model && context.model.activate) {
var result;
try{
if(system.isArray(context.activationData)) {
result = context.model.activate.apply(context.model, context.activationData);
} else {
result = context.model.activate(context.activationData);
}
if(result && result.then) {
result.then(successCallback, function(reason) {
system.error(reason);
successCallback();
});
} else if(result || result === undefined) {
successCallback();
} else {
endComposition();
cleanUp(context);
}
}
catch(e){
system.error(e);
}
} else {
successCallback();
}
}
function triggerAttach() {
var context = this;
if (context.activeView) {
context.activeView.removeAttribute(activeViewAttributeName);
}
if (context.child) {
try{
if (context.model && context.model.attached) {
if (context.composingNewView || context.alwaysTriggerAttach) {
context.model.attached(context.child, context.parent, context);
}
}
if (context.attached) {
context.attached(context.child, context.parent, context);
}
context.child.setAttribute(activeViewAttributeName, true);
if (context.composingNewView && context.model && context.model.detached) {
ko.utils.domNodeDisposal.addDisposeCallback(context.child, function () {
try{
context.model.detached(context.child, context.parent, context);
}catch(e2){
system.error(e2);
}
});
}
}catch(e){
system.error(e);
}
}
context.triggerAttach = system.noop;
}
function shouldTransition(context) {
if (system.isString(context.transition)) {
if (context.activeView) {
if (context.activeView == context.child) {
return false;
}
if (!context.child) {
return true;
}
if (context.skipTransitionOnSameViewId) {
var currentViewId = context.activeView.getAttribute('data-view');
var newViewId = context.child.getAttribute('data-view');
return currentViewId != newViewId;
}
}
return true;
}
return false;
}
function cloneNodes(nodesArray) {
for (var i = 0, j = nodesArray.length, newNodesArray = []; i < j; i++) {
var clonedNode = nodesArray[i].cloneNode(true);
newNodesArray.push(clonedNode);
}
return newNodesArray;
}
function replaceParts(context){
var parts = cloneNodes(context.parts);
var replacementParts = composition.getParts(parts, null, true);
var standardParts = composition.getParts(context.child);
for (var partId in replacementParts) {
$(standardParts[partId]).replaceWith(replacementParts[partId]);
}
}
function removePreviousView(context){
var children = ko.virtualElements.childNodes(context.parent), i, len;
if(!system.isArray(children)){
var arrayChildren = [];
for(i = 0, len = children.length; i < len; i++){
arrayChildren[i] = children[i];
}
children = arrayChildren;
}
for(i = 1,len = children.length; i < len; i++){
ko.removeNode(children[i]);
}
}
function hide(view) {
ko.utils.domData.set(view, visibilityKey, view.style.display);
view.style.display = "none";
}
function show(view) {
view.style.display = ko.utils.domData.get(view, visibilityKey);
}
function hasComposition(element){
var dataBind = element.getAttribute('data-bind');
if(!dataBind){
return false;
}
for(var i = 0, length = composeBindings.length; i < length; i++){
if(dataBind.indexOf(composeBindings[i]) > -1){
return true;
}
}
return false;
}
/**
* @class CompositionTransaction
* @static
*/
var compositionTransaction = {
/**
* Registers a callback which will be invoked when the current composition transaction has completed. The transaction includes all parent and children compositions.
* @method complete
* @param {function} callback The callback to be invoked when composition is complete.
*/
complete: function (callback) {
compositionCompleteCallbacks.push(callback);
}
};
/**
* @class CompositionModule
* @static
*/
composition = {
/**
* An array of all the binding handler names (includeing :) that trigger a composition.
* @property {string} composeBindings
* @default ['compose:']
*/
composeBindings:composeBindings,
/**
* Converts a transition name to its moduleId.
* @method convertTransitionToModuleId
* @param {string} name The name of the transtion.
* @return {string} The moduleId.
*/
convertTransitionToModuleId: function (name) {
return 'transitions/' + name;
},
/**
* The name of the transition to use in all compositions.
* @property {string} defaultTransitionName
* @default null
*/
defaultTransitionName: null,
/**
* Represents the currently executing composition transaction.
* @property {CompositionTransaction} current
*/
current: compositionTransaction,
/**
* Registers a binding handler that will be invoked when the current composition transaction is complete.
* @method addBindingHandler
* @param {string} name The name of the binding handler.
* @param {object} [config] The binding handler instance. If none is provided, the name will be used to look up an existing handler which will then be converted to a composition handler.
* @param {function} [initOptionsFactory] If the registered binding needs to return options from its init call back to knockout, this function will server as a factory for those options. It will receive the same parameters that the init function does.
*/
addBindingHandler:function(name, config, initOptionsFactory){
var key,
dataKey = 'composition-handler-' + name,
handler;
config = config || ko.bindingHandlers[name];
initOptionsFactory = initOptionsFactory || function(){ return undefined; };
handler = ko.bindingHandlers[name] = {
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
if(compositionCount > 0){
var data = {
trigger:ko.observable(null)
};
composition.current.complete(function(){
if(config.init){
config.init(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
}
if(config.update){
ko.utils.domData.set(element, dataKey, config);
data.trigger('trigger');
}
});
ko.utils.domData.set(element, dataKey, data);
}else{
ko.utils.domData.set(element, dataKey, config);
if(config.init){
config.init(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
}
}
return initOptionsFactory(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
},
update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var data = ko.utils.domData.get(element, dataKey);
if(data.update){
return data.update(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
}
if(data.trigger){
data.trigger();
}
}
};
for (key in config) {
if (key !== "init" && key !== "update") {
handler[key] = config[key];
}
}
},
/**
* Gets an object keyed with all the elements that are replacable parts, found within the supplied elements. The key will be the part name and the value will be the element itself.
* @method getParts
* @param {DOMElement\DOMElement[]} elements The element(s) to search for parts.
* @return {object} An object keyed by part.
*/
getParts: function(elements, parts, isReplacementSearch) {
parts = parts || {};
if (!elements) {
return parts;
}
if (elements.length === undefined) {
elements = [elements];
}
for (var i = 0, length = elements.length; i < length; i++) {
var element = elements[i];
if (element.getAttribute) {
if(!isReplacementSearch && hasComposition(element)){
continue;
}
var id = element.getAttribute(partAttributeName);
if (id) {
parts[id] = element;
}
if(!isReplacementSearch && element.hasChildNodes()){
composition.getParts(element.childNodes, parts);
}
}
}
return parts;
},
cloneNodes:cloneNodes,
finalize: function (context) {
if(context.transition === undefined) {
context.transition = this.defaultTransitionName;
}
if(!context.child && !context.activeView){
if (!context.cacheViews) {
ko.virtualElements.emptyNode(context.parent);
}
context.triggerAttach();
endComposition();
cleanUp(context);
}else if (shouldTransition(context)) {
var transitionModuleId = this.convertTransitionToModuleId(context.transition);
system.acquire(transitionModuleId).then(function (transition) {
context.transition = transition;
transition(context).then(function () {
if (!context.cacheViews) {
if(!context.child){
ko.virtualElements.emptyNode(context.parent);
}else{
removePreviousView(context);
}
}else if(context.activeView){
var instruction = binder.getBindingInstruction(context.activeView);
if(instruction && instruction.cacheViews != undefined && !instruction.cacheViews){
ko.removeNode(context.activeView);
}
}
context.triggerAttach();
endComposition();
cleanUp(context);
});
}).fail(function(err){
system.error('Failed to load transition (' + transitionModuleId + '). Details: ' + err.message);
});
} else {
if (context.child != context.activeView) {
if (context.cacheViews && context.activeView) {
var instruction = binder.getBindingInstruction(context.activeView);
if(!instruction || (instruction.cacheViews != undefined && !instruction.cacheViews)){
ko.removeNode(context.activeView);
}else{
hide(context.activeView);
}
}
if (!context.child) {
if (!context.cacheViews) {
ko.virtualElements.emptyNode(context.parent);
}
} else {
if (!context.cacheViews) {
removePreviousView(context);
}
show(context.child);
}
}
context.triggerAttach();
endComposition();
cleanUp(context);
}
},
bindAndShow: function (child, context, skipActivation) {
context.child = child;
if (context.cacheViews) {
context.composingNewView = (ko.utils.arrayIndexOf(context.viewElements, child) == -1);
} else {
context.composingNewView = true;
}
tryActivate(context, function () {
if (context.binding) {
context.binding(context.child, context.parent, context);
}
if (context.preserveContext && context.bindingContext) {
if (context.composingNewView) {
if(context.parts){
replaceParts(context);
}
hide(child);
ko.virtualElements.prepend(context.parent, child);
binder.bindContext(context.bindingContext, child, context.model);
}
} else if (child) {
var modelToBind = context.model || dummyModel;
var currentModel = ko.dataFor(child);
if (currentModel != modelToBind) {
if (!context.composingNewView) {
ko.removeNode(child);
viewEngine.createView(child.getAttribute('data-view')).then(function(recreatedView) {
composition.bindAndShow(recreatedView, context, true);
});
return;
}
if(context.parts){
replaceParts(context);
}
hide(child);
ko.virtualElements.prepend(context.parent, child);
binder.bind(modelToBind, child);
}
}
composition.finalize(context);
}, skipActivation);
},
/**
* Eecutes the default view location strategy.
* @method defaultStrategy
* @param {object} context The composition context containing the model and possibly existing viewElements.
* @return {promise} A promise for the view.
*/
defaultStrategy: function (context) {
return viewLocator.locateViewForObject(context.model, context.area, context.viewElements);
},
getSettings: function (valueAccessor, element) {
var value = valueAccessor(),
settings = ko.utils.unwrapObservable(value) || {},
activatorPresent = activator.isActivator(value),
moduleId;
if (system.isString(settings)) {
if (viewEngine.isViewUrl(settings)) {
settings = {
view: settings
};
} else {
settings = {
model: settings,
activate: true
};
}
return settings;
}
moduleId = system.getModuleId(settings);
if (moduleId) {
settings = {
model: settings,
activate: true
};
return settings;
}
if(!activatorPresent && settings.model) {
activatorPresent = activator.isActivator(settings.model);
}
for (var attrName in settings) {
if (ko.utils.arrayIndexOf(bindableSettings, attrName) != -1) {
settings[attrName] = ko.utils.unwrapObservable(settings[attrName]);
} else {
settings[attrName] = settings[attrName];
}
}
if (activatorPresent) {
settings.activate = false;
} else if (settings.activate === undefined) {
settings.activate = true;
}
return settings;
},
executeStrategy: function (context) {
context.strategy(context).then(function (child) {
composition.bindAndShow(child, context);
});
},
inject: function (context) {
if (!context.model) {
this.bindAndShow(null, context);
return;
}
if (context.view) {
viewLocator.locateView(context.view, context.area, context.viewElements).then(function (child) {
composition.bindAndShow(child, context);
});
return;
}
if (!context.strategy) {
context.strategy = this.defaultStrategy;
}
if (system.isString(context.strategy)) {
system.acquire(context.strategy).then(function (strategy) {
context.strategy = strategy;
composition.executeStrategy(context);
}).fail(function(err){
system.error('Failed to load view strategy (' + context.strategy + '). Details: ' + err.message);
});
} else {
this.executeStrategy(context);
}
},
/**
* Initiates a composition.
* @method compose
* @param {DOMElement} element The DOMElement or knockout virtual element that serves as the parent for the composition.
* @param {object} settings The composition settings.
* @param {object} [bindingContext] The current binding context.
*/
compose: function (element, settings, bindingContext, fromBinding) {
compositionCount++;
if(!fromBinding){
settings = composition.getSettings(function() { return settings; }, element);
}
if (settings.compositionComplete) {
compositionCompleteCallbacks.push(function () {
settings.compositionComplete(settings.child, settings.parent, settings);
});
}
compositionCompleteCallbacks.push(function () {
if(settings.composingNewView && settings.model && settings.model.compositionComplete){
settings.model.compositionComplete(settings.child, settings.parent, settings);
}
});
var hostState = getHostState(element);
settings.activeView = hostState.activeView;
settings.parent = element;
settings.triggerAttach = triggerAttach;
settings.bindingContext = bindingContext;
if (settings.cacheViews && !settings.viewElements) {
settings.viewElements = hostState.childElements;
}
if (!settings.model) {
if (!settings.view) {
this.bindAndShow(null, settings);
} else {
settings.area = settings.area || 'partial';
settings.preserveContext = true;
viewLocator.locateView(settings.view, settings.area, settings.viewElements).then(function (child) {
composition.bindAndShow(child, settings);
});
}
} else if (system.isString(settings.model)) {
system.acquire(settings.model).then(function (module) {
settings.model = system.resolveObject(module);
composition.inject(settings);
}).fail(function(err){
system.error('Failed to load composed module (' + settings.model + '). Details: ' + err.message);
});
} else {
composition.inject(settings);
}
}
};
ko.bindingHandlers.compose = {
init: function() {
return { controlsDescendantBindings: true };
},
update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var settings = composition.getSettings(valueAccessor, element);
if(settings.mode){
var data = ko.utils.domData.get(element, compositionDataKey);
if(!data){
var childNodes = ko.virtualElements.childNodes(element);
data = {};
if(settings.mode === 'inline'){
data.view = viewEngine.ensureSingleElement(childNodes);
}else if(settings.mode === 'templated'){
data.parts = cloneNodes(childNodes);
}
ko.virtualElements.emptyNode(element);
ko.utils.domData.set(element, compositionDataKey, data);
}
if(settings.mode === 'inline'){
settings.view = data.view.cloneNode(true);
}else if(settings.mode === 'templated'){
settings.parts = data.parts;
}
settings.preserveContext = true;
}
composition.compose(element, settings, bindingContext, true);
}
};
ko.virtualElements.allowedBindings.compose = true;
return composition;
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* Durandal events originate from backbone.js but also combine some ideas from signals.js as well as some additional improvements.
* Events can be installed into any object and are installed into the `app` module by default for convenient app-wide eventing.
* @module events
* @requires system
*/
define('durandal/events',['durandal/system'], function (system) {
var eventSplitter = /\s+/;
var Events = function() { };
/**
* Represents an event subscription.
* @class Subscription
*/
var Subscription = function(owner, events) {
this.owner = owner;
this.events = events;
};
/**
* Attaches a callback to the event subscription.
* @method then
* @param {function} callback The callback function to invoke when the event is triggered.
* @param {object} [context] An object to use as `this` when invoking the `callback`.
* @chainable
*/
Subscription.prototype.then = function (callback, context) {
this.callback = callback || this.callback;
this.context = context || this.context;
if (!this.callback) {
return this;
}
this.owner.on(this.events, this.callback, this.context);
return this;
};
/**
* Attaches a callback to the event subscription.
* @method on
* @param {function} [callback] The callback function to invoke when the event is triggered. If `callback` is not provided, the previous callback will be re-activated.
* @param {object} [context] An object to use as `this` when invoking the `callback`.
* @chainable
*/
Subscription.prototype.on = Subscription.prototype.then;
/**
* Cancels the subscription.
* @method off
* @chainable
*/
Subscription.prototype.off = function () {
this.owner.off(this.events, this.callback, this.context);
return this;
};
/**
* Creates an object with eventing capabilities.
* @class Events
*/
/**
* Creates a subscription or registers a callback for the specified event.
* @method on
* @param {string} events One or more events, separated by white space.
* @param {function} [callback] The callback function to invoke when the event is triggered. If `callback` is not provided, a subscription instance is returned.
* @param {object} [context] An object to use as `this` when invoking the `callback`.
* @return {Subscription|Events} A subscription is returned if no callback is supplied, otherwise the events object is returned for chaining.
*/
Events.prototype.on = function(events, callback, context) {
var calls, event, list;
if (!callback) {
return new Subscription(this, events);
} else {
calls = this.callbacks || (this.callbacks = {});
events = events.split(eventSplitter);
while (event = events.shift()) {
list = calls[event] || (calls[event] = []);
list.push(callback, context);
}
return this;
}
};
/**
* Removes the callbacks for the specified events.
* @method off
* @param {string} [events] One or more events, separated by white space to turn off. If no events are specified, then the callbacks will be removed.
* @param {function} [callback] The callback function to remove. If `callback` is not provided, all callbacks for the specified events will be removed.
* @param {object} [context] The object that was used as `this`. Callbacks with this context will be removed.
* @chainable
*/
Events.prototype.off = function(events, callback, context) {
var event, calls, list, i;
// No events
if (!(calls = this.callbacks)) {
return this;
}
//removing all
if (!(events || callback || context)) {
delete this.callbacks;
return this;
}
events = events ? events.split(eventSplitter) : system.keys(calls);
// Loop through the callback list, splicing where appropriate.
while (event = events.shift()) {
if (!(list = calls[event]) || !(callback || context)) {
delete calls[event];
continue;
}
for (i = list.length - 2; i >= 0; i -= 2) {
if (!(callback && list[i] !== callback || context && list[i + 1] !== context)) {
list.splice(i, 2);
}
}
}
return this;
};
/**
* Triggers the specified events.
* @method trigger
* @param {string} [events] One or more events, separated by white space to trigger.
* @chainable
*/
Events.prototype.trigger = function(events) {
var event, calls, list, i, length, args, all, rest;
if (!(calls = this.callbacks)) {
return this;
}
rest = [];
events = events.split(eventSplitter);
for (i = 1, length = arguments.length; i < length; i++) {
rest[i - 1] = arguments[i];
}
// For each event, walk through the list of callbacks twice, first to
// trigger the event, then to trigger any `"all"` callbacks.
while (event = events.shift()) {
// Copy callback lists to prevent modification.
if (all = calls.all) {
all = all.slice();
}
if (list = calls[event]) {
list = list.slice();
}
// Execute event callbacks.
if (list) {
for (i = 0, length = list.length; i < length; i += 2) {
list[i].apply(list[i + 1] || this, rest);
}
}
// Execute "all" callbacks.
if (all) {
args = [event].concat(rest);
for (i = 0, length = all.length; i < length; i += 2) {
all[i].apply(all[i + 1] || this, args);
}
}
}
return this;
};
/**
* Creates a function that will trigger the specified events when called. Simplifies proxying jQuery (or other) events through to the events object.
* @method proxy
* @param {string} events One or more events, separated by white space to trigger by invoking the returned function.
* @return {function} Calling the function will invoke the previously specified events on the events object.
*/
Events.prototype.proxy = function(events) {
var that = this;
return (function(arg) {
that.trigger(events, arg);
});
};
/**
* Creates an object with eventing capabilities.
* @class EventsModule
* @static
*/
/**
* Adds eventing capabilities to the specified object.
* @method includeIn
* @param {object} targetObject The object to add eventing capabilities to.
*/
Events.includeIn = function(targetObject) {
targetObject.on = Events.prototype.on;
targetObject.off = Events.prototype.off;
targetObject.trigger = Events.prototype.trigger;
targetObject.proxy = Events.prototype.proxy;
};
return Events;
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* The app module controls app startup, plugin loading/configuration and root visual display.
* @module app
* @requires system
* @requires viewEngine
* @requires composition
* @requires events
* @requires jquery
*/
define('durandal/app',['durandal/system', 'durandal/viewEngine', 'durandal/composition', 'durandal/events', 'jquery'], function(system, viewEngine, composition, Events, $) {
var app,
allPluginIds = [],
allPluginConfigs = [];
function loadPlugins(){
return system.defer(function(dfd){
if(allPluginIds.length == 0){
dfd.resolve();
return;
}
system.acquire(allPluginIds).then(function(loaded){
for(var i = 0; i < loaded.length; i++){
var currentModule = loaded[i];
if(currentModule.install){
var config = allPluginConfigs[i];
if(!system.isObject(config)){
config = {};
}
currentModule.install(config);
system.log('Plugin:Installed ' + allPluginIds[i]);
}else{
system.log('Plugin:Loaded ' + allPluginIds[i]);
}
}
dfd.resolve();
}).fail(function(err){
system.error('Failed to load plugin(s). Details: ' + err.message);
});
}).promise();
}
/**
* @class AppModule
* @static
* @uses Events
*/
app = {
/**
* The title of your application.
* @property {string} title
*/
title: 'Application',
/**
* Configures one or more plugins to be loaded and installed into the application.
* @method configurePlugins
* @param {object} config Keys are plugin names. Values can be truthy, to simply install the plugin, or a configuration object to pass to the plugin.
* @param {string} [baseUrl] The base url to load the plugins from.
*/
configurePlugins:function(config, baseUrl){
var pluginIds = system.keys(config);
baseUrl = baseUrl || 'plugins/';
if(baseUrl.indexOf('/', baseUrl.length - 1) === -1){
baseUrl += '/';
}
for(var i = 0; i < pluginIds.length; i++){
var key = pluginIds[i];
allPluginIds.push(baseUrl + key);
allPluginConfigs.push(config[key]);
}
},
/**
* Starts the application.
* @method start
* @return {promise}
*/
start: function() {
system.log('Application:Starting');
if (this.title) {
document.title = this.title;
}
return system.defer(function (dfd) {
$(function() {
loadPlugins().then(function(){
dfd.resolve();
system.log('Application:Started');
});
});
}).promise();
},
/**
* Sets the root module/view for the application.
* @method setRoot
* @param {string} root The root view or module.
* @param {string} [transition] The transition to use from the previous root (or splash screen) into the new root.
* @param {string} [applicationHost] The application host element or id. By default the id 'applicationHost' will be used.
*/
setRoot: function(root, transition, applicationHost) {
var hostElement, settings = { activate:true, transition: transition };
if (!applicationHost || system.isString(applicationHost)) {
hostElement = document.getElementById(applicationHost || 'applicationHost');
} else {
hostElement = applicationHost;
}
if (system.isString(root)) {
if (viewEngine.isViewUrl(root)) {
settings.view = root;
} else {
settings.model = root;
}
} else {
settings.model = root;
}
composition.compose(hostElement, settings);
}
};
Events.includeIn(app);
return app;
});
requirejs.config({
paths: {
'text': '../../bower_components/requirejs-text/text',
'durandal':'../../bower_components/durandal/js',
'plugins' : '../../bower_components/durandal/js/plugins',
'knockout': '../../bower_components/knockout.js/knockout',
'jquery': '../../bower_components/jquery/jquery'
},
shim: {
'bootstrap': {
deps: ['jquery'],
exports: 'jQuery'
}
}
});
define('main2',['durandal/system', 'durandal/app', 'durandal/viewLocator'], function (system, app, viewLocator) {
app.title = 'Durandal Simple Project';
app.start().then(function () {
//Replace 'viewmodels' in the moduleId with 'views' to locate the view.
//Look for partial views in a 'views' folder in the root.
viewLocator.useConvention();
//Show the app by setting the root view model for our application.
app.setRoot('shell');
});
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* The dialog module enables the display of message boxes, custom modal dialogs and other overlays or slide-out UI abstractions. Dialogs are constructed by the composition system which interacts with a user defined dialog context. The dialog module enforced the activator lifecycle.
* @module dialog
* @requires system
* @requires app
* @requires composition
* @requires activator
* @requires viewEngine
* @requires jquery
* @requires knockout
*/
define('plugins/dialog',['durandal/system', 'durandal/app', 'durandal/composition', 'durandal/activator', 'durandal/viewEngine', 'jquery', 'knockout'], function (system, app, composition, activator, viewEngine, $, ko) {
var contexts = {},
dialogCount = 0,
dialog;
/**
* Models a message box's message, title and options.
* @class MessageBox
*/
var MessageBox = function(message, title, options) {
this.message = message;
this.title = title || MessageBox.defaultTitle;
this.options = options || MessageBox.defaultOptions;
};
/**
* Selects an option and closes the message box, returning the selected option through the dialog system's promise.
* @method selectOption
* @param {string} dialogResult The result to select.
*/
MessageBox.prototype.selectOption = function (dialogResult) {
dialog.close(this, dialogResult);
};
/**
* Provides the view to the composition system.
* @method getView
* @return {DOMElement} The view of the message box.
*/
MessageBox.prototype.getView = function(){
return viewEngine.processMarkup(MessageBox.defaultViewMarkup);
};
/**
* Configures a custom view to use when displaying message boxes.
* @method setViewUrl
* @param {string} viewUrl The view url relative to the base url which the view locator will use to find the message box's view.
* @static
*/
MessageBox.setViewUrl = function(viewUrl){
delete MessageBox.prototype.getView;
MessageBox.prototype.viewUrl = viewUrl;
};
/**
* The title to be used for the message box if one is not provided.
* @property {string} defaultTitle
* @default Application
* @static
*/
MessageBox.defaultTitle = app.title || 'Application';
/**
* The options to display in the message box of none are specified.
* @property {string[]} defaultOptions
* @default ['Ok']
* @static
*/
MessageBox.defaultOptions = ['Ok'];
/**
* The markup for the message box's view.
* @property {string} defaultViewMarkup
* @static
*/
MessageBox.defaultViewMarkup = [
'<div data-view="plugins/messageBox" class="messageBox">',
'<div class="modal-header">',
'<h3 data-bind="text: title"></h3>',
'</div>',
'<div class="modal-body">',
'<p class="message" data-bind="text: message"></p>',
'</div>',
'<div class="modal-footer" data-bind="foreach: options">',
'<button class="btn" data-bind="click: function () { $parent.selectOption($data); }, text: $data, css: { \'btn-primary\': $index() == 0, autofocus: $index() == 0 }"></button>',
'</div>',
'</div>'
].join('\n');
function ensureDialogInstance(objOrModuleId) {
return system.defer(function(dfd) {
if (system.isString(objOrModuleId)) {
system.acquire(objOrModuleId).then(function (module) {
dfd.resolve(system.resolveObject(module));
}).fail(function(err){
system.error('Failed to load dialog module (' + objOrModuleId + '). Details: ' + err.message);
});
} else {
dfd.resolve(objOrModuleId);
}
}).promise();
}
/**
* @class DialogModule
* @static
*/
dialog = {
/**
* The constructor function used to create message boxes.
* @property {MessageBox} MessageBox
*/
MessageBox:MessageBox,
/**
* The css zIndex that the last dialog was displayed at.
* @property {number} currentZIndex
*/
currentZIndex: 1050,
/**
* Gets the next css zIndex at which a dialog should be displayed.
* @method getNextZIndex
* @return {number} The next usable zIndex.
*/
getNextZIndex: function () {
return ++this.currentZIndex;
},
/**
* Determines whether or not there are any dialogs open.
* @method isOpen
* @return {boolean} True if a dialog is open. false otherwise.
*/
isOpen: function() {
return dialogCount > 0;
},
/**
* Gets the dialog context by name or returns the default context if no name is specified.
* @method getContext
* @param {string} [name] The name of the context to retrieve.
* @return {DialogContext} True context.
*/
getContext: function(name) {
return contexts[name || 'default'];
},
/**
* Adds (or replaces) a dialog context.
* @method addContext
* @param {string} name The name of the context to add.
* @param {DialogContext} dialogContext The context to add.
*/
addContext: function(name, dialogContext) {
dialogContext.name = name;
contexts[name] = dialogContext;
var helperName = 'show' + name.substr(0, 1).toUpperCase() + name.substr(1);
this[helperName] = function (obj, activationData) {
return this.show(obj, activationData, name);
};
},
createCompositionSettings: function(obj, dialogContext) {
var settings = {
model:obj,
activate:false,
transition: false
};
if (dialogContext.attached) {
settings.attached = dialogContext.attached;
}
if (dialogContext.compositionComplete) {
settings.compositionComplete = dialogContext.compositionComplete;
}
return settings;
},
/**
* Gets the dialog model that is associated with the specified object.
* @method getDialog
* @param {object} obj The object for whom to retrieve the dialog.
* @return {Dialog} The dialog model.
*/
getDialog:function(obj){
if(obj){
return obj.__dialog__;
}
return undefined;
},
/**
* Closes the dialog associated with the specified object.
* @method close
* @param {object} obj The object whose dialog should be closed.
* @param {object} results* The results to return back to the dialog caller after closing.
*/
close:function(obj){
var theDialog = this.getDialog(obj);
if(theDialog){
var rest = Array.prototype.slice.call(arguments, 1);
theDialog.close.apply(theDialog, rest);
}
},
/**
* Shows a dialog.
* @method show
* @param {object|string} obj The object (or moduleId) to display as a dialog.
* @param {object} [activationData] The data that should be passed to the object upon activation.
* @param {string} [context] The name of the dialog context to use. Uses the default context if none is specified.
* @return {Promise} A promise that resolves when the dialog is closed and returns any data passed at the time of closing.
*/
show: function(obj, activationData, context) {
var that = this;
var dialogContext = contexts[context || 'default'];
return system.defer(function(dfd) {
ensureDialogInstance(obj).then(function(instance) {
var dialogActivator = activator.create();
dialogActivator.activateItem(instance, activationData).then(function (success) {
if (success) {
var theDialog = instance.__dialog__ = {
owner: instance,
context: dialogContext,
activator: dialogActivator,
close: function () {
var args = arguments;
dialogActivator.deactivateItem(instance, true).then(function (closeSuccess) {
if (closeSuccess) {
dialogCount--;
dialogContext.removeHost(theDialog);
delete instance.__dialog__;
if (args.length === 0) {
dfd.resolve();
} else if (args.length === 1) {
dfd.resolve(args[0]);
} else {
dfd.resolve.apply(dfd, args);
}
}
});
}
};
theDialog.settings = that.createCompositionSettings(instance, dialogContext);
dialogContext.addHost(theDialog);
dialogCount++;
composition.compose(theDialog.host, theDialog.settings);
} else {
dfd.resolve(false);
}
});
});
}).promise();
},
/**
* Shows a message box.
* @method showMessage
* @param {string} message The message to display in the dialog.
* @param {string} [title] The title message.
* @param {string[]} [options] The options to provide to the user.
* @return {Promise} A promise that resolves when the message box is closed and returns the selected option.
*/
showMessage:function(message, title, options){
if(system.isString(this.MessageBox)){
return dialog.show(this.MessageBox, [
message,
title || MessageBox.defaultTitle,
options || MessageBox.defaultOptions
]);
}
return dialog.show(new this.MessageBox(message, title, options));
},
/**
* Installs this module into Durandal; called by the framework. Adds `app.showDialog` and `app.showMessage` convenience methods.
* @method install
* @param {object} [config] Add a `messageBox` property to supply a custom message box constructor. Add a `messageBoxView` property to supply custom view markup for the built-in message box.
*/
install:function(config){
app.showDialog = function(obj, activationData, context) {
return dialog.show(obj, activationData, context);
};
app.showMessage = function(message, title, options) {
return dialog.showMessage(message, title, options);
};
if(config.messageBox){
dialog.MessageBox = config.messageBox;
}
if(config.messageBoxView){
dialog.MessageBox.prototype.getView = function(){
return config.messageBoxView;
};
}
}
};
/**
* @class DialogContext
*/
dialog.addContext('default', {
blockoutOpacity: .2,
removeDelay: 200,
/**
* In this function, you are expected to add a DOM element to the tree which will serve as the "host" for the modal's composed view. You must add a property called host to the modalWindow object which references the dom element. It is this host which is passed to the composition module.
* @method addHost
* @param {Dialog} theDialog The dialog model.
*/
addHost: function(theDialog) {
var body = $('body');
var blockout = $('<div class="modalBlockout"></div>')
.css({ 'z-index': dialog.getNextZIndex(), 'opacity': this.blockoutOpacity })
.appendTo(body);
var host = $('<div class="modalHost"></div>')
.css({ 'z-index': dialog.getNextZIndex() })
.appendTo(body);
theDialog.host = host.get(0);
theDialog.blockout = blockout.get(0);
if (!dialog.isOpen()) {
theDialog.oldBodyMarginRight = body.css("margin-right");
theDialog.oldInlineMarginRight = body.get(0).style.marginRight;
var html = $("html");
var oldBodyOuterWidth = body.outerWidth(true);
var oldScrollTop = html.scrollTop();
$("html").css("overflow-y", "hidden");
var newBodyOuterWidth = $("body").outerWidth(true);
body.css("margin-right", (newBodyOuterWidth - oldBodyOuterWidth + parseInt(theDialog.oldBodyMarginRight, 10)) + "px");
html.scrollTop(oldScrollTop); // necessary for Firefox
}
},
/**
* This function is expected to remove any DOM machinery associated with the specified dialog and do any other necessary cleanup.
* @method removeHost
* @param {Dialog} theDialog The dialog model.
*/
removeHost: function(theDialog) {
$(theDialog.host).css('opacity', 0);
$(theDialog.blockout).css('opacity', 0);
setTimeout(function() {
ko.removeNode(theDialog.host);
ko.removeNode(theDialog.blockout);
}, this.removeDelay);
if (!dialog.isOpen()) {
var html = $("html");
var oldScrollTop = html.scrollTop(); // necessary for Firefox.
html.css("overflow-y", "").scrollTop(oldScrollTop);
if(theDialog.oldInlineMarginRight) {
$("body").css("margin-right", theDialog.oldBodyMarginRight);
} else {
$("body").css("margin-right", '');
}
}
},
attached: function (view) {
//To prevent flickering in IE8, we set visibility to hidden first, and later restore it
$(view).css("visibility", "hidden");
},
/**
* This function is called after the modal is fully composed into the DOM, allowing your implementation to do any final modifications, such as positioning or animation. You can obtain the original dialog object by using `getDialog` on context.model.
* @method compositionComplete
* @param {DOMElement} child The dialog view.
* @param {DOMElement} parent The parent view.
* @param {object} context The composition context.
*/
compositionComplete: function (child, parent, context) {
var theDialog = dialog.getDialog(context.model);
var $child = $(child);
var loadables = $child.find("img").filter(function () {
//Remove images with known width and height
var $this = $(this);
return !(this.style.width && this.style.height) && !($this.attr("width") && $this.attr("height"));
});
$child.data("predefinedWidth", $child.get(0).style.width);
var setDialogPosition = function () {
//Setting a short timeout is need in IE8, otherwise we could do this straight away
setTimeout(function () {
//We will clear and then set width for dialogs without width set
if (!$child.data("predefinedWidth")) {
$child.css({ width: '' }); //Reset width
}
var width = $child.outerWidth(false);
var height = $child.outerHeight(false);
var windowHeight = $(window).height();
var constrainedHeight = Math.min(height, windowHeight);
$child.css({
'margin-top': (-constrainedHeight / 2).toString() + 'px',
'margin-left': (-width / 2).toString() + 'px'
});
if (!$child.data("predefinedWidth")) {
//Ensure the correct width after margin-left has been set
$child.outerWidth(width);
}
if (height > windowHeight) {
$child.css("overflow-y", "auto");
} else {
$child.css("overflow-y", "");
}
$(theDialog.host).css('opacity', 1);
$child.css("visibility", "visible");
$child.find('.autofocus').first().focus();
}, 1);
};
setDialogPosition();
loadables.load(setDialogPosition);
if ($child.hasClass('autoclose')) {
$(theDialog.blockout).click(function () {
theDialog.close();
});
}
}
});
return dialog;
});
define('shell',['require','knockout','plugins/dialog'],function (require) {
var ko = require('knockout'),
dialog = require('plugins/dialog');
return {
name: ko.observable(),
sayHello: function() {
dialog.showMessage('Hello ' + this.name() + '! Nice to meet you.', 'Greetings');
}
};
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* This module is based on Backbone's core history support. It abstracts away the low level details of working with browser history and url changes in order to provide a solid foundation for a router.
* @module history
* @requires system
* @requires jquery
*/
define('plugins/history',['durandal/system', 'jquery'], function (system, $) {
// Cached regex for stripping a leading hash/slash and trailing space.
var routeStripper = /^[#\/]|\s+$/g;
// Cached regex for stripping leading and trailing slashes.
var rootStripper = /^\/+|\/+$/g;
// Cached regex for detecting MSIE.
var isExplorer = /msie [\w.]+/;
// Cached regex for removing a trailing slash.
var trailingSlash = /\/$/;
// Update the hash location, either replacing the current entry, or adding
// a new one to the browser history.
function updateHash(location, fragment, replace) {
if (replace) {
var href = location.href.replace(/(javascript:|#).*$/, '');
location.replace(href + '#' + fragment);
} else {
// Some browsers require that `hash` contains a leading #.
location.hash = '#' + fragment;
}
};
/**
* @class HistoryModule
* @static
*/
var history = {
/**
* The setTimeout interval used when the browser does not support hash change events.
* @property {string} interval
* @default 50
*/
interval: 50,
/**
* Indicates whether or not the history module is actively tracking history.
* @property {string} active
*/
active: false
};
// Ensure that `History` can be used outside of the browser.
if (typeof window !== 'undefined') {
history.location = window.location;
history.history = window.history;
}
/**
* Gets the true hash value. Cannot use location.hash directly due to a bug in Firefox where location.hash will always be decoded.
* @method getHash
* @param {string} [window] The optional window instance
* @return {string} The hash.
*/
history.getHash = function(window) {
var match = (window || history).location.href.match(/#(.*)$/);
return match ? match[1] : '';
};
/**
* Get the cross-browser normalized URL fragment, either from the URL, the hash, or the override.
* @method getFragment
* @param {string} fragment The fragment.
* @param {boolean} forcePushState Should we force push state?
* @return {string} he fragment.
*/
history.getFragment = function(fragment, forcePushState) {
if (fragment == null) {
if (history._hasPushState || !history._wantsHashChange || forcePushState) {
fragment = history.location.pathname + history.location.search;
var root = history.root.replace(trailingSlash, '');
if (!fragment.indexOf(root)) {
fragment = fragment.substr(root.length);
}
} else {
fragment = history.getHash();
}
}
return fragment.replace(routeStripper, '');
};
/**
* Activate the hash change handling, returning `true` if the current URL matches an existing route, and `false` otherwise.
* @method activate
* @param {HistoryOptions} options.
* @return {boolean|undefined} Returns true/false from loading the url unless the silent option was selected.
*/
history.activate = function(options) {
if (history.active) {
system.error("History has already been activated.");
}
history.active = true;
// Figure out the initial configuration. Do we need an iframe?
// Is pushState desired ... is it available?
history.options = system.extend({}, { root: '/' }, history.options, options);
history.root = history.options.root;
history._wantsHashChange = history.options.hashChange !== false;
history._wantsPushState = !!history.options.pushState;
history._hasPushState = !!(history.options.pushState && history.history && history.history.pushState);
var fragment = history.getFragment();
var docMode = document.documentMode;
var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7));
// Normalize root to always include a leading and trailing slash.
history.root = ('/' + history.root + '/').replace(rootStripper, '/');
if (oldIE && history._wantsHashChange) {
history.iframe = $('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
history.navigate(fragment, false);
}
// Depending on whether we're using pushState or hashes, and whether
// 'onhashchange' is supported, determine how we check the URL state.
if (history._hasPushState) {
$(window).on('popstate', history.checkUrl);
} else if (history._wantsHashChange && ('onhashchange' in window) && !oldIE) {
$(window).on('hashchange', history.checkUrl);
} else if (history._wantsHashChange) {
history._checkUrlInterval = setInterval(history.checkUrl, history.interval);
}
// Determine if we need to change the base url, for a pushState link
// opened by a non-pushState browser.
history.fragment = fragment;
var loc = history.location;
var atRoot = loc.pathname.replace(/[^\/]$/, '$&/') === history.root;
// Transition from hashChange to pushState or vice versa if both are requested.
if (history._wantsHashChange && history._wantsPushState) {
// If we've started off with a route from a `pushState`-enabled
// browser, but we're currently in a browser that doesn't support it...
if (!history._hasPushState && !atRoot) {
history.fragment = history.getFragment(null, true);
history.location.replace(history.root + history.location.search + '#' + history.fragment);
// Return immediately as browser will do redirect to new url
return true;
// Or if we've started out with a hash-based route, but we're currently
// in a browser where it could be `pushState`-based instead...
} else if (history._hasPushState && atRoot && loc.hash) {
this.fragment = history.getHash().replace(routeStripper, '');
this.history.replaceState({}, document.title, history.root + history.fragment + loc.search);
}
}
if (!history.options.silent) {
return history.loadUrl();
}
};
/**
* Disable history, perhaps temporarily. Not useful in a real app, but possibly useful for unit testing Routers.
* @method deactivate
*/
history.deactivate = function() {
$(window).off('popstate', history.checkUrl).off('hashchange', history.checkUrl);
clearInterval(history._checkUrlInterval);
history.active = false;
};
/**
* Checks the current URL to see if it has changed, and if it has, calls `loadUrl`, normalizing across the hidden iframe.
* @method checkUrl
* @return {boolean} Returns true/false from loading the url.
*/
history.checkUrl = function() {
var current = history.getFragment();
if (current === history.fragment && history.iframe) {
current = history.getFragment(history.getHash(history.iframe));
}
if (current === history.fragment) {
return false;
}
if (history.iframe) {
history.navigate(current, false);
}
history.loadUrl();
};
/**
* Attempts to load the current URL fragment. A pass-through to options.routeHandler.
* @method loadUrl
* @return {boolean} Returns true/false from the route handler.
*/
history.loadUrl = function(fragmentOverride) {
var fragment = history.fragment = history.getFragment(fragmentOverride);
return history.options.routeHandler ?
history.options.routeHandler(fragment) :
false;
};
/**
* Save a fragment into the hash history, or replace the URL state if the
* 'replace' option is passed. You are responsible for properly URL-encoding
* the fragment in advance.
* The options object can contain `trigger: false` if you wish to not have the
* route callback be fired, or `replace: true`, if
* you wish to modify the current URL without adding an entry to the history.
* @method navigate
* @param {string} fragment The url fragment to navigate to.
* @param {object|boolean} options An options object with optional trigger and replace flags. You can also pass a boolean directly to set the trigger option. Trigger is `true` by default.
* @return {boolean} Returns true/false from loading the url.
*/
history.navigate = function(fragment, options) {
if (!history.active) {
return false;
}
if(options === undefined) {
options = {
trigger: true
};
}else if(system.isBoolean(options)) {
options = {
trigger: options
};
}
fragment = history.getFragment(fragment || '');
if (history.fragment === fragment) {
return;
}
history.fragment = fragment;
var url = history.root + fragment;
// Don't include a trailing slash on the root.
if(fragment === '' && url !== '/') {
url = url.slice(0, -1);
}
// If pushState is available, we use it to set the fragment as a real URL.
if (history._hasPushState) {
history.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
// If hash changes haven't been explicitly disabled, update the hash
// fragment to store history.
} else if (history._wantsHashChange) {
updateHash(history.location, fragment, options.replace);
if (history.iframe && (fragment !== history.getFragment(history.getHash(history.iframe)))) {
// Opening and closing the iframe tricks IE7 and earlier to push a
// history entry on hash-tag change. When replace is true, we don't
// want history.
if (!options.replace) {
history.iframe.document.open().close();
}
updateHash(history.iframe.location, fragment, options.replace);
}
// If you've told us that you explicitly don't want fallback hashchange-
// based history, then `navigate` becomes a page refresh.
} else {
return history.location.assign(url);
}
if (options.trigger) {
return history.loadUrl(fragment);
}
};
/**
* Navigates back in the browser history.
* @method navigateBack
*/
history.navigateBack = function() {
history.history.back();
};
/**
* @class HistoryOptions
* @static
*/
/**
* The function that will be called back when the fragment changes.
* @property {function} routeHandler
*/
/**
* The url root used to extract the fragment when using push state.
* @property {string} root
*/
/**
* Use hash change when present.
* @property {boolean} hashChange
* @default true
*/
/**
* Use push state when present.
* @property {boolean} pushState
* @default false
*/
/**
* Prevents loading of the current url when activating history.
* @property {boolean} silent
* @default false
*/
return history;
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* Enables common http request scenarios.
* @module http
* @requires jquery
* @requires knockout
*/
define('plugins/http',['jquery', 'knockout'], function($, ko) {
/**
* @class HTTPModule
* @static
*/
return {
/**
* The name of the callback parameter to inject into jsonp requests by default.
* @property {string} callbackParam
* @default callback
*/
callbackParam:'callback',
/**
* Makes an HTTP GET request.
* @method get
* @param {string} url The url to send the get request to.
* @param {object} [query] An optional key/value object to transform into query string parameters.
* @return {Promise} A promise of the get response data.
*/
get:function(url, query) {
return $.ajax(url, { data: query });
},
/**
* Makes an JSONP request.
* @method jsonp
* @param {string} url The url to send the get request to.
* @param {object} [query] An optional key/value object to transform into query string parameters.
* @param {string} [callbackParam] The name of the callback parameter the api expects (overrides the default callbackParam).
* @return {Promise} A promise of the response data.
*/
jsonp: function (url, query, callbackParam) {
if (url.indexOf('=?') == -1) {
callbackParam = callbackParam || this.callbackParam;
if (url.indexOf('?') == -1) {
url += '?';
} else {
url += '&';
}
url += callbackParam + '=?';
}
return $.ajax({
url: url,
dataType:'jsonp',
data:query
});
},
/**
* Makes an HTTP POST request.
* @method post
* @param {string} url The url to send the post request to.
* @param {object} data The data to post. It will be converted to JSON. If the data contains Knockout observables, they will be converted into normal properties before serialization.
* @return {Promise} A promise of the response data.
*/
post:function(url, data) {
return $.ajax({
url: url,
data: ko.toJSON(data),
type: 'POST',
contentType: 'application/json',
dataType: 'json'
});
}
};
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* Enables automatic observability of plain javascript object for ES5 compatible browsers. Also, converts promise properties into observables that are updated when the promise resolves.
* @module observable
* @requires system
* @requires binder
* @requires knockout
*/
define('plugins/observable',['durandal/system', 'durandal/binder', 'knockout'], function(system, binder, ko) {
var observableModule,
toString = Object.prototype.toString,
nonObservableTypes = ['[object Function]', '[object String]', '[object Boolean]', '[object Number]', '[object Date]', '[object RegExp]'],
observableArrayMethods = ['remove', 'removeAll', 'destroy', 'destroyAll', 'replace'],
arrayMethods = ['pop', 'reverse', 'sort', 'shift', 'splice'],
additiveArrayFunctions = ['push', 'unshift'],
arrayProto = Array.prototype,
observableArrayFunctions = ko.observableArray.fn,
logConversion = false;
/**
* You can call observable(obj, propertyName) to get the observable function for the specified property on the object.
* @class ObservableModule
*/
function shouldIgnorePropertyName(propertyName){
var first = propertyName[0];
return first === '_' || first === '$';
}
function isNode(obj) {
return !!(obj && obj.nodeType !== undefined && system.isNumber(obj.nodeType));
}
function canConvertType(value) {
if (!value || isNode(value) || value.ko === ko || value.jquery) {
return false;
}
var type = toString.call(value);
return nonObservableTypes.indexOf(type) == -1 && !(value === true || value === false);
}
function makeObservableArray(original, observable) {
var lookup = original.__observable__, notify = true;
if(lookup && lookup.__full__){
return;
}
lookup = lookup || (original.__observable__ = {});
lookup.__full__ = true;
observableArrayMethods.forEach(function(methodName) {
original[methodName] = function() {
notify = false;
var methodCallResult = observableArrayFunctions[methodName].apply(observable, arguments);
notify = true;
return methodCallResult;
};
});
arrayMethods.forEach(function(methodName) {
original[methodName] = function() {
if(notify){
observable.valueWillMutate();
}
var methodCallResult = arrayProto[methodName].apply(original, arguments);
if(notify){
observable.valueHasMutated();
}
return methodCallResult;
};
});
additiveArrayFunctions.forEach(function(methodName){
original[methodName] = function() {
for (var i = 0, len = arguments.length; i < len; i++) {
convertObject(arguments[i]);
}
if(notify){
observable.valueWillMutate();
}
var methodCallResult = arrayProto[methodName].apply(original, arguments);
if(notify){
observable.valueHasMutated();
}
return methodCallResult;
};
});
original['splice'] = function() {
for (var i = 2, len = arguments.length; i < len; i++) {
convertObject(arguments[i]);
}
if(notify){
observable.valueWillMutate();
}
var methodCallResult = arrayProto['splice'].apply(original, arguments);
if(notify){
observable.valueHasMutated();
}
return methodCallResult;
};
for (var i = 0, len = original.length; i < len; i++) {
convertObject(original[i]);
}
}
/**
* Converts an entire object into an observable object by re-writing its attributes using ES5 getters and setters. Attributes beginning with '_' or '$' are ignored.
* @method convertObject
* @param {object} obj The target object to convert.
*/
function convertObject(obj){
var lookup, value;
if(!canConvertType(obj)){
return;
}
lookup = obj.__observable__;
if(lookup && lookup.__full__){
return;
}
lookup = lookup || (obj.__observable__ = {});
lookup.__full__ = true;
if (system.isArray(obj)) {
var observable = ko.observableArray(obj);
makeObservableArray(obj, observable);
} else {
for (var propertyName in obj) {
if(shouldIgnorePropertyName(propertyName)){
continue;
}
if(!lookup[propertyName]){
value = obj[propertyName];
if(!system.isFunction(value)){
convertProperty(obj, propertyName, value);
}
}
}
}
if(logConversion) {
system.log('Converted', obj);
}
}
function innerSetter(observable, newValue, isArray) {
var val;
observable(newValue);
val = observable.peek();
//if this was originally an observableArray, then always check to see if we need to add/replace the array methods (if newValue was an entirely new array)
if (isArray) {
if (!val) {
//don't allow null, force to an empty array
val = [];
observable(val);
makeObservableArray(val, observable);
}
else if (!val.destroyAll) {
makeObservableArray(val, observable);
}
} else {
convertObject(val);
}
}
/**
* Converts a normal property into an observable property using ES5 getters and setters.
* @method convertProperty
* @param {object} obj The target object on which the property to convert lives.
* @param {string} propertyName The name of the property to convert.
* @param {object} [original] The original value of the property. If not specified, it will be retrieved from the object.
* @return {KnockoutObservable} The underlying observable.
*/
function convertProperty(obj, propertyName, original){
var observable,
isArray,
lookup = obj.__observable__ || (obj.__observable__ = {});
if(original === undefined){
original = obj[propertyName];
}
if (system.isArray(original)) {
observable = ko.observableArray(original);
makeObservableArray(original, observable);
isArray = true;
} else if (typeof original == "function") {
if(ko.isObservable(original)){
observable = original;
}else{
return null;
}
} else if(system.isPromise(original)) {
observable = ko.observable();
original.then(function (result) {
if(system.isArray(result)) {
var oa = ko.observableArray(result);
makeObservableArray(result, oa);
result = oa;
}
observable(result);
});
} else {
observable = ko.observable(original);
convertObject(original);
}
Object.defineProperty(obj, propertyName, {
configurable: true,
enumerable: true,
get: observable,
set: ko.isWriteableObservable(observable) ? (function (newValue) {
if (newValue && system.isPromise(newValue)) {
newValue.then(function (result) {
innerSetter(observable, result, system.isArray(result));
});
} else {
innerSetter(observable, newValue, isArray);
}
}) : undefined
});
lookup[propertyName] = observable;
return observable;
}
/**
* Defines a computed property using ES5 getters and setters.
* @method defineProperty
* @param {object} obj The target object on which to create the property.
* @param {string} propertyName The name of the property to define.
* @param {function|object} evaluatorOrOptions The Knockout computed function or computed options object.
* @return {KnockoutObservable} The underlying computed observable.
*/
function defineProperty(obj, propertyName, evaluatorOrOptions) {
var computedOptions = { owner: obj, deferEvaluation: true },
computed;
if (typeof evaluatorOrOptions === 'function') {
computedOptions.read = evaluatorOrOptions;
} else {
if ('value' in evaluatorOrOptions) {
system.error('For defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');
}
if (typeof evaluatorOrOptions.get !== 'function') {
system.error('For defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');
}
computedOptions.read = evaluatorOrOptions.get;
computedOptions.write = evaluatorOrOptions.set;
}
computed = ko.computed(computedOptions);
obj[propertyName] = computed;
return convertProperty(obj, propertyName, computed);
}
observableModule = function(obj, propertyName){
var lookup, observable, value;
if (!obj) {
return null;
}
lookup = obj.__observable__;
if(lookup){
observable = lookup[propertyName];
if(observable){
return observable;
}
}
value = obj[propertyName];
if(ko.isObservable(value)){
return value;
}
return convertProperty(obj, propertyName, value);
};
observableModule.defineProperty = defineProperty;
observableModule.convertProperty = convertProperty;
observableModule.convertObject = convertObject;
/**
* Installs the plugin into the view model binder's `beforeBind` hook so that objects are automatically converted before being bound.
* @method install
*/
observableModule.install = function(options) {
var original = binder.binding;
binder.binding = function(obj, view, instruction) {
if(instruction.applyBindings && !instruction.skipConversion){
convertObject(obj);
}
original(obj, view);
};
logConversion = options.logConversion;
};
return observableModule;
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* Connects the history module's url and history tracking support to Durandal's activation and composition engine allowing you to easily build navigation-style applications.
* @module router
* @requires system
* @requires app
* @requires activator
* @requires events
* @requires composition
* @requires history
* @requires knockout
* @requires jquery
*/
define('plugins/router',['durandal/system', 'durandal/app', 'durandal/activator', 'durandal/events', 'durandal/composition', 'plugins/history', 'knockout', 'jquery'], function(system, app, activator, events, composition, history, ko, $) {
var optionalParam = /\((.*?)\)/g;
var namedParam = /(\(\?)?:\w+/g;
var splatParam = /\*\w+/g;
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
var startDeferred, rootRouter;
var trailingSlash = /\/$/;
function routeStringToRegExp(routeString) {
routeString = routeString.replace(escapeRegExp, '\\$&')
.replace(optionalParam, '(?:$1)?')
.replace(namedParam, function(match, optional) {
return optional ? match : '([^\/]+)';
})
.replace(splatParam, '(.*?)');
return new RegExp('^' + routeString + '$');
}
function stripParametersFromRoute(route) {
var colonIndex = route.indexOf(':');
var length = colonIndex > 0 ? colonIndex - 1 : route.length;
return route.substring(0, length);
}
function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
function compareArrays(first, second) {
if (!first || !second){
return false;
}
if (first.length != second.length) {
return false;
}
for (var i = 0, len = first.length; i < len; i++) {
if (first[i] != second[i]) {
return false;
}
}
return true;
}
/**
* @class Router
* @uses Events
*/
/**
* Triggered when the navigation logic has completed.
* @event router:navigation:complete
* @param {object} instance The activated instance.
* @param {object} instruction The routing instruction.
* @param {Router} router The router.
*/
/**
* Triggered when the navigation has been cancelled.
* @event router:navigation:cancelled
* @param {object} instance The activated instance.
* @param {object} instruction The routing instruction.
* @param {Router} router The router.
*/
/**
* Triggered right before a route is activated.
* @event router:route:activating
* @param {object} instance The activated instance.
* @param {object} instruction The routing instruction.
* @param {Router} router The router.
*/
/**
* Triggered right before a route is configured.
* @event router:route:before-config
* @param {object} config The route config.
* @param {Router} router The router.
*/
/**
* Triggered just after a route is configured.
* @event router:route:after-config
* @param {object} config The route config.
* @param {Router} router The router.
*/
/**
* Triggered when the view for the activated instance is attached.
* @event router:navigation:attached
* @param {object} instance The activated instance.
* @param {object} instruction The routing instruction.
* @param {Router} router The router.
*/
/**
* Triggered when the composition that the activated instance participates in is complete.
* @event router:navigation:composition-complete
* @param {object} instance The activated instance.
* @param {object} instruction The routing instruction.
* @param {Router} router The router.
*/
/**
* Triggered when the router does not find a matching route.
* @event router:route:not-found
* @param {string} fragment The url fragment.
* @param {Router} router The router.
*/
var createRouter = function() {
var queue = [],
isProcessing = ko.observable(false),
currentActivation,
currentInstruction,
activeItem = activator.create();
var router = {
/**
* The route handlers that are registered. Each handler consists of a `routePattern` and a `callback`.
* @property {object[]} handlers
*/
handlers: [],
/**
* The route configs that are registered.
* @property {object[]} routes
*/
routes: [],
/**
* The route configurations that have been designated as displayable in a nav ui (nav:true).
* @property {KnockoutObservableArray} navigationModel
*/
navigationModel: ko.observableArray([]),
/**
* The active item/screen based on the current navigation state.
* @property {Activator} activeItem
*/
activeItem: activeItem,
/**
* Indicates that the router (or a child router) is currently in the process of navigating.
* @property {KnockoutComputed} isNavigating
*/
isNavigating: ko.computed(function() {
var current = activeItem();
var processing = isProcessing();
var currentRouterIsProcesing = current
&& current.router
&& current.router != router
&& current.router.isNavigating() ? true : false;
return processing || currentRouterIsProcesing;
}),
/**
* An observable surfacing the active routing instruction that is currently being processed or has recently finished processing.
* The instruction object has `config`, `fragment`, `queryString`, `params` and `queryParams` properties.
* @property {KnockoutObservable} activeInstruction
*/
activeInstruction:ko.observable(null),
__router__:true
};
events.includeIn(router);
activeItem.settings.areSameItem = function (currentItem, newItem, currentActivationData, newActivationData) {
if (currentItem == newItem) {
return compareArrays(currentActivationData, newActivationData);
}
return false;
};
function hasChildRouter(instance) {
return instance.router && instance.router.parent == router;
}
function setCurrentInstructionRouteIsActive(flag) {
if (currentInstruction && currentInstruction.config.isActive) {
currentInstruction.config.isActive(flag)
}
}
function completeNavigation(instance, instruction) {
system.log('Navigation Complete', instance, instruction);
var fromModuleId = system.getModuleId(currentActivation);
if (fromModuleId) {
router.trigger('router:navigation:from:' + fromModuleId);
}
currentActivation = instance;
setCurrentInstructionRouteIsActive(false);
currentInstruction = instruction;
setCurrentInstructionRouteIsActive(true);
var toModuleId = system.getModuleId(currentActivation);
if (toModuleId) {
router.trigger('router:navigation:to:' + toModuleId);
}
if (!hasChildRouter(instance)) {
router.updateDocumentTitle(instance, instruction);
}
rootRouter.explicitNavigation = false;
rootRouter.navigatingBack = false;
router.trigger('router:navigation:complete', instance, instruction, router);
}
function cancelNavigation(instance, instruction) {
system.log('Navigation Cancelled');
router.activeInstruction(currentInstruction);
if (currentInstruction) {
router.navigate(currentInstruction.fragment, false);
}
isProcessing(false);
rootRouter.explicitNavigation = false;
rootRouter.navigatingBack = false;
router.trigger('router:navigation:cancelled', instance, instruction, router);
}
function redirect(url) {
system.log('Navigation Redirecting');
isProcessing(false);
rootRouter.explicitNavigation = false;
rootRouter.navigatingBack = false;
router.navigate(url, { trigger: true, replace: true });
}
function activateRoute(activator, instance, instruction) {
rootRouter.navigatingBack = !rootRouter.explicitNavigation && currentActivation != instruction.fragment;
router.trigger('router:route:activating', instance, instruction, router);
activator.activateItem(instance, instruction.params).then(function(succeeded) {
if (succeeded) {
var previousActivation = currentActivation;
completeNavigation(instance, instruction);
if (hasChildRouter(instance)) {
var fullFragment = instruction.fragment;
if (instruction.queryString) {
fullFragment += "?" + instruction.queryString;
}
instance.router.loadUrl(fullFragment);
}
if (previousActivation == instance) {
router.attached();
router.compositionComplete();
}
} else if(activator.settings.lifecycleData && activator.settings.lifecycleData.redirect){
redirect(activator.settings.lifecycleData.redirect);
}else{
cancelNavigation(instance, instruction);
}
if (startDeferred) {
startDeferred.resolve();
startDeferred = null;
}
}).fail(function(err){
system.error(err);
});;
}
/**
* Inspects routes and modules before activation. Can be used to protect access by cancelling navigation or redirecting.
* @method guardRoute
* @param {object} instance The module instance that is about to be activated by the router.
* @param {object} instruction The route instruction. The instruction object has config, fragment, queryString, params and queryParams properties.
* @return {Promise|Boolean|String} If a boolean, determines whether or not the route should activate or be cancelled. If a string, causes a redirect to the specified route. Can also be a promise for either of these value types.
*/
function handleGuardedRoute(activator, instance, instruction) {
var resultOrPromise = router.guardRoute(instance, instruction);
if (resultOrPromise) {
if (resultOrPromise.then) {
resultOrPromise.then(function(result) {
if (result) {
if (system.isString(result)) {
redirect(result);
} else {
activateRoute(activator, instance, instruction);
}
} else {
cancelNavigation(instance, instruction);
}
});
} else {
if (system.isString(resultOrPromise)) {
redirect(resultOrPromise);
} else {
activateRoute(activator, instance, instruction);
}
}
} else {
cancelNavigation(instance, instruction);
}
}
function ensureActivation(activator, instance, instruction) {
if (router.guardRoute) {
handleGuardedRoute(activator, instance, instruction);
} else {
activateRoute(activator, instance, instruction);
}
}
function canReuseCurrentActivation(instruction) {
return currentInstruction
&& currentInstruction.config.moduleId == instruction.config.moduleId
&& currentActivation
&& ((currentActivation.canReuseForRoute && currentActivation.canReuseForRoute.apply(currentActivation, instruction.params))
|| (!currentActivation.canReuseForRoute && currentActivation.router && currentActivation.router.loadUrl));
}
function dequeueInstruction() {
if (isProcessing()) {
return;
}
var instruction = queue.shift();
queue = [];
if (!instruction) {
return;
}
isProcessing(true);
router.activeInstruction(instruction);
if (canReuseCurrentActivation(instruction)) {
ensureActivation(activator.create(), currentActivation, instruction);
} else {
system.acquire(instruction.config.moduleId).then(function(module) {
var instance = system.resolveObject(module);
ensureActivation(activeItem, instance, instruction);
}).fail(function(err){
system.error('Failed to load routed module (' + instruction.config.moduleId + '). Details: ' + err.message);
});
}
}
function queueInstruction(instruction) {
queue.unshift(instruction);
dequeueInstruction();
}
// Given a route, and a URL fragment that it matches, return the array of
// extracted decoded parameters. Empty or unmatched parameters will be
// treated as `null` to normalize cross-browser behavior.
function createParams(routePattern, fragment, queryString) {
var params = routePattern.exec(fragment).slice(1);
for (var i = 0; i < params.length; i++) {
var current = params[i];
params[i] = current ? decodeURIComponent(current) : null;
}
var queryParams = router.parseQueryString(queryString);
if (queryParams) {
params.push(queryParams);
}
return {
params:params,
queryParams:queryParams
};
}
function configureRoute(config){
router.trigger('router:route:before-config', config, router);
if (!system.isRegExp(config)) {
config.title = config.title || router.convertRouteToTitle(config.route);
config.moduleId = config.moduleId || router.convertRouteToModuleId(config.route);
config.hash = config.hash || router.convertRouteToHash(config.route);
config.routePattern = routeStringToRegExp(config.route);
}else{
config.routePattern = config.route;
}
config.isActive = config.isActive || ko.observable(false);
router.trigger('router:route:after-config', config, router);
router.routes.push(config);
router.route(config.routePattern, function(fragment, queryString) {
var paramInfo = createParams(config.routePattern, fragment, queryString);
queueInstruction({
fragment: fragment,
queryString:queryString,
config: config,
params: paramInfo.params,
queryParams:paramInfo.queryParams
});
});
};
function mapRoute(config) {
if(system.isArray(config.route)){
var isActive = config.isActive || ko.observable(false);
for(var i = 0, length = config.route.length; i < length; i++){
var current = system.extend({}, config);
current.route = config.route[i];
current.isActive = isActive;
if(i > 0){
delete current.nav;
}
configureRoute(current);
}
}else{
configureRoute(config);
}
return router;
}
/**
* Parses a query string into an object.
* @method parseQueryString
* @param {string} queryString The query string to parse.
* @return {object} An object keyed according to the query string parameters.
*/
router.parseQueryString = function (queryString) {
var queryObject, pairs;
if (!queryString) {
return null;
}
pairs = queryString.split('&');
if (pairs.length == 0) {
return null;
}
queryObject = {};
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i];
if (pair === '') {
continue;
}
var parts = pair.split('=');
queryObject[parts[0]] = parts[1] && decodeURIComponent(parts[1].replace(/\+/g, ' '));
}
return queryObject;
};
/**
* Add a route to be tested when the url fragment changes.
* @method route
* @param {RegEx} routePattern The route pattern to test against.
* @param {function} callback The callback to execute when the route pattern is matched.
*/
router.route = function(routePattern, callback) {
router.handlers.push({ routePattern: routePattern, callback: callback });
};
/**
* Attempt to load the specified URL fragment. If a route succeeds with a match, returns `true`. If no defined routes matches the fragment, returns `false`.
* @method loadUrl
* @param {string} fragment The URL fragment to find a match for.
* @return {boolean} True if a match was found, false otherwise.
*/
router.loadUrl = function(fragment) {
var handlers = router.handlers,
queryString = null,
coreFragment = fragment,
queryIndex = fragment.indexOf('?');
if (queryIndex != -1) {
coreFragment = fragment.substring(0, queryIndex);
queryString = fragment.substr(queryIndex + 1);
}
if(router.relativeToParentRouter){
var instruction = this.parent.activeInstruction();
coreFragment = instruction.params.join('/');
if(coreFragment && coreFragment.charAt(0) == '/'){
coreFragment = coreFragment.substr(1);
}
if(!coreFragment){
coreFragment = '';
}
coreFragment = coreFragment.replace('//', '/').replace('//', '/');
}
coreFragment = coreFragment.replace(trailingSlash, '');
for (var i = 0; i < handlers.length; i++) {
var current = handlers[i];
if (current.routePattern.test(coreFragment)) {
current.callback(coreFragment, queryString);
return true;
}
}
system.log('Route Not Found');
router.trigger('router:route:not-found', fragment, router);
if (currentInstruction) {
history.navigate(currentInstruction.fragment, { trigger:false, replace:true });
}
rootRouter.explicitNavigation = false;
rootRouter.navigatingBack = false;
return false;
};
/**
* Updates the document title based on the activated module instance, the routing instruction and the app.title.
* @method updateDocumentTitle
* @param {object} instance The activated module.
* @param {object} instruction The routing instruction associated with the action. It has a `config` property that references the original route mapping config.
*/
router.updateDocumentTitle = function(instance, instruction) {
if (instruction.config.title) {
if (app.title) {
document.title = instruction.config.title + " | " + app.title;
} else {
document.title = instruction.config.title;
}
} else if (app.title) {
document.title = app.title;
}
};
/**
* Save a fragment into the hash history, or replace the URL state if the
* 'replace' option is passed. You are responsible for properly URL-encoding
* the fragment in advance.
* The options object can contain `trigger: false` if you wish to not have the
* route callback be fired, or `replace: true`, if
* you wish to modify the current URL without adding an entry to the history.
* @method navigate
* @param {string} fragment The url fragment to navigate to.
* @param {object|boolean} options An options object with optional trigger and replace flags. You can also pass a boolean directly to set the trigger option. Trigger is `true` by default.
* @return {boolean} Returns true/false from loading the url.
*/
router.navigate = function(fragment, options) {
if(fragment && fragment.indexOf('://') != -1){
window.location.href = fragment;
return true;
}
rootRouter.explicitNavigation = true;
return history.navigate(fragment, options);
};
/**
* Navigates back in the browser history.
* @method navigateBack
*/
router.navigateBack = function() {
history.navigateBack();
};
router.attached = function() {
router.trigger('router:navigation:attached', currentActivation, currentInstruction, router);
};
router.compositionComplete = function(){
isProcessing(false);
router.trigger('router:navigation:composition-complete', currentActivation, currentInstruction, router);
dequeueInstruction();
};
/**
* Converts a route to a hash suitable for binding to a link's href.
* @method convertRouteToHash
* @param {string} route
* @return {string} The hash.
*/
router.convertRouteToHash = function(route) {
if(router.relativeToParentRouter){
var instruction = router.parent.activeInstruction(),
hash = instruction.config.hash + '/' + route;
if(history._hasPushState){
hash = '/' + hash;
}
hash = hash.replace('//', '/').replace('//', '/');
return hash;
}
if(history._hasPushState){
return route;
}
return "#" + route;
};
/**
* Converts a route to a module id. This is only called if no module id is supplied as part of the route mapping.
* @method convertRouteToModuleId
* @param {string} route
* @return {string} The module id.
*/
router.convertRouteToModuleId = function(route) {
return stripParametersFromRoute(route);
};
/**
* Converts a route to a displayable title. This is only called if no title is specified as part of the route mapping.
* @method convertRouteToTitle
* @param {string} route
* @return {string} The title.
*/
router.convertRouteToTitle = function(route) {
var value = stripParametersFromRoute(route);
return value.substring(0, 1).toUpperCase() + value.substring(1);
};
/**
* Maps route patterns to modules.
* @method map
* @param {string|object|object[]} route A route, config or array of configs.
* @param {object} [config] The config for the specified route.
* @chainable
* @example
router.map([
{ route: '', title:'Home', moduleId: 'homeScreen', nav: true },
{ route: 'customer/:id', moduleId: 'customerDetails'}
]);
*/
router.map = function(route, config) {
if (system.isArray(route)) {
for (var i = 0; i < route.length; i++) {
router.map(route[i]);
}
return router;
}
if (system.isString(route) || system.isRegExp(route)) {
if (!config) {
config = {};
} else if (system.isString(config)) {
config = { moduleId: config };
}
config.route = route;
} else {
config = route;
}
return mapRoute(config);
};
/**
* Builds an observable array designed to bind a navigation UI to. The model will exist in the `navigationModel` property.
* @method buildNavigationModel
* @param {number} defaultOrder The default order to use for navigation visible routes that don't specify an order. The default is 100 and each successive route will be one more than that.
* @chainable
*/
router.buildNavigationModel = function(defaultOrder) {
var nav = [], routes = router.routes;
var fallbackOrder = defaultOrder || 100;
for (var i = 0; i < routes.length; i++) {
var current = routes[i];
if (current.nav) {
if (!system.isNumber(current.nav)) {
current.nav = ++fallbackOrder;
}
nav.push(current);
}
}
nav.sort(function(a, b) { return a.nav - b.nav; });
router.navigationModel(nav);
return router;
};
/**
* Configures how the router will handle unknown routes.
* @method mapUnknownRoutes
* @param {string|function} [config] If not supplied, then the router will map routes to modules with the same name.
* If a string is supplied, it represents the module id to route all unknown routes to.
* Finally, if config is a function, it will be called back with the route instruction containing the route info. The function can then modify the instruction by adding a moduleId and the router will take over from there.
* @param {string} [replaceRoute] If config is a module id, then you can optionally provide a route to replace the url with.
* @chainable
*/
router.mapUnknownRoutes = function(config, replaceRoute) {
var catchAllRoute = "*catchall";
var catchAllPattern = routeStringToRegExp(catchAllRoute);
router.route(catchAllPattern, function (fragment, queryString) {
var paramInfo = createParams(catchAllPattern, fragment, queryString);
var instruction = {
fragment: fragment,
queryString: queryString,
config: {
route: catchAllRoute,
routePattern: catchAllPattern
},
params: paramInfo.params,
queryParams: paramInfo.queryParams
};
if (!config) {
instruction.config.moduleId = fragment;
} else if (system.isString(config)) {
instruction.config.moduleId = config;
if(replaceRoute){
history.navigate(replaceRoute, { trigger:false, replace:true });
}
} else if (system.isFunction(config)) {
var result = config(instruction);
if (result && result.then) {
result.then(function() {
router.trigger('router:route:before-config', instruction.config, router);
router.trigger('router:route:after-config', instruction.config, router);
queueInstruction(instruction);
});
return;
}
} else {
instruction.config = config;
instruction.config.route = catchAllRoute;
instruction.config.routePattern = catchAllPattern;
}
router.trigger('router:route:before-config', instruction.config, router);
router.trigger('router:route:after-config', instruction.config, router);
queueInstruction(instruction);
});
return router;
};
/**
* Resets the router by removing handlers, routes, event handlers and previously configured options.
* @method reset
* @chainable
*/
router.reset = function() {
currentInstruction = currentActivation = undefined;
router.handlers = [];
router.routes = [];
router.off();
delete router.options;
return router;
};
/**
* Makes all configured routes and/or module ids relative to a certain base url.
* @method makeRelative
* @param {string|object} settings If string, the value is used as the base for routes and module ids. If an object, you can specify `route` and `moduleId` separately. In place of specifying route, you can set `fromParent:true` to make routes automatically relative to the parent router's active route.
* @chainable
*/
router.makeRelative = function(settings){
if(system.isString(settings)){
settings = {
moduleId:settings,
route:settings
};
}
if(settings.moduleId && !endsWith(settings.moduleId, '/')){
settings.moduleId += '/';
}
if(settings.route && !endsWith(settings.route, '/')){
settings.route += '/';
}
if(settings.fromParent){
router.relativeToParentRouter = true;
}
router.on('router:route:before-config').then(function(config){
if(settings.moduleId){
config.moduleId = settings.moduleId + config.moduleId;
}
if(settings.route){
if(config.route === ''){
config.route = settings.route.substring(0, settings.route.length - 1);
}else{
config.route = settings.route + config.route;
}
}
});
return router;
};
/**
* Creates a child router.
* @method createChildRouter
* @return {Router} The child router.
*/
router.createChildRouter = function() {
var childRouter = createRouter();
childRouter.parent = router;
return childRouter;
};
return router;
};
/**
* @class RouterModule
* @extends Router
* @static
*/
rootRouter = createRouter();
rootRouter.explicitNavigation = false;
rootRouter.navigatingBack = false;
/**
* Verify that the target is the current window
* @method targetIsThisWindow
* @return {boolean} True if the event's target is the current window, false otherwise.
*/
rootRouter.targetIsThisWindow = function(event) {
var targetWindow = $(event.target).attr('target');
if (!targetWindow ||
targetWindow === window.name ||
targetWindow === '_self' ||
(targetWindow === 'top' && window === window.top)) { return true; }
return false;
};
/**
* Activates the router and the underlying history tracking mechanism.
* @method activate
* @return {Promise} A promise that resolves when the router is ready.
*/
rootRouter.activate = function(options) {
return system.defer(function(dfd) {
startDeferred = dfd;
rootRouter.options = system.extend({ routeHandler: rootRouter.loadUrl }, rootRouter.options, options);
history.activate(rootRouter.options);
if(history._hasPushState){
var routes = rootRouter.routes,
i = routes.length;
while(i--){
var current = routes[i];
current.hash = current.hash.replace('#', '');
}
}
$(document).delegate("a", 'click', function(evt){
if(history._hasPushState){
if(!evt.altKey && !evt.ctrlKey && !evt.metaKey && !evt.shiftKey && rootRouter.targetIsThisWindow(evt)){
var href = $(this).attr("href");
// Ensure the protocol is not part of URL, meaning its relative.
// Stop the event bubbling to ensure the link will not cause a page refresh.
if (href != null && !(href.charAt(0) === "#" || /^[a-z]+:/i.test(href))) {
rootRouter.explicitNavigation = true;
evt.preventDefault();
history.navigate(href);
}
}
}else{
rootRouter.explicitNavigation = true;
}
});
if(history.options.silent && startDeferred){
startDeferred.resolve();
startDeferred = null;
}
}).promise();
};
/**
* Disable history, perhaps temporarily. Not useful in a real app, but possibly useful for unit testing Routers.
* @method deactivate
*/
rootRouter.deactivate = function() {
history.deactivate();
};
/**
* Installs the router's custom ko binding handler.
* @method install
*/
rootRouter.install = function(){
ko.bindingHandlers.router = {
init: function() {
return { controlsDescendantBindings: true };
},
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var settings = ko.utils.unwrapObservable(valueAccessor()) || {};
if (settings.__router__) {
settings = {
model:settings.activeItem(),
attached:settings.attached,
compositionComplete:settings.compositionComplete,
activate: false
};
} else {
var theRouter = ko.utils.unwrapObservable(settings.router || viewModel.router) || rootRouter;
settings.model = theRouter.activeItem();
settings.attached = theRouter.attached;
settings.compositionComplete = theRouter.compositionComplete;
settings.activate = false;
}
composition.compose(element, settings, bindingContext);
}
};
ko.virtualElements.allowedBindings.router = true;
};
return rootRouter;
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* Serializes and deserializes data to/from JSON.
* @module serializer
* @requires system
*/
define('plugins/serializer',['durandal/system'], function(system) {
/**
* @class SerializerModule
* @static
*/
return {
/**
* The name of the attribute that the serializer should use to identify an object's type.
* @property {string} typeAttribute
* @default type
*/
typeAttribute: 'type',
/**
* The amount of space to use for indentation when writing out JSON.
* @property {string|number} space
* @default undefined
*/
space:undefined,
/**
* The default replacer function used during serialization. By default properties starting with '_' or '$' are removed from the serialized object.
* @method replacer
* @param {string} key The object key to check.
* @param {object} value The object value to check.
* @return {object} The value to serialize.
*/
replacer: function(key, value) {
if(key){
var first = key[0];
if(first === '_' || first === '$'){
return undefined;
}
}
return value;
},
/**
* Serializes the object.
* @method serialize
* @param {object} object The object to serialize.
* @param {object} [settings] Settings can specify a replacer or space to override the serializer defaults.
* @return {string} The JSON string.
*/
serialize: function(object, settings) {
settings = (settings === undefined) ? {} : settings;
if(system.isString(settings) || system.isNumber(settings)) {
settings = { space: settings };
}
return JSON.stringify(object, settings.replacer || this.replacer, settings.space || this.space);
},
/**
* Gets the type id for an object instance, using the configured `typeAttribute`.
* @method getTypeId
* @param {object} object The object to serialize.
* @return {string} The type.
*/
getTypeId: function(object) {
if (object) {
return object[this.typeAttribute];
}
return undefined;
},
/**
* Maps type ids to object constructor functions. Keys are type ids and values are functions.
* @property {object} typeMap.
*/
typeMap: {},
/**
* Adds a type id/constructor function mampping to the `typeMap`.
* @method registerType
* @param {string} typeId The type id.
* @param {function} constructor The constructor.
*/
registerType: function() {
var first = arguments[0];
if (arguments.length == 1) {
var id = first[this.typeAttribute] || system.getModuleId(first);
this.typeMap[id] = first;
} else {
this.typeMap[first] = arguments[1];
}
},
/**
* The default reviver function used during deserialization. By default is detects type properties on objects and uses them to re-construct the correct object using the provided constructor mapping.
* @method reviver
* @param {string} key The attribute key.
* @param {object} value The object value associated with the key.
* @param {function} getTypeId A custom function used to get the type id from a value.
* @param {object} getConstructor A custom function used to get the constructor function associated with a type id.
* @return {object} The value.
*/
reviver: function(key, value, getTypeId, getConstructor) {
var typeId = getTypeId(value);
if (typeId) {
var ctor = getConstructor(typeId);
if (ctor) {
if (ctor.fromJSON) {
return ctor.fromJSON(value);
}
return new ctor(value);
}
}
return value;
},
/**
* Deserialize the JSON.
* @method deserialize
* @param {string} text The JSON string.
* @param {object} [settings] Settings can specify a reviver, getTypeId function or getConstructor function.
* @return {object} The deserialized object.
*/
deserialize: function(text, settings) {
var that = this;
settings = settings || {};
var getTypeId = settings.getTypeId || function(object) { return that.getTypeId(object); };
var getConstructor = settings.getConstructor || function(id) { return that.typeMap[id]; };
var reviver = settings.reviver || function(key, value) { return that.reviver(key, value, getTypeId, getConstructor); };
return JSON.parse(text, reviver);
}
};
});
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* Layers the widget sugar on top of the composition system.
* @module widget
* @requires system
* @requires composition
* @requires jquery
* @requires knockout
*/
define('plugins/widget',['durandal/system', 'durandal/composition', 'jquery', 'knockout'], function(system, composition, $, ko) {
var kindModuleMaps = {},
kindViewMaps = {},
bindableSettings = ['model', 'view', 'kind'],
widgetDataKey = 'durandal-widget-data';
function extractParts(element, settings){
var data = ko.utils.domData.get(element, widgetDataKey);
if(!data){
data = {
parts:composition.cloneNodes(ko.virtualElements.childNodes(element))
};
ko.virtualElements.emptyNode(element);
ko.utils.domData.set(element, widgetDataKey, data);
}
settings.parts = data.parts;
}
/**
* @class WidgetModule
* @static
*/
var widget = {
getSettings: function(valueAccessor) {
var settings = ko.utils.unwrapObservable(valueAccessor()) || {};
if (system.isString(settings)) {
return { kind: settings };
}
for (var attrName in settings) {
if (ko.utils.arrayIndexOf(bindableSettings, attrName) != -1) {
settings[attrName] = ko.utils.unwrapObservable(settings[attrName]);
} else {
settings[attrName] = settings[attrName];
}
}
return settings;
},
/**
* Creates a ko binding handler for the specified kind.
* @method registerKind
* @param {string} kind The kind to create a custom binding handler for.
*/
registerKind: function(kind) {
ko.bindingHandlers[kind] = {
init: function() {
return { controlsDescendantBindings: true };
},
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var settings = widget.getSettings(valueAccessor);
settings.kind = kind;
extractParts(element, settings);
widget.create(element, settings, bindingContext, true);
}
};
ko.virtualElements.allowedBindings[kind] = true;
composition.composeBindings.push(kind + ':');
},
/**
* Maps views and module to the kind identifier if a non-standard pattern is desired.
* @method mapKind
* @param {string} kind The kind name.
* @param {string} [viewId] The unconventional view id to map the kind to.
* @param {string} [moduleId] The unconventional module id to map the kind to.
*/
mapKind: function(kind, viewId, moduleId) {
if (viewId) {
kindViewMaps[kind] = viewId;
}
if (moduleId) {
kindModuleMaps[kind] = moduleId;
}
},
/**
* Maps a kind name to it's module id. First it looks up a custom mapped kind, then falls back to `convertKindToModulePath`.
* @method mapKindToModuleId
* @param {string} kind The kind name.
* @return {string} The module id.
*/
mapKindToModuleId: function(kind) {
return kindModuleMaps[kind] || widget.convertKindToModulePath(kind);
},
/**
* Converts a kind name to it's module path. Used to conventionally map kinds who aren't explicitly mapped through `mapKind`.
* @method convertKindToModulePath
* @param {string} kind The kind name.
* @return {string} The module path.
*/
convertKindToModulePath: function(kind) {
return 'widgets/' + kind + '/viewmodel';
},
/**
* Maps a kind name to it's view id. First it looks up a custom mapped kind, then falls back to `convertKindToViewPath`.
* @method mapKindToViewId
* @param {string} kind The kind name.
* @return {string} The view id.
*/
mapKindToViewId: function(kind) {
return kindViewMaps[kind] || widget.convertKindToViewPath(kind);
},
/**
* Converts a kind name to it's view id. Used to conventionally map kinds who aren't explicitly mapped through `mapKind`.
* @method convertKindToViewPath
* @param {string} kind The kind name.
* @return {string} The view id.
*/
convertKindToViewPath: function(kind) {
return 'widgets/' + kind + '/view';
},
createCompositionSettings: function(element, settings) {
if (!settings.model) {
settings.model = this.mapKindToModuleId(settings.kind);
}
if (!settings.view) {
settings.view = this.mapKindToViewId(settings.kind);
}
settings.preserveContext = true;
settings.activate = true;
settings.activationData = settings;
settings.mode = 'templated';
return settings;
},
/**
* Creates a widget.
* @method create
* @param {DOMElement} element The DOMElement or knockout virtual element that serves as the target element for the widget.
* @param {object} settings The widget settings.
* @param {object} [bindingContext] The current binding context.
*/
create: function(element, settings, bindingContext, fromBinding) {
if(!fromBinding){
settings = widget.getSettings(function() { return settings; }, element);
}
var compositionSettings = widget.createCompositionSettings(element, settings);
composition.compose(element, compositionSettings, bindingContext);
},
/**
* Installs the widget module by adding the widget binding handler and optionally registering kinds.
* @method install
* @param {object} config The module config. Add a `kinds` array with the names of widgets to automatically register. You can also specify a `bindingName` if you wish to use another name for the widget binding, such as "control" for example.
*/
install:function(config){
config.bindingName = config.bindingName || 'widget';
if(config.kinds){
var toRegister = config.kinds;
for(var i = 0; i < toRegister.length; i++){
widget.registerKind(toRegister[i]);
}
}
ko.bindingHandlers[config.bindingName] = {
init: function() {
return { controlsDescendantBindings: true };
},
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var settings = widget.getSettings(valueAccessor);
extractParts(element, settings);
widget.create(element, settings, bindingContext, true);
}
};
composition.composeBindings.push(config.bindingName + ':');
ko.virtualElements.allowedBindings[config.bindingName] = true;
}
};
return widget;
});
/**
* @license RequireJS text 2.0.3 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/requirejs/text for details
*/
/*jslint regexp: true */
/*global require: false, XMLHttpRequest: false, ActiveXObject: false,
define: false, window: false, process: false, Packages: false,
java: false, location: false */
define('text',['module'], function (module) {
var text, fs,
progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
hasLocation = typeof location !== 'undefined' && location.href,
defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''),
defaultHostName = hasLocation && location.hostname,
defaultPort = hasLocation && (location.port || undefined),
buildMap = [],
masterConfig = (module.config && module.config()) || {};
text = {
version: '2.0.3',
strip: function (content) {
//Strips <?xml ...?> declarations so that external SVG and XML
//documents can be added to a document without worry. Also, if the string
//is an HTML document, only the part inside the body tag is returned.
if (content) {
content = content.replace(xmlRegExp, "");
var matches = content.match(bodyRegExp);
if (matches) {
content = matches[1];
}
} else {
content = "";
}
return content;
},
jsEscape: function (content) {
return content.replace(/(['\\])/g, '\\$1')
.replace(/[\f]/g, "\\f")
.replace(/[\b]/g, "\\b")
.replace(/[\n]/g, "\\n")
.replace(/[\t]/g, "\\t")
.replace(/[\r]/g, "\\r")
.replace(/[\u2028]/g, "\\u2028")
.replace(/[\u2029]/g, "\\u2029");
},
createXhr: masterConfig.createXhr || function () {
//Would love to dump the ActiveX crap in here. Need IE 6 to die first.
var xhr, i, progId;
if (typeof XMLHttpRequest !== "undefined") {
return new XMLHttpRequest();
} else if (typeof ActiveXObject !== "undefined") {
for (i = 0; i < 3; i += 1) {
progId = progIds[i];
try {
xhr = new ActiveXObject(progId);
} catch (e) {}
if (xhr) {
progIds = [progId]; // so faster next time
break;
}
}
}
return xhr;
},
/**
* Parses a resource name into its component parts. Resource names
* look like: module/name.ext!strip, where the !strip part is
* optional.
* @param {String} name the resource name
* @returns {Object} with properties "moduleName", "ext" and "strip"
* where strip is a boolean.
*/
parseName: function (name) {
var strip = false, index = name.indexOf("."),
modName = name.substring(0, index),
ext = name.substring(index + 1, name.length);
index = ext.indexOf("!");
if (index !== -1) {
//Pull off the strip arg.
strip = ext.substring(index + 1, ext.length);
strip = strip === "strip";
ext = ext.substring(0, index);
}
return {
moduleName: modName,
ext: ext,
strip: strip
};
},
xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
/**
* Is an URL on another domain. Only works for browser use, returns
* false in non-browser environments. Only used to know if an
* optimized .js version of a text resource should be loaded
* instead.
* @param {String} url
* @returns Boolean
*/
useXhr: function (url, protocol, hostname, port) {
var uProtocol, uHostName, uPort,
match = text.xdRegExp.exec(url);
if (!match) {
return true;
}
uProtocol = match[2];
uHostName = match[3];
uHostName = uHostName.split(':');
uPort = uHostName[1];
uHostName = uHostName[0];
return (!uProtocol || uProtocol === protocol) &&
(!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
((!uPort && !uHostName) || uPort === port);
},
finishLoad: function (name, strip, content, onLoad) {
content = strip ? text.strip(content) : content;
if (masterConfig.isBuild) {
buildMap[name] = content;
}
onLoad(content);
},
load: function (name, req, onLoad, config) {
//Name has format: some.module.filext!strip
//The strip part is optional.
//if strip is present, then that means only get the string contents
//inside a body tag in an HTML string. For XML/SVG content it means
//removing the <?xml ...?> declarations so the content can be inserted
//into the current doc without problems.
// Do not bother with the work if a build and text will
// not be inlined.
if (config.isBuild && !config.inlineText) {
onLoad();
return;
}
masterConfig.isBuild = config.isBuild;
var parsed = text.parseName(name),
nonStripName = parsed.moduleName + '.' + parsed.ext,
url = req.toUrl(nonStripName),
useXhr = (masterConfig.useXhr) ||
text.useXhr;
//Load the text. Use XHR if possible and in a browser.
if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) {
text.get(url, function (content) {
text.finishLoad(name, parsed.strip, content, onLoad);
}, function (err) {
if (onLoad.error) {
onLoad.error(err);
}
});
} else {
//Need to fetch the resource across domains. Assume
//the resource has been optimized into a JS module. Fetch
//by the module name + extension, but do not include the
//!strip part to avoid file system issues.
req([nonStripName], function (content) {
text.finishLoad(parsed.moduleName + '.' + parsed.ext,
parsed.strip, content, onLoad);
});
}
},
write: function (pluginName, moduleName, write, config) {
if (buildMap.hasOwnProperty(moduleName)) {
var content = text.jsEscape(buildMap[moduleName]);
write.asModule(pluginName + "!" + moduleName,
"define(function () { return '" +
content +
"';});\n");
}
},
writeFile: function (pluginName, moduleName, req, write, config) {
var parsed = text.parseName(moduleName),
nonStripName = parsed.moduleName + '.' + parsed.ext,
//Use a '.js' file name so that it indicates it is a
//script that can be loaded across domains.
fileName = req.toUrl(parsed.moduleName + '.' +
parsed.ext) + '.js';
//Leverage own load() method to load plugin value, but only
//write out values that do not have the strip argument,
//to avoid any potential issues with ! in file names.
text.load(nonStripName, req, function (value) {
//Use own write() method to construct full module value.
//But need to create shell that translates writeFile's
//write() to the right interface.
var textWrite = function (contents) {
return write(fileName, contents);
};
textWrite.asModule = function (moduleName, contents) {
return write.asModule(moduleName, fileName, contents);
};
text.write(pluginName, nonStripName, textWrite, config);
}, config);
}
};
if (masterConfig.env === 'node' || (!masterConfig.env &&
typeof process !== "undefined" &&
process.versions &&
!!process.versions.node)) {
//Using special require.nodeRequire, something added by r.js.
fs = require.nodeRequire('fs');
text.get = function (url, callback) {
var file = fs.readFileSync(url, 'utf8');
//Remove BOM (Byte Mark Order) from utf8 files if it is there.
if (file.indexOf('\uFEFF') === 0) {
file = file.substring(1);
}
callback(file);
};
} else if (masterConfig.env === 'xhr' || (!masterConfig.env &&
text.createXhr())) {
text.get = function (url, callback, errback) {
var xhr = text.createXhr();
xhr.open('GET', url, true);
//Allow overrides specified in config
if (masterConfig.onXhr) {
masterConfig.onXhr(xhr, url);
}
xhr.onreadystatechange = function (evt) {
var status, err;
//Do not explicitly handle errors, those should be
//visible via console output in the browser.
if (xhr.readyState === 4) {
status = xhr.status;
if (status > 399 && status < 600) {
//An http 4xx or 5xx error. Signal an error.
err = new Error(url + ' HTTP status: ' + status);
err.xhr = xhr;
errback(err);
} else {
callback(xhr.responseText);
}
}
};
xhr.send(null);
};
} else if (masterConfig.env === 'rhino' || (!masterConfig.env &&
typeof Packages !== 'undefined' && typeof java !== 'undefined')) {
//Why Java, why is this so awkward?
text.get = function (url, callback) {
var stringBuffer, line,
encoding = "utf-8",
file = new java.io.File(url),
lineSeparator = java.lang.System.getProperty("line.separator"),
input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
content = '';
try {
stringBuffer = new java.lang.StringBuffer();
line = input.readLine();
// Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
// http://www.unicode.org/faq/utf_bom.html
// Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
if (line && line.length() && line.charAt(0) === 0xfeff) {
// Eat the BOM, since we've already found the encoding on this file,
// and we plan to concatenating this buffer with others; the BOM should
// only appear at the top of a file.
line = line.substring(1);
}
stringBuffer.append(line);
while ((line = input.readLine()) !== null) {
stringBuffer.append(lineSeparator);
stringBuffer.append(line);
}
//Make sure we return a JavaScript string and not a Java string.
content = String(stringBuffer.toString()); //String
} finally {
input.close();
}
callback(content);
};
}
return text;
});
define('text!shell.html',[],function () { return '<section>\r\n <h2>Hello! What is your name?</h2>\r\n <form class="form-inline">\r\n <fieldset>\r\n <label>Name</label>\r\n <input type="text" data-bind="value: name, valueUpdate: \'afterkeydown\'"/>\r\n <button type="submit" class="btn" data-bind="click: sayHello, enable: name">Click Me</button>\r\n </fieldset>\r\n </form>\r\n</section>';});
require(["main2"]);
}());//# sourceMappingURL=main.js.map
|
code
|
PJ Walker has been entertaining children and adults with his unique brand of Magic and Comedy for over thirty years. His shows are always funny, exciting, and, most of all, mystifying. Whether on stage, in a hired hall or the comfort of your personal home or family room, PJ Walker can adjust his performance to fit your needs. Children shows, family audiences or Corporate or Club functions, all get customized magic and comedy to suit the audience and the occasion.
And, a unique feature in the entertainment industry, PJ Walker guarantees his performances. So, you can be sure that the Magic and Comedy of PJ Walker will Guarantee that your public function, or private affair, will be a hit!
"The Famous Elephant Wedding Bands"
|
english
|
२०२४ तक प्म पद के लिए कोई वैकेंसी नहीं- ब्जप
जल्दी एकजुट हों, नहीं तो भविष्य अंधकारमय- लालू
२०१९ के लिए ज्यादा से ज्यादा विपक्षी दल एक साथ आएं- नीतीश
वर्ष २०१९ में देश का अगला लोकसभा चुनाव होगा. लेकिन इसे लेकर अभी से विपक्षियों की छटपटाहट दिखने लगी है. बिहार में खासकर जेडीयू, राजद और कांग्रेस की ओर से आते तरह-तरह के बयानों से सियासत गर्म है. जाहिर है, यूपी विधानसभा के नतीजों ने राजद और जदयू की नीन्दें उड़ा दी हैं.
पहले लालू ने ट्वीट करके कांग्रेस समेत सभी विपक्षी दलों को एक साथ आने को कहा. लालू ने तो ये तक कह दिया कि अभी मौका है एक हो जाओ नहीं तो कहीं के नहीं रहोगे. लालू के इस बयान से उनकी बेचैनी साफ दिखने लगी है. इधर बीजेपी लगातार ये कह रही है कि साल २०२४ तक पीएम पद के लिए कोई वैकेंसी नहीं है.
इसके तुरंत बाद सीएम नीतीश कुमार ने भी सभी विपक्षी दलों को एक साथ आने की सलाह दी है. नीतीश कुमार ने कहा कि बेहतर हो कि जल्द से जल्द इसपर काम शुरू हो. और सबसे बड़ी पार्टी के रुप में कांग्रेस को इसे लीड करना चाहिए. लेकिन पीएम के चेहरे को लेकर उन्होंने गोल-मोल जवाब दे दिया. नीतीश कुमार ने कहा कि पहले एक साथ आने दीजिए. पीएम के लिए तो देश में कई चेहरे हैं.
अब जदयू ने साफ कर दिया कि विपक्ष को नीतीश के नेतृत्व में एकजुट होना चाहिए, तभी मोदी का मुकाबला कर पाएंगे. राजद इसे लेकर तैयार नजर आ रहा है, लेकिन कांग्रेस इस मामले में कोई समझौता करने को तैयार नहीं दिखता. इसकी वजह भी है. एक तो राहुल गांधी का कद और दूसरा हाल के पंजाब, गोवा और मणिपुर विधानसभा के नतीजों से कांग्रेस को कहीं ना कहीं उम्मीदें नजर आ रही हैं.
कांग्रेस नेता मानते हैं कि विपक्ष को कांग्रेस के साथ आना चाहिए और राहुल गांधी के नेतृत्व में ही चुनाव लड़ना चाहिए. कांग्रेस राहुल गांधी के अलावा किसी और चेहरे को सामने करके चुनाव में आगे नहीं आना चाहती.ऐसे में विपक्षी एकता फिलहाल दूर की कौड़ी नजर आ रही है. अब देखना होगा कि नीतीश और लालू के आह्वान पर कितने दल उनके साथ आते हैं और ये दल कितनी दूर तक एक-दूसरे का साथ निभा पाते हैं. क्योंकि पिछले २० साल में अब तक तीसरे मोर्चे का प्रयास आज तक जमीन पर नहीं आ पाया है.
रामनवमी पर आरा की शोभा यात्रा के रंग
अब ८ अप्रैल से होगा टेट के लिए आवेदन
|
hindi
|
Different types of Cloth Diapers - GreenandHappyMom!
As soon as you start to read a little about cloth diapers you find that there are different kinds of cloth diapers. Here you will find an overview of the different types. Each type has a short description and their pros and cons. Hopefully, this helps you make a choice for a cloth diaper that suits you and your baby.
A waterproof diaper with an opening on the inside. This opening needs to be filled with absorbing inserts.
The whole diaper goes in the laundry.
A waterproof diaper with snaps. Absorbing inserts can be attached with the snaps.
A waterproof diaper with the inserts attached.
Een vierkante lap die tot luier gevouwen wordt. Deze wordt om de baby vastgezet met een snappie. Er moet nog een overbroekje overheen.
Cover can be used again when the flat is wet.
A fabric square with extra absorbance in the middle. Can be folder as a diaper and used on the baby with a snappy. Needs a cover.
Cover can be used again when the prefold is wet.
Absorbant fabric shaped as a diaper. Snaps or velcro are used for closing the diaper.
Cover can be used again when the diaper is wet.
As you can see, you have lots of choices. What works best for you depends on how much time you want to invest in the diapers and your budget. I started with different systems; pockets, all-in-ones and fitted diapers (I did not want to fold diapers) from different brands. By trying them out I found out what I like to use and what suited my daughter. I choose fitted diapers to use at home and I also bought a few pockets for the daycare. As those were easiest to use for them.
Which system did you choose for you and your baby?
|
english
|
नई दिल्ली। भारत में साइबर हमलों के मामले में पिछले साल की चौथी तिमाही के मुकाबले इस साल २०२० की पहली तिमाही में ३७ प्रतिशत की वृद्धि देखने को मिली है। एक नई रिपोर्ट से शनिवार को इस बात की जानकारी मिली है। कैस्पर स्काई सिक्योरिटी नेटवर्क (केएसएन) की रिपोर्ट के अनुसार, भारत में इसके प्रोडक्ट्स ने इस साल जनवरी से मार्च के बीच ५२,८२०,८७४ स्थानीय साइबर खतरों का पता लगाकर इन्हें रोका।
|
hindi
|
बिहार में राज्यसभा चुनाव: भाजपा-जदयू को भारी नुक्सान तो राजद-कांग्रेस होंगे बड़े गेनर, यह रहा आंकड़ों का खेल -
बिहार में राज्यसभा चुनाव: भाजपा-जदयू को भारी नुक्सान तो राजद-कांग्रेस होंगे बड़े गेनर, यह रहा आंकड़ों का खेल
इस बार के राज्यसभा और विधान परिषद के चुनाव का बड़ा अचीवर राष्ट्रीय जनता दल होगा कांग्रेस को भी फायदा होगा जबकि जदयू को भारी घाटा और भाजपा को नुकसान होगा.बिहार में २३ मार्च को राज्यसभा चुनाव होने जा रहा है.
राज्यसभा की सभी ६ सीटें भाजपा- जदयू की है इनमे चार- बशिष्ठ नारायण सिंह,अनिल साहनी अली अनवर अंसारी और किंग महेन्द्र जदयू से राज्यसभा के निवर्तमान सदस्य रहे हैं. वहीं भाजपा के रविशंकर प्रसाद और धर्मेंद प्रधान राज्यसभा सदस्य थे. इस प्रकार एनडीए गठबंधन के लिए यह कत्तई संभव नहीं कि वह अपनी तमाम छह की छह सीटें बचा सके. बल्कि विधानसभा के जो मौजूदा आंकड़ें हैं ( वही वोटर भी हैं) उससे साफ जाहिर है कि जदयू को दो भाजपा को एक सीट का नुकसान होना तय है. इस समय राजद के सबसे ज्यादा ८० विधान सभा सदस्य हैं. जदयू के ७१ हैं जबकि कांग्रेस के २७ एमएलए राज्यसभा के उम्मीदवारों को चुनेंगे. राजद की संख्या ज्यादा होने के कारण उसे सबसे ज्यादा फायदा होना तय है.
दूसरी तरफ राजद को २ और कांग्रेस को एक सीट पर फायदा होना तय है.
क्या राजद किसी दलित या मुस्लिम को देगा टिक्ट?
अब यह देखना होगा कि राजद अपने किन किन नेताओं को राज्यसभा भेजता है. जैसी की चर्चा है राजद की ओर से शिवानंद तिवारी, शरद यादव, किंग महेंद्र, रघुवंश प्रसाद सिंह के अलावा कोई दलित व मुस्लिम चेहरा राज्यसभा में जा सकता है. लेकिन इन नामों की चर्चा फिलहाल सामने नहीं आ रही है. इससे पहले हुए राज्यसभा चुनाव में राजद ने डा. मीसा भारती और वरिष्ठ वकील रामजेठमलानी को राज्य सभा भेज चुका है. उस समय ड़ा. एम एजाज अली की दावेदारी पुख्ता थी लेकिन उन्हें अवसर नहीं दिया गया. इससे नाराज एजाज अली ने बगावत का बिगुल फूक दिया और राजद से अलग हो गये. ऐसे में राजद के सामने अल्पसंख्यक समुदाय के स्पिरेशन को समझने का अवसर है. देखना है कि वह इस बार क्या फैसला लेता है. उधर तेजस्वी यादव ने बसपा प्रमुख मायवती को राज्यसभा भेजने के लालू प्रसाद के वचन को पूरा करने के लिए उनसे सम्पर्क किया था लेकिन मायवती ने शालीनता से ना कह दिया. इसके बाद दलित समाज में यह उम्मीद बंधी है कि उनकी जगह किसी दलित को राज्यसभा भेजा जाये.
उधर कांग्रेस में भी राज्यसभा जाने के लिए नेताओं में आपसी रस्सकशी जारी है.कांग्रेस से मीरा कुमार, शकील अहमद और अखिलेश सिंह के नामो की चर्चा है.
जदयू में क्या है खेल
जहां तक जदयू की बात है तो सीटें कम होने के कारण वह किसे उम्मीदवारी दे या किसकी उम्मीदवारी काटे यह बात बड़ी चुनौती है. महेंद्र प्रसाद, को पहले ही जदयू ने मना कर दिया है. पार्टी के प्रदेश अध्यक्ष बशिष्ठ नारायण सिंह भी शायद इस बार राज्यसभा से वंचित रह जायें. जहां तक अनिल साहनी की बात है तो पार्टी की किरकिरी कराने के कारण ड्राप किया जा सकता है. जहां तक अली अनवर की बात है तो वह पहले ही पार्टी से बाहर निकाले जा चुके है. पार्टी में जिन नामो की जवर्दस्त चर्चा है उनमें संजय झा और के सी त्यागी प्रमुख दावेदार है.
भाजपा की क्या होगी रंगत
आंकड़ों को देखें तो भाजपा को एक सीट मिलेगी. धर्मेंद्र प्रधान और रविशंकर प्रसाद में से कोई एक ही जा पाएंगा. संख्याबल के हिसाब से सबकुछ सामान्य रहा तो चुनाव की नौबत नही आएगी. मुख्यमंत्री नीतीश कुमार भी यही चाहते रहे है पर भाजपा को हड़बड़ी है. संख्या बल के आधार पर जदयू २ राजद २ भाजपा दो और राजद के सहयोग से कांग्रेस १ सीट प्राप्त कर सकती है. पर भाजपा और जदयू कांग्रेस विधायकों को मैनेज कर अपने सरप्लस वोटो के सहारे किसी को खड़ा कर छट्ठी सीट को हथियाने का मंसूबा पाल रखा है. ऐसे में इस सीट पर चुनाव तय है. छट्ठी सीट पर तब कांग्रेस भी उम्मीदवार उतारने में जैसे को तैसा की नीति अपना सकती है.
प्रेवियस: मानिक सरकार हार गये अगली पीढ़िया जब उनकी सादगी के बारे में जानेंगी तो दांतो तले उंगलिया दबा लेंगी
नेक्स्ट: गौरी लंकेश की हत्या के बाद साम्प्रदायिकता का बेहुदा खेल खेला गया, अब बताओ जो पकड़ा गया वह कौन है?
|
hindi
|
package org.bukkit;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
/**
* Represents a chunk of blocks
*/
public interface Chunk {
/**
* Gets the X-coordinate of this chunk
*
* @return X-coordinate
*/
int getX();
/**
* Gets the Z-coordinate of this chunk
*
* @return Z-coordinate
*/
int getZ();
/**
* Gets the world containing this chunk
*
* @return Parent World
*/
World getWorld();
/**
* Gets a block from this chunk
*
* @param x 0-15
* @param y 0-127
* @param z 0-15
* @return the Block
*/
Block getBlock(int x, int y, int z);
/**
* Capture thread-safe read-only snapshot of chunk data
*
* @return ChunkSnapshot
*/
ChunkSnapshot getChunkSnapshot();
/**
* Capture thread-safe read-only snapshot of chunk data
*
* @param includeMaxblocky - if true, snapshot includes per-coordinate
* maximum Y values
* @param includeBiome - if true, snapshot includes per-coordinate biome
* type
* @param includeBiomeTempRain - if true, snapshot includes per-coordinate
* raw biome temperature and rainfall
* @return ChunkSnapshot
*/
ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain);
/**
* Get a list of all entities in the chunk.
*
* @return The entities.
*/
Entity[] getEntities();
/**
* Get a list of all tile entities in the chunk.
*
* @return The tile entities.
*/
BlockState[] getTileEntities();
/**
* Checks if the chunk is loaded.
*
* @return True if it is loaded.
*/
boolean isLoaded();
/**
* Loads the chunk.
*
* @param generate Whether or not to generate a chunk if it doesn't
* already exist
* @return true if the chunk has loaded successfully, otherwise false
*/
boolean load(boolean generate);
/**
* Loads the chunk.
*
* @return true if the chunk has loaded successfully, otherwise false
*/
boolean load();
/**
* Unloads and optionally saves the Chunk
*
* @param save Controls whether the chunk is saved
* @param safe Controls whether to unload the chunk when players are
* nearby
* @return true if the chunk has unloaded successfully, otherwise false
* @deprecated it is never safe to remove a chunk in use
*/
@Deprecated
boolean unload(boolean save, boolean safe);
/**
* Unloads and optionally saves the Chunk
*
* @param save Controls whether the chunk is saved
* @return true if the chunk has unloaded successfully, otherwise false
*/
boolean unload(boolean save);
/**
* Unloads and optionally saves the Chunk
*
* @return true if the chunk has unloaded successfully, otherwise false
*/
boolean unload();
}
|
code
|
बॉलीवुड सेलेबल्स के पसंदीदा स्ट्रीट फूड | बेट्टरबटर ब्लॉग
अधिकांश बॉलीवुड सितारे अपने स्वास्थ्य को लेकर बहुत ही जागरूक होते हैं और एक पौष्टिक आहार और व्यायाम कर अपने शरीर को तंदरुस्त रखते हैं पर जहाँ बात आती है स्ट्रीट फ़ूड की, तो सबकी कोई न कोई कमज़ोरी है, चाहे वह वाडा पाव, समोसा या पानी पूरी हो! यहां विभिन्न बॉलीवुड सेलेबल्स के पसंदीदा स्ट्रीट फ़ूड दिए गए हैं-
१.सलमान खान: कबाब
सलमान अपनी फिटनेस और बॉडीबिल्डिंग दिनचर्या के लिए जाने जाते हैं, हालांकि उन्हें मुंबई स्ट्रीट विक्रेताओं से कबाब खाना बहुत पसंद है। वह उन्हें अक्सर खाते हैं।
२.दीपिका पादुकोण: मैंगलोर भाजी
दीपिका का पसंदीदा मंगलौर भजी कर्नाटक का एक लोकप्रिय स्ट्रीट फ़ूड है। ये एक टाला हुआ मैदे का पैदा है जो नारियल की चटनी के साथ परोसा जाता है। दीपिका को अपने पसंदीदा भोजन की बहुत ज़रूरत होती है, खासकर जब वह घर और परिवार से दूर शूटिंग कर रही होती है। केले के चिप्स और चक्लिस वे खाद्य पदार्थ हैं जिन्हें खाकर उन्हें आराम मिलता है और उसे अपनी मनोदशा ठीक करने में मदद मिलती है!
३.ऋतिक रोशन: समोसा
रितिक भारतीय स्ट्रीट फ़ूड से प्यार करते हैं और उसके पसंदीदा समोसे हैं। वह दावा करते हैं कि वह एक बार में एक दर्जन समोसे खा सकते हैं। समोसे कहते हुए अगर कोई आहे परेशां करे तो उन्हें बिलकुल अच्छा नहीं लगता।
४.शाहिद कपूर: समोसा और भजिया
शाहिद एक शाकाहारी हैं और विशेष रूप से बारिश के मौसम में समोसा और भजिया खाना ज़्यादा पसंद करते हैं।
५.सोनम कपूर: पाव भाजी
सोनम जो अपनी फैशन सेंस और फिट बॉडी के लिए जानी जाती हैं, एक असली पंजाबी है और पाव भजी उन्हें बहुत पसंद है। वो चॉक्लेट खाना भी बेहद पसंद करती हैं और बंगाली खाने में उन्हें शोरशे इलीश और छोलार दाल बहुत अच्छी लगती है।
६.आलिया भट: इंडियन चाइनीस
चुलबुली और उत्थान अभिनेत्री आलिया भट ने बॉलीवुड में विभिन्न भूमिकाओं में उनके प्रदर्शन के साथ एक अलग पहचान बना ली है। क्या आप उनका पसंदीदा स्ट्रीट फ़ूड जानना चाहते हैं? आलिया को भारतीय स्ट्रीट स्टाल्स पर मिलने वाला चीनी खाना पसंद है। उन्हें सड़क पर मिलने वाला तीखा चिन्जाबी खाना अच्छा लगता है।
अपनी शादी की हलचल के बाद, हर कपल एक छुट्टी पर जाता है ताकि उन्हें
अभिनेता / अभिनेत्री जिन्होंने किसिंग सीन करने से इंकार कर दिया
आप भी रह सकते हैं हरदम फ्रेश और ऊर्जावान डॉ. शिखा शर्मा
|
hindi
|
<?php
/*******************************************************************************
Copyright 2011 Whole Foods Co-op
This file is part of CORE-POS.
CORE-POS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
CORE-POS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
in the file license.txt along with IT CORE; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*********************************************************************************/
/* HELP
nightly.equity.php
Copies equity transaction information
for the previous day from dlog_15 into
stockpurchases.
Should be run after dtransaction rotation
and after midnight.
*/
include(dirname(__FILE__) . '/../config.php');
if (!class_exists('FannieAPI')) {
include(__DIR__ . '/../classlib2.0/FannieAPI.php');
}
if (!function_exists('cron_msg')) {
include(__DIR__ . '/../src/cron_msg.php');
}
if (!isset($FANNIE_EQUITY_DEPARTMENTS) || empty($FANNIE_EQUITY_DEPARTMENTS)) {
return;
}
set_time_limit(0);
$ret = preg_match_all("/[0-9]+/",$FANNIE_EQUITY_DEPARTMENTS,$depts);
$depts = array_pop($depts);
$dlist = "(";
foreach ($depts as $d){
$dlist .= $d.",";
}
$dlist = substr($dlist,0,strlen($dlist)-1).")";
$sql = new SQLManager($FANNIE_SERVER,$FANNIE_SERVER_DBMS,$FANNIE_TRANS_DB,
$FANNIE_SERVER_USER,$FANNIE_SERVER_PW);
$query = "INSERT INTO stockpurchases
SELECT card_no,
CASE WHEN department IN $dlist THEN total ELSE 0 END as stockPayments,
tdate,trans_num,department
FROM dlog_15 WHERE "
.$sql->datediff($sql->now(),'tdate')." = 1
AND department IN $dlist";
$sql->query($query);
// rebuild summary table
$sql->query('TRUNCATE TABLE equity_history_sum');
$sql->query('INSERT INTO equity_history_sum
SELECT card_no, SUM(stockPurchase), MIN(tdate)
FROM stockpurchases
GROUP BY card_no');
|
code
|
اَتھ دوران اوس سُہ مگر زبردست غۄطَن گوٚمُت زنانہِ ہُنٛد یہِ عجیب ورتاو وُچھِتھ اوس سُہ ترٛؠن تہٕ ترٛواہَن گوٚمُت
|
kashmiri
|
We currently do not take any new enquiries. Our apologies for any inconvenience.
Have a project for us? We are always ready to chat with you!
|
english
|
پالی بِیس تہٕ مُمکنہٕ سوگڈِیانا کیِو ستراپن ہندِ مُطٲبِق ژھُن اِتھیڈمسن اکہِ میگھنیسی یوُنٲنہِ ۲۳۰ ق م منٛز ڈِیوڈوٹس دوم تختٕہ پؠٹھہٕ وٲلِتھ تہٕ کورُن پنُن شٲہی خانداں شروُع
|
kashmiri
|
وزِل سیرن ہینز تعٲمیراتی صنعت،ہوس ہتہٕ بٔد فیکٹرین پیٹھ مشتمل ٲس یم دریابس أند أند چھ نیلک تلچھٹک ذخائر استعمال کران،تہٕ یم منفی طور پٲنٹھ چھ متٲثر گمت۔
|
kashmiri
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.