public IndexMappingBufferRecord(int from, int to) { this.toName = IndicesUtils.getNameWithType(to); states |= 1 << IndicesUtils.getStateInt(to); states |= (IndicesUtils.getStateInt(from) ^ IndicesUtils.getStateInt(to)) << 2; }
public boolean tryMap(int from, int to) { if (IndicesUtils.getNameWithType(to) != toName) return false; if ((IndicesUtils.getStateInt(from) != IndicesUtils.getStateInt(to)) != ((states & 0x4) == 0x4)) throw new InconsistentIndicesException(from); if ((states & (1 << IndicesUtils.getStateInt(to))) != 0) throw new InconsistentIndicesException(to); states |= 1 << IndicesUtils.getStateInt(to); return true; }
@Override public boolean tryMap(int from, int to) { int fromState = IndicesUtils.getStateInt(from); if (fromState != IndicesUtils.getStateInt(to) && !CC.isMetric(IndicesUtils.getType(from))) return false; int fromName = IndicesUtils.getNameWithType(from); IndexMappingBufferRecord record = map.get(fromName); if (record == null) { record = new IndexMappingBufferRecord(from, to); map.put(fromName, record); return true; } return record.tryMap(from, to); }
state = 1 - IndicesUtils.getStateInt(index); state = IndicesUtils.getStateInt(index); info[state][pointer[state]] = packToLong(tensorIndex, diffIds[i], i); indices[state][pointer[state]++] = IndicesUtils.getNameWithType(index);
private int[] getLinks(final int pivot) { if (pivot == DUMMY_PIVOT) return DUMMY; assert pivot >= 0; final int[] links = {NOT_INITIALIZED, NOT_INITIALIZED}; final long[] contractions = fcs.contractions[pivot]; Indices indices = pc.get(pivot).getIndices(); int index, toTensorIndex; for (int i = contractions.length - 1; i >= 0; --i) { index = indices.get(i); if (getType(index) != type.getType()) continue; toTensorIndex = getToTensorIndex(contractions[i]); int state = 1 - getStateInt(index); if (links[state] >= -1 && links[state] != toTensorIndex) links[state] = BRANCHING; if (links[state] == NOT_INITIALIZED) links[state] = toTensorIndex; } if (links[0] == NOT_INITIALIZED) links[0] = NO_LINKS; if (links[1] == NOT_INITIALIZED) links[1] = NO_LINKS; return links; }
state = 1 - IndicesUtils.getStateInt(index); for (i = 0; i < tInds.size(); ++i) { index = tInds.get(i); state = IndicesUtils.getStateInt(index); info[state][pointer[state]] = packToLong(tensorIndex, stretchIndices[tensorIndex], diffIds[i]); indices[state][pointer[state]++] = IndicesUtils.getNameWithType(index);