# Ising-Based Kernel Clustering +
## 3 Ising-Based Kernel Clustering
### QUBO Matrix Generation by Matrix-Matrix Calculations  
To generate the QUBO matrix using matrix-matrix calculations, a binary decision vector \(\mathbf{q}\in\mathbb{R}^{NK}\) is introduced. Each element of \(\mathbf{q}\) is defined as follows. \[\mathbf{q}=[q_{0}^{0},\ldots,q_{K-1}^{0},q_{0}^{1},\ldots,q_{K-1}^{1},\ldots, \ldots,q_{0}^{N-1},\ldots,q_{K-1}^{N-1}]^{T}. \tag{15}\]  
Here, the following five matrices are defined to discuss the matrix-matrix product form of Equation (14). * \(\mathbf{I_{K}}\in\mathbb{R}^{K}\) is a \(K\)-dimensional identity matrix. * \(\mathbf{U_{K}}\in\mathbb{R}^{K}\) is a \(K\)-dimensional upper triangular matrix with 0 for the diagonal components and 1 for the upper triangular components. * \(\mathbf{\Lambda}\in\mathbb{R}^{N}\) is defined as a matrix with \(\lambda\) for the diagonal components and 0 for the other components. * \(\mathbf{G_{diag}}\in\mathbb{R}^{N}\) is a matrix consisting of only the diagonal components of the Gram matrix \(\mathbf{G}\). \(\mathbf{G_{diag}}\) has zero non-diagonal components. * \(\mathbf{G_{triu}}\in\mathbb{R}^{N}\) is a matrix consisting of only the upper triangular components of the Gram matrix \(\mathbf{G}\). \(\mathbf{G_{triu}}\) has zero diagonal and lower triangular components. First, let us consider the matrix-matrix product form of calculating the similarities between two data points in the high-dimensional feature space. The first term of Equation (14) calculates the products among the diagonal components \(g_{ii}\) of the Gram matrix and the same two binary decision variables \(q_{a}^{i}\) and \(q_{a}^{i}\). The second term calculates the products among the upper triangular components \(g_{ij}\) and two different binary decision variables \(q_{a}^{i}\) and \(q_{a}^{j}\). Thus, the first and second terms of Equation (14) are transformed to Equation (16). \[H_{objective}=\mathbf{q}((-\mathbf{G_{diag}}-2\mathbf{G_{triu}})\otimes\mathbf{I_{K}})\mathbf{q}^{T}. \tag{16}\]  
The operator \(\otimes\) is the Kronecker product. The Kronecker product of matrices \(\mathbf{A}\in\mathbb{R}^{p\times q}\) and \(\mathbf{B}\in\mathbb{R}^{r\times s}\) generates a matrix \(\mathbf{C}\in\mathbb{R}^{pr\times q}\) as follows. \[\mathbf{C} = \mathbf{A}\otimes\mathbf{B} \tag{17}\] \[= \begin{bmatrix}a_{0,0}\ldots a_{0,q-1}\\ \vdots\ddots\vdots\\ a_{p-1,0}\ldots a_{p-1,q-1}\end{bmatrix} \otimes\mathbf{B}\] \[= \begin{bmatrix}a_{0,0}\mathbf{B}\ldots a_{0,q-1}\mathbf{B}\\ \vdots\ddots\vdots\\ a_{p-1,0}\mathbf{B}\ldots a_{p-1,q-1}\mathbf{B}\end{bmatrix} .\]  
Equation (16) is calculated by using the calculation of Equation (17). The summation operators of \(\sum_{i=0}^{N-1}g_{ii}\), \(\sum_{i<j}^{N-1}g_{ij}\), and \(\sum_{a=0}^{K-1}\) correspond to the matrices of \(\mathbf{G_{diag}}\), \(\mathbf{G_{triu}}\) and \(\mathbf{I_{K}}\), respectively. \(\mathbf{G_{diag}}\) and \(\mathbf{G_{triu}}\) have the same sizes of \(\mathbb{R}^{N\times N}\). \(\mathbf{I_{K}}\) is the matrix with the size of \(\mathbb{R}^{K\times K}\). Since \(\mathbf{q}\) of Equation (15) is the vector with the size of \(\mathbb{R}^{NK}\), the size of the matrix \(((-\mathbf{G_{diag}}-2\mathbf{G_{triu}})\otimes\mathbf{I_{K}})\) is expanded to \(\mathbb{R}^{NK\times NK}\). As a result, Equation (16) can perform the same calculation of the first and second terms of Equation (14). Second, let us consider the matrix-matrix QUBO generation form of the one-hot constraint. The third term of Equation (14) is represented as Equation (18) [18]. \[H_{constraint}=-\sum_{i=0}^{N-1}\lambda\sum_{a=0}^{K-1}(q_{a}^{i})^{2}+2\sum_ {i=0}^{N-1}\lambda\sum_{a<b}q_{a}^{i}q_{b}^{i}. \tag{18}\]  
As well as the case in the matrix-matrix product form of calculating the Gram elements, the summation operators of \(\sum_{i=0}^{N-1}\lambda\sum_{a=0}^{K-1}\), and \(\sum_{a<b}\) correspond to the matrices of \(\mathbf{\Lambda}\), \(\mathbf{I_{K}}\), \(\mathbf{U_{K}}\), respectively. Hence, Equation (18) is represented as the matrix-matrix product form of Equation (19).