Examples of IntArrayList


Examples of bak.pcj.list.IntArrayList

    public IntArrayListBenchmark() {
        super(
            new IntListFactory() {
                public IntList create(int[] elements) {
                    IntList s = new IntArrayList(elements.length);
                    for (int i = 0; i < elements.length; i++)
                        s.add(elements[i]);
                    return s;
                }
            }
        );
    }
View Full Code Here

Examples of cc.redberry.core.utils.IntArrayList

                //selecting unitary matrices from product
                //extracting trace combinations from product
                Product product = (Product) current;
                //positions of matrices
                IntArrayList positionsOfMatrices = new IntArrayList();
                int sizeOfIndexless = product.sizeOfIndexlessPart();
                ProductContent pc = product.getContent();
                PrimitiveSubgraph[] partition
                        = PrimitiveSubgraphPartition.calculatePartition(pc, matrixType);

                //calculated traces
                ProductBuilder traces = new ProductBuilder();

                traces:
                for (PrimitiveSubgraph subgraph : partition) {
                    if (subgraph.getGraphType() != GraphType.Cycle)
                        continue;

                    int numberOfGammas = 0, numberOfGamma5s = 0;

                    Tensor gamma;
                    //actual positions in current
                    int[] positions = subgraph.getPartition();
                    assert positions.length > 1;

                    for (int i = positions.length - 1; i >= 0; --i) {
                        positions[i] = positions[i] + sizeOfIndexless;
                        gamma = product.get(positions[i]);
                        if (gamma instanceof SimpleTensor) {
                            if (((SimpleTensor) gamma).getName() == gammaName)
                                ++numberOfGammas;
                            else if (((SimpleTensor) gamma).getName() == gamma5Name)
                                ++numberOfGamma5s;
                            else
                                //not a gamma matrix
                                continue traces;
                        } else {
                            //not a gamma matrix
                            continue traces;
                        }
                    }

                    //early terminations
                    if (numberOfGammas % 2 == 1
                            || (numberOfGammas == 2 && numberOfGamma5s % 2 == 1)) {
                        iterator.set(Complex.ZERO);
                        continue out;
                    }
                    if (numberOfGammas == 0 && numberOfGamma5s % 2 == 1) {
                        iterator.set(Complex.ZERO);
                        continue out;
                    }

                    positionsOfMatrices.addAll(positions);
                    if (numberOfGamma5s == 0)
                        traces.put(traceWithout5(product.select(positions), numberOfGammas));
                    else {
                        //early check
                        if (numberOfGammas == 0) {
                            //numberOfGamma5s % 2 == 0
                            traces.put(Complex.FOUR);
                            continue traces;
                        }


                        //eliminating excess products of gamma5s
                        if (numberOfGamma5s > 1) {
                            //take into account odd number of swaps
                            boolean sign = false;
                            //product of gammas as ordered array (will be filled without excess gamma5s)
                            final SimpleTensor[] orderedProduct = new SimpleTensor[numberOfGammas + (numberOfGamma5s % 2 == 0 ? 0 : 1)];
                            int counter = -1;

                            //index of tensor in product content, which is contracted with current gamma5
                            int positionOfPreviousGamma = -2;

                            SimpleTensor currentGamma;
                            for (int positionOfGamma = 0; positionOfGamma < positions.length; ++positionOfGamma) {
                                currentGamma = (SimpleTensor) product.get(positions[positionOfGamma]);
                                if (currentGamma.getName() == gamma5Name) {
                                    //adding one gamma5 if they are odd number
                                    if (positionOfPreviousGamma == -2) {
                                        if (numberOfGamma5s % 2 == 1) {
                                            orderedProduct[++counter] = currentGamma;
                                            positionOfPreviousGamma = -1;
                                        } else {
                                            positionOfPreviousGamma = positionOfGamma;
                                        }
                                        continue;
                                    }
                                    if (positionOfPreviousGamma == -1)
                                        positionOfPreviousGamma = positionOfGamma;
                                    else {
                                        //odd number of swaps
                                        if ((positionOfGamma - positionOfPreviousGamma) % 2 == 0)
                                            sign ^= true;
                                        positionOfPreviousGamma = -1;
                                    }
                                } else
                                    orderedProduct[++counter] = currentGamma;
                            }

                            //fixing new indices contractions
                            int u = 0, l = 0;
                            for (int i = 0; ; ++i) {
                                if (i == orderedProduct.length - 1) {
                                    orderedProduct[i] = setMatrixIndices(orderedProduct[i], u, 0);
                                    break;
                                }
                                orderedProduct[i] = setMatrixIndices(orderedProduct[i], u, ++l);
                                u = l;
                            }

                            Tensor withoutExcessGamma5s = multiply(orderedProduct);

                            if (numberOfGamma5s % 2 == 0)
                                withoutExcessGamma5s = traceWithout5(withoutExcessGamma5s, numberOfGammas);
                            else {
                                withoutExcessGamma5s = traceWith5(withoutExcessGamma5s, numberOfGammas);
                                withoutExcessGamma5s = simplifyLeviCivita.transform(withoutExcessGamma5s);
                            }

                            if (sign)
                                withoutExcessGamma5s = negate(withoutExcessGamma5s);
                            traces.put(withoutExcessGamma5s);
                        } else
                            traces.put(traceWith5(product.select(positions), numberOfGammas));
                    }
                }
                if (positionsOfMatrices.isEmpty())
                    continue out;

                //final simplifications
                traces.put(product.remove(positionsOfMatrices.toArray()));
                current = traces.build();
                current = ExpandAndEliminateTransformation.expandAndEliminate(current);
                current = deltaTrace.transform(current);
                if (simplifyLeviCivita != null)
                    current = simplifyLeviCivita.transform(current);
View Full Code Here

Examples of cern.colt.list.IntArrayList

    setUp(rows, columns);
  }
  catch (IllegalArgumentException exc) { // we can hold rows*columns>Integer.MAX_VALUE cells !
    if (! "matrix too large".equals(exc.getMessage())) throw exc;
  }
  indexes = new IntArrayList();
  values = new DoubleArrayList();
  starts = new int[rows+1];
}
View Full Code Here

Examples of com.bulletphysics.util.IntArrayList

    }

    Transform orgtrans0 = body0.getWorldTransform(Stack.alloc(Transform.class));
    Transform orgtrans1 = body1.getWorldTransform(Stack.alloc(Transform.class));

    IntArrayList collided_results = new IntArrayList();

    gimpact_vs_shape_find_pairs(orgtrans0, orgtrans1, shape0, shape1, collided_results);

    if (collided_results.size() == 0) {
      return;
    }
    shape0.lockChildShapes();

    GIM_ShapeRetriever retriever0 = new GIM_ShapeRetriever(shape0);

    boolean child_has_transform0 = shape0.childrenHasTransform();

    Transform tmpTrans = Stack.alloc(Transform.class);

    int i = collided_results.size();

    while ((i--) != 0) {
      int child_index = collided_results.get(i);
      if (swapped) {
        triface1 = child_index;
      }
      else {
        triface0 = child_index;
View Full Code Here

Examples of com.carrotsearch.hppc.IntArrayList

    Random rand = new Random(5);
   
    final int N = space.getInstanceSize();
    final int D = space.getFeatureSize();
   
    IntArrayList        ys = space.getYs();
    ArrayList<int[]>    xs = space.getXs();
    ArrayList<double[]> vs = space.getVs();
   
    double[] alpha  = new double[N];
    double[] weight = new double[D];
View Full Code Here

Examples of com.gs.collections.impl.list.mutable.primitive.IntArrayList

        return target;
    }

    public MutableIntCollection collectInt(IntFunction<? super V> intFunction)
    {
        return this.collectInt(intFunction,  new IntArrayList(this.size()));
    }
View Full Code Here

Examples of com.intellij.util.containers.IntArrayList

    final GherkinTableRow row = table != null ? table.getHeaderRow() : null;
    if (row == null) {
      return;
    }
    final List<GherkinTableCell> cells = row.getPsiCells();
    IntArrayList unusedIndices = new IntArrayList();

    for (int i = 0, cellsSize = cells.size(); i < cellsSize; i++) {
      String columnName = cells.get(i).getText().trim();
      if (!columnNames.contains(columnName)) {
        unusedIndices.add(i);
      }
    }

    if (!unusedIndices.isEmpty()) {
      highlightUnusedColumns(row, unusedIndices, holder);
      for (GherkinTableRow tableRow : table.getDataRows()) {
        highlightUnusedColumns(tableRow, unusedIndices, holder);
      }
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntArrayList

      this.field = field;
      this.indexingType = indexingType;
      if ( indexingType != IndexingType.STANDARD && indexingType != IndexingType.REMAPPED ) throw new UnsupportedOperationException( "Non-standard payload-based indices support only standard and remapped indexing" );
      if ( indexingType == IndexingType.REMAPPED ) position = new long[ documentsPerBatch ];
      this.batchDir = batchDir;
      this.cutPoints = new IntArrayList();
      this.cutPoints.add( 0 );

      flags = new EnumMap<Component, Coding>( CompressionFlags.DEFAULT_PAYLOAD_INDEX );
      accumulatorStream = new FastByteArrayOutputStream();
      accumulator = new OutputBitStream( accumulatorStream );
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntArrayList

    this.termProcessor = termProcessor;
    this.bufferSize = bufferSize;
    this.builder = builder;
    this.batchDir = batchDir;
    this.virtualDocumentGap = virtualDocumentGap;
    this.cutPoints = new IntArrayList();
    this.cutPoints.add( 0 );

    termMap = new Object2ReferenceOpenHashMap<MutableString, ByteArrayPostingList>( INITIAL_TERM_MAP_SIZE );

    flags = new EnumMap<Component, Coding>( CompressionFlags.DEFAULT_STANDARD_INDEX );
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntArrayList


  public static int[] parseQualifiedSizes( final String[] qualifiedSizes, final String defaultSize, final int[] indexedField, final DocumentFactory factory ) throws ParseException {
    final int[] size = new int[ indexedField.length ];
    String defaultSpec = defaultSize;
    IntArrayList indexedFields = IntArrayList.wrap( indexedField );
    for ( int i = 0; i < qualifiedSizes.length; i++ )
      if ( qualifiedSizes[ i ].indexOf( ':' ) == -1 ) defaultSpec = qualifiedSizes[ i ];
    for ( int i = 0; i < size.length; i++ )
      size[ i ] = (int)LongSizeStringParser.parseSize( defaultSpec );
    for ( int i = 0; i < qualifiedSizes.length; i++ ) {
      final int split = qualifiedSizes[ i ].indexOf( ':' );
      if ( split >= 0 ) {
        final String fieldName = qualifiedSizes[ i ].substring( 0, split );
        final int field = factory.fieldIndex( fieldName );
        if ( field < 0 ) throw new IllegalArgumentException( "Field " + fieldName + " is not part of factory " + factory.getClass().getName() );
        if ( !indexedFields.contains( field ) ) throw new IllegalArgumentException( "Field " + factory.fieldName( field ) + " is not being indexed" );
        size[ indexedFields.indexOf( field ) ] = (int)LongSizeStringParser.parseSize( qualifiedSizes[ i ].substring( split + 1 ) );
      }
    }
    return size;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.