Examples of BitArray


Examples of cc.redberry.core.utils.BitArray

            int i;

            //Allocating origins arrays
            usedArrays = new BitArray[allDummyIndices.length];
            for (i = allDummyIndices.length - 1; i >= 0; --i)
                usedArrays[i] = new BitArray(size);

            //Fulfilling origins array
            for (i = size - 1; i >= 0; --i) {
                dummy = TensorUtils.getAllDummyIndicesT(tensor.get(i));
                TIntIterator iterator = dummy.iterator();
View Full Code Here

Examples of cc.redberry.core.utils.BitArray

    public PrimitiveSubgraphPartition(ProductContent productContent, IndexType type) {
        this.pc = productContent;
        this.fcs = pc.getStructureOfContractions();
        this.size = pc.size();
        this.type = type;
        this.used = new BitArray(size);
        this.partition = calculatePartition();
    }
View Full Code Here

Examples of cc.redberry.core.utils.BitArray

            Arrays.sort(set);
            if (maxIndex < set[set.length - 1])
                maxIndex = set[set.length - 1];
        }
        ++maxIndex;
        previousMask = new BitArray(maxIndex);
        temp = new BitArray(maxIndex);

        setMasks = new BitArray[sets.length];
        for (int i = 0; i < sets.length; ++i) {
            setMasks[i] = new BitArray(maxIndex);
            for (int j : sets[i])
                setMasks[i].set(j);
        }
        combination = new int[sets.length];
        previousMask.setAll();
View Full Code Here

Examples of cc.redberry.core.utils.BitArray

    public StructureOfIndices(byte type, int count, boolean... states) {
        typesCounts[type] = count;
        size = count;
        for (int i = 0; i < IndexType.TYPES_COUNT; ++i)
            if (!CC.isMetric((byte) i))
                this.states[i] = i == type ? new BitArray(states) : BitArray.EMPTY;
    }
View Full Code Here

Examples of cc.redberry.core.utils.BitArray

    }

    private static BitArray createBBBA(int size) {
        if (size == 0)
            return BitArray.EMPTY;
        return new BitArray(size);
    }
View Full Code Here

Examples of cc.redberry.core.utils.BitArray

            int omittedIndicesCount = structure.getTypeData(omittedIndexType.getType()).length;
            if ((omittedIndicesCount % 2) == 1)
                throw new IllegalArgumentException("The number of omitted indices for metric types should be even.");
            omittedIndicesCount /= 2;

            BitArray omittedIndices = structure.getTypeData(omittedIndexType.getType()).states;

            for (int i = 0, size = omittedIndices.size(); i < size; ++i) {
                if (i < omittedIndicesCount && !omittedIndices.get(i))
                    throw new IllegalArgumentException("Inconsistent states signature for metric type.");
                if (i >= omittedIndicesCount && omittedIndices.get(i))
                    throw new IllegalArgumentException("Inconsistent states signature for metric type.");
            }
        }
        mappedRules = null;
        InsertionRule rule = initialRules.get(originalStructureAndName);
View Full Code Here

Examples of cc.redberry.core.utils.BitArray

            //this.insertionRule = insertionRule;
            StructureOfIndices originalStructure = insertionRule.originalStructureAndName.getStructure()[0];
            StructureOfIndices currentStructure = node.getIndicesTypeStructureAndName().getStructure()[0];
            for (IndexType type : insertionRule.indicesAllowedToOmit)
                if (currentStructure.getStates(type).size() == 0) {
                    BitArray originalStates = originalStructure.getStates(type);
                    if (originalStates != null) {
                        outerIndices.upper[type.getType()] = originalStates.bitCount();
                        outerIndices.lower[type.getType()] = originalStates.size() - outerIndices.upper[type.getType()];
                    } else {
                        outerIndices.upper[type.getType()] = outerIndices.lower[type.getType()]
                                = originalStructure.typeCount(type.getType()) / 2;
                    }
                } else if (currentStructure.typeCount(type.getType()) !=
View Full Code Here

Examples of cc.redberry.core.utils.BitArray

     * @return {@code true} if specified array satisfies the one-line notation for permutations and {@code false} if
     *         not
     */
    public static boolean testPermutationCorrectness(int[] permutation) {
        int length = permutation.length;
        BitArray checked = new BitArray(length);
        for (int i = 0; i < length; ++i) {
            if (permutation[i] >= length || permutation[i] < 0)
                return false;
            if (checked.get(permutation[i]))
                return false;
            checked.set(permutation[i]);
        }
        return checked.isFull();
    }
View Full Code Here

Examples of cc.redberry.core.utils.BitArray

    public PrimitiveSubgraphPartition(ProductContent productContent, IndexType type) {
        this.pc = productContent;
        this.fcs = pc.getStructureOfContractions();
        this.size = pc.size();
        this.type = type;
        this.used = new BitArray(size);
        this.partition = calculatePartition();
    }
View Full Code Here

Examples of cc.redberry.core.utils.BitArray

     */
    public static int parity(int[] permutation) {
        //we shall decompose this permutation into product of cycles and calculate l.c.m. of their sizes

        //to mark viewed points
        BitArray used = new BitArray(permutation.length);
        //lcm
        int start, pointer, currentSize, counter = 0;
        int numOfTranspositions = 0;
        //while not all points are seen
        //loop over cycles
        while (counter < permutation.length) {
            //get first point that was not already traversed
            start = pointer = used.nextZeroBit(0);
            currentSize = 0;
            //processing current cycle
            //loop over current cycle
            do {
                assert !used.get(pointer);
                used.set(pointer);
                pointer = permutation[pointer];
                ++currentSize;
            } while (pointer != start);
            counter += currentSize;
            numOfTranspositions += currentSize - 1;
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.