Hi everyone, I am trying to fit a Bayesian Bekk model, but I can not control the sampling to get a symmetric covariance matrix. How can I improve the rejection of my sampling?

When including Stan code in your post it really helps if you make it as readable as possible by using Stan code chunks (```stan) with clear spacing and indentation. For example, use

```
data {
int<lower=0> n; // number of data items
int<lower=1> d; // number of dimensions
int<lower=0> s; // number of predictors arch
int<lower=0> k; // number of predictors garch
row_vector[d]y[n];// outcome matrix
}
transformed data{
row_vector[d] zero = rep_row_vector(0, d);
matrix[d,d] Id = diag_matrix(rep_vector(1.0,d));
}
parameters {
row_vector[d] mu; // Location parameter
cholesky_factor_cov[d] alpha0; //arch constant
matrix[d,d] alpha[s]; // arch coefficients
matrix[d,d] beta[k]; // garch coefficients
}
transformed parameters {
cov_matrix[d] sigma[n];
for(i in 1:n){
if(i <= k){
sigma[i]=Id;
}
else{
sigma[i] = multiply_lower_tri_self_transpose(alpha0);
for(j in 1:s){
sigma[i] = sigma[i] + quad_form( (y[i-j] - mu)'*(y[i-j]-mu),alpha[j]);
}
for(j in 1:k){
sigma[i] = sigma[i] +quad_form(sigma[i-j],beta[j]);
}
}
}
}
model{
// Likelihood
for(i in 1:n)
y[i] ~ multi_normal_cholesky(mu,cholesky_decompose(sigma[i]));
}
```