Hey,

stan seems quite picky with regard to covariance matrices. Specifically, it throws an error if a covariance matrix is semi-definite, which still is a valid covariance matrix.

The following MWE demonstrates this.

```
data{
int<lower=1> maxTime;
vector[maxTime] Y;
}
parameters{
real theVar;
}
transformed parameters{
vector[maxTime] mu;
matrix[maxTime,maxTime] Sigma;
for (i in 1:maxTime){
mu[i]=0;
}
for (i in 1:maxTime){
for( j in 1:maxTime){
Sigma[i,j] = theVar;
}
}
}
model{
Y ~ multi_normal(mu, Sigma);
}
```

which I run in R using

```
library(MASS)
library(rstan)
theModel <- stan_model(file='stan_file.stan')
maxTime <- 10
Y <- mvrnorm(n=1,mu=rep(0,10),Sigma=matrix(3,nrow = maxTime,ncol = maxTime))
theData <- list(maxTime=10,Y=Y)
fittedModel <- optimizing(theModel,theData,hessian = TRUE,as_vector=FALSE)
```

It throws

```
Exception: multi_normal_lpdf: LDLT_Factor of covariance parameter is not positive definite. last conditional variance is 0.
Error in sampler$call_sampler(c(args, dotlist)) : Initialization failed.
```

Is there a way to fit models that imply a semi-definite covariance matrix in stan?