public It(int gamma, int gamma5, Product product, IndexType matrixType, Indicator<GraphType> filter) { this.gamma = gamma; this.gamma5 = gamma5; this.product = product; this.content = product.getContent(); this.matrixType = matrixType; this.partition = PrimitiveSubgraphPartition.calculatePartition(this.content, matrixType); this.filter = filter; }
/** * Creates partition of graph (or equivalently the product of indexed tensors) specified by {@link ProductContent} * taking into account edges (dummy indices) of specified {@link IndexType}. This method returns an array of all its * sub-graphs of types specified by {@link GraphType}. * * @param p {@link ProductContent} representing the graph * @param type type of edges to be taken into account in partition * @since 1.1 */ public static PrimitiveSubgraph[] calculatePartition(ProductContent p, IndexType type) { return new PrimitiveSubgraphPartition(p, type).partition; }
private PrimitiveSubgraph[] calculatePartition() { List<PrimitiveSubgraph> subgraphs = new ArrayList<>(); for (int pivot = 0; pivot < size; ++pivot) if (pc.get(pivot).getIndices().size(type) != 0 && !used.get(pivot)) subgraphs.add(calculateComponent(pivot)); return subgraphs.toArray(new PrimitiveSubgraph[subgraphs.size()]); }
left = right = getLinks(pivot); return processGraph(pivot); return processGraph(pivot); return new PrimitiveSubgraph(GraphType.Cycle, deque2array(positions)); left = getLinks(leftPivot); return processGraph(pivot); return new PrimitiveSubgraph(GraphType.Cycle, deque2array(positions)); left = getLinks(leftPivot); right = getLinks(rightPivot); return new PrimitiveSubgraph(GraphType.Line, deque2array(positions));
/** * Creates partition of graph (or equivalently the product of indexed tensors) specified by {@link ProductContent} * taking into account edges (dummy indices) of specified {@link IndexType}. * * @param productContent {@link ProductContent} representing the graph * @param type type of edges to be taken into account in partition */ public PrimitiveSubgraphPartition(ProductContent productContent, IndexType type) { this.pc = productContent; this.fcs = pc.getStructureOfContractions(); this.size = pc.size(); this.type = type; this.used = new BitArray(size); this.partition = calculatePartition(); }
/** * Creates a partition of graph (or equivalently the product of indexed tensors) specified by {@link Product} taking * into account edges (dummy indices) of specified {@link IndexType}. This method returns an array of all its * sub-graphs of types specified by {@link GraphType}. <b>Note</b>, that only indexed part of specified product * (i.e. its {@link ProductContent}) will be taken into account. So the positions of sub-graphs elements in {@link * PrimitiveSubgraph} may not be equal to the positions of tensors in product (since it can e.g. have a symbolic * part), but strictly corresponds to the positions of tensors in its {@link ProductContent}, i.e. in the indexed * part of the product. * * @param p {@link Product} representing the graph * @param type type of edges to be taken into account in partition * @return the partition of graph, i.e. an array of all its sub-graphs of types specified by {@link GraphType} * @since 1.1 */ public static PrimitiveSubgraph[] calculatePartition(Product p, IndexType type) { return new PrimitiveSubgraphPartition(p.getContent(), type).partition; }
void printData() { ArrayList<SubgraphContainer> subgraphs = new ArrayList<>(); for (IndexType type : matrixTypes) { PrimitiveSubgraph[] sgs = PrimitiveSubgraphPartition.calculatePartition(getContent(), type); out0: for (PrimitiveSubgraph sg : sgs) {
private static Tensor inverseOrderInProduct(Product product, IndexType type) { ProductContent pc = product.getContent(); PrimitiveSubgraph[] subgraphs = PrimitiveSubgraphPartition.calculatePartition(pc, type); Tensor[] data = pc.getDataCopy(); boolean somethingDone = false;
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(); }
ProductContent productContent = product.getContent(); PrimitiveSubgraph[] subgraphs = PrimitiveSubgraphPartition.calculatePartition(productContent, matrixType);
= PrimitiveSubgraphPartition.calculatePartition(pc, matrixType);