The invention features a programmable optical chip. The optical chip has a plurality
of optical functions, each of which is connected to a waveguide having a core and
a cladding. A photosensitive layer is disposed between at least three of the waveguides,
and the photosensitive layer has a refractive index similar to that of the cladding
prior to exposure to irradiation. The photosensitive layer changes refractive index
upon exposure to irradiation to selectively form an optical connection between
at least two of the waveguides.