@Override public IndexMappingBuffer take() { if (currentBuffer == null) return null; IndexMappingBuffer buf = currentBuffer; if (state) { currentBuffer = null; buf.addSign(true); } else { buf = buf.clone(); state = true; } return buf; } }
@Override public IndexMappingBuffer take() { if (currentBuffer == null) return null; IndexMappingBuffer buf; while (true) { if (currentSource != null && (buf = currentSource.take()) != null) return buf; if (!permutationGenerator.hasNext()) { currentBuffer = null; return null; } currentPermutation = permutationGenerator.next(); currentSource = IndexMappings.createPortOfBuffers(currentBuffer.clone(), from[0], to[currentPermutation[0]]); } }
@Override public IndexMappingBuffer take() { if (currentBuffer == null) return null; while (currentProvider == null) { if (!generator.hasNext()) return null; final int[] permutation = generator.next(); final Tensor[] newTo = new Tensor[to.length]; for (int i = 0; i < to.length; ++i) newTo[i] = to[permutation[i]]; currentProvider = new SimpleProductMappingsPort(IndexMappingProvider.Util.singleton(currentBuffer.clone()), from, newTo); final IndexMappingBuffer buffer = currentProvider.take(); if (buffer != null) return buffer; currentProvider = null; } final IndexMappingBuffer buffer = currentProvider.take(); if (buffer == null) { currentProvider = null; return take(); } return buffer; } }
while (searchForPermutations.hasNext()) { permutation = searchForPermutations.next(); IndexMappingBuffer tempBuffer = currentBuffer.clone(); for (int i = 0; i < size; ++i) if (!tempBuffer.tryMap(fromIndices.get(i), toIndices.get(permutation.newIndexOf(i))))