## 3 Materials and Methods
### Euclidean and Riemannian Dissimilarity Frameworks
Assume that \(\mathbf{\mathcal{X}}\) represents a population of manifold points \(\mathbf{X}_{i}\in\mathcal{M}\); in other words, \(\mathbf{\mathcal{X}}\) is a manifold tensor \(\mathbf{\mathcal{X}}:=\{\mathbf{X}_{i}\}_{i=1}^{k}\). Let us also consider another manifold dictionary tensor, \(\mathbf{\mathcal{D}}=\big{\{}\mathbf{D}_{j}\big{\}}_{j=1}^{N}\), with \(\mathbf{D}_{j}\in\mathcal{M}\). In the context of the Riemannian VLAD (R-VLAD) [51], \(\mathbf{D}_{j}\) is an atom; i.e., a member of the Riemannian dictionary \(\mathbf{\mathcal{D}}\). Since the manifold \(\mathcal{M}\) is a Riemannian one, it is equipped with an arbitrary measure (or metric) \(\delta_{\mathcal{M}}(\cdot,\cdot)\colon\mathcal{M}\times\mathcal{M}\to \mathbb{R}^{+}\), which measures how close an \(\mathbf{X}_{i}\) to a \(\mathbf{D}_{j}\) is [57]. Therefore, in order to construct a Riemannian equivalent of Equation (9), two factors must be taken into account: (a) the selection of a suitable distance function \(\delta_{\mathcal{M}}\) and (b) the equivalent of the subtraction operator on a Riemannian manifold \((-)_{\mathcal{M}}\). Thus, the generic term of Equation (9), i.e., the equivalent R-VLAD, is initially constructed by the following:  
\[v_{j}^{R-VLAD}=\sum_{\mathbf{X}_{i}^{Q}\in\mathbf{D}_{j}}\Psi_{\mathcal{M}}(\mathbf{D}_{j},\mathbf{X}_{i}^{Q}) \tag{10}\]  
where \(\Psi_{\mathcal{M}}:\mathcal{M}\times\mathcal{M}\to\mathcal{T}_{\mathbf{D}_{j}} \mathcal{M}\) is the Riemannian equivalent \((-)_{\mathcal{M}}\) of the subtraction between two manifold points, while the term \(\mathbf{X}_{i}^{Q}\in\mathbf{D}_{j}\) relates to the proximity among these two manifold points with the use of the Riemannian metric \(\delta_{\mathcal{M}}\). On a Riemannian manifold \(\mathcal{M}\), one may obtain the equivalent \((-)_{\mathcal{M}}\) of the Euclidean subtraction operator by using an appropriate manifold function, \(\Psi_{\mathcal{M}}(\cdot,\cdot):\mathcal{M}\times\mathcal{M}\to\mathcal{T}_{ \mathbf{D}}\mathcal{M}\), a method which has been useful in a number of applications [51]. For example, \(\Psi_{\mathcal{M}}(\mathbf{D}_{j},\mathbf{X}_{i}^{Q})\) can take up the form of the logarithmic map \(log_{\mathbf{D}_{j}}\mathbf{X}_{i}^{Q}\). Taking into account that, in the Euclidean case, the LDVs can be regarded as the gradient of the distance function, it seems suitable to rewrite Equation (10) for a Riemannian manifold \(\mathcal{M}\) according to the following:  
\[v_{j}^{R-VLAD}=\sum_{\mathbf{X}_{i}^{Q}\in\mathbf{D}_{j}}\
abla_{\mathbf{D}_{j}}\delta_{ \mathcal{M}}^{2}(\mathbf{D}_{j},\mathbf{X}_{i}^{Q}) \tag{11}\]  
in which \(\Psi_{\mathcal{M}}(\mathbf{D}_{j},\mathbf{X}_{i}^{Q})=\
abla_{\mathbf{D}_{j}}\delta_{ \mathcal{M}}^{2}(\mathbf{D}_{j},\mathbf{X}_{i}^{Q})\) is an appealing candidate for the Riemannian counterpart of the dissimilarity vectors. Unfortunately, this selection suffers from the fact that, with the exception in the case of the AIRM \(\delta_{\delta}\), the norm \(\left\|\
abla_{\mathbf{D}_{j}}\delta_{\mathcal{M}}^{2}\Big{(}\mathbf{D}_{j},\mathbf{X}_{i }^{Q}\Big{)}\right\|\) does not relate directly to the metric \(\delta_{\mathcal{M}}\). Consequently, the norm of the gradient decreases as the \(\mathbf{Y}\) point becomes more distant from the \(\mathbf{X}\) point. To avoid this, the following form for the \(\Psi_{\mathcal{M}}(\cdot,\cdot)\) Riemannian subtraction was proposed [51], which results in a symmetric matrix \(\Psi\), as follows:  
\[\Psi\to\Psi_{\mathcal{M}}\left(\mathbf{D}_{j},\mathbf{X}_{i}^{Q}\right)=\delta_{ \mathcal{M}}(\mathbf{D}_{j},\mathbf{X}_{i}^{Q})\frac{\
abla_{\mathbf{D}_{j}}\delta_{ \mathcal{M}}^{2}(\mathbf{D}_{j},\mathbf{X}_{i}^{Q})}{\left\|\
abla_{\mathbf{D}_{j}}\delta_ {\mathcal{M}}^{2}(\mathbf{D}_{j},\mathbf{X}_{i}^{Q})\right\|}\in\{S^{d}\} \tag{12}\]