I'm solving a problem which features a function $f: \mathbb{R}^4 \rightarrow \mathbb{R}^4.$ I don't know the function, but I assume it's linear and it can be expressed as $ \mathbf{y} = \mathbf{A} \cdot \mathbf{x},\; \mathbf{A} \in \mathbb{R}^{4\times 4},\; \mathbf{x},\mathbf{y} \in \mathbb{R}^{4}$.
I have a lot of data, ie. $ (\mathbf{x}, \mathbf{y}) $ tupples and my first thought was to perform some kind of least-squares fitting in order to obtain the matrix $ \mathbf{A} $. However, I'm not sure if this approach is correct, because I've only seen the least-squares applied to functions $ \mathbb{R}^{n} \rightarrow \mathbb{R} $. If I used least-squares I'd perform the fitting for each of the $f$'s range variables separately, which I doubt is valid.
How to solve this problem correctly?