Ab initio studies of the optoelectronic structure of undoped and doped silicon nanocrystals and nanowires: the role of size, passivation, symmetry and phase