private static Set<IndexMappingBuffer> getAllMappings(MappingsPort opu) { Set<IndexMappingBuffer> res = new HashSet<>(); IndexMappingBuffer c; while ((c = opu.take()) != null) res.add(c); return res; }
/** * Returns {@code true} if there is positive mapping of tensor {@code from} on tensor {@code to}. * * @param from from tensor * @param to to tensor * @return {@code true} if there is positivemapping of tensor {@code from} on tensor {@code to} */ public static boolean positiveMappingExists(Tensor from, Tensor to) { IndexMappingBuffer buffer; MappingsPort port = createPort(from, to); while ((buffer = port.take()) != null) if (!buffer.getSign()) return true; return false; }