Ab initio study on localization and finite size effects in the structural, electronic, and optical properties of hydrogenated amorphous silicon