congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
LongBigArrays.set
Code IndexAdd Tabnine to your IDE (free)

How to use
set
method
in
it.unimi.dsi.fastutil.longs.LongBigArrays

Best Java code snippets using it.unimi.dsi.fastutil.longs.LongBigArrays.set (Showing top 19 results out of 315)

origin: it.unimi.dsi/fastutil

/**
 * Writes a length.
 * 
 * @param a
 *            the data array.
 * @param length
 *            the length to be written.
 * @param pos
 *            the starting position.
 * @return the number of elements coding {@code length}.
 */
private static int writeInt(final long a[][], int length, long pos) {
  LongBigArrays.set(a, pos, length);
  return 1;
}
/**
origin: it.unimi.dsi/fastutil

@Override
public long set(final long index, final long k) {
  if (index >= size)
    throw new IndexOutOfBoundsException(
        "Index (" + index + ") is greater than or equal to list size (" + size + ")");
  long old = LongBigArrays.get(a, index);
  LongBigArrays.set(a, index, k);
  return old;
}
@Override
origin: it.unimi.dsi/fastutil

  private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
    s.defaultReadObject();
    a = LongBigArrays.newBigArray(size);
    for (int i = 0; i < size; i++)
      LongBigArrays.set(a, i, s.readLong());
  }
}
origin: it.unimi.dsi/dsiutils

/** Computes the inverse of a permutation expressed
 * as a {@linkplain BigArrays big array} of <var>n</var> distinct long integers in [0&nbsp;..&nbsp;<var>n</var>).
 *
 * <p><strong>Warning</strong>: if <code>perm</code> is not a permutation,
 * essentially anything can happen.
 *
 * @param perm the permutation to be inverted.
 * @param inv the big array storing the inverse.
 * @return <code>inv</code>.
 */
public static long[][] invertPermutation(long[][] perm, long[][] inv) {
  for(int i = perm.length; i-- != 0;) {
    final long t[] = perm[i];
    for(int d = t.length; d-- != 0;) LongBigArrays.set(inv, t[d], BigArrays.index(i, d));
  }
  return inv;
}
origin: it.unimi.dsi/fastutil

/**
 * Shuffles the specified big array fragment using the specified pseudorandom
 * number generator.
 *
 * @param a
 *            the big array to be shuffled.
 * @param from
 *            the index of the first element (inclusive) to be shuffled.
 * @param to
 *            the index of the last element (exclusive) to be shuffled.
 * @param random
 *            a pseudorandom number generator.
 * @return {@code a}.
 */
public static long[][] shuffle(final long[][] a, final long from, final long to, final Random random) {
  for (long i = to - from; i-- != 0;) {
    final long p = (random.nextLong() & 0x7FFFFFFFFFFFFFFFL) % (i + 1);
    final long t = get(a, from + i);
    set(a, from + i, get(a, from + p));
    set(a, from + p, t);
  }
  return a;
}
/**
origin: it.unimi.dsi/fastutil

  /**
   * Shuffles the specified big array using the specified pseudorandom number
   * generator.
   *
   * @param a
   *            the big array to be shuffled.
   * @param random
   *            a pseudorandom number generator.
   * @return {@code a}.
   */
  public static long[][] shuffle(final long[][] a, final Random random) {
    for (long i = length(a); i-- != 0;) {
      final long p = (random.nextLong() & 0x7FFFFFFFFFFFFFFFL) % (i + 1);
      final long t = get(a, i);
      set(a, i, get(a, p));
      set(a, p, t);
    }
    return a;
  }
}
origin: it.unimi.dsi/dsiutils

/** Computes in place the inverse of a permutation expressed
 * as a {@linkplain BigArrays big array} of <var>n</var> distinct long integers in [0&nbsp;..&nbsp;<var>n</var>).
 *
 * <p><strong>Warning</strong>: if <code>perm</code> is not a permutation,
 * essentially anything can happen.
 *
 * @param perm the permutation to be inverted.
 * @return <code>perm</code>.
 */
public static long[][] invertPermutationInPlace(long[][] perm) {
  for(long n = LongBigArrays.length(perm); n-- != 0;) {
    long i = LongBigArrays.get(perm, n);
    if (i < 0) LongBigArrays.set(perm, n, -i - 1);
    else if (i != n) {
      long j, k = n;
      for(;;) {
        j = LongBigArrays.get(perm, i);
        LongBigArrays.set(perm, i, -k - 1);
        if (j == n) {
          LongBigArrays.set(perm, n, i);
          break;
        }
        k = i;
        i = j;
      }
    }
  }
  return perm;
}
origin: it.unimi.dsi/fastutil

@Override
public boolean add(final long k) {
  grow(size + 1);
  LongBigArrays.set(a, size++, k);
  assert size <= LongBigArrays.length(a);
  return true;
}
@Override
origin: it.unimi.di/mg4j-big

/** Utility method to load a compressed offset file into a list.
 *
 * @param in the input bit stream providing the offsets (see {@link BitStreamIndexWriter}).
 * @param T the number of terms indexed.
 * @return a list of longs backed by an array; the list has
 * an additional final element of index <code>T</code> that gives the number
 * of bytes of the index file.
 */
public static LongBigList readOffsets( final InputBitStream in, final long T ) throws IOException {
  final long[][] offset = LongBigArrays.newBigArray( T + 1 );
  LOGGER.debug( "Loading offsets..." );
  long prev;
  LongBigArrays.set( offset, 0, prev = in.readLongGamma() );
  for( int i = 0; i < T; i++ ) LongBigArrays.set( offset, i + 1, prev = in.readLongGamma() + prev );
  LOGGER.debug( "Completed." );
  return LongBigArrayBigList.wrap( offset );
}
origin: it.unimi.dsi/mg4j-big

/** Utility method to load a compressed offset file into a list.
 *
 * @param in the input bit stream providing the offsets (see {@link BitStreamIndexWriter}).
 * @param T the number of terms indexed.
 * @return a list of longs backed by an array; the list has
 * an additional final element of index <code>T</code> that gives the number
 * of bytes of the index file.
 */
public static LongBigList readOffsets( final InputBitStream in, final long T ) throws IOException {
  final long[][] offset = LongBigArrays.newBigArray( T + 1 );
  LOGGER.debug( "Loading offsets..." );
  long prev;
  LongBigArrays.set( offset, 0, prev = in.readLongGamma() );
  for( int i = 0; i < T; i++ ) LongBigArrays.set( offset, i + 1, prev = in.readLongGamma() + prev );
  LOGGER.debug( "Completed." );
  return LongBigArrayBigList.wrap( offset );
}
origin: it.unimi.dsi/mg4j-big

/** Utility method to load a compressed offset file into a list.
 *
 * @param filename the file containing the offsets (see {@link BitStreamIndexWriter}).
 * @param T the number of terms indexed.
 * @return a list of longs backed by an array; the list has
 * an additional final element of index <code>T</code> that gives the number
 * of bytes of the index file.
 */
public static LongBigList readOffsets( final CharSequence filename, final long T ) throws IOException {
  final InputBitStream in = new InputBitStream( filename.toString() );
  final long[][] offset = LongBigArrays.newBigArray( T + 1 );
  LOGGER.debug( "Loading offsets..." );
  long prev;
  LongBigArrays.set( offset, 0, prev = in.readLongGamma() );
  for( int i = 0; i < T; i++ ) LongBigArrays.set( offset, i + 1, prev = in.readLongGamma() + prev );
  in.close();
  LOGGER.debug( "Completed." );
  return LongBigArrayBigList.wrap( offset );
}
origin: it.unimi.dsi/fastutil

/**
 * Shifts left entries with the specified hash code, starting at the specified
 * position, and empties the resulting free entry.
 *
 * @param pos
 *            a starting position.
 */
protected final void shiftKeys(long pos) {
  // Shift entries with the same hash.
  long last, slot;
  final long[][] key = this.key;
  for (;;) {
    pos = ((last = pos) + 1) & mask;
    for (;;) {
      if (((LongBigArrays.get(key, pos)) == (0))) {
        LongBigArrays.set(key, last, (0));
        return;
      }
      slot = it.unimi.dsi.fastutil.HashCommon.mix((LongBigArrays.get(key, pos))) & mask;
      if (last <= pos ? last >= slot || slot > pos : last >= slot && slot > pos)
        break;
      pos = (pos + 1) & mask;
    }
    LongBigArrays.set(key, last, LongBigArrays.get(key, pos));
  }
}
private boolean removeEntry(final int base, final int displ) {
origin: it.unimi.dsi/fastutil

private static void selectionSort(final long[][] a, final long[][] b, final long from, final long to) {
  for (long i = from; i < to - 1; i++) {
    long m = i;
    for (long j = i + 1; j < to; j++)
      if (((LongBigArrays.get(a, j)) < (LongBigArrays.get(a, m)))
          || ((LongBigArrays.get(a, j)) == (LongBigArrays.get(a, m)))
              && ((LongBigArrays.get(b, j)) < (LongBigArrays.get(b, m))))
        m = j;
    if (m != i) {
      long t = LongBigArrays.get(a, i);
      LongBigArrays.set(a, i, LongBigArrays.get(a, m));
      LongBigArrays.set(a, m, t);
      t = LongBigArrays.get(b, i);
      LongBigArrays.set(b, i, LongBigArrays.get(b, m));
      LongBigArrays.set(b, m, t);
    }
  }
}
/**
origin: it.unimi.dsi/fastutil

@Override
public void add(final long index, final long k) {
  ensureIndex(index);
  grow(size + 1);
  if (index != size)
    LongBigArrays.copy(a, index, a, index + 1, size - index);
  LongBigArrays.set(a, index, k);
  size++;
  assert size <= LongBigArrays.length(a);
}
@Override
origin: it.unimi.dsi/fastutil

for (;;) {
  if (((curr = LongBigArrays.get(key, pos)) == (0))) {
    LongBigArrays.set(key, last, (0));
    return;
  wrapped.add(LongBigArrays.get(key, pos));
LongBigArrays.set(key, last, curr);
origin: it.unimi.dsi/fastutil

/**
 * {@inheritDoc}
 *
 * <p>
 * This is a trivial iterator-based implementation. It is expected that
 * implementations will override this method with a more optimized version.
 */
@Override
public void getElements(final long from, final long a[][], long offset, long length) {
  LongBigListIterator i = listIterator(from);
  LongBigArrays.ensureOffsetLength(a, offset, length);
  if (from + length > size64())
    throw new IndexOutOfBoundsException(
        "End index (" + (from + length) + ") is greater than list size (" + size64() + ")");
  while (length-- != 0)
    LongBigArrays.set(a, offset++, i.nextLong());
}
/**
origin: it.unimi.dsi/dsiutils

/** Generates a 64-bit signatures big array using a given function and string sequence.
 *
 * <p>The resulting big array can be saved using {@link BinIO#storeLongs(long[][], CharSequence)}
 * or similar {@link BinIO} methods.
 *
 * @param iterator an iterator over a list of strings.
 * @param function the function to be signed.
 * @param pl a progress logger, or {@code null}.
 * @return a big array of 64-bit signatures.
 */
public static long[][] sign(final Iterator<? extends CharSequence> iterator, final Object2LongFunction<? extends CharSequence> function , final ProgressLogger pl) {
  final long n = function  instanceof Size64 ? ((Size64)function).size64() : function .size();
  final long[][] signature = LongBigArrays.newBigArray(n);
  if (pl != null) {
    pl.expectedUpdates = n;
    pl.start("Signing...");
  }
  CharSequence s;
  for(long i = 0; i < n; i++) {
    s = iterator.next();
    LongBigArrays.set(signature, function .getLong(s), signature(s));
    if (pl != null) pl.lightUpdate();
  }
  if (iterator.hasNext()) throw new IllegalStateException("Iterator provides more than " + n + " elements");
  if (pl != null) pl.done();
  return signature;
}
origin: it.unimi.dsi/fastutil

  final int zz = c;
  t = LongBigArrays.get(a, d + first);
  LongBigArrays.set(a, d + first, z);
  z = u;
  u = LongBigArrays.get(b, d + first);
  LongBigArrays.set(b, d + first, z);
  c = ByteBigArrays.get(digit, d) & 0xFF;
  ByteBigArrays.set(digit, d, (byte) zz);
LongBigArrays.set(a, i + first, t);
LongBigArrays.set(b, i + first, u);
origin: it.unimi.dsi/fastutil

  t = LongBigArrays.get(a, d + first);
  c = ByteBigArrays.get(digit, d) & 0xFF;
  LongBigArrays.set(a, d + first, z);
  ByteBigArrays.set(digit, d, (byte) zz);
LongBigArrays.set(a, i + first, t);
it.unimi.dsi.fastutil.longsLongBigArraysset

Javadoc

Sets the element of the given big array of specified index.

Popular methods of LongBigArrays

  • newBigArray
    Creates a new big array.
  • get
    Returns the element of the given big array of specified index.
  • length
    Returns the length of the given big array.
  • binarySearch
    Searches a big array for the specified value using the binary search algorithm and a specified compa
  • copy
    Copies a big array from the specified source big array, beginning at the specified position, to the
  • copyFromBig
    Copies a big array from the specified source big array, beginning at the specified position, to the
  • copyToBig
    Copies an array from the specified source array, beginning at the specified position, to the specifi
  • ensureCapacity
    Ensures that a big array can contain the given number of entries, preserving just a part of the big
  • ensureOffsetLength
    Ensures that a range given by an offset and a length fits a big array. This method may be used whene
  • equals
    Returns true if the two big arrays are elementwise equal. This method uses a backward loop. It is si
  • fill
    Fills a portion of the given big array with the given value. If possible (i.e., from is 0) this meth
  • forceCapacity
    Forces a big array to contain the given number of entries, preserving just a part of the big array.W
  • fill,
  • forceCapacity,
  • grow,
  • med3,
  • quickSort,
  • radixSort,
  • selectionSort,
  • swap,
  • trim

Popular in Java

  • Reactive rest calls using spring rest template
  • compareTo (BigDecimal)
  • runOnUiThread (Activity)
  • findViewById (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • String (java.lang)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now