/** Creates a new equation. * * @param c the constant term. * @param numVars the number of variables. */ public Modulo2Equation(final long c, final int numVars){ this.c = c; this.bitVector = LongArrayBitVector.ofLength(numVars); this.bits = bitVector.bits(); this.firstVar = Integer.MAX_VALUE; this.isEmpty = true; }
/** Returns the bit vector indexed; since the bits are not stored in this data structure, * a copy is built on purpose and returned. * * @return a copy of the underlying bit vector. */ @Override public BitVector bitVector() { final LongArrayBitVector result = LongArrayBitVector.ofLength(n); for(long i = length; i-- != 0;) result.set(select(i)); return result; }
/** Creates a new equation. * * @param c the constant term. * @param numVars the number of variables. */ public Modulo3Equation(final long c, final int numVars) { this.c = c; this.bitVector = LongArrayBitVector.ofLength(numVars * 2); this.bits = bitVector.bits(); this.list = bitVector.asLongBigList(2); this.firstVar = Integer.MAX_VALUE; this.isEmpty = true; }
public boolean check(final long[] solution) { assert solution.length == numVars; final LongArrayBitVector solutions = LongArrayBitVector.ofLength(numVars * 2); final LongBigList list = solutions.asLongBigList(2); for(int i = solution.length; i-- != 0;) list.set(i, solution[i]); return check(solutions); }
/** Solves the system using Gaussian elimination and write the solution * in an array of longs (mainly for testing purposes). * * @param solution an array where the solution will be written. * @return true if the system is solvable. */ public boolean gaussianElimination(final long[] solution) { assert solution.length == numVars; final LongArrayBitVector solutions = LongArrayBitVector.ofLength(numVars * 2); if (! gaussianElimination(solutions)) return false; final LongBigList list = solutions.asLongBigList(2); for(int i = solution.length; i-- != 0;) solution[i] = list.getLong(i); return true; }
final LongArrayBitVector bitVector = LongArrayBitVector.ofLength(registerSize * Math.min(CHUNK_SIZE, sizeInRegisters - ((long)i << CHUNK_SHIFT))); bits[i] = bitVector.bits(); registers[i] = bitVector.asLongBigList(registerSize);
final BitVector v = LongArrayBitVector.ofLength(//
/** Computes the strongly connected components of a given graph. * * @param graph the graph whose strongly connected components are to be computed. * @param computeBuckets if true, buckets will be computed. * @param pl a progress logger, or <code>null</code>. * @return an instance of this class containing the computed components. */ public static StronglyConnectedComponents compute(final ImmutableGraph graph, final boolean computeBuckets, final ProgressLogger pl) { final int n = graph.numNodes(); final Visit visit = new Visit(graph, new int[n], computeBuckets ? LongArrayBitVector.ofLength(n) : null, pl); visit.run(); return new StronglyConnectedComponents(visit.numberOfComponents, visit.status, visit.buckets); }
final BitVector v = LongArrayBitVector.ofLength(//
/** Computes the strongly connected components of a given arc-labelled graph, filtering its arcs. * * @param graph the arc-labelled graph whose strongly connected components are to be computed. * @param filter a filter selecting the arcs that must be taken into consideration. * @param computeBuckets if true, buckets will be computed. * @param pl a progress logger, or <code>null</code>. * @return an instance of this class containing the computed components. */ public static StronglyConnectedComponents compute(final ArcLabelledImmutableGraph graph, final LabelledArcFilter filter, final boolean computeBuckets, final ProgressLogger pl) { final int n = graph.numNodes(); FilteredVisit filteredVisit = new FilteredVisit(graph, filter, new int[n], computeBuckets ? LongArrayBitVector.ofLength(n) : null, pl); filteredVisit.run(); return new StronglyConnectedComponents(filteredVisit.numberOfComponents, filteredVisit.status, filteredVisit.buckets); }
private static <K, V> Select sizesToSelect(final TableConfig<K, V> config, final File tempSizes, final long dataSize) throws IOException { final long numEntries = tempSizes.length() / 4; try (final MMapBuffer sizes = new MMapBuffer(tempSizes, 0L, numEntries * 4, FileChannel.MapMode.READ_ONLY, ByteOrder.nativeOrder())) { final DirectMemory sizesMemory = sizes.memory(); final long maxValue = config.compressOffset(dataSize, numEntries); final BitVector bits = LongArrayBitVector.ofLength(maxValue); for (long i = 0, offset = 0; i < numEntries; offset += sizesMemory.getInt(i * 4), ++i) { final long value = config.compressOffset(offset, i); bits.set(value); } return new HintedBsearchSelect(new Rank9(bits)); } }
final LongArrayBitVector dataBitVector = LongArrayBitVector.ofLength(solution.length * 2); final LongBigList dataList = dataBitVector.asLongBigList(2); for(int j = 0; j < solution.length; j++) dataList.set(j, solution[j]);
final LongArrayBitVector solutions = LongArrayBitVector.ofLength(numVars * 2); if (! denseSystem.gaussianElimination(solutions)) return false; // numVars >= denseSystem.numVars
marker = LongArrayBitVector.ofLength(m); final LongBigList newData = LongArrayBitVector.getInstance().asLongBigList(width); newData.size(nonZero);
final int l = Integer.parseInt(arg[0]); final int n = Integer.parseInt(arg[1]); final LongArrayBitVector bv = LongArrayBitVector.ofLength(l);
skips = intermediateTrie.skips; balParen = intermediateTrie.balParen; final LongArrayBitVector emitted = LongArrayBitVector.ofLength(intermediateTrie.size64());
marker = LongArrayBitVector.ofLength(m); final LongBigList newData = LongArrayBitVector.getInstance().asLongBigList(this.width); newData.size(nonZero);
final LongArrayBitVector leavesBitVector = LongArrayBitVector.ofLength(rankerArray.length); int q = 0;
final LongArrayBitVector olderNodeFound = LongArrayBitVector.ofLength(n); final IntStack nodeStack = new IntArrayList(); final Stack<LabelledArcIterator> successorsStack = new ObjectArrayList<>();