/**
  * Multiplies one mapping by another.
  *
  * <p>{@code divide(A, B)} returns a mapping C such that B . C (the mapping B followed by the
  * mapping C) is equivalent to A.
  *
  * @param mapping1 First mapping
  * @param mapping2 Second mapping
  * @return Mapping mapping3 such that mapping1 = mapping2 . mapping3
  */
 public static Mapping multiply(Mapping mapping1, Mapping mapping2) {
   if (mapping1.getTargetCount() != mapping2.getSourceCount()) {
     throw new IllegalArgumentException();
   }
   Mapping product =
       create(
           MappingType.INVERSE_SURJECTION, mapping1.getSourceCount(), mapping2.getTargetCount());
   for (int source = 0; source < mapping1.getSourceCount(); ++source) {
     int x = mapping1.getTargetOpt(source);
     if (x >= 0) {
       int target = mapping2.getTarget(x);
       product.set(source, target);
     }
   }
   return product;
 }
 public int getSourceOpt(int target) {
   return parent.getTargetOpt(target);
 }