@Override public Tensor transform(Tensor t) { if (!(t instanceof Product)) return t; Product p = (Product) t; if (p.indexlessLength() == 0) return t; Tensor indexless = p.getIndexlessSubProduct(); return Tensors.multiply(ExpandTransformation.expand(indexless), p.getDataSubProduct()); // boolean needExpandSums = false, needExpandPowers = false; // if (indexless instanceof Product) // for (Tensor i : indexless) { // if (i instanceof Sum) // needExpandSums = true; // if (isExpandablePower(i)) // needExpandPowers = true; // } // if (needExpandSums) // return Tensors.multiply(expandProductOfSums1(indexless, new Transformation[0], false), p.getDataSubProduct()); // return t; } };