ProductContent content = product.getContent(); ns = new ArrayList<>(content.size()); ns.add(product.getIndexlessSubProduct()); sums = new ArrayList<>(content.size()); for (Tensor t : content)
@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; } };
public static Tensor expandProductOfSums(Product product, Transformation[] transformations) { Tensor indexless = product.getIndexlessSubProduct(), data = product.getDataSubProduct(); boolean expandIndexless = false, expandData = false, containsIndexlessSumNeededExpand = false;
return Tensors.multiply(product.getIndexlessSubProduct(), Tensors.multiply(data));
private Tensor expandDiracStructures(final Tensor t) { FromChildToParentIterator iterator = new FromChildToParentIterator(t); Tensor current; while ((current = iterator.next()) != null) { if (!(current instanceof Product)) continue; //early termination if (!containsGammaOr5Matrices(current)) continue; Product product = (Product) current; //positions of matrices PrimitiveSubgraph[] partition = PrimitiveSubgraphPartition.calculatePartition(product.getContent(), matrixType); //traces (expand brackets) boolean containsTraces = false; traces: for (PrimitiveSubgraph subgraph : partition) { if (subgraph.getGraphType() != GraphType.Cycle) continue traces; //expand each cycle containsTraces = true; } if (containsTraces) iterator.set(multiply(product.getIndexlessSubProduct(), expandAndEliminate.transform(product.getDataSubProduct()))); } return iterator.result(); }
return tensor; Tensor indexless = product.getIndexlessSubProduct(); ProductBuilder pb = new ProductBuilder(); pb.put(indexless);