# How to create a toric variety whose Cox ring has a specific grading?

If one wanted to obtain a fan for a toric variety of dimension $$n>1$$ whose Cox ring is $$\mathbb{Z}^{2}$$ graded with weights $$\{(a_{i},b_{i})\}_{i=1}^{n+2}$$, then one could let $$B$$ be the $$n \times (n+2)$$ matrix whose $$(i,j)$$-th entry is $$\delta(i,j)$$ if $$1 \le i, j \le n$$, $$a_{i}$$ if $$j$$ is equal to $$n+1$$ and $$b_{i}$$ if $$n$$ is equal to $$n+2$$. After performing row reduction over the integers, one ends up with an $$n \times (n+2)$$ matrix $$A$$ with entries in $$\mathbb{Z}$$. The $$n+2$$ columns of $$A$$ are the rays for a fan in $$\mathbb{R}^{n}$$. If the rays are $$\{u_{\rho_{1}},\dots,u_{\rho_{n+2}} \}$$, then maximal dimensional cones $$\sigma$$ are of the form $$\operatorname{Cone}(u_{\rho_{i_{1}}},\dots,u_{\rho_{i_{n}}})$$. The fan $$\Sigma$$ is then obtained from the maximal cones and their faces. From $$\Sigma$$ one obtains an ideal $$B(\Sigma) = \langle x^{\widehat{\sigma}} \rangle_{\sigma \in \Sigma}$$ where $$x^{\widehat{\sigma}}$$ is $$\prod_{i \mid \rho_{i} \notin \sigma} x_{i}$$. From here the quotient of $$\mathbb{A}^{n+2}_{\mathbb{C}} \setminus Z(B(\Sigma))$$ by the $$\mathbb{G}_{m}^{2}$$ action which sends $$x_{i}$$ to $$z_{1}^{a_{i}}z_{2}^{b_{i}}x_{i}$$ is isomorphic to the variety $$X_{\Sigma}$$ obtained from the fan $$\Sigma$$. As a result, the Cox ring of $$X_{\Sigma}$$ has the desired grading.

What if instead of wanting to find an explicit fan of a toric variety of dimension $$n>1$$ whose Cox ring is $$\mathbb{Z}^{2}$$ graded, one wants to find an explicit fan of a toric variety of dimension $$n>1$$ whose Cox ring is $$\operatorname{Hom}(\mathbb{Z}/\langle M \rangle \mathbb{Z}, \mathbb{C}^{\ast}) \times \operatorname{Hom}(\mathbb{Z}/\langle N \rangle \mathbb{Z}, \mathbb{C}^{\ast})$$ graded with weights $$(\overline{a_{i}}, \overline{b_{i}})_{i=1}^{n}$$? Is there a similar algorithm for obtaining the fan for such a variety?

I realized an answer to this. Let $$B$$ be the $$n \times (n+2)$$-matrix with entries $$\delta(i,j)$$ if $$1 \le i,j \le n$$, $$a_{i}$$ if $$j$$ is equal to $$n+1$$ and $$b_{i}$$ if $$j$$ is equal to $$n+2$$. Now perform row reduction (with operations strictly in the integers) on the matrix $$B$$ until all entries of $$B$$ in the $$n+1$$-st column are $$c \delta(1,i)$$ and are equal to $$d \delta(2,j)$$ for some integers $$c$$ and $$d$$. If $$\ell_{1}$$ is equal to $$\operatorname{LCM}(c,M)$$ and $$\ell_{2}$$ is equal to $$\operatorname{LCM}(d,N)$$, then multiply the first row by $$M/\ell_{1}$$ and the second row by $$N/\ell_{2}$$. The $$i$$-th column is $$u_{\rho_{i}} \in \mathbb{N}^{n}$$. If $$\rho_{i}$$ is equal to $$\mathbb{R}_{+} u_{\rho_{1}}$$, then the cone $$\sigma$$ equal to $$\operatorname{Cone}(\rho_{1},\dots,\rho_{n})$$ is an affine toric variety.
The fan for the affine toric variety $$\operatorname{Spec}(\mathbb{C}[\sigma^{\vee} \cap M])$$ determines an ideal $$B(\Sigma)$$. If $$\mathbb{A}^{n}_{\mathbb{C}}$$ is isomorphic to $$\operatorname{Spec}(\mathbb{C}[y_{1},\dots,y_{n}])$$ he variety $$\left(\mathbb{A}^{n}_{k} \setminus Z(B(\Sigma))\right)//\left(\operatorname{Hom}(\mathbb{Z}/\langle M \rangle \mathbb{Z}, \mathbb{C}^{\ast}) \times \operatorname{Hom}(\mathbb{Z}/\langle N \rangle \mathbb{Z}, \mathbb{C}^{\ast})\right)$$ is isomorphic to this variety and therefore has the desired grading. Here the action sends $$y_{i}$$ to $$z_{1}^{\overline{a_{1}}} z_{2}^{\overline{b_{i}}} y_{i}$$. If others up-vote this answer, then I will accept it. If someone sees something wrong with this, then let me know.