  In this article, we present a nonparametric method for the general two-sample
problem involving functional random variables modelled as elements of a
separable Hilbert space ${\cal H}$. First, we present a general recipe based on
linear projections to construct a measure of dissimilarity between two
probability distributions on ${\cal H}$. In particular, we consider a measure
based on the energy statistic and present some of its nice theoretical
properties. A plug-in estimator of this measure is used as the test statistic
to construct a general two-sample test. Large sample distribution of this
statistic is derived both under null and alternative hypotheses. However, since
the quantiles of the limiting null distribution are analytically intractable,
the test is calibrated using the permutation method. We prove the large sample
consistency of the resulting permutation test under fairly general assumptions.
We also study the efficiency of the proposed test by establishing a new local
asymptotic normality result for functional random variables. Using that result,
we derive the asymptotic distribution of the permuted test statistic and the
asymptotic power of the permutation test under local contiguous alternatives.
This establishes that the permutation test is statistically efficient in the
Pitman sense. Extensive simulation studies are carried out and a real data set
is analyzed to compare the performance of our proposed test with some
state-of-the-art methods.
