In a many-to-many collimating system using gradient-index- rod lenses (GRINs) for an optomechanical matrix switch, there are multiple cross-connections having different optical path lengths so that excess coupling losses arise. The total coupling loss is greatly reduced by properly choosing the GRIN lengths. Two schemes can do so. In the equal ?Z scheme, all GRINs have the same excess length ?Z0 than the quarter pitch, which is optimized at 13, 25, and 49 µm for the three focusing parameters of 0.237, 0.326, and 0.417 mm-1, respectively. The total coupling loss is further reduced in the unequal ?Z scheme, in which the ?Zµ of each GRIN is independently determined and optimized by numerical computation. The results are preferred rather than the zero ?Z scheme where just quarter-pitch GRINs are used.