<s>[INST] Integral of exponential quadratic and linear Is there any closed form of the integral below?
$$
y = \int_0^\infty \exp\left[-\frac{(\mathbf{b}-\mathbf{Ax})^2}{2\sigma^2}-\lambda \sum_{i=0}^{N-1} x_i\right]\ \mathrm{d}\mathbf{x}
$$
where $\mathbf{x}$ is an $N\times1$ vector, $\mathbf{A}$ is an $M\times N$ matrix, and $\mathbf{b}$ is an $M\times 1$ vector. If $\mathbf{A}$ is a diagonal square matrix, I can solve it by separating the integral for each $x_i$. However, for general matrix $\mathbf{A}$, I have no idea how to solve it. Any ideas will be appreciated!
 [/INST] With a vector $\mathbf{1}$ with all components equal to 1, write is as  
$$
y = \int_0^\infty \exp\left[-\frac{(\mathbf{b}-\mathbf{Ax})^2}{2\sigma^2}-\lambda \mathbf{x}\mathbf{1}\right]\ \mathrm{d}\mathbf{x}
$$
and further, for $M = N$,
$$
y = \int_0^\infty \exp\left[-\frac{1}{2\sigma^2}(\mathbf{b}^2-2 \mathbf{bAx} + \mathbf{xA^2x}+ 2 \sigma^2\lambda \mathbf{x}\mathbf{1})\right]\ \mathrm{d}\mathbf{x}\\
= \int_0^\infty \exp-\frac{1}{2\sigma^2}\left[(\mathbf{Ax} -(\mathbf{b} - \sigma^2\lambda \mathbf{A^{-1}}\mathbf{1}))^2 - (\mathbf{b} - \sigma^2\lambda \mathbf{A^{-1}}\mathbf{1}))^2 + \mathbf{b}^2\right]\ \mathrm{d}\mathbf{x}\\
= \exp-\frac{1}{2\sigma^2} (- (\mathbf{b} - \sigma^2\lambda \mathbf{A^{-1}}\mathbf{1}))^2 + \mathbf{b}^2) \int_{-\mathbf{A^{-1}}(\mathbf{b} - \sigma^2\lambda \mathbf{A^{-1}}\mathbf{1})}^\infty \exp-\frac{1}{2\sigma^2}(\mathbf{Ax} )^2  \mathrm{d}\mathbf{x}\\
$$
where the last integral is standard but however will leave you some work if $\mathbf{A}$ is not diagonal. It would be easier here to have the integrals $ \int_{-\infty}^\infty$. 
EDIT:
Case $M \neq N$.
In  this case there is no matrix $A^{-1}$. 
The main task to do is to perform a completion of the square of the term already derived above,
$$
\mathbf{b}^2-2 \mathbf{bAx} + \mathbf{xA^2x}+ 2 \sigma^2\lambda \mathbf{x}\mathbf{1}
$$
When the inverse $\mathbf{A^{-1}}$ exists, the completion is possible by setting  $\mathbf{y} = \mathbf{Ax}$ which inverts to $\mathbf{x} = \mathbf{A^{-1} y}$ and then continue as laid out above, where the term $ \mathbf{x}\mathbf{1}$ turns into $ \mathbf{1} \mathbf{A^{-1}} \mathbf{A}\mathbf{x} = \mathbf{1} \mathbf{A^{-1}}\mathbf{y}$.
Now, when  the inverse $\mathbf{A^{-1}}$ does not exist, we can proceed along  the lines of completions of the square, but in a modified way. We have the square term (with transposed matrices)  $\mathbf{x^T A^T A x}$. Regardless of $M$,  $\mathbf{ A^T A}$ is an $N \times N$ matrix which is symmetric. Therefore it can be decomposed into a product $\mathbf{ B^T B}$ where  $\mathbf{B}$ will be a $N \times N$ matrix. Formally, write a matrix $U$ composed from eigenvectors and, if necessary, generalized eigenvectors of  $\mathbf{ A^T A}$, which span the $N$-dimensional space. A diagonal matrix $\mathbf{\Lambda}$ will contain the eigenvalues and, if necessary, generalized eigenvalues of  $\mathbf{ A^T A}$. Then $\mathbf{B} = \mathbf{\sqrt \Lambda U}$ where the square root indicates that the square root is taken of all elements on the diagonal. We have that $\mathbf{A^T A}$ = $\mathbf{B^T B}$.
With these considerations, $\mathbf{B}$ is invertible to $\mathbf{B^{-1}} = \mathbf{ U^{-1} \sqrt \Lambda^{-1}}$ and we can write $\mathbf{x} = \mathbf{B^{-1} y}$ and further, as above, $ \mathbf{1} \mathbf{x} = \mathbf{1} \mathbf{B^{-1}}\mathbf{y}$. The general result can then be taken directly from above,
$$
y 
= \exp-\frac{1}{2\sigma^2} (- (\mathbf{b} - \sigma^2\lambda \mathbf{B^{-1}}\mathbf{1}))^2 + \mathbf{b}^2) \int_{-\mathbf{B^{-1}}(\mathbf{b} - \sigma^2\lambda \mathbf{B^{-1}}\mathbf{1})}^\infty \exp-\frac{1}{2\sigma^2}(\mathbf{Ax} )^2  \mathrm{d}\mathbf{x}\\
$$
where the square in the exponent can be written both ways, $\mathbf{xA^2x} = \mathbf{xB^2x}$. 
P.S.: I believe that $\mathbf{B^{-1}}$ cannot be expressed  as the Pseudoinverse. 
</s>