Ab initio calculations of the electronic and optical properties of silicon quantum dots embedded in different matrices