Package cc.redberry.core.utils

Examples of cc.redberry.core.utils.IntArrayList.toArray()


            for (int i : arr)
                if (contains(i))
                    continue;
                else
                    temp.add(i);
            super.addAll(temp.toArray());
        }
    }
}
View Full Code Here


        if (indexMode)
            ParserIndices.parseIndices(indicesList, indicesString, indexState);
        if (indicesList.size() == 0)
            indices = EmptyIndices.INSTANCE;
        else
            indices = IndicesFactory.createSimple(indicesList.toArray());
        name = nameBuilder.toString();
    }

    /**
     *
 
View Full Code Here

        if (indexMode)
            parseIndices(indicesList, indicesString, indexState);
        if (indicesList.size() == 0)
            return EmptyIndices.INSTANCE;
        else
            return IndicesFactory.createSimple(indicesList.toArray());
    }

    /**
     *
     * Parse string representation and put result indices in indices
View Full Code Here

                    if (remainder instanceof Sum)
                        remainder = ((Sum) remainder).remove(i);
                    else remainder = Complex.ZERO;
                }
            }
            Tensor symbolicPart = ((Sum) c).select(symbolicPositions.toArray());
            symbolicPart = factorSymbolicTerm(symbolicPart);
            if (remainder instanceof Sum) {
                SumBuilder sb = new SumBuilder(remainder.size());
                for (Tensor tt : remainder)
                    sb.put(factorSymbolicTerms(tt));
View Full Code Here

        IntArrayList contracted = new IntArrayList();
        for (int i = 0; i < freeIndices1.length; ++i)
            for (int j = 0; j < freeIndices2.length; ++j)
                if (freeIndices2[j] == inverseIndexState(freeIndices1[i]))
                    contracted.add(getNameWithType(freeIndices2[j]));
        return contracted.toArray();
    }

    /**
     * Returns an array of contracted indices between specified indices.
     *
 
View Full Code Here

                from.add(fromIndex);
                to.add(generator.generate(IndicesUtils.getType(fromIndex)));
            }
        }

        int[] _from = from.toArray(), _to = to.toArray();
        ArraysUtils.quickSort(_from, _to);

        IITransformer transformer = createTransformer(node, indicator);
        if (transformer != null)
            transformer.apply(new IndexMapper(_from, _to), new IGWrapper(generator), upper, lower);
View Full Code Here

        if (fromL == null)
            return tensor;

        allIndicesNames.addAll(getIndicesNames(tensor.getIndices().getFree()));
        IndexGenerator generator = new IndexGenerator(allIndicesNames.toArray());
        int[] from = fromL.toArray(), to = new int[fromL.size()];
        Arrays.sort(from);
        added.ensureCapacity(from.length);
        int i;
        for (i = from.length - 1; i >= 0; --i)
            added.add(to[i] = generator.generate(IndicesUtils.getType(from[i])));
View Full Code Here

        if (fromL == null)
            return tensor;

        allIndicesNames.addAll(getIndicesNames(tensor.getIndices().getFree()));
        IndexGenerator generator = new IndexGenerator(allIndicesNames.toArray());
        int[] from = fromL.toArray(), to = new int[fromL.size()];
        Arrays.sort(from);
        int i;
        for (i = from.length - 1; i >= 0; --i)
            to[i] = generator.generate(IndicesUtils.getType(from[i]));
View Full Code Here

        // and it will be appended to {@code from} and {@code to}
        if (newFromLength < oldFromLength) {
            from = Arrays.copyOfRange(from, 0, newFromLength);
            to = Arrays.copyOfRange(to, 0, newFromLength);
        } else if (newFromLength > oldFromLength) {
            int[] toAdd = list.toArray();
            from = Arrays.copyOfRange(from, 0, newFromLength);
            to = Arrays.copyOfRange(to, 0, newFromLength);
            System.arraycopy(toAdd, 0, from, oldFromLength, toAdd.length);
            System.arraycopy(toAdd, 0, to, oldFromLength, toAdd.length);
        }
View Full Code Here

                assert ArraysUtils.binarySearch(fromNames, index) < 0;
                fromL.add(index);
                toL.add(generator.generate(IndicesUtils.getType(index)));
            }

        int[] _from = fromL.toArray(), _to = toL.toArray();
        ArraysUtils.quickSort(_from, _to);

        return applyIndexMapping(tensor, new IndexMapper(_from, _to));
    }
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.