Effect of Rigidity of a Polymer Matrix on the Photochemical Transformations of Photochromic Compounds