The short answer is:
$$
\vec{u}\cdot\vec{v} = \vec{u}^TG\vec{v},
$$
where $^T$ is transpose and $G$ is a special matrix called metric tensor. For standard $\mathbb{R}^n$ space this tensor has signature $(n,0,0)$ which is just identity $n\times n$ matrix. Thus in $\mathbb{R}^2$
$$
\begin{pmatrix}u_1 \\ u_2\end{pmatrix}\cdot\begin{pmatrix}v_1 \\ v_2\end{pmatrix} = \begin{pmatrix}u_1 & u_2\end{pmatrix}\begin{pmatrix}1 & 0 \\ 0 & 1\end{pmatrix}\begin{pmatrix}v_1 \\ v_2\end{pmatrix} = u_1v_1 + u_2v_2.
$$
In other spaces with other metrices the scalar product may has another forms. For example, in Minkowski space the metric tensor has signature $(3,-1,0)$, and the matrix $G$ from the first equation there has the following form:
$$
G = \begin{pmatrix}-1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\end{pmatrix}.
$$
Thus for two vectors $\vec{s}_1 = (t_1, x_1, y_1, z_1)^T$ and $\vec{s}_2 = (t_2, x_2, y_2, z_2)^T$ the scalar product has the form
$$
\vec{s}_1\cdot\vec{s}_2 = -t_1t_2 + x_1x_2 + y_1y_2 + z_1z_2.
$$