Toric Calabi-Yau threefolds as quantum integrable systems. ℛ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$ \mathrm{\mathcal{R}} $$\end{document}-matrix and ℛTT\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$ \mathrm{\mathcal{R}}\mathcal{T}\mathcal{T} $$\end{document} relations

ℛ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$ \mathrm{\mathcal{R}} $$\end{document}-matrix is explicitly constructed for simplest representations of the Ding-Iohara-Miki algebra. Calculation is straightforward and significantly simpler than the one through the universal ℛ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$ \mathrm{\mathcal{R}} $$\end{document}-matrix used for a similar calculation in the Yangian case by A. Smirnov but less general. We investigate the interplay between the ℛ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$ \mathrm{\mathcal{R}} $$\end{document}-matrix structure and the structure of DIM algebra intertwiners, i.e. of refined topological vertices and show that the ℛ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$ \mathrm{\mathcal{R}} $$\end{document}-matrix is diagonalized by the action of the spectral duality belonging to the SL(2, ℤ) group of DIM algebra automorphisms. We also construct the T\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$ \mathcal{T} $$\end{document}-operators satisfying the ℛTT\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$ \mathrm{\mathcal{R}}\mathcal{T}\mathcal{T} $$\end{document} relations with the ℛ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$ \mathrm{\mathcal{R}} $$\end{document}-matrix from refined amplitudes on resolved conifold. We thus show that topological string theories on the toric Calabi-Yau threefolds can be naturally interpreted as lattice integrable models. Integrals of motion for these systems are related to q-deformation of the reflection matrices of the Liouville/Toda theories.


Introduction
Integrability plays an exceptional role in modern studies of quantum field theory and string theory. Whenever there is a breakthrough in understanding of non-perturbative dynamics, some form of integrability invariably appears to be behind this success. An (incomplete) list of recent examples includes • Seiberg-Witten solution of N = 2 theories [1,2] and the corresponding classical complex integrable systems [3][4][5][6],
In this paper we demonstrate a new integrable structure in refined topological strings on toric Calabi-Yau threefolds. This structure is related to several points from the list above and we elaborate on these connections in section 5. Let us now briefly summarize how this kind of integrability appears. The central object, on which we will mostly focus in our approach is the R-matrix of the Ding-Iohara-Miki (DIM) algebra [26,27]. R-matrices, which can be considered as emerging in the description of coproducts of group elementsĝ ∈ G ⊗ A(G) [28][29][30][31] for quantum groups [32][33][34][35][36], are crucial to all integrable systems. As evident from eq. (1.1), the job of the R-matrix is to permute the components in the tensor product of representations of the algebra G. This is the property we will use in refined topological strings. The representations in question are going to be Fock modules [37][38][39] and their permutation exchanges the legs of the toric diagram corresponding to a DIM intertwiner [40,41]. The permutation of the legs performed by the R-matrix has a simple interpretation in terms of the corresponding conformal blocks of the q-Virasoro or qW N -algebras. Ratios of the spectral parameters on the horizontal legs determine the Liouville-like momenta of the primary states [41]. By exchanging the spectral parameters, the R-matrix inverts the momenta, and therefore acts exactly as the Liouville reflection matrix introduced in [42]. This connection (first noted in [43], see also [44]) is quite interesting, since, as we will see in the following, the R-matrix can be evaluated explicitly by solving for the eigenfunctions of the generalized Macdonald Hamiltonian with known eigenvalues.
Also among other things, let us mention that the R-matrices are used to construct knot polynomials in Chern-Simons theory [45][46][47][48], one of the most challenging subjects in topology. In particular, the knot superpolynomials of [49][50][51], constructed with the help of double-affine Hecke algebras (DAHA) [52], still lack a clear R-matrix realization within the Reshetikhin-Turaev (RT) formalism, either original [53][54][55] or modern [56][57][58]. On the other hand, the DIM algebra is naturally related with DAHA by a kind of Schur duality (see [59] for a degenerate version of this correspondence). There is another way to naturally associate these two algebras: the DIM algebra is the limit of spherical DAHA for large number of strands (see [60][61][62] for a degenerate version of this correspondence).
The notation in this paper follows our paper [41].
JHEP10(2016)047 Figure 1. The lattice of U q,t ( gl 1 ) generators. The algebra is doubly graded, so that each generator has two integer weights. The standard generators x + n , ψ ± n and x − n form the three central rows. ψ + n generators (they are framed in blue) form the Cartan subalgebra and x + n , x − n act as the raising and lowering operators respectively. Blue arrows show the action S of the spectral duality, an SL(2, Z) rotation of the integer lattice. Notice that S(ψ + 1 ) = x + 0 , i.e. the first Cartan generator transforms into the zero mode of the raising generator.

DIM algebra, generalized Macdonald polynomials and the R-matrix
We are going to compute the R-matrix of the DIM algebra, also known as quantum toroidal algebra or U q,t ( gl 1 ) [26,27]. It is a double quantum deformation of the double loop algebra of gl 1 . The double loop algebra can be understood as the algebra of torus mappings into the group gl 1 . The two deformation parameters are related to the quantum deformation parameter of the affine algebra gl 1 and the quantum deformation of the torus respectively.
The DIM algebra is generated by respectively the "raising" and "lowering" operators x + n and x − n with n ∈ Z together with the "Cartan" generators ψ ± ±n , n ∈ Z >0 and two central elements C 1 , C 2 . The algebra has a double grading coming from the two loops, i.e. a torus T 2 , in the double loop construction. Each element of the algebra with a definite grading can be, therefore, drawn as an integral point on the plane. The generators, x + n , ψ ± n , x − n and their commutators form a lattice, which is sketched in figure 1. The exact definition of the DIM algebra can be found in [41,[63][64][65][66] (see also [67][68][69][70][71] for elliptic DIM algebra).
There is a nice representation of the DIM algebra on the Fock space F (1,0) u , i.e. a bosonization of the DIM generators, which are expressed through exponentials of the free bosons (for concrete expressions see [37][38][39][40]). The second central charge of this representation is trivial, C 2 = 1, while the first one is given by C 1 = (t/q) 1/2 . We will henceforth call this representation horizontal, since the first central charge is associated with the horizontal direction. There is also the vertical Fock representation F (0,1) u , isomorphic to the JHEP10(2016)047 horizontal one, but with a different action of the DIM generators [37][38][39][40]. In the basis of Macdonald symmetric polynomials, M (q,t) Y (a −n )|u , the generators x + n add a box to the Young diagram Y , while x − n delete one box, and ψ ± n act diagonally. The central charges of this representation are (1, (t/q) 1/2 ) (we refer the reader to [37][38][39][40] for the complete construction).
It will be important for us that the DIM algebra has a remarkable group of automorphisms SL(2, Z), which are precisely the automorphisms of the integer lattice of generators [27]. Let us also note that the central charges (C 1 , C 2 ) transform as a doublet under this SL(2, Z) symmetry. One of the automorphisms, which we call S is particularly important. 1 S corresponds to rotation of the integer lattice by π 2 clockwise. The action of this element on the algebra realizes the spectral duality [72][73][74][75][76][77][78][79][80] of different representations: in particular, the central charge vector is rotated; the horizontal representations become the vertical ones and vice versa. The action of S is illustrated in figure 1.
Let us construct a natural basis in the tensor product of horizontal modules. This basis is given by generalized Macdonald polynomials [65,66,[81][82][83][84][85][86] of the Hamiltonian In the simplest example, i.e. for the tensor product of two Fock modules F u 1 ⊗ F u 2 , the generalized Macdonald polynomials depend on a pair of Young diagrams and on ratio of the spectral parameters u 1 u 2 . The HamiltonianĤ 1 is the zero mode of the raising generator, x + 0 in the horizontal representation. One can also understand the Hamiltonian (1.3) as the spectral dual of the first Cartan generator ψ + 1 . As we mentioned above, in the vertical representation the Cartan generators ψ + n acts diagonally on the ordinary Macdonald polynomials. The same is true for tensor products of the vertical representations, i.e. the "diagonal" basis is given by tensor products of the Macdonald polynomials M (q,t) −n )|u 2 (in order to see this, one should use the DIM coproduct [41] and the fact that, for the vertical representations, C 1 = 1). Thus, the generalized Macdonald polynomials M AB −n |u 1 ⊗ |u 2 , which diagonalize x + 0 = S(ψ + 1 ), can be thought of as spectral duals of the ordinary Macdonald polynomials. A remarkable feature of DIM, which greatly simplifies calculations, is that the eigenvalues of the first Hamiltonian H 1 are non-degenerate, so it is sufficient to diagonalize only this one operator to define the entire set of polynomials and all "higher Hamiltonians" (i.e. the other Cartan generators, H n = ρ u 1 ⊗ ρ u 2 S(ψ + n ) for n ≥ 2) are automatically diagonal, see appendix B.

JHEP10(2016)047
Let us make two remarks here. The eigenvalues are non-degenerate only for u 1 , u 2 in general position. However, the case of resonance between u 1 and u 2 is more subtle, then the eigenvalues do become degenerate. We will not consider this case. The eigenvalues also become degenerate in the 4d/Yangian limit in which the first Hamiltonian should be expanded up to the first order and a lot of information is thus lost. This is because the (q, t)-deformation reveals a true exponential nature of the DIM-symmetry generators, while the ordinary Virasoro and W (and thus the higher Hamiltonians of the Calogero-Sutherland-Ruijsennars family) arise all together in their series expansions. We will usually suppress the two sets of time variables p n = i x n i ,p n = ix n i , which the Hamiltonian acts on and polynomials depend on; when they are needed, we use the notation M {p,p} or M [x,x], depending on the choice between the time and Miwa parametrizations.
In the tensor products of more than two Fock modules, there are still eigenstates of x + 0 , which we call in the same way generalized Macdonald polynomials. In this case, the number of time sets and Young diagrams is correspondingly increased. Now we are at the crucial point of our approach to the R-matrix. The HamiltonianĤ 1 depends on the choice of the coproduct in the DIM algebra; there are two natural options: schematically, The DIM algebra is a quasitriangular Hopf algebra. Thus, these two coproducts are related by an R-matrix: Hence, their eigenfunctions are also related: 2 where the sum is actually finite, because the size of Young diagrams is restricted by the conservation law which makes R block-diagonal with finite-dimensional blocks. The coproducts ∆ and ∆ op differ only by permutation of the two representations on which the algebra acts. Thus, the "opposite" Macdonald polynomials can be alternatively obtained by a simple change of variables, exchanging u 1 ↔ u 2 , A ↔ B and p n ↔p n : (1.10) 2 Notice a slight change in the notation compared to [86]. We are now writing the generalized Macdonald polynomials as functions of the variable u 1 u 2 , which we call Q, whereas in [86] we denoted u 2 u 1 as Q.

JHEP10(2016)047
Since the generalized Macdonald polynomials are actually known explicitly in many cases [65,66,[84][85][86], one can just use (1.8) to evaluate the first blocks of the R-matrix, and then promote these examples to the general formula. This is a much simpler way to get explicit expressions as compared with deducing them from the universal R-matrix [85,87], as was suggested in [88,89], and this will be the approach we adopt here.

Refined topological strings and RT T relations
Refined topological string theory is a hypothetical string (or, more probably, M-) theory generalizing the theory of topological strings. Apart from the string coupling q = e −gs , the refined string theory depends on an extra deformation parameter t, which is related to the non-self-dual Nekrasov Ω-deformation. In order to reduce it to the ordinary topological string theory, one should put t = q. The amplitudes of refined strings on the toric Calabi-Yau threefolds have been computed with the help of the refined topological vertex technique [90][91][92][93]. The main idea of this technique [94][95][96][97] is to break down the threefold into C 3 patches and find the universal amplitudes, trivalent refined vertices on those patches. Each vertex depends on boundary conditions on three Lagrangian branes of topology S 1 × D 2 sitting on the legs of the toric diagram. These boundary conditions are encoded in the Young diagram, which summarizes the winding numbers of string boundaries on the branes. The final answer for any amplitude, either closed string, i.e. without any branes, or open with nonzero boundary conditions, is obtained as a sum of the product of topological vertices over intermediate Young diagrams with "a propagator" containing Kähler parameters of the edges. We employ an algebraic approach to the refined topological vertices developed in [40]. The vertices are treated as intertwiners of the Fock representations of the DIM algebra, each representation corresponding to the leg connected to the vertex. The slopes of the legs are encoded in the central charges of the corresponding representations. Finally, the sum over intermediate Young diagram residing on the leg is interpreted as a sum over the complete basis of states in the corresponding Fock representation. Thus, to any toric diagram, one associates an intertwiner between tensor products of Fock representations. Such intertwiners by definition commute with the action of the DIM algebra on the representations. To get the answer for the amplitude from the intertwiner, one should simply evaluate the matrix element of the intertwiner between the basis vectors in the Fock modules corresponding to the external Young diagrams (see details and examples in [41]).
The sum over intermediate Young diagrams in the computation of any amplitude can also be interpreted as a "network"-type matrix model [41,[98][99][100]. For certain "balanced" toric diagrams, the corresponding matrix model can be identified with the Dotsenko-Fateev (DF) representation for the multipoint conformal blocks of the q-deformed W N algebra [41]. Moreover, one can usually obtain two such descriptions related by the action of the spectral duality: either as a (k + 2)-point W N -block or as an (N + 2)-point W k -block, the corresponding toric diagrams being related to each other by π 2 rotation. The existence of two coinciding conformal blocks of different kinds is related to the AGT duality as shown in [86].

JHEP10(2016)047
The fact that any toric diagram essentially represents a contraction of the intertwiners commuting with the action of the DIM algebra leads to important implications for matrix model, to the Ward identities [41,100]. These identities are very similar to the W Nalgebra Ward identities derived in the DF representations, where the generators of algebra also commute with the set of screening charges Q a . These identities relate the correlators involving descendants to those of the primary fields. In fact, one can show that this construction can be entirely incorporated in the DIM approach to topological strings. The W N generators are obtained from the DIM generators acting on the tensor product of M Fock modules, and the screening charges arise from a certain combination of the DIM intertwiners. In the context of gauge theory, such identities were described in [101] as following from the regularity of qq-characters. Also, in the Nekrasov-Shatashvili limit these identities turn out to give the Baxter TQ equations for the Seiberg-Witten integrable systems related to the gauge theory [13][14][15][16].
However, we would like to describe a different form of integrable structure, related not to infinitesimal transformations (realized as the action of the DIM algebra), but to the "large" action of an automorphism group. This "large" action is performed by the R-matrix which we have describe above. Indeed, the R-matrix permutes the representations and thus acts on the intertwiners, i.e. on the topological vertices. The refined topological string amplitudes can then be interpreted as matrix elements of the transfer (or Lax) matrices, which are permuted according to the RT T -relations. More concretely, the simplest Toperator taking part in the relations is given by the following conifold geometry: (1.11) The action of the R-matrix on the toric diagram T -operator is given by eq. (3.2). The whole toric diagram now looks like the combination of objects familiar from the theory of quantum integrable models (e.g. spin chains): the R-matrices and T -operators (see figure 2). The vertical representations are identified with the quantum spaces (e.g. Hilbert spaces of the spins), while the horizontal ones are the auxiliary spaces, on which the Rmatrix acts. In terms of quantum group elements, the quantum space is associated with the algebra of functions, while the auxiliary one with the universal enveloping algebra [28][29][30][31]. Geometrically the R-matrix performs a generalized version of the flop transition on the Calabi-Yau manifold [102][103][104].
Let us also make a remark on a relation between the spectral duality and the R-matrix. The spectral duality S rotates the lattice of generators (or the preferred direction on the toric diagram) in figure 1 by π 2 . It turns out that the R-matrix can be naturally interpreted using the S automorphism. As we have already seen, the R-matrix looks simple in the basis of generalized Macdonald polynomials: indeed, it is just the permutation of the spaces and the spectral parameters denoted by the op label in (1.10). The generalized Macdonald basis is spectral dual to that of tensor products of the ordinary Macdonald polynomials. Thus, to compute the R-matrix in the basis of ordinary polynomials, one should first rotate to the spectral dual frame using S, then make the permutation of the spaces and finally rotate back using S −1 . We thus obtain the relation of the form where σ denotes the permutation of representations or legs of the toric diagram. We will encounter this relation when performing concrete computations of the R-matrices.
Having transfer matrices, one can take traces of them. Just as in any quantum integrable system, these traces generate a family of commuting integrals of motion. Those too have an interpretation in terms of topological string. However, this time one has to compactify the toric diagram, i.e. to consider not the toric Calabi-Yau threefold, but its compactified version. The situation here resembles that considered in the classic paper by V. Bazhanov, S. Lukyanov and A. Zamolodchikov [105,106], where an infinite family of integrals of motion in CFT was derived. The intertwiners of DIM play the role of exponentials of free fields and their traces, i.e. compactifications provide the integrals of motion. In JHEP10(2016)047 the language of matrix models, this corresponds to further deforming the measure: depending on the direction of compactification, it becomes either elliptic or affine. Eventually, the matrix elements of commuting integrals of our integrable system correspond to certain correlators in the elliptic or affine matrix models. There are different directions to pursue from this point. However, we only sketch possible further developments in section 5.
Let us point out an important difference between our approach and several recent works dealing with the DIM Ward identities and R-matrices [85,87,89,107]. We will predominantly work with horizontal representations, whereas in [85,87,89,107] it was essential to consider the vertical representations. It would be very interesting to unify the two approaches and make the SL(2, Z) invariance and duality between vertical and horizontal directions manifest.
We understand that similar calculations for DIM R-matrix have also been done by S. Shakirov [108].
2 R-matrices: from β-deformation to (q, t)-deformation In this section we implement the algorithm given in section 1.1 to compute the DIM Rmatrix.
To warm up, we start with two simplified examples. The first one (section 2.1) is the trivial case of unrefined topological string, i.e. t = q. The second one is the "4d limit" of the DIM algebra, the affine Yangian Y (ĝl 1 ) considered in section 2.2 (see [43, 44, 60-62, 88, 107, 109-115]). The construction in this case is parallel to the DIM algebra, with the generalized Macdonald polynomials replaced by the generalized Jack polynomials, and this makes the formulas a bit less bulky. Finally, in section 2.3 we turn to our real focus, the DIM R-matrix.

A trivial example: t = q, Schur polynomials
For the unrefined topological string, i.e. for t = q the generalized Macdonald Hamiltonian H 1 , (1.3) degenerates into the sum of two noninteracting Ruijsenaars Hamiltonians. Thus, the generalized Macdonald polynomials become just the product of two Schur functions, and do not essentially depend on the spectral parameters u 1,2 . This means that eq. (1.8) defines a trivial R-matrix, which is proportional to the identity matrix: 3

Affine Yangian R-matrix from generalized Jack polynomials
Two strands. For the tensor product of two Fock representation, the generalized Jack polynomials are eigenfunctions of the β-deformed cut-and-join operatorĤ to the Cartan subalgebra of the affine Yangian: It is the last term in the third line which breaks the symmetry between p andp and makes dual polynomials different. Notice that this term vanishes for β = 1, i.e. in the trivial case that we have considered in the previous subsection. In general, the eigenvalues corresponding to the eigenfunctions J AB {p,p} are Notice also that the eigenvalues (2.3) are degenerate: e.g. κ [1,1] . Thus, one still needs higher Hamiltonians H β n with n ≥ 2 to uniquely specify the polynomials, which makes the problem a little sophisticated. As we have already mentioned, this is cured at the DIM level, where the (q, t)-deformation makes the eigenvalues non-degenerate.
One can take the answer for the eigenfunctions from [81][82][83]. The first level reads: It is now straightforward to obtain the R-matrix from the relation similar to eq. (1.8). However, first, we emphasize a subtlety which makes the definition of the R-matrix nontrivial. The point is the simplicity of the definition of the "opposite" polynomials (1.10). This definition in fact depends on the choice of the particular special normalization of the polynomials. To put it another way, the R-matrix indeed transforms each generalized Jack polynomial into the corresponding "opposite" polynomial, however, the coefficient needs not necessarily to be the identity. Thus, for arbitrary normalization of the generalized polynomials, one has the following definition of the opposite ones: where N AB (u|β) is the normalization coefficient absent for the special normalization. Then, the R-matrix is indeed given by or, using the Jack scalar product,

JHEP10(2016)047
The Jack scalar product is defined as Notice the conjugate polynomial J * op AB in the bra vector in eq. (2.7). We now describe the special normalization of Jack polynomials explicitly. To this end, we expand J AB in the basis of monomial symmetric functions: where m A (p n ) denote the monomial symmetric polynomials and the normalization factor is (2.10) and is the usual 4d Nekrasov factor. The normalization factor N AB in eq. (2.9) is the same as in eq. (2.5). Notice that the special normalization is different from another popular choice of normalization, which we call standard. In the standard normalization, the coefficient in where z vec is the vector contribution to the Nekrasov functions [116][117][118]. In particular, one has ||J AB || 2 = z vec AB (u|β). (2.12) The polynomials (2.5) are already written in the special normalization. This normalization is in fact natural from the cohomological point of view. The generalized Jack polynomials can be associated to the fixed points in the moduli space of SU(2) instantons (or to the Hilbert schemes of points on C 2 ) [114]. The action of the first HamiltonianĤ 1 is given by the cup product with the first Chern class in the cohomology, whereas higher Hamiltonians are cup products with higher Chern classes. They commute simply because of the commutativity of the cup product. The specially normalized generalized Jack polynomials then describe stable envelopes of the corresponding fixed points.
Having understood the subtle point of normalization, we get the R-matrix in the basis of generalized Jack polynomials: (2.14)

JHEP10(2016)047
This R-matrix, though simple, is still nontrivial. It should be supplemented with the identity block arising from the generalized Jack polynomials at the zeroth level: should satisfy some form of the Yang-Baxter relation. However, it does not look like the 3 × 3 block of the standard rational R-matrix which is the only 3 × 3 rational solution to the Yang-Baxter equation. This discrepancy is resolved if we recall that the basis of generalized Jack polynomials in the tensor product of two Fock representations of the affine Yangian, are not factorised into vectors in each representation. To get more familiar expression for the R-matrix, we should consider its matrix elements in a basis, where the vectors are factorized into tensor products, e.g. the products of the Jack polynomials J (β) The basis is changed with the help of the generalized Kostka matrices: (2.18) At the first level, we have The R-matrix in the factorized basis of the ordinary Jack polynomials is given by where ||J|| 2 denotes the diagonal matrix containing the norms of generalized Jack polynomials. Eq. (2.20) gives the standard rational R-matrix (2.17). Formula (2.20) can be understood as a decomposition of the R-matrix into the upper and lower triangular parts, since

JHEP10(2016)047
Moreover, one can refine this decomposition even further: one can identify the upper and lower triangular parts with identities on the diagonal and the diagonal part sandwiched between them. To obtain this decomposition, one should explicitly write down the normalization coefficients N AB (u|β) of generalized Jack polynomials in the formulas for the R-matrix. The diagonal part then comes from the term N AB (u 1 −u 2 |β) N BA (u 2 −u 1 |β) in eq. (2.5) and the whole expression becomes In eq. (2.22) the term in the curly brackets is upper triangular with identities on the diagonal, the matrix N is diagonal and K is lower triangular.
Decomposition of the R-matrix into the upper and lower triangular parts also has an interpretation in the cohomology of the instanton moduli space [88,89]. Parts of the R-matrix decomposition correspond to stable envelopes of the fixed points, i.e. to the cohomology classes of the attracting domains of the fixed points under a certain C × -action. The R-matrix in this approach is given by the infinite product of the "wall R-matrices" labelled by rational slopes (determined by the integer pairs corresponding to the double gradings of DIM or affine Yangian generators, as depicted in figure 1) within the interval of angles: [0, π]. The lower triangular part corresponds to the product over [0, π 2 ], the diagonal one represents the wall with infinite slope, and the lower triangular matrix is the product over [ π 2 , π]: .
(2.23) Such a decomposition is just a reflection of the identity R = SσS which we have mentioned in the Introduction. Each wall R-matrix corresponds to a change of the preferred direction from one "chamber" in (C × ) 2 to another, the border between them being the line of rational slope. The product of wall R-matrices over angles [0, π 2 ] is nothing but the automorphism S. Also, in [119] it was shown that the generalized Kostka matrices are in fact the matrix elements of S in the basis of eigenfunctions of the DIM Cartan subalgebra (the story for the affine Yangian, which we study in this section, is parallel). Depending on whether the preferred direction (or the representation in question) is horizontal or vertical, the eigenfunctions of the Cartan subalgebra can be either ordinary or generalized polynomials. S performs a linear transformation between the two basis sets, and is thus nothing but the Kostka matrix K as clearly seen from the definition (2.18). Eventually, the decomposition (2.22) is a reflection of the decomposition (1.12), where σ is accompanied by multiplication with the diagonal matrix N .
Yet another meaning of the R-matrix that we have just obtained can be seen by noticing that the affine Yangian acting on the tensor product of two Fock modules contains the Virasoro subalgebra generated by the dressed current t(z) = α(z)x + (z)β(z). A pair of Heisenberg algebras provides a bosonization of this Virasoro algebra. However, it is well-known that there are two such bosonizations related to each other by the Liouville reflection matrix [42]. The job of the reflection matrix is similar to that of the R-matrix: it JHEP10(2016)047 exchanges the two types of bosons. Indeed, one can see that the two objects are in fact one and the same. For example, as we have discussed in the previous subsection, the R-matrix is trivial for t = q or equivalently β = 1, and the Liouville reflection matrix is also trivial, since c = 1 + 6( √ β − 1/ √ β) 2 = 1 in this case. In fact, the tensor product of two Heisenberg algebras acting on two Fock modules contains in addition to the Virasoro also the diagonal Heisenberg subalgebra, which is usually called the "U(1) part" in the AGT context [120]. This part is of course left invariant by the reflection matrix. One can see that the R-matrix also leaves this subspace invariant. Thus, the R-matrix of the affine Yangian is nothing but the reflection matrix of the Liouville theory.
More strands. For more than two strands, the generalized Jack polynomials can still be described as eigenfunctions of a certain Hamiltonian H (2.26) The construction of the R-matrix is similar to the case of two strands. The important difference is that there are now r − 1 R-matrices, which permute the factors in the tensor product of Fock modules. They form a representation of the r-strand braid group B r . In the basis of generalized Jack polynomials, the resulting R-matrices look rather ugly (see appendices A.1.2 and especially A.2.2). However, in the basis of ordinary Jack polynomials, the expressions simplify. In this basis, the R-matrix acting on each pair of strands becomes a copy of the two-strand R-matrix: (2.27) Thus, all the familiar results from integrable systems hold, e.g. the fusion of R-matrices. For three strands, one can also check the Yang-Baxter equation and it works as expected. The relation with the spectral duality (1.12) for several strands is modified in an obvious way: where σ i,j permutes the i-th and j-th strands.

DIM R-matrix from generalized Macdonald polynomials
In this section, we compute the DIM R-matrix from the generalized Macdonald polynomials. This turns out to be simpler and more natural than the affine Yangian R-matrix in the previous subsection.
Two strands. As we described in the Introduction, the generalized Macdonald polynomials are eigenfunctions of the element x + 0 of the DIM algebra acting in the tensor product of Fock representations: and where ∆ is the DIM coproduct and ρ u denotes the horizontal Fock representation [41,63,64]. Note that the eigenvalues (2.30) are non-degenerate and, though there are higher Hamiltonians H n (see appendix B), they are not needed to determine the spectrum. One can ask how does the degeneration appear in the Yangian limit q → 1. The Hamiltonian H 1 in this limit is expanded in series of operators in (q−1), and the first term is the Hamiltonian H (β) 1 (2.2) which we considered in the previous subsection. Since this is just the first term in the expansion, some eigenvalues degenerate and one needs higher Hamiltonians H (β) n . However, all these Hamiltonians are contained in the expansion of H 1 .
We slightly changed our notations compared to the previous subsection: the order of Young diagrams A, B is reversed as compared to section 2.2. This is done mostly to conform with the existing literature on the subject, where the discrepancy seems to be already entrenched.
The generalized Macdonald polynomials at the first level are given by 4 4 We again remind the reader of the change of convention Q → Q −1 as compared to [86].

JHEP10(2016)047
As in the previous subsection, these polynomials are written in the special normalization such that the definition of opposite polynomials is given by eq. (1.10). In [86] a different normalization was used such that M AB = 1 · m A (p n )m B (p n ) + . . . We conform with the previous notation and denote the specially normalized polynomials by M AB as in [86], eq. (19). Let us write down the normalization coefficient, which we take from [86]: For the polynomials M AB (without tilde), the definition of opposite polynomial is After the generalized polynomials are found, the R-matrix is determined in the same way as for the affine Yangian. We simply write down the main formulas, since the discussion is very similar to the previous section. The R-matrix in the basis of generalized Macdonald polynomials is It is given by Transformation to the basis of ordinary Macdonalds is performed using the q-deformed versions of generalized Kostka matrices:

JHEP10(2016)047
The resulting 2 × 2 block is the same as the block appearing in the standard trigonometric R-matrix: Again the digression on the triangular decomposition is relevant here. The only difference is that the geometric interpretation now lies in equivariant K-theory of the instanton moduli space. Otherwise, the comparison with the "wall R-matrices" as in eq. (2.23) is still valid and the resulting decomposition also gives the relation with the spectral duality transformation S as in eq. (1.12). Also, the DIM R-matrix provides the reflection matrix for the q-deformed Virasoro algebra.
More strands. Again the discussion here is exactly parallel to the previous section, only the formulas are somewhat larger. The generalized Macdonald Hamiltonian for N strands is given by

JHEP10(2016)047
and the generalized Macdonald polynomials are defined as its eigenfunctions: An explicit computation of the R-matrix for three strands is performed in appendices A.1.1 (first level) and A.2.1 (second level). In the basis of ordinary Macdonald polynomials, the R matrices R ij act only on the i-th and j-th representations in the tensor product, just as for any standard integrable system. The Yang-Baxter equation is also satisfied, as shown in appendix A.1.1.
Thus, in this R matrix section, we demonstrated that both the DIM R-matrix and its affine Yangian limit can be easily computed for the horizontal Fock representations using the generalized Jack or Macdonald polynomials. The resulting R-matrices have usual properties and resemble the standard rational and trigonometric R-matrices. They are also related to the (q-)Virasoro reflection matrices and can be understood as the intersection of stable envelopes in the cohomology or K-theory of the instanton moduli spaces.
In the next section, we show that the transfer matrices or the Lax operators permuted by the DIM R matrix, can be understood as refined topological string amplitudes on resolved conifold.

RT T relations in the toric diagram
In this section, we prove that the R-matrix permutes the basic building blocks of the balanced toric web. These basic building blocks are resolved conifolds with Young diagrams placed on each external line: where Ψ and Ψ * are the intertwiners of DIM algebra [40,41], |s A , u denote the basis of Schur functions in the horizontal Fock space, |M | R denote the basis of ordinary Macdonald polynomials in the vertical Fock space (hence, the sign | ) and Ψ P denotes the matrix element of Ψ for the Macdonald polynomial M P on the vertical leg. Such building blocks allow us to construct an arbitrary balanced networks as shown in [41]. We assume that all correlators are normalized in such a way that, for the empty diagrams, the averages are identities.

Trivial diagrams on vertical legs
Before considering the most general RT T relation, let us give the proof in the simplified case, where some of the external diagrams are empty. The main ideas of the proof are similar to the general case, which requires one additional observation.
The RT T relations for the conifold building blocks look very similar to the RT T relations in any integrable system and can be drawn as follows: Here R, drawn as a box acts on the tensor product of the horizontal Fock modules corresponding to the horizontal legs. The preferred direction is vertical. Two horizontal modules are intertwined with one vertical by the combination of topological vertices. Equivalently, in the algebraic form, we have: Notice that the Young diagrams on the vertical external legs are chosen empty. This is the simplification that we use in this subsection and lift in the next one. We will use the following trick, which renders the RT T relations almost trivial. We rotate the preferred direction in the diagram from vertical to horizontal with the help of the automorphism S. This corresponds to the change of basis in the tensor product of horizontal representations from that of Schur functions |s Y 1 , u 1 |s Y 2 , u 2 to the generalized Macdonald polynomials |M Y 1 Y 2 (u 1 , u 2 |q, t) (without tilde, i.e. not specially normalized). In this new basis, the R matrix acts simply by permuting the strands (though, as we learned in the previous section, depending on the normalization of the basis vectors an additional constant might arise). Thus, in this basis, one gets the following relation (we moved two R-matrices to the r.h.s. of eq. (3.3)):

JHEP10(2016)047
or, algebraically, Notice the change in ordering of the tensor product due to the exchange of p n andp n in M op . It remains to prove the identity between l.h.s. of eq. (3.5) and r.h.s. of eq. (3.6). Both expressions are matrix elements of the T -operators in the basis of generalized Macdonald polynomials. We employ a very nice property of the generalized Macdonald basis. In this basis, the matrix elements of the product of two T -matrices are explicitly computable and given by the Nekrasov functions. As shown in [119], the corresponding matrix model averages factorize and the answer can be schematically written as follows (we again omit the prefactors, which cancel in the both sides of the RT T relations): (3.7) The G factors on the both sides of the RT T relations in the denominator cancel with the normalization factors N Y 1 Y 2 and (3.5) reduces to the elementary identity for the bifundamental Nekrasov functions [116][117][118]:

Arbitrary diagrams on vertical legs
We now generalize our proof of the RT T relations to the case of arbitrary states in the vertical representations. To this end, we use explicit expressions for the DIM intertwiners acting in the horizontal Fock module with the spectral parameter z (see [40,41] for details): The combination of intertwiners entering eq. (3.1) is then given by: where W λ,µ (z, u, v) ∼ z |λ|−|µ| ∆ (q,t) (uq λ t ρ , vq µ t ρ ) −1 is the scalar prefactor including the prefactors of Ψ and Ψ * and the terms from the normal ordering of Ψ and Ψ * . We will henceforth omit this prefactor in our calculations, since it does not affect the RT T relations, which are homogeneous in T . The identity we would like to prove can be represented pictorially as

JHEP10(2016)047
or, algebraically, for arbitrary α and β. We use the same trick as in the previous subsection and rotate the preferred direction of the diagram from vertical to horizontal. This makes the R-matrix diagonal as in eq. (3.6). However, now we compute the resulting amplitude in a different way: we also rotate the whole picture by π 2 and write down the operator expression for the matrix elements in the rotated frame. Explicitly, we have which should be valid for any α and β, so that these external states can be dropped. We have thus reduced the RT T relation to the commutation relation for the T -operators composed of the DIM intertwiners Ψ and Ψ * . We normalize the product of T -operators using the explicit expressions (3.12). We obtain (3.16) where we have dropped inessential prefactors. This result certainly reduces to eq. (3.7) for α = β = ∅, since the normally ordered operators act trivially on the vacuum. One can now obtain the commutation relation for the T -operators by normal ordering of the both sides of (3.15) and using the identity (3.8) for the Nekrasov bifundamental factor.
Let us recapitulate our main point in this section. We proved the RT T relations for the DIM R-matrix and T -operators constructed from refined topological string amplitudes on resolved conifold. In the next section, we use these relations to obtain commuting integrals of motion for our system.

Integrals of motion and compactification
Just as in any integrable system, the RT T relations (3.2) allow one to construct a commutative family of operators, integrals of motion on the Hilbert space of the theory. Those are usually taken to be traces of T -operators in various representations. In our case, there are several different ways to write down the integrals of motion. The first possibility is to take the vacuum matrix element of a product of T -operators. This gives the closed string amplitude on the toric Calabi-Yau threefold consisting of the resolved conifolds. The other JHEP10(2016)047 Figure 3. Commutativity of the integrals of motion implies relations between amplitudes with different Kähler parameters on the toric strip geometry. way is to compactify the toric diagram, which gives traces of products T -operators. The resulting amplitude is given by the matrix model average with the affine or elliptic measures depending on the direction of compactification.
A geometric meaning of the commutativity is in the both cases a generalization of the flop transition on the Calabi-Yau threefold. The most basic example of this transition is resolved conifold. The resolution can be taken in two different ways: either in one direction, or in the other one. The topological string amplitudes on two resolutions are related to each other by an analytic continuation in the Kähler parameter Q of the resolution. To switch from one threefold to the other, one has to replace Q by Q −1 . In the RT T relation, a similar exchange happens and, since the spectral parameters of two legs are exchanged, their ratio, i.e. the corresponding Kähler parameter is reversed. However, the situation is here slightly different, since the toric diagram looks the same after the application of the R-matrix.
Let us consider the two ways to construct the integrals of motion.
Vacuum matrix elements. The simplest example of this form is given by the toric strip geometry shown in figure 3. This geometry corresponds to a single chain of intertwiners with the empty diagrams on all vertical legs. From the explicit expressions for the intertwiners [41], one can deduce that the T operators indeed commute. The next step is to glue several strips together. This gives what was called in [41] balanced network. The amplitude corresponding to a balanced network can be interpreted as the partition function of a 5d linear quiver gauge theory with zero β-function. Then, depending on the duality frame (or preferred direction), the commutativity of integrals is either related to the action of the Weyl group of the gauge group or to the spectral dual Weyl group. This dual Weyl group corresponds to the Dynkin diagram of the quiver and permutes the gauge coupling constants. This dual Weyl group has an interesting interpretation in terms of the AGT dual conformal block: it exchanges the points and therefore represents some kind of a braiding matrix.
Compactification. The compactified toric diagram corresponds to elliptically fibered Calabi-Yau threefolds. Within the geometric engineering approach, such manifolds are related to gauge theories with adjoint matter, or necklace quivers. Again, the commutativity of integrals of motion is equivalent to the invariance under the Weyl group of the corre-JHEP10(2016)047 sponding necklace quiver, and thus permutes the coupling constants of the gauge theory. The spectral dual interpretation of the resulting amplitude is the partition function of a 6d linear quiver gauge theory compactified on a two-dimensional torus. The AGT relations in this case [121][122][123][124][125][126][127][128][129][130][131][132][133][134] give the conformal block of the q-deformed W -algebras on torus, or the spherical conformal block of the affine W -algebra [98,99].

Conclusion
• DIM algebras of higher rank. It would be interesting to consider similar construction of the R-matrix for the quantum toroidal algebras of higher rank, i.e. U q,t ( gl r ). However, the generalized Macdonald polynomials in this case remain to be computed. One of possible difficulties on this way is that bosonization involves less trivial free fields a la [135][136][137].
• Triple-deformed R-matrix. If one compactifies the toric diagram in the vertical direction, there would emerge an "affinized" version of the DIM R-matrix. It is plausible that this is the R-matrix for the Pagoda algebra [41], with the additional parameter being the compactification radius.
To evaluate this R-matrix, one needs to understand the corresponding "affine" generalized Macdonald polynomials. Let us notice that they exist already for a single horizontal leg, i.e. the simplest example is given by the polynomial labelled by a single Young diagram and depending on three parameters M (q,t,t) A (p n ). Fort → 0 one should recover the ordinary Macdonald polynomials.
• Application to knots. As we already noticed, the DIM algebra can be obtained as a limit of the spherical DAHA algebra for infinite number of strands. It is also known that the toric knot superpolynomials can be obtained from the action of spherical DAHA, or the corresponding DIM (the SL(2, Z) automorphisms play a crucial role in these computations). It is natural to assume that the R-matrix of DIM should be related to computation of superpolynomials. Presumably this R-matrix might give the Reshetikhin-Turaev formalism behind the Khovanov-Rozansky cohomologies.
• Building representations. Another important direction is to consider more sophisticated representations of the DIM algebra. Those can be obtained out of Fock modules by taking tensor products, e.g. F u 1 ⊗ · · · ⊗ F u k . For u i in general position, these representations turn out to be irreducible. The R-matrix for these representations is given by the fusion construction, which is similar to the known technique for affine quantum algebras. The R-matrix for these discrete choices of parameters also satisfies the Hecke algebra relations. However, as in the case of affine quantum algebras, (see, e.g., [138]) for certain discrete choice of parameters u a in resonance, i.e. for with i a , j a ∈ Z ≥0 , one gets invariant subspaces inside the tensor product arising from degenerate vectors. After factoring out these subspaces, one gets an irreducible representation space spanned by a subset of k-tuples of Young diagrams obeying additional Burge conditions [139][140][141]. These conditions can be interpreted as the requirement that the k-tuple of Young diagrams combine into a plane partition (3d Young diagram, melting crystal) of width k. In general, one can consider 3d Young diagrams with infinite "legs", i.e. nontrivial asymptotics along the coordinate axes, see figure 4. In the case of the tensor product, the "vertical" leg is nontrivial and is determined by the collection of numbers {i a , j a } in the resonance condition (5.1). To get a second nontrivial leg, one should consider an infinite tensor lim k→∞ k i=1 F u i . In this case, the second asymptotic of the 3d Young diagram is determined by the asymptotic shape of the last Young diagram lim k→∞ Y k . The resulting representation is called the MacMahon module and has many nice properties, e.g. the S 3 symmetry exchanging the coordinate axes. Since the MacMahon module is a subrepresentation of the tensor product, it is, in principle, possible to obtain the R-matrix for it by the fusion method. The R-matrix in this case should be related to the one studied in [85,87]. It would be interesting to see if this calculation can be made explicitly.

A Explicit expressions for DIM R-matrix
In this appendix, we provide explicit expressions for the DIM R-matrix at the first two levels of Fock representations for two and three strands. We then demand that the three R-matrices acting on the three strands, R 12 , R 23 and R 13 act on its own pair of spaces each. This means that R 12 acts exclusively on the first two polynomials in the basis M A (p (1) )M B (p (2) )M C (p (3) ). This allows us to find the special normalization constants, which we denote here by k ij l . They are related to the normalization constants N AB (u|q, t) featuring in the main text, e.g.
In this appendix, we formally write the R-matrix as R = i a i ⊗ b i and set In order to obtain the representation matrix of R ij , we need the generalized Macdonald polynomials M ABC in N = 3 case. The following are examples of M ABC at level 1: By definition of the R-matrix, one has Thus, ρ u 1 u 2 u 3 (R 12 )M ABC is proportional to an eigenfunction of ρ u 1 u 2 u 3 ((∆ op ⊗id)•∆(x + 0 )), where ρ u 1 u 2 u 3 = ρ u 1 ⊗ ρ u 2 ⊗ ρ u 3 . Its eigenfunctions M (12) DEF are obtained by replacing p (1) with p (2) and u 1 with u 2 , i.e., ABC and ρ(R 12 )(M ABC ). In the same way, from the formula the representation matrix of ρ u 1 u 2 u 3 (R 23 ) is The constants k (ij) l are determined as follows. At first, since the scalar multiples of R-matrices are also R-matrices, we can normalize k Then B (ij) have the following form l . Since when R 12 acts to p  In this way, one obtains an explicit expression of the R-Matrix at level 1

JHEP10(2016)047
Thus, using the symmetry w.r.t. p (i) at different i, one also gets the representation matrix of ρ u 1 u 2 u 3 (R 13 ) Indeed, one can check that they satisfy the Yang-Baxter equation (12) .

JHEP10(2016)047
We do not write down the matrix B (13) , since it is too complicated. The representation matrix of (ρ u 1 ⊗ ρ u 2 )(R) is the 2 × 2 matrix block at the lower right corner of t B (12) The generalized Macdonald polynomials are reduced to the generalized Jack polynomials in the limit q → 1 (t = q β , u i = q u i ) (hereafter in this paragraph we substitute u i by u i ). Hence, the β-deformed version of R-matrix R (β) is immediately obtained from the results of the last paragraph. For example, for the representation ρ u 1 ⊗ ρ u 2 and in the basis of generalized Jack polynomials, . (A.24) Here Then, (A. 28) In the basis of power sum symmetric functions, where M ABC denotes the product of ordinary Macdonald polynomials M A (p (1) )M B (p (2) ) · M C (p (3) ), and the matrix A is given below. In the same manner, one can get the representation matrix of R. First of all, we choose B (12) at level 2 to be of the form Then, one finds the proportionality constant such that all b ij are zero just by solving the equations b i1 = 0 (i = 3, 4, . . . , 9). We also checked that the representation matrix B ij obtained in this way satisfies the Yang-Baxter equation.
B.1 Action of x + ±1 on generalized Macdonald polynomials We use the notation M λ is renormalized as M λ = m λ + · · · , in terms of the product of the monomial symmetric functions m λ = m λ (1) ⊗ · · · ⊗ m λ (N ) . Their integral forms M λ are defined by where λ T is the transposed of Young diagram λ and we use the Nekrasov factor (2.34). It is expected that the basis M λ corresponds to the AFLT basis 5 in [142] and realizes the rank N representation through the spectral duality S. That is to say, for any generator a in the DIM algebra, that the action of ρ (N ) u 1 ,...,u N • S(a) on the integral forms M λ are the same as the action of ρ rankN (a) on the basis | u, λ [142]. Indeed, one can check that the action of x + ±1 on the generalized Macdonald polynomials is given by the following conjecture. Let us denote adding a box to or removing it from the Young diagram λ through A( λ) and R( λ) respectively. We also use the notation χ ( ,i,j) = u t −i+1 q j−1 for the triple x = ( , i, j), where (i, j) ∈ λ ( ) are the coordinates of the box of the Young diagram λ ( ) .

JHEP10(2016)047
where for the partition λ we define The eigenvalues e (k) λ correspond to those of the rank N representation of the generators ψ + k in [142]. In the k = 1 case, the conjecture (B.11) can be proven. We have checked it for | λ| ≤ 5 for N = 1, for | λ| ≤ 3 for N = 2, for | λ| ≤ 2 for N = 3 and for | λ| ≤ 1 for N = 4 in the k ≤ 5 case.