Fix an integer vector $\mathbf m\in \mathbb Z^k$. Let $q$ be a positive integer.


Is there a "good" upper bound in terms of $q,\bf m$ for the exponential sum:
\[\sum\_{\mathbf n} e\left(\frac{\langle m, n\rangle}{q}\right).\]
Here $\langle \cdot, \cdot \rangle$ is usual inner product and $e(z) = e^{2\pi i z}$. The sum is taken over all ${\mathbf n=(n\_1,\cdots,n\_k)}$ such that $1\le n\_i\le q$ and $gcd(n\_1,\cdots,n\_k,q)=1$.


When $k=1$, this is the famous Ramanujan sum. I have tried searching relevant results, but could not find any useful reference for $k\ge 2$. Any answers or references are appreciated!



Upper bound for a higher dimensional Ramanujan sum
Call this sum $c\_q(m\_1,\ldots,m\_k)$. The indicator function of the condition $(n\_1,\ldots,n\_k,q) = 1$ can be written as the sum $\sum\_{cd = (n\_1,\ldots,n\_k,q)} \mu(c)$, so that $d \mid q$, $c = \frac{q}{d}$, and $n\_j \equiv 0 \pmod{c}$ for all $j \in \{1,\ldots,k\}$. It follows that $c\_q(m\_1,\ldots,m\_k)$ may be written as
\[\sum\_{cd = (n\_1, \ldots, n\_k,q)} \mu(c) \prod\_{j = 1}^{k} \sum\_{n\_j = 1}^{q} e\left(\frac{n\_j m\_j}{q}\right)= \sum\_{d \mid q} \mu\left(\frac{q}{d}\right) \prod\_{j = 1}^{k} \sum\_{\substack{n\_j = 1 \\ n\_j \equiv 0 \pmod{\frac{q}{d}}}}^{q} e\left(\frac{n\_j m\_j}{q}\right).
\]
Writing $n\_j = \frac{q}{d} \ell\_j$, the inner sum is
\[\sum\_{\ell\_j = 1}^{d} e\left(\frac{\ell\_j m\_j}{d}\right)
= \begin{cases}
d & \text{if $d \mid m\_j$,} \\
0 & \text{otherwise.}
\end{cases}\]
So
\[c\_q(m\_1,\ldots,m\_k) = \sum\_{d \mid (m\_1, \ldots, m\_k, q)} \mu\left(\frac{q}{d}\right) d^k.\]
This is multiplicative as a function of $q$, so that
\[c\_q(m\_1,\ldots,m\_k) = \prod\_{p^r \parallel q} c\_{p^r}(m\_1,\ldots,m\_k).\]
So we need only determine $c\_q(m\_1,\ldots,m\_k)$ when $q = p^r$ is a prime power. Since
\[\mu(p^r) = \begin{cases}
1 & \text{if $r = 0$,} \\
-1 & \text{if $r = 1$,} \\
0 & \text{if $r \geq 2$,}
\end{cases}\]
we have that for $q = p$,
\[c\_p(m\_1,\ldots,m\_k) = \begin{cases}
p^k - 1 & \text{if $p \mid (m\_1,\ldots,m\_k)$,} \\
-1 & \text{if $p \nmid (m\_1,\ldots,m\_k)$,}
\end{cases}\]
while for $q = p^r$ with $r \geq 2$,
\[c\_{p^r}(m\_1,\ldots,m\_k) = \begin{cases}
p^{(r - 1)k} (p^k - 1) & \text{if $p^r \mid (m\_1,\ldots,m\_k)$,} \\
-p^{(r - 1)k} & \text{if $p^{r - 1} \parallel (m\_1,\ldots,m\_k)$,} \\
-1 & \text{if $p^{r - 1} \nmid (m\_1,\ldots,m\_k)$.}
\end{cases}\]


