Package cc.redberry.core.utils

Examples of cc.redberry.core.utils.IntArrayList


    private IndicesBuilder(IntArrayList data) {
        this.data = data;
    }

    public IndicesBuilder(int capacity) {
        data = new IntArrayList(capacity);
    }
View Full Code Here


            currentBuffer = null;
            return tempBuffer;
        }

        //try to find partial mapping
        IntArrayList permMappingFrom = null, permMappingTo = null;
        outer:
        for (int mapFrom = 0; mapFrom < size; ++mapFrom) {
            int fromIndex = fromIndices.get(mapFrom);
            IndexMappingBufferRecord bRec = currentBuffer.getMap().get(getNameWithType(fromIndex));
            //no such index in mapping yet
            if (bRec == null)
                continue;
            //index contained in mapping have same state
            if (getRawStateInt(fromIndex) == bRec.getFromRawState())
                return currentBuffer = null;
            //toIndex that we'll find in toIndices
            int toIndex = inverseIndexState(setRawState(bRec.getToRawState(), bRec.getIndexName()));
            for (int mapTo = 0; mapTo < size; ++mapTo) {
                if (toIndices.get(mapTo) == toIndex) {
                    if (permMappingFrom == null) {
                        permMappingFrom = new IntArrayList();
                        permMappingTo = new IntArrayList();
                    }
                    permMappingFrom.add(mapFrom);
                    permMappingTo.add(mapTo);
                    continue outer;
                }
            }
            //no index found in toIndices
            return currentBuffer = null;
        }
        if (permMappingFrom == null)
            searchForPermutations = fromIndices.getSymmetries().getPermutationGroup().iterator();
        else
            searchForPermutations = new OutputPort.PortIterator<>(
                    fromIndices.getSymmetries().getPermutationGroup().mapping(
                            permMappingFrom.toArray(), permMappingTo.toArray()));
        return take();
    }
View Full Code Here

        return create(dataInv, symmetries);
    }

    @Override
    public SimpleIndices getFree() {
        IntArrayList dataList = new IntArrayList();
        boolean y;
        for (int i = 0; i < data.length; i++) {
            y = true;
            for (int j = 0; j < data.length; j++)
                if (i != j && (data[i] ^ data[j]) == 0x80000000) {
                    y = false;
                    break;
                }
            if (y)
                dataList.add(data[i]);
        }
        return UnsafeIndicesFactory.createIsolatedUnsafeWithoutSort(null, dataList.toArray());
    }
View Full Code Here

        return UnsafeIndicesFactory.createIsolatedUnsafeWithoutSort(null, dataList.toArray());
    }

    @Override
    public int[] getNamesOfDummies() {
        IntArrayList dataList = new IntArrayList();
        for (int i = 0; i < data.length; i++)
            for (int j = i + 1; j < data.length; ++j) {
                if ((data[i] ^ data[j]) == 0x80000000) {
                    dataList.add(data[i] & 0x7FFFFFFF);
                    break;
                }
            }
        return dataList.toArray();
    }
View Full Code Here

            if (newIndexOf(start) == start) {
                ++counter;
                seen.set(start);
                continue;
            }
            IntArrayList cycle = new IntArrayList();
            while (!seen.get(start)) {
                seen.set(start);
                ++counter;
                cycle.add(start);
                start = newIndexOf(start);
            }
            cycles.add(cycle.toArray());
        }
        return cycles.toArray(new int[cycles.size()][]);
    }
View Full Code Here

                    pntf.content[i] = newArgNode;
                    newArgNode.parent = pntf;

                    SimpleIndices oldArgIndices = pntf.argumentsIndices[i];
                    if (oldArgIndices != null) {
                        IntArrayList newArgIndices = new IntArrayList(oldArgIndices.getAllIndices().copy());
                        Indices newIndices = newArgNode.getIndices();
                        for (byte j = 0; j < TYPES_COUNT; ++j) {
                            if (oldArgIndices.size(IndexType.getType(j)) < newIndices.size(IndexType.getType(j))) {
                                if (oldArgIndices.size(IndexType.getType(j)) != 0)
                                    throw new IllegalArgumentException("Error in field arg indices.");
                                newArgIndices.addAll(newIndices.getOfType(IndexType.getType(j)).getAllIndices());
                            }
                        }
                        pntf.argumentsIndices[i] = IndicesFactory.createSimple(null, newArgIndices.toArray());
                    }
                }
        }
        if (pn.tokenType == TokenType.Power || pn.tokenType == TokenType.ScalarFunction) {
            for (int i = 0; i < pn.content.length; ++i)
View Full Code Here

     * @param basePoint              base point
     * @param stabilizerGenerators   stabilizers
     * @param SchreierVectorCapacity initial capacity of Schreier vector
     */
    BSGSCandidateElement(int basePoint, List<Permutation> stabilizerGenerators, int SchreierVectorCapacity) {
        super(basePoint, stabilizerGenerators, new SchreierVector(SchreierVectorCapacity), new IntArrayList());
        assert stabilizerGenerators instanceof ArrayList;
        //creating list of orbit points
        orbitList.add(basePoint);
        recalculateOrbitAndSchreierVector();
    }
View Full Code Here

        if (freeIndices1.length > freeIndices2.length) {
            int[] temp = freeIndices1;
            freeIndices1 = freeIndices2;
            freeIndices2 = temp;
        }
        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();
    }
View Full Code Here

     */
    public static int[] parse(String expression) {
        if (expression.isEmpty())
            return new int[0];

        IntArrayList indices = new IntArrayList();
        int level = 0;
        int state = 0;
        final char[] expressionChars = expression.toCharArray();
        char c;
        int beginIndex = 0, endIndex = 0;
        for (; endIndex < expressionChars.length; ++endIndex) {
            c = expressionChars[endIndex];
            if (c == '{')
                ++level;
            else if (c == '}')
                --level;
            else if (c == '_' && level == 0) {
                if (endIndex != 0)
                    parse(expression.substring(beginIndex + 1, endIndex), indices, state);
                state = 0;
                beginIndex = endIndex;
            } else if (c == '^') {
                if (level != 0)
                    throw new BracketsError();
                if (endIndex != 0)
                    parse(expression.substring(beginIndex + 1, endIndex), indices, state);
                state = 0x80000000;
                beginIndex = endIndex;
            }
        }
        if (level != 0)
            throw new BracketsError();
        if (beginIndex != endIndex)
            parse(expression.substring(beginIndex + 1, endIndex), indices, state);
        return indices.toArray();
    }
View Full Code Here

            //there is no any point that is not fixed by all generators, i.e. all generators are identities
            return Collections.EMPTY_LIST;
        }

        // our "proto-base" with only one point
        IntArrayList base = new IntArrayList();
        base.add(firstBasePoint);
        // our "proto-BSGS" with only one element
        // corresponding G^(i) is G^(0) = G, so its stabilizer generators (stabilizes zero points)
        // are just generators of group
        ArrayList<BSGSCandidateElement> BSGS = new ArrayList<>();
        BSGS.add(new BSGSCandidateElement(firstBasePoint, new ArrayList<>(generators), degree));
View Full Code Here

TOP

Related Classes of cc.redberry.core.utils.IntArrayList

Copyright © 2018 www.massapicom. 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.